os/ossrv/ossrv_pub/boost_apis/boost/wave/preprocessing_hooks.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*=============================================================================
sl@0
     2
    Boost.Wave: A Standard compliant C++ preprocessor library
sl@0
     3
sl@0
     4
    http://www.boost.org/
sl@0
     5
sl@0
     6
    Copyright (c) 2001-2007 Hartmut Kaiser. Distributed under the Boost
sl@0
     7
    Software License, Version 1.0. (See accompanying file
sl@0
     8
    LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
sl@0
     9
=============================================================================*/
sl@0
    10
sl@0
    11
#if !defined(PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED)
sl@0
    12
#define PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED
sl@0
    13
sl@0
    14
#include <boost/wave/wave_config.hpp>
sl@0
    15
#include <vector>
sl@0
    16
sl@0
    17
// this must occur after all of the includes and before any code appears
sl@0
    18
#ifdef BOOST_HAS_ABI_HEADERS
sl@0
    19
#include BOOST_ABI_PREFIX
sl@0
    20
#endif
sl@0
    21
sl@0
    22
///////////////////////////////////////////////////////////////////////////////
sl@0
    23
namespace boost {
sl@0
    24
namespace wave {
sl@0
    25
namespace context_policies {
sl@0
    26
sl@0
    27
///////////////////////////////////////////////////////////////////////////////
sl@0
    28
//  
sl@0
    29
//  The default_preprocessing_hooks class is a placeholder for all 
sl@0
    30
//  preprocessing hooks called from inside the preprocessing engine
sl@0
    31
//
sl@0
    32
///////////////////////////////////////////////////////////////////////////////
sl@0
    33
struct default_preprocessing_hooks {
sl@0
    34
sl@0
    35
    ///////////////////////////////////////////////////////////////////////////
sl@0
    36
    //  
sl@0
    37
    //  The function 'expanding_function_like_macro' is called, whenever a 
sl@0
    38
    //  function-like macro is to be expanded.
sl@0
    39
    //
sl@0
    40
    //  The macroname parameter marks the position, where the macro to expand 
sl@0
    41
    //  is defined.
sl@0
    42
    //  The formal_args parameter holds the formal arguments used during the
sl@0
    43
    //  definition of the macro.
sl@0
    44
    //  The definition parameter holds the macro definition for the macro to 
sl@0
    45
    //  trace.
sl@0
    46
    //
sl@0
    47
    //  The macro call parameter marks the position, where this macro invoked.
sl@0
    48
    //  The arguments parameter holds the macro arguments used during the 
sl@0
    49
    //  invocation of the macro
sl@0
    50
    //
sl@0
    51
    ///////////////////////////////////////////////////////////////////////////
sl@0
    52
    template <typename TokenT, typename ContainerT>
sl@0
    53
    void expanding_function_like_macro(
sl@0
    54
        TokenT const &macrodef, std::vector<TokenT> const &formal_args, 
sl@0
    55
        ContainerT const &definition,
sl@0
    56
        TokenT const &macrocall, std::vector<ContainerT> const &arguments) 
sl@0
    57
    {}
sl@0
    58
sl@0
    59
    ///////////////////////////////////////////////////////////////////////////
sl@0
    60
    //  
sl@0
    61
    //  The function 'expanding_object_like_macro' is called, whenever a 
sl@0
    62
    //  object-like macro is to be expanded .
sl@0
    63
    //
sl@0
    64
    //  The macroname parameter marks the position, where the macro to expand 
sl@0
    65
    //  is defined.
sl@0
    66
    //  The definition parameter holds the macro definition for the macro to 
sl@0
    67
    //  trace.
sl@0
    68
    //
sl@0
    69
    //  The macro call parameter marks the position, where this macro invoked.
sl@0
    70
    //
sl@0
    71
    ///////////////////////////////////////////////////////////////////////////
sl@0
    72
    template <typename TokenT, typename ContainerT>
sl@0
    73
    void expanding_object_like_macro(TokenT const &macro, 
sl@0
    74
        ContainerT const &definition, TokenT const &macrocall)
sl@0
    75
    {}
sl@0
    76
sl@0
    77
    ///////////////////////////////////////////////////////////////////////////
sl@0
    78
    //  
sl@0
    79
    //  The function 'expanded_macro' is called, whenever the expansion of a 
sl@0
    80
    //  macro is finished but before the rescanning process starts.
sl@0
    81
    //
sl@0
    82
    //  The parameter 'result' contains the token sequence generated as the 
sl@0
    83
    //  result of the macro expansion.
sl@0
    84
    //
sl@0
    85
    ///////////////////////////////////////////////////////////////////////////
sl@0
    86
    template <typename ContainerT>
sl@0
    87
    void expanded_macro(ContainerT const &result)
sl@0
    88
    {}
sl@0
    89
sl@0
    90
    ///////////////////////////////////////////////////////////////////////////
sl@0
    91
    //  
sl@0
    92
    //  The function 'rescanned_macro' is called, whenever the rescanning of a 
sl@0
    93
    //  macro is finished.
sl@0
    94
    //
sl@0
    95
    //  The parameter 'result' contains the token sequence generated as the 
sl@0
    96
    //  result of the rescanning.
sl@0
    97
    //
sl@0
    98
    ///////////////////////////////////////////////////////////////////////////
sl@0
    99
    template <typename ContainerT>
sl@0
   100
    void rescanned_macro(ContainerT const &result)
sl@0
   101
    {}
sl@0
   102
sl@0
   103
    ///////////////////////////////////////////////////////////////////////////
sl@0
   104
    //  
sl@0
   105
    //  The function 'found_include_directive' is called, whenever a #include
sl@0
   106
    //  directive was located.
sl@0
   107
    //
sl@0
   108
    //  The parameter 'filename' contains the (expanded) file name found after 
sl@0
   109
    //  the #include directive. This has the format '<file>', '"file"' or 
sl@0
   110
    //  'file'.
sl@0
   111
    //  The formats '<file>' or '"file"' are used for #include directives found 
sl@0
   112
    //  in the preprocessed token stream, the format 'file' is used for files
sl@0
   113
    //  specified through the --force_include command line argument.
sl@0
   114
    //
sl@0
   115
    //  The parameter 'include_next' is set to true if the found directive was
sl@0
   116
    //  a #include_next directive and the BOOST_WAVE_SUPPORT_INCLUDE_NEXT
sl@0
   117
    //  preprocessing constant was defined to something != 0.
sl@0
   118
    //
sl@0
   119
    ///////////////////////////////////////////////////////////////////////////
sl@0
   120
    void 
sl@0
   121
    found_include_directive(std::string const &filename, bool include_next) 
sl@0
   122
    {}
sl@0
   123
    
sl@0
   124
    ///////////////////////////////////////////////////////////////////////////
sl@0
   125
    //  
sl@0
   126
    //  The function 'opened_include_file' is called, whenever a file referred 
sl@0
   127
    //  by an #include directive was successfully located and opened.
sl@0
   128
    //
sl@0
   129
    //  The parameter 'filename' contains the file system path of the 
sl@0
   130
    //  opened file (this is relative to the directory of the currently 
sl@0
   131
    //  processed file or a absolute path depending on the paths given as the
sl@0
   132
    //  include search paths).
sl@0
   133
    //
sl@0
   134
    //  The include_depth parameter contains the current include file depth.
sl@0
   135
    //
sl@0
   136
    //  The is_system_include parameter denotes, whether the given file was 
sl@0
   137
    //  found as a result of a #include <...> directive.
sl@0
   138
    //  
sl@0
   139
    ///////////////////////////////////////////////////////////////////////////
sl@0
   140
    void 
sl@0
   141
    opened_include_file(std::string const &relname, std::string const &absname, 
sl@0
   142
        std::size_t include_depth, bool is_system_include) 
sl@0
   143
    {}
sl@0
   144
    
sl@0
   145
    ///////////////////////////////////////////////////////////////////////////
sl@0
   146
    //  
sl@0
   147
    //  The function 'returning_from_include_file' is called, whenever an
sl@0
   148
    //  included file is about to be closed after it's processing is complete.
sl@0
   149
    //
sl@0
   150
    ///////////////////////////////////////////////////////////////////////////
sl@0
   151
    void
sl@0
   152
    returning_from_include_file() 
sl@0
   153
    {}
sl@0
   154
sl@0
   155
    ///////////////////////////////////////////////////////////////////////////
sl@0
   156
    //  
sl@0
   157
    //  The function 'interpret_pragma' is called, whenever a #pragma command 
sl@0
   158
    //  directive is found which isn't known to the core Wave library, where
sl@0
   159
    //  command is the value defined as the BOOST_WAVE_PRAGMA_KEYWORD constant
sl@0
   160
    //  which defaults to "wave".
sl@0
   161
    //
sl@0
   162
    //  The parameter 'ctx' is a reference to the context object used for 
sl@0
   163
    //  instantiating the preprocessing iterators by the user.
sl@0
   164
    //
sl@0
   165
    //  The parameter 'pending' may be used to push tokens back into the input 
sl@0
   166
    //  stream, which are to be used as the replacement text for the whole 
sl@0
   167
    //  #pragma directive.
sl@0
   168
    //
sl@0
   169
    //  The parameter 'option' contains the name of the interpreted pragma.
sl@0
   170
    //
sl@0
   171
    //  The parameter 'values' holds the values of the parameter provided to 
sl@0
   172
    //  the pragma operator.
sl@0
   173
    //
sl@0
   174
    //  The parameter 'act_token' contains the actual #pragma token, which may 
sl@0
   175
    //  be used for error output.
sl@0
   176
    //
sl@0
   177
    //  If the return value is 'false', the whole #pragma directive is 
sl@0
   178
    //  interpreted as unknown and a corresponding error message is issued. A
sl@0
   179
    //  return value of 'true' signs a successful interpretation of the given 
sl@0
   180
    //  #pragma.
sl@0
   181
    //
sl@0
   182
    ///////////////////////////////////////////////////////////////////////////
sl@0
   183
    template <typename ContextT, typename ContainerT>
sl@0
   184
    bool 
sl@0
   185
    interpret_pragma(ContextT const &ctx, ContainerT &pending, 
sl@0
   186
        typename ContextT::token_type const &option, ContainerT const &values, 
sl@0
   187
        typename ContextT::token_type const &act_token)
sl@0
   188
    {
sl@0
   189
        return false;
sl@0
   190
    }
sl@0
   191
sl@0
   192
    ///////////////////////////////////////////////////////////////////////////
sl@0
   193
    //
sl@0
   194
    //  The function 'defined_macro' is called, whenever a macro was defined
sl@0
   195
    //  successfully.
sl@0
   196
    //
sl@0
   197
    //  The parameter 'name' is a reference to the token holding the macro name.
sl@0
   198
    //
sl@0
   199
    //  The parameter 'is_functionlike' is set to true, whenever the newly 
sl@0
   200
    //  defined macro is defined as a function like macro.
sl@0
   201
    //
sl@0
   202
    //  The parameter 'parameters' holds the parameter tokens for the macro
sl@0
   203
    //  definition. If the macro has no parameters or if it is a object like
sl@0
   204
    //  macro, then this container is empty.
sl@0
   205
    //
sl@0
   206
    //  The parameter 'definition' contains the token sequence given as the
sl@0
   207
    //  replacement sequence (definition part) of the newly defined macro.
sl@0
   208
    //
sl@0
   209
    //  The parameter 'is_predefined' is set to true for all macros predefined 
sl@0
   210
    //  during the initialisation phase of the library.
sl@0
   211
    //
sl@0
   212
    ///////////////////////////////////////////////////////////////////////////
sl@0
   213
    template <typename TokenT, typename ParametersT, typename DefinitionT>
sl@0
   214
    void
sl@0
   215
    defined_macro(TokenT const &macro_name, bool is_functionlike, 
sl@0
   216
        ParametersT const &parameters, DefinitionT const &definition, 
sl@0
   217
        bool is_predefined)
sl@0
   218
    {}
sl@0
   219
    
sl@0
   220
    ///////////////////////////////////////////////////////////////////////////
sl@0
   221
    //
sl@0
   222
    //  The function 'undefined_macro' is called, whenever a macro definition
sl@0
   223
    //  was removed successfully.
sl@0
   224
    //  
sl@0
   225
    //  The parameter 'name' holds the name of the macro, which definition was 
sl@0
   226
    //  removed.
sl@0
   227
    //
sl@0
   228
    ///////////////////////////////////////////////////////////////////////////
sl@0
   229
    template <typename TokenT>
sl@0
   230
    void
sl@0
   231
    undefined_macro(TokenT const &macro_name)
sl@0
   232
    {}
sl@0
   233
    
sl@0
   234
    ///////////////////////////////////////////////////////////////////////////
sl@0
   235
    //
sl@0
   236
    //  The function 'found_directive' is called, whenever a preprocessor 
sl@0
   237
    //  directive was encountered, but before the corresponding action is 
sl@0
   238
    //  executed.
sl@0
   239
    //
sl@0
   240
    //  The parameter 'directive' is a reference to the token holding the 
sl@0
   241
    //  preprocessing directive.
sl@0
   242
    //
sl@0
   243
    ///////////////////////////////////////////////////////////////////////////
sl@0
   244
    template <typename TokenT>
sl@0
   245
    void
sl@0
   246
    found_directive(TokenT const& directive)
sl@0
   247
    {}
sl@0
   248
sl@0
   249
    ///////////////////////////////////////////////////////////////////////////
sl@0
   250
    //
sl@0
   251
    //  The function 'evaluated_conditional_expression' is called, whenever a 
sl@0
   252
    //  conditional preprocessing expression was evaluated (the expression
sl@0
   253
    //  given to a #if, #ifdef or #ifndef directive)
sl@0
   254
    //
sl@0
   255
    //  The parameter 'expression' holds the non-expanded token sequence
sl@0
   256
    //  comprising the evaluated expression.
sl@0
   257
    //
sl@0
   258
    //  The parameter expression_value contains the result of the evaluation of
sl@0
   259
    //  the expression in the current preprocessing context.
sl@0
   260
    //
sl@0
   261
    ///////////////////////////////////////////////////////////////////////////
sl@0
   262
    template <typename ContainerT>
sl@0
   263
    void
sl@0
   264
    evaluated_conditional_expression(ContainerT const& expression, 
sl@0
   265
        bool expression_value)
sl@0
   266
    {}
sl@0
   267
    
sl@0
   268
    ///////////////////////////////////////////////////////////////////////////
sl@0
   269
    //
sl@0
   270
    //  The function 'skipped_token' is called, whenever a token is about to be
sl@0
   271
    //  skipped due to a false preprocessor condition (code fragments to be
sl@0
   272
    //  skipped inside the not evaluated conditional #if/#else/#endif branches).
sl@0
   273
    //
sl@0
   274
    //  The parameter 'token' refers to the token to be skipped.
sl@0
   275
    //  
sl@0
   276
    //
sl@0
   277
    ///////////////////////////////////////////////////////////////////////////
sl@0
   278
    template <typename TokenT>
sl@0
   279
    void
sl@0
   280
    skipped_token(TokenT const& token)
sl@0
   281
    {}
sl@0
   282
sl@0
   283
    ///////////////////////////////////////////////////////////////////////////
sl@0
   284
    //
sl@0
   285
    //  The function 'may_skip_whitespace' is called, will be called by the 
sl@0
   286
    //  library, whenever a token is about to be returned to the calling 
sl@0
   287
    //  application. 
sl@0
   288
    //
sl@0
   289
    //  The parameter 'ctx' is a reference to the context object used for 
sl@0
   290
    //  instantiating the preprocessing iterators by the user.
sl@0
   291
    //
sl@0
   292
    //  The 'token' parameter holds a reference to the current token. The policy 
sl@0
   293
    //  is free to change this token if needed.
sl@0
   294
    //
sl@0
   295
    //  The 'skipped_newline' parameter holds a reference to a boolean value 
sl@0
   296
    //  which should be set to true by the policy function whenever a newline 
sl@0
   297
    //  is going to be skipped. 
sl@0
   298
    //
sl@0
   299
    //  If the return value is true, the given token is skipped and the 
sl@0
   300
    //  preprocessing continues to the next token. If the return value is 
sl@0
   301
    //  false, the given token is returned to the calling application. 
sl@0
   302
    //
sl@0
   303
    //  ATTENTION!
sl@0
   304
    //  Caution has to be used, because by returning true the policy function 
sl@0
   305
    //  is able to force skipping even significant tokens, not only whitespace. 
sl@0
   306
    //
sl@0
   307
    ///////////////////////////////////////////////////////////////////////////
sl@0
   308
    template <typename ContextT, typename TokenT>
sl@0
   309
    bool
sl@0
   310
    may_skip_whitespace(ContextT const& ctx, TokenT& token, bool& skipped_newline)
sl@0
   311
    { return false; }
sl@0
   312
};
sl@0
   313
sl@0
   314
///////////////////////////////////////////////////////////////////////////////
sl@0
   315
}   // namespace context_policies
sl@0
   316
}   // namespace wave
sl@0
   317
}   // namespace boost
sl@0
   318
sl@0
   319
// the suffix header occurs after all of the code
sl@0
   320
#ifdef BOOST_HAS_ABI_HEADERS
sl@0
   321
#include BOOST_ABI_SUFFIX
sl@0
   322
#endif
sl@0
   323
sl@0
   324
#endif // !defined(PREPROCESSING_HOOKS_HPP_338DE478_A13C_4B63_9BA9_041C917793B8_INCLUDED)