|
||||
File indexing completed on 2025-01-18 09:53:43
0001 /*============================================================================= 0002 Boost.Wave: A Standard compliant C++ preprocessor library 0003 0004 http://www.boost.org/ 0005 0006 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 0007 Software License, Version 1.0. (See accompanying file 0008 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0009 =============================================================================*/ 0010 0011 #if !defined(BOOST_DEFAULT_PREPROCESSING_HOOKS_HPP_INCLUDED) 0012 #define BOOST_DEFAULT_PREPROCESSING_HOOKS_HPP_INCLUDED 0013 0014 #include <boost/wave/wave_config.hpp> 0015 #include <boost/wave/util/cpp_include_paths.hpp> 0016 #include <boost/wave/cpp_exceptions.hpp> 0017 0018 #include <vector> 0019 0020 // this must occur after all of the includes and before any code appears 0021 #ifdef BOOST_HAS_ABI_HEADERS 0022 #include BOOST_ABI_PREFIX 0023 #endif 0024 0025 /////////////////////////////////////////////////////////////////////////////// 0026 namespace boost { 0027 namespace wave { 0028 namespace context_policies { 0029 0030 /////////////////////////////////////////////////////////////////////////////// 0031 // 0032 // The default_preprocessing_hooks class is a placeholder for all 0033 // preprocessing hooks called from inside the preprocessing engine 0034 // 0035 /////////////////////////////////////////////////////////////////////////////// 0036 struct default_preprocessing_hooks 0037 { 0038 /////////////////////////////////////////////////////////////////////////// 0039 // 0040 // The function 'expanding_function_like_macro' is called, whenever a 0041 // function-like macro is to be expanded. 0042 // 0043 // The parameter 'macrodef' marks the position, where the macro to expand 0044 // is defined. 0045 // 0046 // The parameter 'formal_args' holds the formal arguments used during the 0047 // definition of the macro. 0048 // 0049 // The parameter 'definition' holds the macro definition for the macro to 0050 // trace. 0051 // 0052 // The parameter 'macro_call' marks the position, where this macro invoked. 0053 // 0054 // The parameter 'arguments' holds the macro arguments used during the 0055 // invocation of the macro 0056 // 0057 // The parameters 'seqstart' and 'seqend' point into the input token 0058 // stream allowing to access the whole token sequence comprising the macro 0059 // invocation (starting with the opening parenthesis and ending after the 0060 // closing one). 0061 // 0062 // The return value defines whether the corresponding macro will be 0063 // expanded (return false) or will be copied to the output (return true). 0064 // Note: the whole argument list is copied unchanged to the output as well 0065 // without any further processing. 0066 // 0067 /////////////////////////////////////////////////////////////////////////// 0068 0069 template <typename ContextT, typename TokenT, typename ContainerT, typename IteratorT> 0070 bool 0071 expanding_function_like_macro(ContextT const& ctx, 0072 TokenT const& macrodef, std::vector<TokenT> const& formal_args, 0073 ContainerT const& definition, 0074 TokenT const& macrocall, std::vector<ContainerT> const& arguments, 0075 IteratorT const& seqstart, IteratorT const& seqend) 0076 { return false; } // default is to normally expand the macro 0077 0078 /////////////////////////////////////////////////////////////////////////// 0079 // 0080 // The function 'expanding_object_like_macro' is called, whenever a 0081 // object-like macro is to be expanded . 0082 // 0083 // The parameter 'ctx' is a reference to the context object used for 0084 // instantiating the preprocessing iterators by the user. 0085 // 0086 // The parameter 'macro' marks the position, where the macro to expand 0087 // is defined. 0088 // 0089 // The definition 'definition' holds the macro definition for the macro to 0090 // trace. 0091 // 0092 // The parameter 'macrocall' marks the position, where this macro invoked. 0093 // 0094 // The return value defines whether the corresponding macro will be 0095 // expanded (return false) or will be copied to the output (return true). 0096 // 0097 /////////////////////////////////////////////////////////////////////////// 0098 template <typename ContextT, typename TokenT, typename ContainerT> 0099 bool 0100 expanding_object_like_macro(ContextT const& ctx, TokenT const& macro, 0101 ContainerT const& definition, TokenT const& macrocall) 0102 { return false; } // default is to normally expand the macro 0103 0104 /////////////////////////////////////////////////////////////////////////// 0105 // 0106 // The function 'expanded_macro' is called, whenever the expansion of a 0107 // macro is finished but before the rescanning process starts. 0108 // 0109 // The parameter 'ctx' is a reference to the context object used for 0110 // instantiating the preprocessing iterators by the user. 0111 // 0112 // The parameter 'result' contains the token sequence generated as the 0113 // result of the macro expansion. 0114 // 0115 /////////////////////////////////////////////////////////////////////////// 0116 template <typename ContextT, typename ContainerT> 0117 void expanded_macro(ContextT const& ctx, ContainerT const& result) 0118 {} 0119 0120 /////////////////////////////////////////////////////////////////////////// 0121 // 0122 // The function 'rescanned_macro' is called, whenever the rescanning of a 0123 // macro is finished. 0124 // 0125 // The parameter 'ctx' is a reference to the context object used for 0126 // instantiating the preprocessing iterators by the user. 0127 // 0128 // The parameter 'result' contains the token sequence generated as the 0129 // result of the rescanning. 0130 // 0131 /////////////////////////////////////////////////////////////////////////// 0132 template <typename ContextT, typename ContainerT> 0133 void rescanned_macro(ContextT const& ctx, ContainerT const& result) 0134 {} 0135 0136 /////////////////////////////////////////////////////////////////////////// 0137 // 0138 // The function 'locate_include_file' is called, whenever a #include 0139 // directive was encountered. It is supposed to locate the given file and 0140 // should return the full file name of the located file. This file name 0141 // is expected to uniquely identify the referenced file. 0142 // 0143 // The parameter 'ctx' is a reference to the context object used for 0144 // instantiating the preprocessing iterators by the user. 0145 // 0146 // The parameter 'file_path' contains the (expanded) file name found after 0147 // the #include directive. This parameter holds the string as it is 0148 // specified in the #include directive, i.e. <file> or "file" will result 0149 // in a parameter value 'file'. 0150 // 0151 // The parameter 'is_system' is set to 'true' if this call happens as a 0152 // result of a #include '<file>' directive, it is 'false' otherwise, i.e. 0153 // for #include "file" directives. 0154 // 0155 // The parameter 'current_name' is only used if a #include_next directive 0156 // was encountered (and BOOST_WAVE_SUPPORT_INCLUDE_NEXT was defined to be 0157 // non-zero). In this case it points to unique full name of the current 0158 // include file (if any). Otherwise this parameter is set to NULL. 0159 // 0160 // The parameter 'dir_path' on return is expected to hold the directory 0161 // part of the located file. 0162 // 0163 // The parameter 'native_name' on return is expected to hold the unique 0164 // full file name of the located file. 0165 // 0166 // The return value defines whether the file was located successfully. 0167 // 0168 /////////////////////////////////////////////////////////////////////////// 0169 template <typename ContextT> 0170 bool 0171 locate_include_file(ContextT& ctx, std::string &file_path, 0172 bool is_system, char const *current_name, std::string &dir_path, 0173 std::string &native_name) 0174 { 0175 if (!ctx.find_include_file (file_path, dir_path, is_system, current_name)) 0176 return false; // could not locate file 0177 0178 namespace fs = boost::filesystem; 0179 0180 fs::path native_path(wave::util::create_path(file_path)); 0181 if (!fs::exists(native_path)) { 0182 BOOST_WAVE_THROW_CTX(ctx, preprocess_exception, bad_include_file, 0183 file_path.c_str(), ctx.get_main_pos()); 0184 return false; 0185 } 0186 0187 // return the unique full file system path of the located file 0188 native_name = wave::util::native_file_string(native_path); 0189 0190 return true; // include file has been located successfully 0191 } 0192 0193 /////////////////////////////////////////////////////////////////////////// 0194 // 0195 // The function 'found_include_directive' is called, whenever a #include 0196 // directive was located. 0197 // 0198 // The parameter 'ctx' is a reference to the context object used for 0199 // instantiating the preprocessing iterators by the user. 0200 // 0201 // The parameter 'filename' contains the (expanded) file name found after 0202 // the #include directive. This has the format '<file>', '"file"' or 0203 // 'file'. 0204 // The formats '<file>' or '"file"' are used for #include directives found 0205 // in the preprocessed token stream, the format 'file' is used for files 0206 // specified through the --force_include command line argument. 0207 // 0208 // The parameter 'include_next' is set to true if the found directive was 0209 // a #include_next directive and the BOOST_WAVE_SUPPORT_INCLUDE_NEXT 0210 // preprocessing constant was defined to something != 0. 0211 // 0212 // The return value defines whether the found file will be included 0213 // (return false) or will be skipped (return true). 0214 // 0215 /////////////////////////////////////////////////////////////////////////// 0216 template <typename ContextT> 0217 bool 0218 found_include_directive(ContextT const& ctx, std::string const& filename, 0219 bool include_next) 0220 { 0221 return false; // ok to include this file 0222 } 0223 0224 /////////////////////////////////////////////////////////////////////////// 0225 // 0226 // The function 'opened_include_file' is called, whenever a file referred 0227 // by an #include directive was successfully located and opened. 0228 // 0229 // The parameter 'ctx' is a reference to the context object used for 0230 // instantiating the preprocessing iterators by the user. 0231 // 0232 // The parameter 'filename' contains the file system path of the 0233 // opened file (this is relative to the directory of the currently 0234 // processed file or a absolute path depending on the paths given as the 0235 // include search paths). 0236 // 0237 // The include_depth parameter contains the current include file depth. 0238 // 0239 // The is_system_include parameter denotes whether the given file was 0240 // found as a result of a #include <...> directive. 0241 // 0242 /////////////////////////////////////////////////////////////////////////// 0243 template <typename ContextT> 0244 void 0245 opened_include_file(ContextT const& ctx, std::string const& relname, 0246 std::string const& absname, bool is_system_include) 0247 {} 0248 0249 /////////////////////////////////////////////////////////////////////////// 0250 // 0251 // The function 'returning_from_include_file' is called, whenever an 0252 // included file is about to be closed after it's processing is complete. 0253 // 0254 // The parameter 'ctx' is a reference to the context object used for 0255 // instantiating the preprocessing iterators by the user. 0256 // 0257 /////////////////////////////////////////////////////////////////////////// 0258 template <typename ContextT> 0259 void 0260 returning_from_include_file(ContextT const& ctx) 0261 {} 0262 0263 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 0264 /////////////////////////////////////////////////////////////////////////// 0265 // 0266 // The function 'detected_include_guard' is called whenever either a 0267 // include file is about to be added to the list of #pragma once headers. 0268 // That means this header file will not be opened and parsed again even 0269 // if it is specified in a later #include directive. 0270 // This function is called as the result of a detected include guard 0271 // scheme. 0272 // 0273 // The implemented heuristics for include guards detects two forms of 0274 // include guards: 0275 // 0276 // #ifndef INCLUDE_GUARD_MACRO 0277 // #define INCLUDE_GUARD_MACRO 0278 // ... 0279 // #endif 0280 // 0281 // or 0282 // 0283 // if !defined(INCLUDE_GUARD_MACRO) 0284 // #define INCLUDE_GUARD_MACRO 0285 // ... 0286 // #endif 0287 // 0288 // note, that the parenthesis are optional (i.e. !defined INCLUDE_GUARD_MACRO 0289 // will work as well). The code allows for any whitespace, newline and single 0290 // '#' tokens before the #if/#ifndef and after the final #endif. 0291 // 0292 // The parameter 'ctx' is a reference to the context object used for 0293 // instantiating the preprocessing iterators by the user. 0294 // 0295 // The parameter 'filename' contains the file system path of the 0296 // opened file (this is relative to the directory of the currently 0297 // processed file or a absolute path depending on the paths given as the 0298 // include search paths). 0299 // 0300 // The parameter contains the name of the detected include guard. 0301 // 0302 /////////////////////////////////////////////////////////////////////////// 0303 template <typename ContextT> 0304 void 0305 detected_include_guard(ContextT const& ctx, std::string const& filename, 0306 std::string const& include_guard) 0307 {} 0308 0309 /////////////////////////////////////////////////////////////////////////// 0310 // 0311 // The function 'detected_pragma_once' is called whenever either a 0312 // include file is about to be added to the list of #pragma once headers. 0313 // That means this header file will not be opened and parsed again even 0314 // if it is specified in a later #include directive. 0315 // This function is called as the result of a detected directive 0316 // #pragma once. 0317 // 0318 // The parameter 'ctx' is a reference to the context object used for 0319 // instantiating the preprocessing iterators by the user. 0320 // 0321 // The parameter pragma_token refers to the token "#pragma" triggering 0322 // this preprocessing hook. 0323 // 0324 // The parameter 'filename' contains the file system path of the 0325 // opened file (this is relative to the directory of the currently 0326 // processed file or a absolute path depending on the paths given as the 0327 // include search paths). 0328 // 0329 /////////////////////////////////////////////////////////////////////////// 0330 template <typename ContextT, typename TokenT> 0331 void 0332 detected_pragma_once(ContextT const& ctx, TokenT const& pragma_token, 0333 std::string const& filename) 0334 {} 0335 #endif 0336 0337 /////////////////////////////////////////////////////////////////////////// 0338 // 0339 // The function 'interpret_pragma' is called, whenever a '#pragma command' 0340 // directive is found which isn't known to the core Wave library, where 0341 // 'command' is the value defined as the BOOST_WAVE_PRAGMA_KEYWORD constant 0342 // which defaults to "wave". 0343 // 0344 // The parameter 'ctx' is a reference to the context object used for 0345 // instantiating the preprocessing iterators by the user. 0346 // 0347 // The parameter 'pending' may be used to push tokens back into the input 0348 // stream, which are to be used as the replacement text for the whole 0349 // #pragma directive. 0350 // 0351 // The parameter 'option' contains the name of the interpreted pragma. 0352 // 0353 // The parameter 'values' holds the values of the parameter provided to 0354 // the pragma operator. 0355 // 0356 // The parameter 'act_token' contains the actual #pragma token, which may 0357 // be used for error output. 0358 // 0359 // If the return value is 'false', the whole #pragma directive is 0360 // interpreted as unknown and a corresponding error message is issued. A 0361 // return value of 'true' signs a successful interpretation of the given 0362 // #pragma. 0363 // 0364 /////////////////////////////////////////////////////////////////////////// 0365 template <typename ContextT, typename ContainerT> 0366 bool 0367 interpret_pragma(ContextT const& ctx, ContainerT &pending, 0368 typename ContextT::token_type const& option, ContainerT const& values, 0369 typename ContextT::token_type const& act_token) 0370 { 0371 return false; 0372 } 0373 0374 /////////////////////////////////////////////////////////////////////////// 0375 // 0376 // The function 'emit_line_directive' is called whenever a #line directive 0377 // has to be emitted into the generated output. 0378 // 0379 // The parameter 'ctx' is a reference to the context object used for 0380 // instantiating the preprocessing iterators by the user. 0381 // 0382 // The parameter 'pending' may be used to push tokens back into the input 0383 // stream, which are to be used instead of the default output generated 0384 // for the #line directive. 0385 // 0386 // The parameter 'act_token' contains the actual #pragma token, which may 0387 // be used for error output. The line number stored in this token can be 0388 // used as the line number emitted as part of the #line directive. 0389 // 0390 // If the return value is 'false', a default #line directive is emitted 0391 // by the library. A return value of 'true' will inhibit any further 0392 // actions, the tokens contained in 'pending' will be copied verbatim 0393 // to the output. 0394 // 0395 /////////////////////////////////////////////////////////////////////////// 0396 template <typename ContextT, typename ContainerT> 0397 bool 0398 emit_line_directive(ContextT const& ctx, ContainerT &pending, 0399 typename ContextT::token_type const& act_token) 0400 { 0401 return false; 0402 } 0403 0404 /////////////////////////////////////////////////////////////////////////// 0405 // 0406 // The function 'defined_macro' is called, whenever a macro was defined 0407 // successfully. 0408 // 0409 // The parameter 'ctx' is a reference to the context object used for 0410 // instantiating the preprocessing iterators by the user. 0411 // 0412 // The parameter 'name' is a reference to the token holding the macro name. 0413 // 0414 // The parameter 'is_functionlike' is set to true, whenever the newly 0415 // defined macro is defined as a function like macro. 0416 // 0417 // The parameter 'parameters' holds the parameter tokens for the macro 0418 // definition. If the macro has no parameters or if it is a object like 0419 // macro, then this container is empty. 0420 // 0421 // The parameter 'definition' contains the token sequence given as the 0422 // replacement sequence (definition part) of the newly defined macro. 0423 // 0424 // The parameter 'is_predefined' is set to true for all macros predefined 0425 // during the initialization phase of the library. 0426 // 0427 /////////////////////////////////////////////////////////////////////////// 0428 template < 0429 typename ContextT, typename TokenT, typename ParametersT, 0430 typename DefinitionT 0431 > 0432 void 0433 defined_macro(ContextT const& ctx, TokenT const& macro_name, 0434 bool is_functionlike, ParametersT const& parameters, 0435 DefinitionT const& definition, bool is_predefined) 0436 {} 0437 0438 /////////////////////////////////////////////////////////////////////////// 0439 // 0440 // The function 'undefined_macro' is called, whenever a macro definition 0441 // was removed successfully. 0442 // 0443 // The parameter 'ctx' is a reference to the context object used for 0444 // instantiating the preprocessing iterators by the user. 0445 // 0446 // The parameter 'name' holds the name of the macro, which definition was 0447 // removed. 0448 // 0449 /////////////////////////////////////////////////////////////////////////// 0450 template <typename ContextT, typename TokenT> 0451 void 0452 undefined_macro(ContextT const& ctx, TokenT const& macro_name) 0453 {} 0454 0455 /////////////////////////////////////////////////////////////////////////// 0456 // 0457 // The function 'found_directive' is called, whenever a preprocessor 0458 // directive was encountered, but before the corresponding action is 0459 // executed. 0460 // 0461 // The parameter 'ctx' is a reference to the context object used for 0462 // instantiating the preprocessing iterators by the user. 0463 // 0464 // The parameter 'directive' is a reference to the token holding the 0465 // preprocessing directive. 0466 // 0467 // The return value defines whether the given expression has to be 0468 // to be executed in a normal way (return 'false'), or if it has to be 0469 // skipped altogether (return 'true'), which means it gets replaced in the 0470 // output by a single newline. 0471 // 0472 /////////////////////////////////////////////////////////////////////////// 0473 template <typename ContextT, typename TokenT> 0474 bool 0475 found_directive(ContextT const& ctx, TokenT const& directive) 0476 { return false; } // by default we never skip any directives 0477 0478 /////////////////////////////////////////////////////////////////////////// 0479 // 0480 // The function 'found_unknown_directive' is called, whenever an unknown 0481 // preprocessor directive was encountered. 0482 // 0483 // The parameter 'ctx' is a reference to the context object used for 0484 // instantiating the preprocessing iterators by the user. 0485 // 0486 // The parameter 'line' holds the tokens of the entire source line 0487 // containing the unknown directive. 0488 // 0489 // The parameter 'pending' may be used to push tokens back into the input 0490 // stream, which are to be used as the replacement text for the whole 0491 // line containing the unknown directive. 0492 // 0493 // The return value defines whether the given expression has been 0494 // properly interpreted by the hook function or not. If this function 0495 // returns 'false', the library will raise an 'ill_formed_directive' 0496 // preprocess_exception. Otherwise the tokens pushed back into 'pending' 0497 // are passed on to the user program. 0498 // 0499 /////////////////////////////////////////////////////////////////////////// 0500 template <typename ContextT, typename ContainerT> 0501 bool 0502 found_unknown_directive(ContextT const& ctx, ContainerT const& line, 0503 ContainerT& pending) 0504 { return false; } // by default we never interpret unknown directives 0505 0506 /////////////////////////////////////////////////////////////////////////// 0507 // 0508 // The function 'evaluated_conditional_expression' is called, whenever a 0509 // conditional preprocessing expression was evaluated (the expression 0510 // given to a #if, #elif, #ifdef or #ifndef directive) 0511 // 0512 // The parameter 'ctx' is a reference to the context object used for 0513 // instantiating the preprocessing iterators by the user. 0514 // 0515 // The parameter 'directive' is a reference to the token holding the 0516 // corresponding preprocessing directive. 0517 // 0518 // The parameter 'expression' holds the non-expanded token sequence 0519 // comprising the evaluated expression. 0520 // 0521 // The parameter expression_value contains the result of the evaluation of 0522 // the expression in the current preprocessing context. 0523 // 0524 // The return value defines whether the given expression has to be 0525 // evaluated again, allowing to decide which of the conditional branches 0526 // should be expanded. You need to return 'true' from this hook function 0527 // to force the expression to be re-evaluated. 0528 // 0529 /////////////////////////////////////////////////////////////////////////// 0530 template <typename ContextT, typename TokenT, typename ContainerT> 0531 bool 0532 evaluated_conditional_expression(ContextT const& ctx, 0533 TokenT const& directive, ContainerT const& expression, 0534 bool expression_value) 0535 { return false; } // ok to continue, do not re-evaluate expression 0536 0537 /////////////////////////////////////////////////////////////////////////// 0538 // 0539 // The function 'skipped_token' is called, whenever a token is about to be 0540 // skipped due to a false preprocessor condition (code fragments to be 0541 // skipped inside the not evaluated conditional #if/#else/#endif branches). 0542 // 0543 // The parameter 'ctx' is a reference to the context object used for 0544 // instantiating the preprocessing iterators by the user. 0545 // 0546 // The parameter 'token' refers to the token to be skipped. 0547 // 0548 /////////////////////////////////////////////////////////////////////////// 0549 template <typename ContextT, typename TokenT> 0550 void 0551 skipped_token(ContextT const& ctx, TokenT const& token) 0552 {} 0553 0554 /////////////////////////////////////////////////////////////////////////// 0555 // 0556 // The function 'generated_token' will be called by the library whenever a 0557 // token is about to be returned from the library. 0558 // 0559 // The parameter 'ctx' is a reference to the context object used for 0560 // instantiating the preprocessing iterators by the user. 0561 // 0562 // The parameter 't' is the token about to be returned from the library. 0563 // This function may alter the token, but in this case it must be 0564 // implemented with a corresponding signature: 0565 // 0566 // TokenT const& 0567 // generated_token(ContextT const& ctx, TokenT& t); 0568 // 0569 // which makes it possible to modify the token in place. 0570 // 0571 // The default behavior is to return the token passed as the parameter 0572 // without modification. 0573 // 0574 /////////////////////////////////////////////////////////////////////////// 0575 template <typename ContextT, typename TokenT> 0576 TokenT const& 0577 generated_token(ContextT const& ctx, TokenT const& t) 0578 { return t; } 0579 0580 /////////////////////////////////////////////////////////////////////////// 0581 // 0582 // The function 'may_skip_whitespace' will be called by the 0583 // library, whenever it must be tested whether a specific token refers to 0584 // whitespace and this whitespace has to be skipped. 0585 // 0586 // The parameter 'ctx' is a reference to the context object used for 0587 // instantiating the preprocessing iterators by the user. 0588 // 0589 // The 'token' parameter holds a reference to the current token. The policy 0590 // is free to change this token if needed. 0591 // 0592 // The 'skipped_newline' parameter holds a reference to a boolean value 0593 // which should be set to true by the policy function whenever a newline 0594 // is going to be skipped. 0595 // 0596 // If the return value is true, the given token is skipped and the 0597 // preprocessing continues to the next token. If the return value is 0598 // false, the given token is returned to the calling application. 0599 // 0600 // ATTENTION! 0601 // Caution has to be used, because by returning true the policy function 0602 // is able to force skipping even significant tokens, not only whitespace. 0603 // 0604 /////////////////////////////////////////////////////////////////////////// 0605 template <typename ContextT, typename TokenT> 0606 bool 0607 may_skip_whitespace(ContextT const& ctx, TokenT& token, bool& skipped_newline) 0608 { return false; } 0609 0610 #if BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE != 0 0611 /////////////////////////////////////////////////////////////////////////// 0612 // 0613 // The function 'found_warning_directive' will be called by the library 0614 // whenever a #warning directive is found. 0615 // 0616 // The parameter 'ctx' is a reference to the context object used for 0617 // instantiating the preprocessing iterators by the user. 0618 // 0619 // The parameter 'message' references the argument token sequence of the 0620 // encountered #warning directive. 0621 // 0622 // If the return value is false, the library throws a preprocessor 0623 // exception of the type 'warning_directive', if the return value is true 0624 // the execution continues as if no #warning directive has been found. 0625 // 0626 /////////////////////////////////////////////////////////////////////////// 0627 template <typename ContextT, typename ContainerT> 0628 bool 0629 found_warning_directive(ContextT const& ctx, ContainerT const& message) 0630 { return false; } 0631 #endif 0632 0633 /////////////////////////////////////////////////////////////////////////// 0634 // 0635 // The function 'found_error_directive' will be called by the library 0636 // whenever a #error directive is found. 0637 // 0638 // The parameter 'ctx' is a reference to the context object used for 0639 // instantiating the preprocessing iterators by the user. 0640 // 0641 // The parameter 'message' references the argument token sequence of the 0642 // encountered #error directive. 0643 // 0644 // If the return value is false, the library throws a preprocessor 0645 // exception of the type 'error_directive', if the return value is true 0646 // the execution continues as if no #error directive has been found. 0647 // 0648 /////////////////////////////////////////////////////////////////////////// 0649 template <typename ContextT, typename ContainerT> 0650 bool 0651 found_error_directive(ContextT const& ctx, ContainerT const& message) 0652 { return false; } 0653 0654 /////////////////////////////////////////////////////////////////////////// 0655 // 0656 // The function 'found_line_directive' will be called by the library 0657 // whenever a #line directive is found. 0658 // 0659 // The parameter 'ctx' is a reference to the context object used for 0660 // instantiating the preprocessing iterators by the user. 0661 // 0662 // The parameter 'arguments' references the argument token sequence of the 0663 // encountered #line directive. 0664 // 0665 // The parameter 'line' contains the recognized line number from the #line 0666 // directive. 0667 // 0668 // The parameter 'filename' references the recognized file name from the 0669 // #line directive (if there was one given). 0670 // 0671 /////////////////////////////////////////////////////////////////////////// 0672 template <typename ContextT, typename ContainerT> 0673 void 0674 found_line_directive(ContextT const& ctx, ContainerT const& arguments, 0675 unsigned int line, std::string const& filename) 0676 {} 0677 0678 /////////////////////////////////////////////////////////////////////////// 0679 // 0680 // The function 'throw_exception' will be called by the library whenever a 0681 // preprocessing exception occurs. 0682 // 0683 // The parameter 'ctx' is a reference to the context object used for 0684 // instantiating the preprocessing iterators by the user. 0685 // 0686 // The parameter 'e' is the exception object containing detailed error 0687 // information. 0688 // 0689 // The default behavior is to call the function boost::throw_exception. 0690 // 0691 /////////////////////////////////////////////////////////////////////////// 0692 template <typename ContextT, typename ExceptionT> 0693 void 0694 throw_exception(ContextT const& ctx, ExceptionT const& e) 0695 { 0696 boost::throw_exception(e); 0697 } 0698 }; 0699 0700 /////////////////////////////////////////////////////////////////////////////// 0701 } // namespace context_policies 0702 } // namespace wave 0703 } // namespace boost 0704 0705 // the suffix header occurs after all of the code 0706 #ifdef BOOST_HAS_ABI_HEADERS 0707 #include BOOST_ABI_SUFFIX 0708 #endif 0709 0710 #endif // !defined(BOOST_DEFAULT_PREPROCESSING_HOOKS_HPP_INCLUDED)
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |