1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/wave/preprocessing_hooks.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,324 @@
1.4 +/*=============================================================================
1.5 + Boost.Wave: A Standard compliant C++ preprocessor library
1.6 +
1.7 + http://www.boost.org/
1.8 +
1.9 + Copyright (c) 2001-2007 Hartmut Kaiser. Distributed under the Boost
1.10 + Software License, Version 1.0. (See accompanying file
1.11 + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1.12 +=============================================================================*/
1.13 +
1.14 +#if !defined(PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED)
1.15 +#define PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED
1.16 +
1.17 +#include <boost/wave/wave_config.hpp>
1.18 +#include <vector>
1.19 +
1.20 +// this must occur after all of the includes and before any code appears
1.21 +#ifdef BOOST_HAS_ABI_HEADERS
1.22 +#include BOOST_ABI_PREFIX
1.23 +#endif
1.24 +
1.25 +///////////////////////////////////////////////////////////////////////////////
1.26 +namespace boost {
1.27 +namespace wave {
1.28 +namespace context_policies {
1.29 +
1.30 +///////////////////////////////////////////////////////////////////////////////
1.31 +//
1.32 +// The default_preprocessing_hooks class is a placeholder for all
1.33 +// preprocessing hooks called from inside the preprocessing engine
1.34 +//
1.35 +///////////////////////////////////////////////////////////////////////////////
1.36 +struct default_preprocessing_hooks {
1.37 +
1.38 + ///////////////////////////////////////////////////////////////////////////
1.39 + //
1.40 + // The function 'expanding_function_like_macro' is called, whenever a
1.41 + // function-like macro is to be expanded.
1.42 + //
1.43 + // The macroname parameter marks the position, where the macro to expand
1.44 + // is defined.
1.45 + // The formal_args parameter holds the formal arguments used during the
1.46 + // definition of the macro.
1.47 + // The definition parameter holds the macro definition for the macro to
1.48 + // trace.
1.49 + //
1.50 + // The macro call parameter marks the position, where this macro invoked.
1.51 + // The arguments parameter holds the macro arguments used during the
1.52 + // invocation of the macro
1.53 + //
1.54 + ///////////////////////////////////////////////////////////////////////////
1.55 + template <typename TokenT, typename ContainerT>
1.56 + void expanding_function_like_macro(
1.57 + TokenT const ¯odef, std::vector<TokenT> const &formal_args,
1.58 + ContainerT const &definition,
1.59 + TokenT const ¯ocall, std::vector<ContainerT> const &arguments)
1.60 + {}
1.61 +
1.62 + ///////////////////////////////////////////////////////////////////////////
1.63 + //
1.64 + // The function 'expanding_object_like_macro' is called, whenever a
1.65 + // object-like macro is to be expanded .
1.66 + //
1.67 + // The macroname parameter marks the position, where the macro to expand
1.68 + // is defined.
1.69 + // The definition parameter holds the macro definition for the macro to
1.70 + // trace.
1.71 + //
1.72 + // The macro call parameter marks the position, where this macro invoked.
1.73 + //
1.74 + ///////////////////////////////////////////////////////////////////////////
1.75 + template <typename TokenT, typename ContainerT>
1.76 + void expanding_object_like_macro(TokenT const ¯o,
1.77 + ContainerT const &definition, TokenT const ¯ocall)
1.78 + {}
1.79 +
1.80 + ///////////////////////////////////////////////////////////////////////////
1.81 + //
1.82 + // The function 'expanded_macro' is called, whenever the expansion of a
1.83 + // macro is finished but before the rescanning process starts.
1.84 + //
1.85 + // The parameter 'result' contains the token sequence generated as the
1.86 + // result of the macro expansion.
1.87 + //
1.88 + ///////////////////////////////////////////////////////////////////////////
1.89 + template <typename ContainerT>
1.90 + void expanded_macro(ContainerT const &result)
1.91 + {}
1.92 +
1.93 + ///////////////////////////////////////////////////////////////////////////
1.94 + //
1.95 + // The function 'rescanned_macro' is called, whenever the rescanning of a
1.96 + // macro is finished.
1.97 + //
1.98 + // The parameter 'result' contains the token sequence generated as the
1.99 + // result of the rescanning.
1.100 + //
1.101 + ///////////////////////////////////////////////////////////////////////////
1.102 + template <typename ContainerT>
1.103 + void rescanned_macro(ContainerT const &result)
1.104 + {}
1.105 +
1.106 + ///////////////////////////////////////////////////////////////////////////
1.107 + //
1.108 + // The function 'found_include_directive' is called, whenever a #include
1.109 + // directive was located.
1.110 + //
1.111 + // The parameter 'filename' contains the (expanded) file name found after
1.112 + // the #include directive. This has the format '<file>', '"file"' or
1.113 + // 'file'.
1.114 + // The formats '<file>' or '"file"' are used for #include directives found
1.115 + // in the preprocessed token stream, the format 'file' is used for files
1.116 + // specified through the --force_include command line argument.
1.117 + //
1.118 + // The parameter 'include_next' is set to true if the found directive was
1.119 + // a #include_next directive and the BOOST_WAVE_SUPPORT_INCLUDE_NEXT
1.120 + // preprocessing constant was defined to something != 0.
1.121 + //
1.122 + ///////////////////////////////////////////////////////////////////////////
1.123 + void
1.124 + found_include_directive(std::string const &filename, bool include_next)
1.125 + {}
1.126 +
1.127 + ///////////////////////////////////////////////////////////////////////////
1.128 + //
1.129 + // The function 'opened_include_file' is called, whenever a file referred
1.130 + // by an #include directive was successfully located and opened.
1.131 + //
1.132 + // The parameter 'filename' contains the file system path of the
1.133 + // opened file (this is relative to the directory of the currently
1.134 + // processed file or a absolute path depending on the paths given as the
1.135 + // include search paths).
1.136 + //
1.137 + // The include_depth parameter contains the current include file depth.
1.138 + //
1.139 + // The is_system_include parameter denotes, whether the given file was
1.140 + // found as a result of a #include <...> directive.
1.141 + //
1.142 + ///////////////////////////////////////////////////////////////////////////
1.143 + void
1.144 + opened_include_file(std::string const &relname, std::string const &absname,
1.145 + std::size_t include_depth, bool is_system_include)
1.146 + {}
1.147 +
1.148 + ///////////////////////////////////////////////////////////////////////////
1.149 + //
1.150 + // The function 'returning_from_include_file' is called, whenever an
1.151 + // included file is about to be closed after it's processing is complete.
1.152 + //
1.153 + ///////////////////////////////////////////////////////////////////////////
1.154 + void
1.155 + returning_from_include_file()
1.156 + {}
1.157 +
1.158 + ///////////////////////////////////////////////////////////////////////////
1.159 + //
1.160 + // The function 'interpret_pragma' is called, whenever a #pragma command
1.161 + // directive is found which isn't known to the core Wave library, where
1.162 + // command is the value defined as the BOOST_WAVE_PRAGMA_KEYWORD constant
1.163 + // which defaults to "wave".
1.164 + //
1.165 + // The parameter 'ctx' is a reference to the context object used for
1.166 + // instantiating the preprocessing iterators by the user.
1.167 + //
1.168 + // The parameter 'pending' may be used to push tokens back into the input
1.169 + // stream, which are to be used as the replacement text for the whole
1.170 + // #pragma directive.
1.171 + //
1.172 + // The parameter 'option' contains the name of the interpreted pragma.
1.173 + //
1.174 + // The parameter 'values' holds the values of the parameter provided to
1.175 + // the pragma operator.
1.176 + //
1.177 + // The parameter 'act_token' contains the actual #pragma token, which may
1.178 + // be used for error output.
1.179 + //
1.180 + // If the return value is 'false', the whole #pragma directive is
1.181 + // interpreted as unknown and a corresponding error message is issued. A
1.182 + // return value of 'true' signs a successful interpretation of the given
1.183 + // #pragma.
1.184 + //
1.185 + ///////////////////////////////////////////////////////////////////////////
1.186 + template <typename ContextT, typename ContainerT>
1.187 + bool
1.188 + interpret_pragma(ContextT const &ctx, ContainerT &pending,
1.189 + typename ContextT::token_type const &option, ContainerT const &values,
1.190 + typename ContextT::token_type const &act_token)
1.191 + {
1.192 + return false;
1.193 + }
1.194 +
1.195 + ///////////////////////////////////////////////////////////////////////////
1.196 + //
1.197 + // The function 'defined_macro' is called, whenever a macro was defined
1.198 + // successfully.
1.199 + //
1.200 + // The parameter 'name' is a reference to the token holding the macro name.
1.201 + //
1.202 + // The parameter 'is_functionlike' is set to true, whenever the newly
1.203 + // defined macro is defined as a function like macro.
1.204 + //
1.205 + // The parameter 'parameters' holds the parameter tokens for the macro
1.206 + // definition. If the macro has no parameters or if it is a object like
1.207 + // macro, then this container is empty.
1.208 + //
1.209 + // The parameter 'definition' contains the token sequence given as the
1.210 + // replacement sequence (definition part) of the newly defined macro.
1.211 + //
1.212 + // The parameter 'is_predefined' is set to true for all macros predefined
1.213 + // during the initialisation phase of the library.
1.214 + //
1.215 + ///////////////////////////////////////////////////////////////////////////
1.216 + template <typename TokenT, typename ParametersT, typename DefinitionT>
1.217 + void
1.218 + defined_macro(TokenT const ¯o_name, bool is_functionlike,
1.219 + ParametersT const ¶meters, DefinitionT const &definition,
1.220 + bool is_predefined)
1.221 + {}
1.222 +
1.223 + ///////////////////////////////////////////////////////////////////////////
1.224 + //
1.225 + // The function 'undefined_macro' is called, whenever a macro definition
1.226 + // was removed successfully.
1.227 + //
1.228 + // The parameter 'name' holds the name of the macro, which definition was
1.229 + // removed.
1.230 + //
1.231 + ///////////////////////////////////////////////////////////////////////////
1.232 + template <typename TokenT>
1.233 + void
1.234 + undefined_macro(TokenT const ¯o_name)
1.235 + {}
1.236 +
1.237 + ///////////////////////////////////////////////////////////////////////////
1.238 + //
1.239 + // The function 'found_directive' is called, whenever a preprocessor
1.240 + // directive was encountered, but before the corresponding action is
1.241 + // executed.
1.242 + //
1.243 + // The parameter 'directive' is a reference to the token holding the
1.244 + // preprocessing directive.
1.245 + //
1.246 + ///////////////////////////////////////////////////////////////////////////
1.247 + template <typename TokenT>
1.248 + void
1.249 + found_directive(TokenT const& directive)
1.250 + {}
1.251 +
1.252 + ///////////////////////////////////////////////////////////////////////////
1.253 + //
1.254 + // The function 'evaluated_conditional_expression' is called, whenever a
1.255 + // conditional preprocessing expression was evaluated (the expression
1.256 + // given to a #if, #ifdef or #ifndef directive)
1.257 + //
1.258 + // The parameter 'expression' holds the non-expanded token sequence
1.259 + // comprising the evaluated expression.
1.260 + //
1.261 + // The parameter expression_value contains the result of the evaluation of
1.262 + // the expression in the current preprocessing context.
1.263 + //
1.264 + ///////////////////////////////////////////////////////////////////////////
1.265 + template <typename ContainerT>
1.266 + void
1.267 + evaluated_conditional_expression(ContainerT const& expression,
1.268 + bool expression_value)
1.269 + {}
1.270 +
1.271 + ///////////////////////////////////////////////////////////////////////////
1.272 + //
1.273 + // The function 'skipped_token' is called, whenever a token is about to be
1.274 + // skipped due to a false preprocessor condition (code fragments to be
1.275 + // skipped inside the not evaluated conditional #if/#else/#endif branches).
1.276 + //
1.277 + // The parameter 'token' refers to the token to be skipped.
1.278 + //
1.279 + //
1.280 + ///////////////////////////////////////////////////////////////////////////
1.281 + template <typename TokenT>
1.282 + void
1.283 + skipped_token(TokenT const& token)
1.284 + {}
1.285 +
1.286 + ///////////////////////////////////////////////////////////////////////////
1.287 + //
1.288 + // The function 'may_skip_whitespace' is called, will be called by the
1.289 + // library, whenever a token is about to be returned to the calling
1.290 + // application.
1.291 + //
1.292 + // The parameter 'ctx' is a reference to the context object used for
1.293 + // instantiating the preprocessing iterators by the user.
1.294 + //
1.295 + // The 'token' parameter holds a reference to the current token. The policy
1.296 + // is free to change this token if needed.
1.297 + //
1.298 + // The 'skipped_newline' parameter holds a reference to a boolean value
1.299 + // which should be set to true by the policy function whenever a newline
1.300 + // is going to be skipped.
1.301 + //
1.302 + // If the return value is true, the given token is skipped and the
1.303 + // preprocessing continues to the next token. If the return value is
1.304 + // false, the given token is returned to the calling application.
1.305 + //
1.306 + // ATTENTION!
1.307 + // Caution has to be used, because by returning true the policy function
1.308 + // is able to force skipping even significant tokens, not only whitespace.
1.309 + //
1.310 + ///////////////////////////////////////////////////////////////////////////
1.311 + template <typename ContextT, typename TokenT>
1.312 + bool
1.313 + may_skip_whitespace(ContextT const& ctx, TokenT& token, bool& skipped_newline)
1.314 + { return false; }
1.315 +};
1.316 +
1.317 +///////////////////////////////////////////////////////////////////////////////
1.318 +} // namespace context_policies
1.319 +} // namespace wave
1.320 +} // namespace boost
1.321 +
1.322 +// the suffix header occurs after all of the code
1.323 +#ifdef BOOST_HAS_ABI_HEADERS
1.324 +#include BOOST_ABI_SUFFIX
1.325 +#endif
1.326 +
1.327 +#endif // !defined(PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED)