[12] | 1 | /*============================================================================= |
---|
| 2 | Boost.Wave: A Standard compliant C++ preprocessor library |
---|
| 3 | |
---|
| 4 | http://www.boost.org/ |
---|
| 5 | |
---|
| 6 | Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost |
---|
| 7 | Software License, Version 1.0. (See accompanying file |
---|
| 8 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
| 9 | =============================================================================*/ |
---|
| 10 | |
---|
| 11 | #if !defined(PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED) |
---|
| 12 | #define PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED |
---|
| 13 | |
---|
| 14 | #include <vector> |
---|
| 15 | |
---|
| 16 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 17 | namespace boost { |
---|
| 18 | namespace wave { |
---|
| 19 | namespace context_policies { |
---|
| 20 | |
---|
| 21 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 22 | // |
---|
| 23 | // The default_preprocessing_hooks class is a placeholder for all |
---|
| 24 | // preprocessing hooks called from inside the preprocessing engine |
---|
| 25 | // |
---|
| 26 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 27 | struct default_preprocessing_hooks { |
---|
| 28 | |
---|
| 29 | /////////////////////////////////////////////////////////////////////////// |
---|
| 30 | // |
---|
| 31 | // The function 'expanding_function_like_macro' is called, whenever a |
---|
| 32 | // function-like macro is to be expanded. |
---|
| 33 | // |
---|
| 34 | // The macroname parameter marks the position, where the macro to expand |
---|
| 35 | // is defined. |
---|
| 36 | // The formal_args parameter holds the formal arguments used during the |
---|
| 37 | // definition of the macro. |
---|
| 38 | // The definition parameter holds the macro definition for the macro to |
---|
| 39 | // trace. |
---|
| 40 | // |
---|
| 41 | // The macro call parameter marks the position, where this macro invoked. |
---|
| 42 | // The arguments parameter holds the macro arguments used during the |
---|
| 43 | // invocation of the macro |
---|
| 44 | // |
---|
| 45 | /////////////////////////////////////////////////////////////////////////// |
---|
| 46 | template <typename TokenT, typename ContainerT> |
---|
| 47 | void expanding_function_like_macro( |
---|
| 48 | TokenT const ¯odef, std::vector<TokenT> const &formal_args, |
---|
| 49 | ContainerT const &definition, |
---|
| 50 | TokenT const ¯ocall, std::vector<ContainerT> const &arguments) |
---|
| 51 | {} |
---|
| 52 | |
---|
| 53 | /////////////////////////////////////////////////////////////////////////// |
---|
| 54 | // |
---|
| 55 | // The function 'expanding_object_like_macro' is called, whenever a |
---|
| 56 | // object-like macro is to be expanded . |
---|
| 57 | // |
---|
| 58 | // The macroname parameter marks the position, where the macro to expand |
---|
| 59 | // is defined. |
---|
| 60 | // The definition parameter holds the macro definition for the macro to |
---|
| 61 | // trace. |
---|
| 62 | // |
---|
| 63 | // The macro call parameter marks the position, where this macro invoked. |
---|
| 64 | // |
---|
| 65 | /////////////////////////////////////////////////////////////////////////// |
---|
| 66 | template <typename TokenT, typename ContainerT> |
---|
| 67 | void expanding_object_like_macro(TokenT const ¯o, |
---|
| 68 | ContainerT const &definition, TokenT const ¯ocall) |
---|
| 69 | {} |
---|
| 70 | |
---|
| 71 | /////////////////////////////////////////////////////////////////////////// |
---|
| 72 | // |
---|
| 73 | // The function 'expanded_macro' is called, whenever the expansion of a |
---|
| 74 | // macro is finished but before the rescanning process starts. |
---|
| 75 | // |
---|
| 76 | // The parameter 'result' contains the token sequence generated as the |
---|
| 77 | // result of the macro expansion. |
---|
| 78 | // |
---|
| 79 | /////////////////////////////////////////////////////////////////////////// |
---|
| 80 | template <typename ContainerT> |
---|
| 81 | void expanded_macro(ContainerT const &result) |
---|
| 82 | {} |
---|
| 83 | |
---|
| 84 | /////////////////////////////////////////////////////////////////////////// |
---|
| 85 | // |
---|
| 86 | // The function 'rescanned_macro' is called, whenever the rescanning of a |
---|
| 87 | // macro is finished. |
---|
| 88 | // |
---|
| 89 | // The parameter 'result' contains the token sequence generated as the |
---|
| 90 | // result of the rescanning. |
---|
| 91 | // |
---|
| 92 | /////////////////////////////////////////////////////////////////////////// |
---|
| 93 | template <typename ContainerT> |
---|
| 94 | void rescanned_macro(ContainerT const &result) |
---|
| 95 | {} |
---|
| 96 | |
---|
| 97 | /////////////////////////////////////////////////////////////////////////// |
---|
| 98 | // |
---|
| 99 | // The function 'found_include_directive' is called, whenever a #include |
---|
| 100 | // directive was located. |
---|
| 101 | // |
---|
| 102 | // The parameter 'filename' contains the (expanded) file name found after |
---|
| 103 | // the #include directive. This has the format '<file>', '"file"' or |
---|
| 104 | // 'file'. |
---|
| 105 | // The formats '<file>' or '"file"' are used for #include directives found |
---|
| 106 | // in the preprocessed token stream, the format 'file' is used for files |
---|
| 107 | // specified through the --force_include command line argument. |
---|
| 108 | // |
---|
| 109 | // The parameter 'include_next' is set to true if the found directive was |
---|
| 110 | // a #include_next directive and the BOOST_WAVE_SUPPORT_INCLUDE_NEXT |
---|
| 111 | // preprocessing constant was defined to something != 0. |
---|
| 112 | // |
---|
| 113 | /////////////////////////////////////////////////////////////////////////// |
---|
| 114 | void |
---|
| 115 | found_include_directive(std::string const &filename, bool include_next) |
---|
| 116 | {} |
---|
| 117 | |
---|
| 118 | /////////////////////////////////////////////////////////////////////////// |
---|
| 119 | // |
---|
| 120 | // The function 'opened_include_file' is called, whenever a file referred |
---|
| 121 | // by an #include directive was successfully located and opened. |
---|
| 122 | // |
---|
| 123 | // The parameter 'filename' contains the file system path of the |
---|
| 124 | // opened file (this is relative to the directory of the currently |
---|
| 125 | // processed file or a absolute path depending on the paths given as the |
---|
| 126 | // include search paths). |
---|
| 127 | // |
---|
| 128 | // The include_depth parameter contains the current include file depth. |
---|
| 129 | // |
---|
| 130 | // The is_system_include parameter denotes, whether the given file was |
---|
| 131 | // found as a result of a #include <...> directive. |
---|
| 132 | // |
---|
| 133 | /////////////////////////////////////////////////////////////////////////// |
---|
| 134 | void |
---|
| 135 | opened_include_file(std::string const &relname, std::string const &absname, |
---|
| 136 | std::size_t include_depth, bool is_system_include) |
---|
| 137 | {} |
---|
| 138 | |
---|
| 139 | /////////////////////////////////////////////////////////////////////////// |
---|
| 140 | // |
---|
| 141 | // The function 'returning_from_include_file' is called, whenever an |
---|
| 142 | // included file is about to be closed after it's processing is complete. |
---|
| 143 | // |
---|
| 144 | /////////////////////////////////////////////////////////////////////////// |
---|
| 145 | void |
---|
| 146 | returning_from_include_file() |
---|
| 147 | {} |
---|
| 148 | |
---|
| 149 | /////////////////////////////////////////////////////////////////////////// |
---|
| 150 | // |
---|
| 151 | // The function 'interpret_pragma' is called, whenever a #pragma wave |
---|
| 152 | // directive is found, which isn't known to the core Wave library. |
---|
| 153 | // |
---|
| 154 | // The parameter 'ctx' is a reference to the context object used for |
---|
| 155 | // instantiating the preprocessing iterators by the user. |
---|
| 156 | // |
---|
| 157 | // The parameter 'pending' may be used to push tokens back into the input |
---|
| 158 | // stream, which are to be used as the replacement text for the whole |
---|
| 159 | // #pragma wave() directive. |
---|
| 160 | // |
---|
| 161 | // The parameter 'option' contains the name of the interpreted pragma. |
---|
| 162 | // |
---|
| 163 | // The parameter 'values' holds the values of the parameter provided to |
---|
| 164 | // the pragma operator. |
---|
| 165 | // |
---|
| 166 | // The parameter 'act_token' contains the actual #pragma token, which may |
---|
| 167 | // be used for error output. |
---|
| 168 | // |
---|
| 169 | // If the return value is 'false', the whole #pragma directive is |
---|
| 170 | // interpreted as unknown and a corresponding error message is issued. A |
---|
| 171 | // return value of 'true' signs a successful interpretation of the given |
---|
| 172 | // #pragma. |
---|
| 173 | // |
---|
| 174 | /////////////////////////////////////////////////////////////////////////// |
---|
| 175 | template <typename ContextT, typename ContainerT> |
---|
| 176 | bool |
---|
| 177 | interpret_pragma(ContextT const &ctx, ContainerT &pending, |
---|
| 178 | typename ContextT::token_type const &option, ContainerT const &values, |
---|
| 179 | typename ContextT::token_type const &act_token) |
---|
| 180 | { |
---|
| 181 | return false; |
---|
| 182 | } |
---|
| 183 | |
---|
| 184 | /////////////////////////////////////////////////////////////////////////// |
---|
| 185 | // |
---|
| 186 | // The function 'defined_macro' is called, whenever a macro was defined |
---|
| 187 | // successfully. |
---|
| 188 | // |
---|
| 189 | // The parameter 'name' is a reference to the token holding the macro name. |
---|
| 190 | // |
---|
| 191 | // The parameter 'is_functionlike' is set to true, whenever the newly |
---|
| 192 | // defined macro is defined as a function like macro. |
---|
| 193 | // |
---|
| 194 | // The parameter 'parameters' holds the parameter tokens for the macro |
---|
| 195 | // definition. If the macro has no parameters or if it is a object like |
---|
| 196 | // macro, then this container is empty. |
---|
| 197 | // |
---|
| 198 | // The parameter 'definition' contains the token sequence given as the |
---|
| 199 | // replacement sequence (definition part) of the newly defined macro. |
---|
| 200 | // |
---|
| 201 | // The parameter 'is_predefined' is set to true for all macros predefined |
---|
| 202 | // during the initialisation phase of the library. |
---|
| 203 | // |
---|
| 204 | /////////////////////////////////////////////////////////////////////////// |
---|
| 205 | template <typename TokenT, typename ParametersT, typename DefinitionT> |
---|
| 206 | void |
---|
| 207 | defined_macro(TokenT const ¯o_name, bool is_functionlike, |
---|
| 208 | ParametersT const ¶meters, DefinitionT const &definition, |
---|
| 209 | bool is_predefined) |
---|
| 210 | {} |
---|
| 211 | |
---|
| 212 | /////////////////////////////////////////////////////////////////////////// |
---|
| 213 | // |
---|
| 214 | // The function 'undefined_macro' is called, whenever a macro definition |
---|
| 215 | // was removed successfully. |
---|
| 216 | // |
---|
| 217 | // The parameter 'name' holds the name of the macro, which definition was |
---|
| 218 | // removed. |
---|
| 219 | // |
---|
| 220 | /////////////////////////////////////////////////////////////////////////// |
---|
| 221 | template <typename TokenT> |
---|
| 222 | void |
---|
| 223 | undefined_macro(TokenT const ¯o_name) |
---|
| 224 | {} |
---|
| 225 | |
---|
| 226 | }; |
---|
| 227 | |
---|
| 228 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 229 | } // namespace context_policies |
---|
| 230 | } // namespace wave |
---|
| 231 | } // namespace boost |
---|
| 232 | |
---|
| 233 | #endif // !defined(PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED) |
---|