sl@0: /*============================================================================= sl@0: Boost.Wave: A Standard compliant C++ preprocessor library sl@0: sl@0: http://www.boost.org/ sl@0: sl@0: Copyright (c) 2001-2007 Hartmut Kaiser. Distributed under the Boost sl@0: Software License, Version 1.0. (See accompanying file sl@0: LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) sl@0: =============================================================================*/ sl@0: sl@0: #if !defined(PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED) sl@0: #define PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // this must occur after all of the includes and before any code appears sl@0: #ifdef BOOST_HAS_ABI_HEADERS sl@0: #include BOOST_ABI_PREFIX sl@0: #endif sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: namespace boost { sl@0: namespace wave { sl@0: namespace context_policies { sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The default_preprocessing_hooks class is a placeholder for all sl@0: // preprocessing hooks called from inside the preprocessing engine sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: struct default_preprocessing_hooks { sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'expanding_function_like_macro' is called, whenever a sl@0: // function-like macro is to be expanded. sl@0: // sl@0: // The macroname parameter marks the position, where the macro to expand sl@0: // is defined. sl@0: // The formal_args parameter holds the formal arguments used during the sl@0: // definition of the macro. sl@0: // The definition parameter holds the macro definition for the macro to sl@0: // trace. sl@0: // sl@0: // The macro call parameter marks the position, where this macro invoked. sl@0: // The arguments parameter holds the macro arguments used during the sl@0: // invocation of the macro sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void expanding_function_like_macro( sl@0: TokenT const ¯odef, std::vector const &formal_args, sl@0: ContainerT const &definition, sl@0: TokenT const ¯ocall, std::vector const &arguments) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'expanding_object_like_macro' is called, whenever a sl@0: // object-like macro is to be expanded . sl@0: // sl@0: // The macroname parameter marks the position, where the macro to expand sl@0: // is defined. sl@0: // The definition parameter holds the macro definition for the macro to sl@0: // trace. sl@0: // sl@0: // The macro call parameter marks the position, where this macro invoked. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void expanding_object_like_macro(TokenT const ¯o, sl@0: ContainerT const &definition, TokenT const ¯ocall) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'expanded_macro' is called, whenever the expansion of a sl@0: // macro is finished but before the rescanning process starts. sl@0: // sl@0: // The parameter 'result' contains the token sequence generated as the sl@0: // result of the macro expansion. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void expanded_macro(ContainerT const &result) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'rescanned_macro' is called, whenever the rescanning of a sl@0: // macro is finished. sl@0: // sl@0: // The parameter 'result' contains the token sequence generated as the sl@0: // result of the rescanning. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void rescanned_macro(ContainerT const &result) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'found_include_directive' is called, whenever a #include sl@0: // directive was located. sl@0: // sl@0: // The parameter 'filename' contains the (expanded) file name found after sl@0: // the #include directive. This has the format '', '"file"' or sl@0: // 'file'. sl@0: // The formats '' or '"file"' are used for #include directives found sl@0: // in the preprocessed token stream, the format 'file' is used for files sl@0: // specified through the --force_include command line argument. sl@0: // sl@0: // The parameter 'include_next' is set to true if the found directive was sl@0: // a #include_next directive and the BOOST_WAVE_SUPPORT_INCLUDE_NEXT sl@0: // preprocessing constant was defined to something != 0. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: void sl@0: found_include_directive(std::string const &filename, bool include_next) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'opened_include_file' is called, whenever a file referred sl@0: // by an #include directive was successfully located and opened. sl@0: // sl@0: // The parameter 'filename' contains the file system path of the sl@0: // opened file (this is relative to the directory of the currently sl@0: // processed file or a absolute path depending on the paths given as the sl@0: // include search paths). sl@0: // sl@0: // The include_depth parameter contains the current include file depth. sl@0: // sl@0: // The is_system_include parameter denotes, whether the given file was sl@0: // found as a result of a #include <...> directive. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: void sl@0: opened_include_file(std::string const &relname, std::string const &absname, sl@0: std::size_t include_depth, bool is_system_include) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'returning_from_include_file' is called, whenever an sl@0: // included file is about to be closed after it's processing is complete. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: void sl@0: returning_from_include_file() sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'interpret_pragma' is called, whenever a #pragma command sl@0: // directive is found which isn't known to the core Wave library, where sl@0: // command is the value defined as the BOOST_WAVE_PRAGMA_KEYWORD constant sl@0: // which defaults to "wave". sl@0: // sl@0: // The parameter 'ctx' is a reference to the context object used for sl@0: // instantiating the preprocessing iterators by the user. sl@0: // sl@0: // The parameter 'pending' may be used to push tokens back into the input sl@0: // stream, which are to be used as the replacement text for the whole sl@0: // #pragma directive. sl@0: // sl@0: // The parameter 'option' contains the name of the interpreted pragma. sl@0: // sl@0: // The parameter 'values' holds the values of the parameter provided to sl@0: // the pragma operator. sl@0: // sl@0: // The parameter 'act_token' contains the actual #pragma token, which may sl@0: // be used for error output. sl@0: // sl@0: // If the return value is 'false', the whole #pragma directive is sl@0: // interpreted as unknown and a corresponding error message is issued. A sl@0: // return value of 'true' signs a successful interpretation of the given sl@0: // #pragma. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: bool sl@0: interpret_pragma(ContextT const &ctx, ContainerT &pending, sl@0: typename ContextT::token_type const &option, ContainerT const &values, sl@0: typename ContextT::token_type const &act_token) sl@0: { sl@0: return false; sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'defined_macro' is called, whenever a macro was defined sl@0: // successfully. sl@0: // sl@0: // The parameter 'name' is a reference to the token holding the macro name. sl@0: // sl@0: // The parameter 'is_functionlike' is set to true, whenever the newly sl@0: // defined macro is defined as a function like macro. sl@0: // sl@0: // The parameter 'parameters' holds the parameter tokens for the macro sl@0: // definition. If the macro has no parameters or if it is a object like sl@0: // macro, then this container is empty. sl@0: // sl@0: // The parameter 'definition' contains the token sequence given as the sl@0: // replacement sequence (definition part) of the newly defined macro. sl@0: // sl@0: // The parameter 'is_predefined' is set to true for all macros predefined sl@0: // during the initialisation phase of the library. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void sl@0: defined_macro(TokenT const ¯o_name, bool is_functionlike, sl@0: ParametersT const ¶meters, DefinitionT const &definition, sl@0: bool is_predefined) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'undefined_macro' is called, whenever a macro definition sl@0: // was removed successfully. sl@0: // sl@0: // The parameter 'name' holds the name of the macro, which definition was sl@0: // removed. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void sl@0: undefined_macro(TokenT const ¯o_name) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'found_directive' is called, whenever a preprocessor sl@0: // directive was encountered, but before the corresponding action is sl@0: // executed. sl@0: // sl@0: // The parameter 'directive' is a reference to the token holding the sl@0: // preprocessing directive. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void sl@0: found_directive(TokenT const& directive) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'evaluated_conditional_expression' is called, whenever a sl@0: // conditional preprocessing expression was evaluated (the expression sl@0: // given to a #if, #ifdef or #ifndef directive) sl@0: // sl@0: // The parameter 'expression' holds the non-expanded token sequence sl@0: // comprising the evaluated expression. sl@0: // sl@0: // The parameter expression_value contains the result of the evaluation of sl@0: // the expression in the current preprocessing context. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void sl@0: evaluated_conditional_expression(ContainerT const& expression, sl@0: bool expression_value) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'skipped_token' is called, whenever a token is about to be sl@0: // skipped due to a false preprocessor condition (code fragments to be sl@0: // skipped inside the not evaluated conditional #if/#else/#endif branches). sl@0: // sl@0: // The parameter 'token' refers to the token to be skipped. sl@0: // sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: void sl@0: skipped_token(TokenT const& token) sl@0: {} sl@0: sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The function 'may_skip_whitespace' is called, will be called by the sl@0: // library, whenever a token is about to be returned to the calling sl@0: // application. sl@0: // sl@0: // The parameter 'ctx' is a reference to the context object used for sl@0: // instantiating the preprocessing iterators by the user. sl@0: // sl@0: // The 'token' parameter holds a reference to the current token. The policy sl@0: // is free to change this token if needed. sl@0: // sl@0: // The 'skipped_newline' parameter holds a reference to a boolean value sl@0: // which should be set to true by the policy function whenever a newline sl@0: // is going to be skipped. sl@0: // sl@0: // If the return value is true, the given token is skipped and the sl@0: // preprocessing continues to the next token. If the return value is sl@0: // false, the given token is returned to the calling application. sl@0: // sl@0: // ATTENTION! sl@0: // Caution has to be used, because by returning true the policy function sl@0: // is able to force skipping even significant tokens, not only whitespace. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: bool sl@0: may_skip_whitespace(ContextT const& ctx, TokenT& token, bool& skipped_newline) sl@0: { return false; } sl@0: }; sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: } // namespace context_policies sl@0: } // namespace wave sl@0: } // namespace boost sl@0: sl@0: // the suffix header occurs after all of the code sl@0: #ifdef BOOST_HAS_ABI_HEADERS sl@0: #include BOOST_ABI_SUFFIX sl@0: #endif sl@0: sl@0: #endif // !defined(PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED)