├── ChangeLog ├── doc ├── theme │ ├── uc.gif │ ├── bkd.gif │ ├── bkd2.gif │ ├── wave.gif │ ├── bullet.gif │ ├── l_arr.gif │ ├── r_arr.gif │ ├── u_arr.gif │ ├── l_arr_disabled.gif │ └── r_arr_disabled.gif └── token_ids.html ├── test └── testwave │ ├── testfiles │ ├── t_1_034.cpp │ ├── t_1_035.cpp │ ├── t_2_019_001.hpp │ ├── t_9_016.hpp │ ├── t_5_007.hpp │ ├── t_9_019.hpp │ ├── t_9_014.cpp │ ├── t_2_022.hpp │ ├── t_2_019_003.hpp │ ├── t_2_019_002.hpp │ ├── t_9_015.cpp │ ├── t_2_012.cpp │ ├── t_9_008.cpp │ ├── t_9_001.cpp │ ├── t_9_002.cpp │ ├── t_1_037.cpp │ ├── t_1_026.cpp │ ├── t_1_036.cpp │ ├── t_2_013.cpp │ ├── t_4_001.cpp │ ├── t_3_001.cpp │ ├── t_2_018.cpp │ ├── t_2_010.cpp │ ├── t_2_011.cpp │ ├── t_2_005.cpp │ ├── t_9_022.cpp │ ├── t_9_007.cpp │ ├── t_9_018.cpp │ ├── t_1_002.cpp │ ├── t_7_001.cpp │ ├── t_9_013.cpp │ ├── t_2_022.cpp │ ├── t_4_002.cpp │ ├── t_1_017.cpp │ ├── t_9_019.cpp │ ├── t_2_016.cpp │ ├── t_9_021.cpp │ ├── t_1_005.cpp │ ├── t_2_015.cpp │ ├── t_1_015.cpp │ ├── t_2_003.cpp │ ├── t_9_004.cpp │ ├── t_9_009.cpp │ ├── t_2_008.cpp │ ├── t_1_016.cpp │ ├── t_2_002.cpp │ ├── t_9_024.cpp │ ├── t_1_038.cpp │ ├── t_1_009.cpp │ ├── t_1_010.cpp │ ├── t_9_023.cpp │ ├── t_1_022.cpp │ ├── t_1_020.cpp │ ├── t_1_025.cpp │ ├── t_1_031.cpp │ ├── t_1_011.cpp │ ├── t_1_030.cpp │ ├── t_9_011.cpp │ ├── t_9_006.cpp │ ├── t_1_018.cpp │ ├── t_1_019.cpp │ ├── t_2_001.cpp │ ├── t_9_005.cpp │ ├── t_1_023.cpp │ ├── t_1_032.cpp │ ├── t_2_017.cpp │ ├── t_1_021.cpp │ ├── t_1_033.cpp │ ├── t_2_007.cpp │ ├── t_1_014.cpp │ ├── t_2_006.cpp │ ├── t_2_004.cpp │ ├── t_9_016.cpp │ ├── t_1_001.cpp │ ├── t_1_027.cpp │ ├── t_2_021.cpp │ ├── t_9_020.cpp │ ├── t_3_002.cpp │ ├── t_1_028.cpp │ ├── t_9_012.cpp │ ├── t_1_029.cpp │ ├── t_1_012.cpp │ ├── t_3_003.cpp │ ├── t_3_004.cpp │ ├── t_2_009.cpp │ ├── t_9_017.cpp │ ├── t_4_004.cpp │ ├── t_9_003.cpp │ ├── t_5_031.hpp │ ├── t_1_007.cpp │ ├── t_1_003.cpp │ └── t_5_035_01.hpp │ ├── testwave_dll.cpp │ └── testwave_app_dll.cpp ├── .gitignore ├── samples ├── custom_directives │ ├── custom_directives.input │ └── build │ │ └── Jamfile.v2 ├── advanced_hooks │ └── build │ │ └── Jamfile.v2 ├── quick_start │ └── build │ │ └── Jamfile.v2 ├── emit_custom_line_directives │ └── build │ │ └── Jamfile.v2 ├── lexed_tokens │ └── build │ │ └── Jamfile.v2 ├── hannibal │ ├── build │ │ └── Jamfile.v2 │ └── translation_unit_skipper.h ├── Jamfile.v2 ├── preprocess_pragma_output │ ├── build │ │ └── Jamfile.v2 │ └── example.cpp ├── token_statistics │ ├── token_statistics_version.hpp │ ├── build │ │ └── Jamfile.v2 │ ├── instantiate_defined_grammar.cpp │ ├── instantiate_cpp_grammar.cpp │ ├── instantiate_xlex_lexer.cpp │ └── token_statistics.hpp ├── real_positions │ ├── build │ │ └── Jamfile.v2 │ ├── instantiate_defined_grammar.cpp │ ├── instantiate_cpp_exprgrammar.cpp │ ├── instantiate_cpp_grammar.cpp │ └── instantiate_cpp_literalgrs.cpp ├── list_includes │ ├── list_includes_version.hpp │ ├── build │ │ └── Jamfile.v2 │ ├── instantiate_defined_grammar.cpp │ ├── instantiate_cpp_exprgrammar.cpp │ ├── lexertl │ │ └── wave_lexertl_config.hpp │ ├── list_includes.hpp │ ├── instantiate_lexertl_lexer.cpp │ ├── instantiate_cpp_grammar.cpp │ └── instantiate_cpp_literalgrs.cpp ├── waveidl │ ├── idl_version.hpp │ ├── build │ │ └── Jamfile.v2 │ ├── idllexer │ │ └── idl_re.hpp │ ├── instantiate_defined_grammar.cpp │ ├── instantiate_predef_macros.cpp │ ├── instantiate_cpp_grammar.cpp │ ├── idl.hpp │ ├── instantiate_re2c_lexer.cpp │ └── instantiate_re2c_lexer_str.cpp └── cpp_tokens │ ├── build │ └── Jamfile.v2 │ ├── instantiate_defined_grammar.cpp │ ├── instantiate_cpp_exprgrammar.cpp │ ├── cpp_tokens.hpp │ ├── instantiate_cpp_grammar.cpp │ ├── instantiate_slex_lexer.cpp │ └── instantiate_cpp_literalgrs.cpp ├── meta └── libraries.json ├── include └── boost │ ├── wave.hpp │ └── wave │ ├── wave_version.hpp │ ├── grammars │ └── cpp_value_error.hpp │ └── cpplexer │ └── re2clex │ ├── cpp_re.hpp │ └── aq.hpp ├── tool ├── cpp_version.hpp ├── build │ └── Jamfile.v2 └── cpp.hpp └── src ├── wave_config_constant.cpp ├── instantiate_cpp_exprgrammar.cpp ├── instantiate_defined_grammar.cpp ├── instantiate_predef_macros.cpp ├── instantiate_cpp_grammar.cpp └── instantiate_cpp_literalgrs.cpp /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/ChangeLog -------------------------------------------------------------------------------- /doc/theme/uc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/uc.gif -------------------------------------------------------------------------------- /doc/theme/bkd.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/bkd.gif -------------------------------------------------------------------------------- /doc/theme/bkd2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/bkd2.gif -------------------------------------------------------------------------------- /doc/theme/wave.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/wave.gif -------------------------------------------------------------------------------- /doc/token_ids.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/token_ids.html -------------------------------------------------------------------------------- /doc/theme/bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/bullet.gif -------------------------------------------------------------------------------- /doc/theme/l_arr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/l_arr.gif -------------------------------------------------------------------------------- /doc/theme/r_arr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/r_arr.gif -------------------------------------------------------------------------------- /doc/theme/u_arr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/u_arr.gif -------------------------------------------------------------------------------- /doc/theme/l_arr_disabled.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/l_arr_disabled.gif -------------------------------------------------------------------------------- /doc/theme/r_arr_disabled.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/doc/theme/r_arr_disabled.gif -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_034.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/test/testwave/testfiles/t_1_034.cpp -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_035.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/wave/develop/test/testwave/testfiles/t_1_035.cpp -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Hartmut Kaiser` 2 | # 3 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | /build 7 | /test/build 8 | -------------------------------------------------------------------------------- /samples/custom_directives/custom_directives.input: -------------------------------------------------------------------------------- 1 | // This example recognizes two additional preprocessor directives (as defined 2 | // in GLSL - OpenGL Shader Language). 3 | 4 | #version 150 core 5 | #extension all : require // trailing comment 6 | 7 | // the following directive is not supported, so it will trigger an exception 8 | #not_supported_directive 9 | -------------------------------------------------------------------------------- /meta/libraries.json: -------------------------------------------------------------------------------- 1 | { 2 | "key": "wave", 3 | "name": "Wave", 4 | "authors": [ 5 | "Hartmut Kaiser" 6 | ], 7 | "description": "The Boost.Wave library is a Standards conformant, and highly configurable implementation of the mandated C99/C++ preprocessor functionality packed behind an easy to use iterator interface.", 8 | "category": [ 9 | "String" 10 | ], 11 | "maintainers": [ 12 | "Hartmut Kaiser " 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_019_001.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #pragma once 11 | t_2_019_001 12 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_016.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | /* intentionally left empty */ 11 | 12 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_5_007.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests the #include directive. 11 | #define MACRO_005_007 abc 12 | 13 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_019.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // this shouldn't give an recursion 11 | #include_next "t_9_019.hpp" 12 | -------------------------------------------------------------------------------- /samples/advanced_hooks/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (advanced_hooks) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | exe advanced_hooks 12 | : ../advanced_hooks.cpp 13 | /boost/wave//boost_wave 14 | /boost/thread//boost_thread 15 | /boost/date_time//boost_date_time 16 | ; 17 | 18 | -------------------------------------------------------------------------------- /samples/custom_directives/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (advanced_hooks) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | exe custom_directives 12 | : ../custom_directives.cpp 13 | /boost/wave//boost_wave 14 | /boost/thread//boost_thread 15 | /boost/date_time//boost_date_time 16 | ; 17 | 18 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_014.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | //O --long_long 11 | // Tests 'LL' suffix 12 | 13 | //R #line 14 "t_9_014.cpp" 14 | 1000LL //R 1000LL 15 | 16 | -------------------------------------------------------------------------------- /samples/quick_start/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (quick_start) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | exe quick_start 12 | : ../quick_start.cpp 13 | /boost/wave//boost_wave 14 | /boost/system//boost_system 15 | /boost/thread//boost_thread 16 | /boost/date_time//boost_date_time 17 | ; 18 | 19 | -------------------------------------------------------------------------------- /samples/emit_custom_line_directives/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (advanced_hooks) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | exe emit_custom_line_directives 12 | : ../emit_custom_line_directives.cpp 13 | /boost/wave//boost_wave 14 | /boost/thread//boost_thread 15 | /boost/date_time//boost_date_time 16 | ; 17 | 18 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_022.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Verify fix of regression #6838: Adding include file with force_include makes 11 | // Wave fail to emit #line directive 12 | int func() { return 42; } 13 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_019_003.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | # 11 | 12 | #ifndef T_2_019_003 13 | # // more comments here 14 | #define T_2_019_003 15 | 16 | t_2_019_003 17 | 18 | #endif 19 | # // and here 20 | 21 | -------------------------------------------------------------------------------- /test/testwave/testwave_dll.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // This file is necessary only because Boost.Build V2 isn't able to handle 11 | // several testcases using the same source files. 12 | 13 | #include "testwave.cpp" 14 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_019_002.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | # 11 | 12 | #if !defined(T_2_019_002) 13 | # // more comments here 14 | #define T_2_019_002 15 | 16 | t_2_019_002 17 | 18 | #endif 19 | # // and here 20 | 21 | -------------------------------------------------------------------------------- /test/testwave/testwave_app_dll.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // This file is necessary only because Boost.Build V2 isn't able to handle 11 | // several testcases using the same source files. 12 | 13 | #include "testwave_app.cpp" 14 | -------------------------------------------------------------------------------- /samples/lexed_tokens/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (lexed_tokens) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | exe lexed_tokens 12 | : ../lexed_tokens.cpp 13 | /boost/wave//boost_wave 14 | /boost/filesystem//boost_filesystem 15 | /boost/system//boost_system 16 | /boost/thread//boost_thread 17 | /boost/date_time//boost_date_time 18 | ; 19 | 20 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_015.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests 'LL' suffix 11 | 12 | //R #line 14 "t_9_015.cpp" 13 | //E t_9_015.cpp(14): warning: long long suffixes are not allowed in pure C++ mode, enable long_long mode to allow these: 1000LL 14 | 1000LL 15 | 16 | -------------------------------------------------------------------------------- /samples/hannibal/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (Hannibal) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | exe hannibal 12 | : ../hannibal.cpp 13 | /boost/wave//boost_wave 14 | /boost/filesystem//boost_filesystem 15 | /boost/program_options//boost_program_options 16 | /boost/system//boost_system 17 | /boost/thread//boost_thread 18 | /boost/date_time//boost_date_time 19 | ; 20 | 21 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_012.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests error reporting for missing #if 11 | 12 | //E t_2_012.cpp(13): error: the #if for this directive is missing: #else 13 | #else 14 | #endif 15 | 16 | //H 10: t_2_012.cpp(13): #else 17 | //H 18: boost::wave::preprocess_exception 18 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_008.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test error reporting during redefinition of 'defined' 11 | 12 | //E t_9_008.cpp(13): warning: #undef may not be used on this predefined name: defined 13 | #undef defined 14 | 15 | //H 10: t_9_008.cpp(13): #undef 16 | //H 18: boost::wave::preprocess_exception 17 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_001.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | /* 11 | 12 | Expose bug 13 | 14 | */ 15 | 16 | #if 1 17 | //R #line 18 "t_9_001.cpp" 18 | void exposed() {} //R void exposed() {} 19 | #endif 20 | 21 | //H 10: t_9_001.cpp(16): #if 22 | //H 11: t_9_001.cpp(16): #if 1: 1 23 | //H 10: t_9_001.cpp(19): #endif 24 | -------------------------------------------------------------------------------- /samples/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Copyright Vladimir Prus 2004. 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE_1_0.txt 4 | # or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | project 7 | : requirements true 8 | ; 9 | 10 | build-project advanced_hooks/build ; 11 | build-project cpp_tokens/build ; 12 | build-project lexed_tokens/build ; 13 | build-project list_includes/build ; 14 | build-project quick_start/build ; 15 | build-project waveidl/build ; 16 | build-project hannibal/build ; 17 | build-project real_positions/build ; 18 | build-project token_statistics/build ; 19 | build-project preprocess_pragma_output/build ; 20 | build-project custom_directives/build ; 21 | build-project emit_custom_line_directives/build ; 22 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_002.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #if 0 11 | // 12 | // some comment 13 | // 14 | #endif 15 | 16 | // another comment 17 | // ---------------------------------------------------- 18 | 1 19 | //R #line 18 "t_9_002.cpp" 20 | //R 1 21 | 22 | //H 10: t_9_002.cpp(10): #if 23 | //H 11: t_9_002.cpp(10): #if 0: 0 24 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_037.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // the following concatenation needs to fail (even if this construct is used 11 | // in some MS headers) 12 | 13 | //R 14 | //E t_1_037.cpp(16): error: pasting the following two tokens does not give a valid preprocessing token: "/" and "/" 15 | #define _VARIANT_BOOL /##/ 16 | _VARIANT_BOOL bool; 17 | 18 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_026.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test error reporting for non-unique parameter names 11 | 12 | //E t_1_026.cpp(13): error: duplicate macro parameter name: x 13 | #define MACRO(x, x) x 14 | // ^ ^ this is illegal 15 | 16 | MACRO(1, 2) 17 | 18 | //H 10: t_1_026.cpp(13): #define 19 | //H 18: boost::wave::macro_handling_exception 20 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_036.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests the concatination operator in object like macros 11 | 12 | #define OBJECT a ## b 13 | 14 | //R #line 15 "t_1_036.cpp" 15 | OBJECT //R ab 16 | 17 | //H 10: t_1_036.cpp(12): #define 18 | //H 08: t_1_036.cpp(12): OBJECT=a ## b 19 | //H 01: t_1_036.cpp(12): OBJECT 20 | //H 02: ab 21 | //H 03: ab 22 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_013.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests error reporting for missing #if 11 | 12 | //E t_2_013.cpp(20): error: detected at least one missing #endif directive 13 | #if 1 14 | #else 15 | 16 | //H 10: t_2_013.cpp(13): #if 17 | //H 11: t_2_013.cpp(13): #if 1: 1 18 | //H 10: t_2_013.cpp(14): #else 19 | //H 18: boost::wave::preprocess_exception 20 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_4_001.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, whether integer arithmetic results get truncated correctly 11 | 12 | //R #line 15 "t_4_001.cpp" 13 | //R true 14 | #if 1 / 10 == 0 15 | true 16 | #else 17 | false 18 | #endif 19 | 20 | //H 10: t_4_001.cpp(14): #if 21 | //H 11: t_4_001.cpp(14): #if 1 / 10 == 0: 1 22 | //H 10: t_4_001.cpp(16): #else 23 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_3_001.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, if a diagnostic is emitted, if a predefined macro is to be undefined. 11 | 12 | //R 13 | //E t_3_001.cpp(14): warning: #undef may not be used on this predefined name: __cplusplus 14 | #undef __cplusplus // should emit a warning 15 | 16 | //H 10: t_3_001.cpp(14): #undef 17 | //H 18: boost::wave::preprocess_exception 18 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_018.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Check if regression reported by ticket #1752 has been fixed 11 | 12 | //R #line 17 "t_2_018.cpp" 13 | //R "__FILE__ is defined" 14 | #ifndef __FILE__ 15 | "No __FILE__" 16 | #else 17 | "__FILE__ is defined" 18 | #endif 19 | 20 | //H 10: t_2_018.cpp(14): #ifndef 21 | //H 11: t_2_018.cpp(14): #ifndef __FILE__: 1 22 | //H 10: t_2_018.cpp(18): #endif 23 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_010.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests error reporting for missing #endif 11 | 12 | //E t_2_010.cpp(22): error: detected at least one missing #endif directive 13 | #if 1 14 | #if 0 15 | #endif 16 | 17 | //H 10: t_2_010.cpp(13): #if 18 | //H 11: t_2_010.cpp(13): #if 1: 1 19 | //H 10: t_2_010.cpp(14): #if 20 | //H 11: t_2_010.cpp(14): #if 0: 0 21 | //H 18: boost::wave::preprocess_exception 22 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_011.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests error reporting for missing #if 11 | 12 | //E t_2_011.cpp(15): error: the #if for this directive is missing: #endif 13 | #if 1 14 | #endif 15 | #endif 16 | 17 | //H 10: t_2_011.cpp(13): #if 18 | //H 11: t_2_011.cpp(13): #if 1: 1 19 | //H 10: t_2_011.cpp(14): #endif 20 | //H 10: t_2_011.cpp(15): #endif 21 | //H 18: boost::wave::preprocess_exception 22 | -------------------------------------------------------------------------------- /samples/preprocess_pragma_output/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (preprocess_pragma_output) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2008 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | exe preprocess_pragma_output 12 | : ../preprocess_pragma_output.cpp 13 | /boost/wave//boost_wave 14 | /boost/thread//boost_thread 15 | /boost/date_time//boost_date_time 16 | /boost/filesystem//boost_filesystem 17 | /boost/system//boost_system 18 | : 19 | msvc-8.0:_SCL_SECURE_NO_DEPRECATE 20 | msvc-8.0:_CRT_SECURE_NO_DEPRECATE 21 | ; 22 | 23 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_005.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // test the error reporting for unknown directives 11 | 12 | //R 13 | //E t_2_005.cpp(14): error: ill formed preprocessor directive: #this_is_a_unknown_pp_directive with some parameter 14 | #this_is_a_unknown_pp_directive with some parameter 15 | 16 | //H 21: t_2_005.cpp(14): #this_is_a_unknown_pp_directive with some parameter 17 | //H 18: boost::wave::preprocess_exception 18 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_022.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Verifies that preprocessing directives are properly recognized only if 11 | // the '#' is really the first character on a line before macro expansion. 12 | // See http://www.open-std.org/jtc1/sc22/wg14/docs/rr/dr_144.html. 13 | 14 | #define EMPTY 15 | # EMPTY define M 1 16 | 17 | //E t_9_022.cpp(15): error: ill formed preprocessor directive: # EMPTY define M 1 18 | 19 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_007.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test error reporting during redefinition of 'defined' 11 | 12 | //E t_9_007.cpp(13): warning: this predefined name may not be redefined: defined 13 | #define defined 1 // undefined in C++ (16.8/3), error in C99 (6.10.8/4) 14 | 15 | #if defined // error 16 | 17 | #endif 18 | 19 | //H 10: t_9_007.cpp(13): #define 20 | //H 18: boost::wave::macro_handling_exception 21 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_018.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // tests, whether macro redefinition does not crash anymore, even if the new 11 | // replacement list is shorter, than the initial one. 12 | 13 | //E t_9_018.cpp(15): warning: illegal macro redefinition: M1 14 | #define M1 1 15 | #define M1 16 | 17 | //H 10: t_9_018.cpp(14): #define 18 | //H 08: t_9_018.cpp(14): M1=1 19 | //H 10: t_9_018.cpp(15): #define 20 | //H 18: boost::wave::macro_handling_exception 21 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_002.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | //O -DTEST 11 | #if defined(TEST) 12 | #define ABC() 1 13 | #endif 14 | 15 | //R #line 16 "t_1_002.cpp" 16 | ABC() //R 1 17 | 18 | //H 10: t_1_002.cpp(11): #if 19 | //H 11: t_1_002.cpp(11): #if defined(TEST): 1 20 | //H 10: t_1_002.cpp(12): #define 21 | //H 08: t_1_002.cpp(12): ABC()=1 22 | //H 10: t_1_002.cpp(13): #endif 23 | //H 00: t_1_002.cpp(16): ABC(), [t_1_002.cpp(12): ABC()=1] 24 | //H 02: 1 25 | //H 03: 1 26 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_7_001.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | //O --c++11 11 | 12 | //R #line 16 "t_7_001.cpp" 13 | //R R"de 14 | //R fg 15 | //R h" 16 | R"de 17 | fg 18 | h" 19 | 20 | //R #line 21 "t_7_001.cpp" 21 | "abc" //R "abc" 22 | R"abc" //R R"abc" 23 | 24 | //R #line 27 "t_7_001.cpp" 25 | //R uR"de fg 26 | //R h" 27 | uR"de \ 28 | fg 29 | h" 30 | 31 | //R #line 32 "t_7_001.cpp" 32 | u"abc" //R u"abc" 33 | U"def" //R U"def" 34 | u8"ghi" //R u8"ghi" 35 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_013.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests error reporting of C99 features in C++ mode (without variadics) 11 | 12 | #define MACRO(a, b, c) a ## b ## c 13 | 14 | //E t_9_013.cpp(15): warning: empty macro arguments are not supported in pure C++ mode, use variadics mode to allow these: MACRO 15 | MACRO(1,, 3) 16 | 17 | //H 10: t_9_013.cpp(12): #define 18 | //H 08: t_9_013.cpp(12): MACRO(a, b, c)=a ## b ## c 19 | //H 18: boost::wave::preprocess_exception 20 | -------------------------------------------------------------------------------- /samples/token_statistics/token_statistics_version.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: Collect token statistics from the analysed files 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(TOKEN_STATISTICS_VERSION_HPP) 14 | #define TOKEN_STATISTICS_VERSION_HPP 15 | 16 | #define TOKEN_STATISTICS_VERSION_MAJOR 0 17 | #define TOKEN_STATISTICS_VERSION_MINOR 1 18 | #define TOKEN_STATISTICS_VERSION_SUBMINOR 0 19 | 20 | #endif // !defined(TOKEN_STATISTICS_VERSION_HPP) 21 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_022.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Verify fix of regression #6838: Adding include file with force_include makes 11 | // Wave fail to emit #line directive 12 | 13 | //O --forceinclude=t_2_022.hpp 14 | 15 | //R #line 12 "t_2_022.hpp" 16 | //R int func() { return 42; } 17 | //R #line 19 "t_2_022.cpp" 18 | //R int main() { return func(); } 19 | int main() { return func(); } 20 | 21 | //H 04: t_2_022.hpp 22 | //H 05: $B(t_2_022.hpp) ($B(t_2_022.hpp)) 23 | //H 06: 24 | -------------------------------------------------------------------------------- /samples/real_positions/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (real_positions) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | exe real_positions 12 | : ../real_positions.cpp 13 | ../instantiate_cpp_exprgrammar.cpp 14 | ../instantiate_cpp_grammar.cpp 15 | ../instantiate_cpp_literalgrs.cpp 16 | ../instantiate_defined_grammar.cpp 17 | ../instantiate_re2c_lexer.cpp 18 | ../instantiate_re2c_lexer_str.cpp 19 | /boost/wave//boost_wave 20 | /boost/filesystem//boost_filesystem 21 | /boost/system//boost_system 22 | /boost/thread//boost_thread 23 | /boost/date_time//boost_date_time 24 | ; 25 | 26 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_4_002.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, whether ecursively defined macros get expanded correctly in the 11 | // context of an #if expression 12 | 13 | #define C C 14 | 15 | //R #line 18 "t_4_002.cpp" 16 | //R true 17 | #if !C 18 | true 19 | #endif 20 | 21 | //H 10: t_4_002.cpp(13): #define 22 | //H 08: t_4_002.cpp(13): C=C 23 | //H 10: t_4_002.cpp(17): #if 24 | //H 01: t_4_002.cpp(13): C 25 | //H 02: C 26 | //H 03: C 27 | //H 11: t_4_002.cpp(17): #if !C: 1 28 | //H 10: t_4_002.cpp(19): #endif 29 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_017.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests macro expansion sequence and proper rescanning 11 | 12 | #define macro() end 13 | 14 | #define par() () 15 | 16 | #define expr macro par par par() 17 | 18 | #define scan(x) x 19 | 20 | //R #line 22 "t_1_017.cpp" 21 | //R macro par par () 22 | expr 23 | //R #line 25 "t_1_017.cpp" 24 | //R macro par () 25 | scan(expr) 26 | //R #line 28 "t_1_017.cpp" 27 | //R macro () 28 | scan(scan(expr)) 29 | //R #line 31 "t_1_017.cpp" 30 | //R end 31 | scan(scan(scan(expr))) 32 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_019.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // tests, whether regression causing #include_next to infinitely recurse is 11 | // fixed 12 | 13 | //E t_9_019.hpp(11): error: could not find include file: t_9_019.hpp 14 | #include "t_9_019.hpp" 15 | 16 | // 10: t_9_019.cpp(14): #include "t_9_019.hpp" 17 | // 04: "t_9_019.hpp" 18 | // 05: $B(t_9_019.hpp) ($B(t_9_019.hpp)) 19 | // 10: t_9_019.hpp(11): #include_next "t_9_019.hpp" 20 | // 04: "t_9_019.hpp" (include_next) 21 | // 18: boost::wave::preprocess_exception 22 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_016.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // if _MSC_VER was defined through the command line, the pp expression was 11 | // garbled 12 | 13 | //O -D_MSC_VER=1200 14 | 15 | //R #line 18 "t_2_016.cpp" 16 | //R true 17 | #if defined (_MSC_VER) && (_MSC_VER >= 1020) 18 | true 19 | #endif 20 | 21 | //H 10: t_2_016.cpp(17): #if 22 | //H 01: (1): _MSC_VER 23 | //H 02: 1200 24 | //H 03: 1200 25 | //H 11: t_2_016.cpp(17): #if defined (_MSC_VER) && (_MSC_VER >= 1020): 1 26 | //H 10: t_2_016.cpp(19): #endif 27 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_021.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Verifies that preprocessing directives are properly recognized only if 11 | // the '#' is really the first character on a line before macro expansion. 12 | // See http://www.open-std.org/jtc1/sc22/wg14/docs/rr/dr_144.html. 13 | 14 | #define EMPTY 15 | EMPTY # define M 1 16 | 17 | //R #line 15 "t_9_021.cpp" 18 | //R #define M 1 19 | 20 | //H 10: t_9_021.cpp(14): #define 21 | //H 08: t_9_021.cpp(14): EMPTY= 22 | //H 01: t_9_021.cpp(14): EMPTY 23 | //H 02: 24 | //H 03: _ 25 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_005.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests macro expansion order. 11 | 12 | #define A() B 13 | #define B(x) x 14 | 15 | //R #line 16 "t_1_005.cpp" 16 | A()(123) //R 123 17 | 18 | //H 10: t_1_005.cpp(12): #define 19 | //H 08: t_1_005.cpp(12): A()=B 20 | //H 10: t_1_005.cpp(13): #define 21 | //H 08: t_1_005.cpp(13): B(x)=x 22 | //H 00: t_1_005.cpp(16): A(), [t_1_005.cpp(12): A()=B] 23 | //H 02: B 24 | //H 03: B 25 | //H 00: t_1_005.cpp(12): B(123), [t_1_005.cpp(13): B(x)=x] 26 | //H 02: 123 27 | //H 03: 123 28 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_015.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, whether #if works when the expression is surrounded by parenthesis 11 | 12 | #define WINVER 0x0500 13 | 14 | //R #line 17 "t_2_015.cpp" 15 | //R true 16 | #if(WINVER >= 0x0500) 17 | true 18 | #endif 19 | 20 | //H 10: t_2_015.cpp(12): #define 21 | //H 08: t_2_015.cpp(12): WINVER=0x0500 22 | //H 10: t_2_015.cpp(16): #if 23 | //H 01: t_2_015.cpp(12): WINVER 24 | //H 02: 0x0500 25 | //H 03: 0x0500 26 | //H 11: t_2_015.cpp(16): #if (WINVER >= 0x0500): 1 27 | //H 10: t_2_015.cpp(18): #endif 28 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_015.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, if the recursive replacement of a macro is correctly handled 11 | 12 | #define f(x) (4-f(x)) 13 | 14 | //R #line 16 "t_1_015.cpp" 15 | //R (4-f((4-f(1)))) 16 | f(f(1)) 17 | 18 | //H 10: t_1_015.cpp(12): #define 19 | //H 08: t_1_015.cpp(12): f(x)=(4-f(x)) 20 | //H 00: t_1_015.cpp(16): f(f(1)), [t_1_015.cpp(12): f(x)=(4-f(x))] 21 | //H 00: t_1_015.cpp(16): f(1), [t_1_015.cpp(12): f(x)=(4-f(x))] 22 | //H 02: (4-f(1)) 23 | //H 03: (4-f(1)) 24 | //H 02: (4-f((4-f(1)))) 25 | //H 03: (4-f((4-f(1)))) 26 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_003.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests #line functionality with out a given file name 11 | 12 | #line 5 13 | 14 | //R 15 | //E t_2_003.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "t_2_003.cpp" 16 | #error This error should occur at line 8 of "t_2_003.cpp" 17 | 18 | //H 10: t_2_003.cpp(12): #line 19 | //H 17: 5 (5, "") 20 | //H 10: t_2_003.cpp(8): #error 21 | //H 16: This error should occur at line 8 of "t_2_003.cpp" 22 | //H 18: boost::wave::preprocess_exception 23 | -------------------------------------------------------------------------------- /include/boost/wave.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | http://www.boost.org/ 5 | 6 | See http://www.boost.org/libs/wave for documentation 7 | 8 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(WAVE_HPP_DCA0EA51_EF5B_4BF1_88A8_461DBC5F292B_INCLUDED) 14 | #define WAVE_HPP_DCA0EA51_EF5B_4BF1_88A8_461DBC5F292B_INCLUDED 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #endif // !defined(WAVE_HPP_DCA0EA51_EF5B_4BF1_88A8_461DBC5F292B_INCLUDED) 24 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_004.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test if invalid or not allowed universal characters are rejected 11 | 12 | #define \u00ff ... 13 | 14 | //R #line 16 "t_9_004.cpp" 15 | //R ... 16 | \u00ff 17 | 18 | //E t_9_004.cpp(19): error: a universal character name cannot designate a character in the basic character set: \u0061 19 | #define \u0061 weird // 0x61 == 'a' 20 | 21 | \u0061 22 | 23 | //H 10: t_9_004.cpp(12): #define 24 | //H 08: t_9_004.cpp(12): \u00ff=... 25 | //H 01: t_9_004.cpp(12): \u00ff 26 | //H 02: ... 27 | //H 03: ... 28 | //H 18: boost::wave::lexing_exception 29 | -------------------------------------------------------------------------------- /samples/list_includes/list_includes_version.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: List include dependencies of a given source file version number 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(LIST_INCLUDES_VERSION_HPP_FF662D6C_C3E6_4BEC_A062_5D9BD7415EBF_INCLUDED) 14 | #define LIST_INCLUDES_VERSION_HPP_FF662D6C_C3E6_4BEC_A062_5D9BD7415EBF_INCLUDED 15 | 16 | #define LIST_INCLUDES_VERSION_MAJOR 0 17 | #define LIST_INCLUDES_VERSION_MINOR 4 18 | #define LIST_INCLUDES_VERSION_SUBMINOR 0 19 | 20 | #endif // !defined(LIST_INCLUDES_VERSION_HPP_FF662D6C_C3E6_4BEC_A062_5D9BD7415EBF_INCLUDED) 21 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_009.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests for a problem wrt preprocessing tokens (preprocessing numbers) 11 | 12 | #define X() X_ ## 0R() 13 | #define X_0R() ... 14 | 15 | //R #line 16 "t_9_009.cpp" 16 | X() //R ... 17 | 18 | //H 10: t_9_009.cpp(12): #define 19 | //H 08: t_9_009.cpp(12): X()=X_ ## 0R() 20 | //H 10: t_9_009.cpp(13): #define 21 | //H 08: t_9_009.cpp(13): X_0R()=... 22 | //H 00: t_9_009.cpp(16): X(), [t_9_009.cpp(12): X()=X_ ## 0R()] 23 | //H 02: X_0R() 24 | //H 00: t_9_009.cpp(12): X_0R(), [t_9_009.cpp(13): X_0R()=...] 25 | //H 02: ... 26 | //H 03: ... 27 | //H 03: ... 28 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_008.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests #include statements with macros as arguments 11 | 12 | //R 13 | //E t_2_008.cpp(15): error: could not find include file: some_include_file.h 14 | #define INCLUDE_FILE "some_include_file.h" 15 | #include INCLUDE_FILE 16 | 17 | //H 10: t_2_008.cpp(14): #define 18 | //H 08: t_2_008.cpp(14): INCLUDE_FILE="some_include_file.h" 19 | //H 10: t_2_008.cpp(15): #include 20 | //H 01: t_2_008.cpp(14): INCLUDE_FILE 21 | //H 02: "some_include_file.h" 22 | //H 03: "some_include_file.h" 23 | //H 04: "some_include_file.h" 24 | //H 18: boost::wave::preprocess_exception 25 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_016.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests continuing scanning into the underlying input stream after expanding 11 | // a macro, if this is appropriate 12 | 13 | #define A Token1 B 14 | #define B() Token2 15 | 16 | //R #line 18 "t_1_016.cpp" 17 | //R Token1 Token2 18 | A() 19 | 20 | //H 10: t_1_016.cpp(13): #define 21 | //H 08: t_1_016.cpp(13): A=Token1 B 22 | //H 10: t_1_016.cpp(14): #define 23 | //H 08: t_1_016.cpp(14): B()=Token2 24 | //H 01: t_1_016.cpp(13): A 25 | //H 02: Token1 B 26 | //H 03: Token1 B 27 | //H 00: t_1_016.cpp(13): B(), [t_1_016.cpp(14): B()=Token2] 28 | //H 02: Token2 29 | //H 03: Token2 30 | -------------------------------------------------------------------------------- /samples/waveidl/idl_version.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: IDL oriented preprocessor 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(IDL_VERSION_HPP_780C1190_3107_440B_B303_B687A449749B_INCLUDED) 14 | #define IDL_VERSION_HPP_780C1190_3107_440B_B303_B687A449749B_INCLUDED 15 | 16 | #include 17 | 18 | #define IDL_VERSION_MAJOR BOOST_WAVE_VERSION_MAJOR 19 | #define IDL_VERSION_MINOR BOOST_WAVE_VERSION_MINOR 20 | #define IDL_VERSION_SUBMINOR BOOST_WAVE_VERSION_SUBMINOR 21 | #define IDL_VERSION_DATE 20050117L 22 | 23 | #endif // !defined(IDL_VERSION_HPP_780C1190_3107_440B_B303_B687A449749B_INCLUDED) 24 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_002.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests simple #line functionality 11 | 12 | #line 5 "a_nonexisting_file.cpp" 13 | 14 | //R 15 | //E a_nonexisting_file.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "a_nonexisting_file.cpp" 16 | #error This error should occur at line 8 of "a_nonexisting_file.cpp" 17 | 18 | //H 10: t_2_002.cpp(12): #line 19 | //H 17: 5 "a_nonexisting_file.cpp" (5, "a_nonexisting_file.cpp") 20 | //H 10: a_nonexisting_file.cpp(8): #error 21 | //H 16: This error should occur at line 8 of "a_nonexisting_file.cpp" 22 | //H 18: boost::wave::preprocess_exception 23 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_024.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2013 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Verifies resolution of #8848: Wave driver improperly processes 0xFFFFui64 11 | // token 12 | 13 | //O --long_long 14 | 15 | #if defined(__TESTWAVE_SUPPORT_MS_EXTENSIONS__) 16 | 17 | #define TEST 0xFFFFFui64 18 | 19 | TEST 20 | 21 | //R #line 19 "t_9_024.cpp" 22 | //R 0xFFFFFui64 23 | 24 | //H 10: t_9_024.cpp(15): #if 25 | //H 11: t_9_024.cpp(15): #if defined(__TESTWAVE_SUPPORT_MS_EXTENSIONS__): 1 26 | //H 10: t_9_024.cpp(17): #define 27 | //H 08: t_9_024.cpp(17): TEST=0xFFFFFui64 28 | //H 01: t_9_024.cpp(17): TEST 29 | //H 02: 0xFFFFFui64 30 | //H 03: 0xFFFFFui64 31 | //H 10: t_9_024.cpp(33): #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_038.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // make sure newlines inside of macro invocations get accounted for correctly 11 | 12 | #define BAZ(T, E) T E 13 | 14 | struct foo 15 | { 16 | BAZ 17 | (bool, 18 | value = true 19 | ); 20 | }; 21 | 22 | struct bar {}; 23 | 24 | //R #line 14 "t_1_038.cpp" 25 | //R struct foo 26 | //R { 27 | //R bool value = true; 28 | //R #line 20 "t_1_038.cpp" 29 | //R }; 30 | //R 31 | //R struct bar {}; 32 | 33 | //H 10: t_1_038.cpp(12): #define 34 | //H 08: t_1_038.cpp(12): BAZ(T, E)=T E 35 | //H 00: t_1_038.cpp(16): BAZ(bool, value = true ), [t_1_038.cpp(12): BAZ(T, E)=T E] 36 | //H 02: bool value = true 37 | //H 03: bool value = true 38 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_009.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test, if wrongly placed '##' operators are detected 11 | 12 | #define TEST1() A ## B 13 | #define TEST2() ## A 14 | 15 | //R #line 17 "t_1_009.cpp" 16 | //R AB 17 | TEST1() 18 | //E t_1_009.cpp(19): error: ill formed preprocessing operator: concat ('##') 19 | TEST2() // error 20 | 21 | //H 10: t_1_009.cpp(12): #define 22 | //H 08: t_1_009.cpp(12): TEST1()=A ## B 23 | //H 10: t_1_009.cpp(13): #define 24 | //H 08: t_1_009.cpp(13): TEST2()=## A 25 | //H 00: t_1_009.cpp(17): TEST1(), [t_1_009.cpp(12): TEST1()=A ## B] 26 | //H 02: AB 27 | //H 03: AB 28 | //H 00: t_1_009.cpp(19): TEST2(), [t_1_009.cpp(13): TEST2()=## A] 29 | //H 18: boost::wave::preprocess_exception 30 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_010.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test, if wrongly placed '##' operators are detected 11 | 12 | #define TEST1() A ## B 13 | #define TEST2() A ## 14 | 15 | //R #line 17 "t_1_010.cpp" 16 | //R AB 17 | TEST1() 18 | //E t_1_010.cpp(19): error: ill formed preprocessing operator: concat ('##') 19 | TEST2() // error 20 | 21 | //H 10: t_1_010.cpp(12): #define 22 | //H 08: t_1_010.cpp(12): TEST1()=A ## B 23 | //H 10: t_1_010.cpp(13): #define 24 | //H 08: t_1_010.cpp(13): TEST2()=A ## 25 | //H 00: t_1_010.cpp(17): TEST1(), [t_1_010.cpp(12): TEST1()=A ## B] 26 | //H 02: AB 27 | //H 03: AB 28 | //H 00: t_1_010.cpp(19): TEST2(), [t_1_010.cpp(13): TEST2()=A ##] 29 | //H 18: boost::wave::preprocess_exception 30 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_023.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Verifies that preprocessing directives are properly recognized only if 11 | // the '#' is really the first character on a line before macro expansion. 12 | // See http://www.open-std.org/jtc1/sc22/wg14/docs/rr/dr_144.html. 13 | 14 | #define _C_STD_BEGIN 15 | 16 | _C_STD_BEGIN 17 | #ifndef _M_CEE_PURE 18 | _C_LIB_DECL 19 | #endif 20 | 21 | //R #line 18 "t_9_023.cpp" 22 | //R _C_LIB_DECL 23 | 24 | //H 10: t_9_023.cpp(14): #define 25 | //H 08: t_9_023.cpp(14): _C_STD_BEGIN= 26 | //H 01: t_9_023.cpp(14): _C_STD_BEGIN 27 | //H 02: 28 | //H 03: _ 29 | //H 10: t_9_023.cpp(17): #ifndef 30 | //H 11: t_9_023.cpp(17): #ifndef _M_CEE_PURE: 0 31 | //H 10: t_9_023.cpp(19): #endif 32 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_022.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests the validity of whitespace handling during macro expansion 11 | 12 | #define MACRO() 123 13 | 14 | //R #line 16 "t_1_022.cpp" 15 | //R 123 16 | MACRO() 17 | //R #line 19 "t_1_022.cpp" 18 | //R 123 19 | MACRO 20 | () 21 | //R #line 23 "t_1_022.cpp" 22 | //R 123 23 | MACRO( 24 | ) 25 | 26 | //H 10: t_1_022.cpp(12): #define 27 | //H 08: t_1_022.cpp(12): MACRO()=123 28 | //H 00: t_1_022.cpp(16): MACRO(), [t_1_022.cpp(12): MACRO()=123] 29 | //H 02: 123 30 | //H 03: 123 31 | //H 00: t_1_022.cpp(19): MACRO(), [t_1_022.cpp(12): MACRO()=123] 32 | //H 02: 123 33 | //H 03: 123 34 | //H 00: t_1_022.cpp(23): MACRO(), [t_1_022.cpp(12): MACRO()=123] 35 | //H 02: 123 36 | //H 03: 123 37 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_020.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests the handling of placeholder tokens, which have to be inserted, when 11 | // some macro expands into nothing (certainly these have to be ignored 12 | // afterwards :-) 13 | 14 | #define NIL 15 | 16 | #define A B NIL 17 | #define B() anything 18 | 19 | //R #line 21 "t_1_020.cpp" 20 | //R B() 21 | A() // not 'anything'! 22 | 23 | //H 10: t_1_020.cpp(14): #define 24 | //H 08: t_1_020.cpp(14): NIL= 25 | //H 10: t_1_020.cpp(16): #define 26 | //H 08: t_1_020.cpp(16): A=B NIL 27 | //H 10: t_1_020.cpp(17): #define 28 | //H 08: t_1_020.cpp(17): B()=anything 29 | //H 01: t_1_020.cpp(16): A 30 | //H 02: B NIL 31 | //H 01: t_1_020.cpp(14): NIL 32 | //H 02: 33 | //H 03: _ 34 | //H 03: B_ 35 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_025.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, if macro expansion eats up follow up tokens under certain conditions 11 | // (which it shouldn't). 12 | 13 | #define SCAN(x) x 14 | 15 | #define BUG BUG_2 16 | #define BUG_2 17 | 18 | //R #line 19 "t_1_025.cpp" 19 | SCAN(BUG) 1 2 3 4 5 //R 1 2 3 4 5 20 | 21 | //H 10: t_1_025.cpp(13): #define 22 | //H 08: t_1_025.cpp(13): SCAN(x)=x 23 | //H 10: t_1_025.cpp(15): #define 24 | //H 08: t_1_025.cpp(15): BUG=BUG_2 25 | //H 10: t_1_025.cpp(16): #define 26 | //H 08: t_1_025.cpp(16): BUG_2= 27 | //H 00: t_1_025.cpp(19): SCAN(BUG), [t_1_025.cpp(13): SCAN(x)=x] 28 | //H 01: t_1_025.cpp(15): BUG 29 | //H 02: BUG_2 30 | //H 01: t_1_025.cpp(16): BUG_2 31 | //H 02: 32 | //H 03: _ 33 | //H 03: _ 34 | //H 02: 35 | //H 03: _ 36 | -------------------------------------------------------------------------------- /tool/cpp_version.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #if !defined(CPP_VERSION_HPP_CE4FE67F_63F9_468D_8364_C855F89D3C5D_INCLUDED) 11 | #define CPP_VERSION_HPP_CE4FE67F_63F9_468D_8364_C855F89D3C5D_INCLUDED 12 | 13 | #include 14 | 15 | #define CPP_VERSION_MAJOR BOOST_WAVE_VERSION_MAJOR 16 | #define CPP_VERSION_MINOR BOOST_WAVE_VERSION_MINOR 17 | #define CPP_VERSION_SUBMINOR BOOST_WAVE_VERSION_SUBMINOR 18 | #define CPP_VERSION_FULL BOOST_WAVE_VERSION 19 | 20 | #define CPP_VERSION_FULL_STR BOOST_PP_STRINGIZE(CPP_VERSION_FULL) 21 | 22 | #define CPP_VERSION_DATE 20120523L 23 | #define CPP_VERSION_DATE_STR "20120523" 24 | 25 | #endif // !defined(CPP_VERSION_HPP_CE4FE67F_63F9_468D_8364_C855F89D3C5D_INCLUDED) 26 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_031.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests macro expansion using variadic macros 11 | 12 | //O --variadics 13 | 14 | #define is_empty(...) is_empty_ ## __VA_ARGS__ ## other 15 | 16 | //R #line 17 "t_1_031.cpp" 17 | is_empty( + ) //R is_empty_+other 18 | is_empty( +text ) //R is_empty_+textother 19 | 20 | //H 10: t_1_031.cpp(14): #define 21 | //H 08: t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other 22 | //H 00: t_1_031.cpp(17): is_empty( + ), [t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other] 23 | //H 02: is_empty_+other 24 | //H 03: is_empty_+other 25 | //H 00: t_1_031.cpp(18): is_empty( +text ), [t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other] 26 | //H 02: is_empty_+textother 27 | //H 03: is_empty_+textother 28 | -------------------------------------------------------------------------------- /samples/token_statistics/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (token_statistics) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | SOURCES = 12 | ../token_statistics 13 | ../instantiate_xlex_lexer 14 | ../instantiate_cpp_grammar 15 | ../instantiate_defined_grammar 16 | ; 17 | 18 | exe token_statistics 19 | : 20 | $(SOURCES) 21 | /boost/wave//boost_wave 22 | /boost/program_options//boost_program_options 23 | /boost/filesystem//boost_filesystem 24 | /boost/system//boost_system 25 | /boost/thread//boost_thread 26 | /boost/date_time//boost_date_time 27 | ; 28 | 29 | for local source in $(SOURCES) 30 | { 31 | local requirements ; 32 | requirements += 7.1:off ; # workaround for compiler bug 33 | requirements += 7.1_stlport4:off ; 34 | obj $(source) : $(source).cpp : $(requirements) ; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /include/boost/wave/wave_version.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | This is the current version of the Wave library 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(WAVE_VERSION_H_9D79ABDB_AC54_4C0A_89B1_F70A2DCFE21E_INCLUDED) 14 | #define WAVE_VERSION_H_9D79ABDB_AC54_4C0A_89B1_F70A2DCFE21E_INCLUDED 15 | 16 | // BOOST_WAVE_VERSION & 0x0000FF is the sub-minor version 17 | // BOOST_WAVE_VERSION & 0x00FF00 is the minor version 18 | // BOOST_WAVE_VERSION & 0xFF0000 is the major version 19 | #define BOOST_WAVE_VERSION 0x020302 20 | 21 | // The following defines contain the same information as above 22 | #define BOOST_WAVE_VERSION_MAJOR 2 23 | #define BOOST_WAVE_VERSION_MINOR 3 24 | #define BOOST_WAVE_VERSION_SUBMINOR 2 25 | 26 | #endif // !defined(WAVE_VERSION_H_9D79ABDB_AC54_4C0A_89B1_F70A2DCFE21E_INCLUDED) 27 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_011.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test if macros at not used parameter positions are expanded correctly 11 | 12 | #define MACRO() /**/ 13 | #define ID(x) // parameter not used at all 14 | #define CAT(x) X ## x // expanded parameter not used 15 | 16 | ID( MACRO(*) ) 17 | //R #line 19 "t_1_011.cpp" 18 | //R XMACRO(*) 19 | CAT( MACRO(*) ) 20 | 21 | //H 10: t_1_011.cpp(12): #define 22 | //H 08: t_1_011.cpp(12): MACRO()= 23 | //H 10: t_1_011.cpp(13): #define 24 | //H 08: t_1_011.cpp(13): ID(x)= 25 | //H 10: t_1_011.cpp(14): #define 26 | //H 08: t_1_011.cpp(14): CAT(x)=X ## x 27 | //H 00: t_1_011.cpp(16): ID( MACRO(*) ), [t_1_011.cpp(13): ID(x)=] 28 | //H 02: 29 | //H 03: _ 30 | //H 00: t_1_011.cpp(19): CAT( MACRO(*) ), [t_1_011.cpp(14): CAT(x)=X ## x] 31 | //H 02: XMACRO(*) 32 | //H 03: XMACRO(*) 33 | -------------------------------------------------------------------------------- /samples/waveidl/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (waveidl) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | SOURCES = 12 | ../idl 13 | ../instantiate_cpp_grammar 14 | ../instantiate_defined_grammar 15 | ../instantiate_predef_macros 16 | ../instantiate_re2c_lexer 17 | ../instantiate_re2c_lexer_str 18 | ../idllexer/idl_re 19 | ; 20 | 21 | exe waveidl 22 | : 23 | $(SOURCES) 24 | /boost/wave//boost_wave 25 | /boost/program_options//boost_program_options 26 | /boost/system//boost_system 27 | /boost/thread//boost_thread 28 | /boost/date_time//boost_date_time 29 | ; 30 | 31 | for local source in $(SOURCES) 32 | { 33 | local requirements ; 34 | # workaround for compiler bug 35 | requirements += 7.1:off ; 36 | requirements += 7.1_stlport4:off ; 37 | obj $(source) : $(source).cpp : $(requirements) ; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_030.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, whether an empty macro prevents another macro from expansion 11 | 12 | #define EMPTY() 13 | #define SCAN(x) x 14 | #define MACRO(x) (x) 15 | 16 | //R #line 17 "t_1_030.cpp" 17 | SCAN( MACRO EMPTY() )(1) //R (1) 18 | 19 | //H 10: t_1_030.cpp(12): #define 20 | //H 08: t_1_030.cpp(12): EMPTY()= 21 | //H 10: t_1_030.cpp(13): #define 22 | //H 08: t_1_030.cpp(13): SCAN(x)=x 23 | //H 10: t_1_030.cpp(14): #define 24 | //H 08: t_1_030.cpp(14): MACRO(x)=(x) 25 | //H 00: t_1_030.cpp(17): SCAN( MACRO EMPTY() ), [t_1_030.cpp(13): SCAN(x)=x] 26 | //H 00: t_1_030.cpp(17): EMPTY(), [t_1_030.cpp(12): EMPTY()=] 27 | //H 02: 28 | //H 03: _ 29 | //H 02: MACRO 30 | //H 03: MACRO 31 | //H 00: t_1_030.cpp(17): MACRO(1), [t_1_030.cpp(14): MACRO(x)=(x)] 32 | //H 02: (1) 33 | //H 03: (1) 34 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_011.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test, if additional whitespace is inserted at appropriate places. 11 | 12 | //O --variadics 13 | 14 | #define PRIMITIVE_CAT(a, b) a ## b 15 | #define PRIMITIVE_CAT3(a, b, c) a ## b ## c 16 | 17 | //R #line 18 "t_9_011.cpp" 18 | PRIMITIVE_CAT(1, ABC) //R 1 ABC 19 | PRIMITIVE_CAT3(ABC, 1, ABC) //R ABC1ABC 20 | 21 | //H 10: t_9_011.cpp(14): #define 22 | //H 08: t_9_011.cpp(14): PRIMITIVE_CAT(a, b)=a ## b 23 | //H 10: t_9_011.cpp(15): #define 24 | //H 08: t_9_011.cpp(15): PRIMITIVE_CAT3(a, b, c)=a ## b ## c 25 | //H 00: t_9_011.cpp(18): PRIMITIVE_CAT(1, ABC), [t_9_011.cpp(14): PRIMITIVE_CAT(a, b)=a ## b] 26 | //H 02: 1ABC 27 | //H 03: 1ABC 28 | //H 00: t_9_011.cpp(19): PRIMITIVE_CAT3(ABC, 1, ABC), [t_9_011.cpp(15): PRIMITIVE_CAT3(a, b, c)=a ## b ## c] 29 | //H 02: ABC1ABC 30 | //H 03: ABC1ABC 31 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_006.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // syntax for defined operator 11 | // is either: 12 | // 13 | // defined X 14 | // 15 | // -or- 16 | // 17 | // defined(X) 18 | // 19 | // i.e. the parenthesis are optional (ala sizeof) 20 | 21 | #define X 22 | 23 | //R #line 26 "t_9_006.cpp" 24 | //R "X" is defined. 25 | #if defined(X) 26 | "X" is defined. 27 | #else 28 | "X" is not defined. 29 | #endif 30 | 31 | //R #line 34 "t_9_006.cpp" 32 | //R "X" is defined. 33 | #if defined X 34 | "X" is defined. 35 | #else 36 | "X" is not defined. 37 | #endif 38 | 39 | //H 10: t_9_006.cpp(21): #define 40 | //H 08: t_9_006.cpp(21): X= 41 | //H 10: t_9_006.cpp(25): #if 42 | //H 11: t_9_006.cpp(25): #if defined(X): 1 43 | //H 10: t_9_006.cpp(27): #else 44 | //H 10: t_9_006.cpp(33): #if 45 | //H 11: t_9_006.cpp(33): #if defined X: 1 46 | //H 10: t_9_006.cpp(35): #else 47 | -------------------------------------------------------------------------------- /samples/cpp_tokens/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (cpp_tokens) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | SOURCES = 12 | ../cpp_tokens 13 | ../instantiate_cpp_exprgrammar 14 | ../instantiate_cpp_grammar 15 | ../instantiate_cpp_literalgrs 16 | ../instantiate_defined_grammar 17 | ../instantiate_slex_lexer 18 | ; 19 | 20 | exe cpp_tokens 21 | : 22 | $(SOURCES) 23 | /boost/wave//boost_wave 24 | /boost/program_options//boost_program_options 25 | /boost/filesystem//boost_filesystem 26 | /boost/system//boost_system 27 | /boost/thread//boost_thread 28 | /boost/date_time//boost_date_time 29 | ; 30 | 31 | for local source in $(SOURCES) 32 | { 33 | local requirements ; 34 | # workaround for compiler bug 35 | requirements += 7.1:off ; 36 | requirements += 7.1_stlport4:off ; 37 | obj $(source) : $(source).cpp : $(requirements) ; 38 | } 39 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_018.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests macro expansion sequence and proper rescanning 11 | 12 | #define macro() expr_2 13 | #define macro_2() expr 14 | 15 | #define par() () 16 | 17 | #define expr macro par () 18 | #define expr_2 macro_2 par par par() 19 | 20 | #define scan(x) x 21 | 22 | //R #line 24 "t_1_018.cpp" 23 | //R macro () 24 | expr 25 | //R #line 27 "t_1_018.cpp" 26 | //R macro_2 par par () 27 | scan(expr) 28 | //R #line 30 "t_1_018.cpp" 29 | //R macro_2 par () 30 | scan(scan(expr)) 31 | //R #line 33 "t_1_018.cpp" 32 | //R macro_2 () 33 | scan(scan(scan(expr))) 34 | //R #line 36 "t_1_018.cpp" 35 | //R macro () 36 | scan(scan(scan(scan(expr)))) 37 | //R #line 39 "t_1_018.cpp" 38 | //R macro_2 par par () 39 | scan(scan(scan(scan(scan(expr))))) 40 | //R #line 42 "t_1_018.cpp" 41 | //R macro_2 par () 42 | scan(scan(scan(scan(scan(scan(expr)))))) 43 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_019.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests macro expansion sequence and proper rescanning 11 | 12 | #define macro() expr_2 13 | #define macro_2() expr 14 | 15 | #define par() () 16 | 17 | #define expr macro () 18 | #define expr_2 macro_2 par par par() 19 | 20 | #define scan(x) x 21 | 22 | //R #line 24 "t_1_019.cpp" 23 | //R macro_2 par par () 24 | expr 25 | //R #line 27 "t_1_019.cpp" 26 | //R macro_2 par () 27 | scan(expr) 28 | //R #line 30 "t_1_019.cpp" 29 | //R macro_2 () 30 | scan(scan(expr)) 31 | //R #line 33 "t_1_019.cpp" 32 | //R macro_2 par par () 33 | scan(scan(scan(expr))) 34 | //R #line 36 "t_1_019.cpp" 35 | //R macro_2 par () 36 | scan(scan(scan(scan(expr)))) 37 | //R #line 39 "t_1_019.cpp" 38 | //R macro_2 () 39 | scan(scan(scan(scan(scan(expr))))) 40 | //R #line 42 "t_1_019.cpp" 41 | //R macro_2 () 42 | scan(scan(scan(scan(scan(scan(expr)))))) 43 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_001.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests the #warning directive (note: only available, if enabled during 11 | // compilation, the macro expansion is available only, when enabled separately 12 | // during the compilation too) 13 | 14 | //R 15 | //E t_2_001.cpp(18): warning: encountered #warning directive: This is a warning 16 | #define WARNING1 This is a 17 | #define WARNING2 warning 18 | #warning WARNING1 WARNING2 19 | 20 | //H 10: t_2_001.cpp(16): #define 21 | //H 08: t_2_001.cpp(16): WARNING1=This is a 22 | //H 10: t_2_001.cpp(17): #define 23 | //H 08: t_2_001.cpp(17): WARNING2=warning 24 | //H 10: t_2_001.cpp(18): #warning 25 | //H 01: t_2_001.cpp(16): WARNING1 26 | //H 02: This is a 27 | //H 03: This is a 28 | //H 01: t_2_001.cpp(17): WARNING2 29 | //H 02: warning 30 | //H 03: warning 31 | //H 15: WARNING1 WARNING2 32 | //H 18: boost::wave::preprocess_exception 33 | -------------------------------------------------------------------------------- /samples/list_includes/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Boost.Wave: A Standard compliant C++ preprocessor library 2 | # 3 | # Boost Wave Library Sample Build Jamfile (list_includes) 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | SOURCES = 12 | ../list_includes 13 | ../instantiate_cpp_exprgrammar 14 | ../instantiate_cpp_grammar 15 | ../instantiate_cpp_literalgrs 16 | ../instantiate_defined_grammar 17 | ../instantiate_lexertl_lexer 18 | ; 19 | 20 | exe list_includes 21 | : 22 | $(SOURCES) 23 | /boost/wave//boost_wave 24 | /boost/program_options//boost_program_options 25 | /boost/filesystem//boost_filesystem 26 | /boost/system//boost_system 27 | /boost/thread//boost_thread 28 | /boost/date_time//boost_date_time 29 | ; 30 | 31 | for local source in $(SOURCES) 32 | { 33 | local requirements ; 34 | # workaround for compiler bug 35 | requirements += 7.1:off ; 36 | requirements += 7.1_stlport4:off ; 37 | obj $(source) : $(source).cpp : $(requirements) ; 38 | } 39 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_005.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, if no universal character values are to be generated accidently by 11 | // concatenation 12 | 13 | #define CONCAT(a, b) PRIMITIVE_CONCAT(a, b) 14 | #define PRIMITIVE_CONCAT(a, b) a ## b 15 | #define STRINGIZE(x) STRINGIZE_D(x) 16 | #define STRINGIZE_D(x) # x 17 | 18 | //R #line 19 "t_9_005.cpp" 19 | STRINGIZE( CONCAT(\, u00ff) ) //R "\u00ff" 20 | STRINGIZE( CONCAT(\u00, ff) ) //R "\u00ff" 21 | STRINGIZE( CONCAT(\u00ff, 56) ) //R "\u00ff56" 22 | CONCAT(\, u00ff) //R \u00ff 23 | CONCAT(\u00, ff) //R \ u00ff 24 | CONCAT(\u00ff, 56) //R \u00ff56 25 | 26 | //E t_9_005.cpp(27): error: a universal character name cannot designate a character in the basic character set: \u0061 27 | STRINGIZE( CONCAT(\, u0061) ) // reports an error 28 | -------------------------------------------------------------------------------- /samples/preprocess_pragma_output/example.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | Example demonstrating how to preprocess the token stream generated by a 4 | #pragma directive 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | /////////////////////////////////////////////////////////////////////////////// 14 | // This special pragma is implemented by the interpret_pragma hook function 15 | // provided in the preprocess_pragma_output_hooks policy class. This 16 | // #pragma preprocesses the provided arguments in the current context. 17 | #pragma wave pp ( \ 18 | "#define A() \"some text\" and more\n" \ 19 | "#define B() 1.0\n" \ 20 | ) \ 21 | /**/ 22 | 23 | A() // this should produce: "some text" and more 24 | B() // and this expands to 1.0 25 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_023.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, if function-like macros buried deep inside a macro expansion of the 11 | // same name as an object-like macro do not eat up more tokens, than expected. 12 | 13 | #define PRIMITIVE_CAT(a, b) a ## b 14 | 15 | #define EAT(n) PRIMITIVE_CAT(EAT_, n) 16 | #define EAT_1(a) 17 | 18 | //R #line 20 "t_1_023.cpp" 19 | //R EAT_1... 20 | EAT(1)... 21 | 22 | //H 10: t_1_023.cpp(13): #define 23 | //H 08: t_1_023.cpp(13): PRIMITIVE_CAT(a, b)=a ## b 24 | //H 10: t_1_023.cpp(15): #define 25 | //H 08: t_1_023.cpp(15): EAT(n)=PRIMITIVE_CAT(EAT_, n) 26 | //H 10: t_1_023.cpp(16): #define 27 | //H 08: t_1_023.cpp(16): EAT_1(a)= 28 | //H 00: t_1_023.cpp(20): EAT(1), [t_1_023.cpp(15): EAT(n)=PRIMITIVE_CAT(EAT_, n)] 29 | //H 02: PRIMITIVE_CAT(EAT_, 1) 30 | //H 00: t_1_023.cpp(15): PRIMITIVE_CAT(EAT_, 1), [t_1_023.cpp(13): PRIMITIVE_CAT(a, b)=a ## b] 31 | //H 02: EAT_1 32 | //H 03: EAT_1 33 | //H 03: EAT_1 34 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_032.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test partial macro evaluation using varidic macros 11 | 12 | //O --variadics 13 | 14 | #define cat(...) cat_i(__VA_ARGS__,,,,,) 15 | #define cat_i(a, b, c, d, e, ...) \ 16 | a ## b ## c ## d ## e \ 17 | /**/ 18 | 19 | #define primitive_cat(a, b) a ## b 20 | 21 | #define partial_cat(x, y) cat(partial_cat_, x, y) 22 | 23 | #define partial_cat_00(a, b) partial_cat_f(, ## a, b ## ,) 24 | #define partial_cat_01(a, b) partial_cat_f(, ## a, b ,) 25 | #define partial_cat_10(a, b) partial_cat_f(, a, b ## ,) 26 | #define partial_cat_11(a, b) partial_cat_f(, a, b ,) 27 | 28 | #define partial_cat_f(a, b, c, d) b ## c 29 | 30 | #define X Token1 31 | #define Y Token2 32 | 33 | //R #line 34 "t_1_032.cpp" 34 | partial_cat(0, 0)(X, Y) //R XY 35 | partial_cat(0, 1)(X, Y) //R XToken2 36 | partial_cat(1, 0)(X, Y) //R Token1Y 37 | partial_cat(1, 1)(X, Y) //R Token1Token2 38 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_017.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // The result of macro expansion must be retokenized to find header-name tokens 11 | // of either or "file". Test inclusion using absolute names. 12 | 13 | #if !defined(FILE_002_017_CPP) // avoid #include recursion 14 | #define FILE_002_017_CPP 15 | 16 | #include __FILE__ 17 | 18 | #endif // FILE_002_017_CPP 19 | 20 | //R #line 24 "t_2_017.cpp" 21 | //R file t_2_017.cpp 22 | //R #line 24 "t_2_017.cpp" 23 | //R file t_2_017.cpp 24 | file t_2_017.cpp 25 | 26 | //H 10: t_2_017.cpp(13): #if 27 | //H 11: t_2_017.cpp(13): #if !defined(FILE_002_017_CPP) : 1 28 | //H 10: t_2_017.cpp(14): #define 29 | //H 08: t_2_017.cpp(14): FILE_002_017_CPP= 30 | //H 10: t_2_017.cpp(16): #include 31 | //H 04: "$P(t_2_017.cpp)" 32 | //H 05: $B(t_2_017.cpp) ($B(t_2_017.cpp)) 33 | //H 10: t_2_017.cpp(13): #if 34 | //H 11: t_2_017.cpp(13): #if !defined(FILE_002_017_CPP) : 0 35 | //H 06: 36 | //H 10: t_2_017.cpp(18): #endif 37 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_021.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests continuing scanning into the underlying input stream after expanding 11 | // a macro, if this is appropriate 12 | 13 | #define MACRO() X + Y NEXT 14 | #define X 1 15 | #define Y 2 16 | #define NEXT() ... 17 | 18 | //R #line 20 "t_1_021.cpp" 19 | //R 1 + 2 ... 20 | MACRO()() 21 | 22 | //H 10: t_1_021.cpp(13): #define 23 | //H 08: t_1_021.cpp(13): MACRO()=X + Y NEXT 24 | //H 10: t_1_021.cpp(14): #define 25 | //H 08: t_1_021.cpp(14): X=1 26 | //H 10: t_1_021.cpp(15): #define 27 | //H 08: t_1_021.cpp(15): Y=2 28 | //H 10: t_1_021.cpp(16): #define 29 | //H 08: t_1_021.cpp(16): NEXT()=... 30 | //H 00: t_1_021.cpp(20): MACRO(), [t_1_021.cpp(13): MACRO()=X + Y NEXT] 31 | //H 02: X + Y NEXT 32 | //H 01: t_1_021.cpp(14): X 33 | //H 02: 1 34 | //H 03: 1 35 | //H 01: t_1_021.cpp(15): Y 36 | //H 02: 2 37 | //H 03: 2 38 | //H 03: 1 + 2 NEXT 39 | //H 00: t_1_021.cpp(13): NEXT(), [t_1_021.cpp(16): NEXT()=...] 40 | //H 02: ... 41 | //H 03: ... 42 | -------------------------------------------------------------------------------- /samples/waveidl/idllexer/idl_re.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: Re2C based IDL lexer 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(IDL_RE_HPP_BD62775D_1659_4684_872C_03C02543C9A5_INCLUDED) 14 | #define IDL_RE_HPP_BD62775D_1659_4684_872C_03C02543C9A5_INCLUDED 15 | 16 | #include 17 | 18 | /////////////////////////////////////////////////////////////////////////////// 19 | namespace boost { 20 | namespace wave { 21 | namespace idllexer { 22 | namespace re2clex { 23 | 24 | /////////////////////////////////////////////////////////////////////////////// 25 | // The scanner function to call whenever a new token is requested 26 | boost::wave::token_id scan( 27 | boost::wave::cpplexer::re2clex::Scanner *s); 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | } // namespace re2clex 31 | } // namespace idllexer 32 | } // namespace wave 33 | } // namespace boost 34 | 35 | #endif // !defined(IDL_RE_HPP_BD62775D_1659_4684_872C_03C02543C9A5_INCLUDED) 36 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_033.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests the stringize operator in conjunction with varidic macros 11 | 12 | //O --variadics 13 | 14 | #define STR(...) #__VA_ARGS__ 15 | 16 | //R #line 17 "t_1_033.cpp" 17 | STR(1, 2, 3) //R "1, 2, 3" 18 | STR(1,2,3) //R "1,2,3" 19 | STR(1 , 2 , 3) //R "1 , 2 , 3" 20 | STR( 1 , 2 , 3 ) //R "1 , 2 , 3" 21 | 22 | //H 10: t_1_033.cpp(14): #define 23 | //H 08: t_1_033.cpp(14): STR(...)=#__VA_ARGS__ 24 | //H 00: t_1_033.cpp(17): STR(1, 2, 3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__] 25 | //H 02: "1, 2, 3" 26 | //H 03: "1, 2, 3" 27 | //H 00: t_1_033.cpp(18): STR(1,2,3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__] 28 | //H 02: "1,2,3" 29 | //H 03: "1,2,3" 30 | //H 00: t_1_033.cpp(19): STR(1 , 2 , 3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__] 31 | //H 02: "1 , 2 , 3" 32 | //H 03: "1 , 2 , 3" 33 | //H 00: t_1_033.cpp(20): STR( 1 , 2 , 3 ), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__] 34 | //H 02: "1 , 2 , 3" 35 | //H 03: "1 , 2 , 3" 36 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_007.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | //O --c99 11 | 12 | // Tests correctness of macro expansion inside #pragma directives 13 | // Note: in C99 mode the STDC prefix in pragma's suppresses macro expansion 14 | 15 | #define PRAGMA_BODY preprocessed pragma body 16 | 17 | //R #line 19 "t_2_007.cpp" 18 | //R #pragma some pragma body 19 | #pragma some pragma body 20 | //R #line 22 "t_2_007.cpp" 21 | //R #pragma preprocessed pragma body 22 | #pragma PRAGMA_BODY 23 | //R #line 25 "t_2_007.cpp" 24 | //R #pragma STDC some C99 standard pragma body 25 | #pragma STDC some C99 standard pragma body 26 | //R #line 28 "t_2_007.cpp" 27 | //R #pragma STDC PRAGMA_BODY 28 | #pragma STDC PRAGMA_BODY 29 | 30 | //H 10: t_2_007.cpp(15): #define 31 | //H 08: t_2_007.cpp(15): PRAGMA_BODY=preprocessed pragma body 32 | //H 10: t_2_007.cpp(19): #pragma 33 | //H 10: t_2_007.cpp(22): #pragma 34 | //H 01: t_2_007.cpp(15): PRAGMA_BODY 35 | //H 02: preprocessed pragma body 36 | //H 03: preprocessed pragma body 37 | //H 10: t_2_007.cpp(25): #pragma 38 | //H 10: t_2_007.cpp(28): #pragma 39 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_014.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // This sample is taken from the C++ standard 16.3.5.5 [cpp.scope] 11 | 12 | // Currently this test fails due to a pathologic border case, which is included 13 | // here. Wave currently does not support expanding macros, where the 14 | // replacement-list terminates in partial macro expansion (such as the 15 | // definition of the macro h below). This will be fixed in a future release. 16 | 17 | #define x 3 18 | #define f(a) f(x * (a)) 19 | #undef x 20 | #define x 2 21 | #define g f 22 | #define z z[0] 23 | #define h g( ~ 24 | #define m(a) a(w) 25 | #define w 0,1 26 | #define t(a) a 27 | f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); 28 | g(x+(3,4)-w) 29 | h 5) & m(f)^m(m); 30 | 31 | //R #line 27 "t_1_014.cpp" 32 | //R f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); 33 | //R f(2 * (2+(3,4)-0,1)) 34 | //E t_1_014.cpp(29): error: improperly terminated macro invocation or replacement-list terminates in partial macro expansion (not supported yet): missing ')' 35 | // should expand to: f(2 * g( ~ 5)) & f(2 * (0,1))^m(0,1); 36 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_006.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests correctness of macro expansion inside #pragma directives 11 | 12 | #define PRAGMA_BODY preprocessed pragma body 13 | 14 | //R #line 16 "t_2_006.cpp" 15 | //R #pragma some pragma body 16 | #pragma some pragma body 17 | //R #line 19 "t_2_006.cpp" 18 | //R #pragma preprocessed pragma body 19 | #pragma PRAGMA_BODY 20 | //R #line 22 "t_2_006.cpp" 21 | //R #pragma STDC some C99 standard pragma body 22 | #pragma STDC some C99 standard pragma body 23 | //R #line 25 "t_2_006.cpp" 24 | //R #pragma STDC preprocessed pragma body 25 | #pragma STDC PRAGMA_BODY 26 | 27 | //H 10: t_2_006.cpp(12): #define 28 | //H 08: t_2_006.cpp(12): PRAGMA_BODY=preprocessed pragma body 29 | //H 10: t_2_006.cpp(16): #pragma 30 | //H 10: t_2_006.cpp(19): #pragma 31 | //H 01: t_2_006.cpp(12): PRAGMA_BODY 32 | //H 02: preprocessed pragma body 33 | //H 03: preprocessed pragma body 34 | //H 10: t_2_006.cpp(22): #pragma 35 | //H 10: t_2_006.cpp(25): #pragma 36 | //H 01: t_2_006.cpp(12): PRAGMA_BODY 37 | //H 02: preprocessed pragma body 38 | //H 03: preprocessed pragma body 39 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_004.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests #line functionality with macro expansion required 11 | 12 | #define LINE_NO 5 13 | #define FILE_NAME "a_nonexisting_file.cpp" 14 | #line LINE_NO FILE_NAME 15 | 16 | //R 17 | //E a_nonexisting_file.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "a_nonexisting_file.cpp" 18 | #error This error should occur at line 8 of "a_nonexisting_file.cpp" 19 | 20 | //H 10: t_2_004.cpp(12): #define 21 | //H 08: t_2_004.cpp(12): LINE_NO=5 22 | //H 10: t_2_004.cpp(13): #define 23 | //H 08: t_2_004.cpp(13): FILE_NAME="a_nonexisting_file.cpp" 24 | //H 10: t_2_004.cpp(14): #line 25 | //H 01: t_2_004.cpp(12): LINE_NO 26 | //H 02: 5 27 | //H 03: 5 28 | //H 01: t_2_004.cpp(13): FILE_NAME 29 | //H 02: "a_nonexisting_file.cpp" 30 | //H 03: "a_nonexisting_file.cpp" 31 | //H 17: 5 "a_nonexisting_file.cpp" (5, "a_nonexisting_file.cpp") 32 | //H 10: a_nonexisting_file.cpp(8): #error 33 | //H 16: This error should occur at line 8 of "a_nonexisting_file.cpp" 34 | //H 18: boost::wave::preprocess_exception 35 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_016.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #if !defined(inclusion) 11 | # define inclusion 12 | # include __FILE__ 13 | # include "t_9_016.hpp" 14 | #else 15 | //R #line 18 "t_9_016.cpp" 16 | //R # define later 17 | #define EXPAND(x) x 18 | EXPAND(#) define later 19 | #endif 20 | 21 | //H 10: t_9_016.cpp(10): #if 22 | //H 11: t_9_016.cpp(10): #if !defined(inclusion): 1 23 | //H 10: t_9_016.cpp(11): #define 24 | //H 08: t_9_016.cpp(11): inclusion= 25 | //H 10: t_9_016.cpp(12): # include 26 | //H 04: "$P(t_9_016.cpp)" 27 | //H 05: $B(t_9_016.cpp) ($B(t_9_016.cpp)) 28 | //H 10: t_9_016.cpp(10): #if 29 | //H 11: t_9_016.cpp(10): #if !defined(inclusion): 0 30 | //H 10: t_9_016.cpp(17): #define 31 | //H 08: t_9_016.cpp(17): EXPAND(x)=x 32 | //H 00: t_9_016.cpp(18): EXPAND(#), [t_9_016.cpp(17): EXPAND(x)=x] 33 | //H 02: # 34 | //H 03: # 35 | //H 10: t_9_016.cpp(19): #endif 36 | //H 06: 37 | //H 19: $B(t_9_016.cpp): inclusion 38 | //H 10: t_9_016.cpp(13): # include "t_9_016.hpp" 39 | //H 04: "t_9_016.hpp" 40 | //H 05: t_9_016.hpp ($B(t_9_016.hpp)) 41 | //H 06: 42 | //H 10: t_9_016.cpp(14): #else 43 | -------------------------------------------------------------------------------- /samples/cpp_tokens/instantiate_defined_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | http://www.boost.org/ 5 | 6 | Copyright (c) 2001-2012 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 | #include "cpp_tokens.hpp" // config data 12 | 13 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 14 | 15 | #include 16 | 17 | #include 18 | 19 | #include "slex_token.hpp" 20 | #include "slex_iterator.hpp" 21 | 22 | #include 23 | 24 | /////////////////////////////////////////////////////////////////////////////// 25 | // 26 | // Explicit instantiation of the defined_grammar_gen template 27 | // with the correct token type. This instantiates the corresponding parse 28 | // function, which in turn instantiates the defined_grammar 29 | // object (see wave/grammars/cpp_defined_grammar.hpp) 30 | // 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | typedef boost::wave::cpplexer::slex::slex_iterator< 34 | boost::wave::cpplexer::slex_token<> > 35 | lexer_type; 36 | template struct boost::wave::grammars::defined_grammar_gen; 37 | 38 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 39 | 40 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_001.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test macro expansion order 11 | #define A(x, y) x,y 12 | #define B(x, y) [x][y] 13 | #define C(x) B(x) 14 | 15 | //R #line 16 "t_1_001.cpp" 16 | C(A(2,3)) //R [2][3] 17 | C( A(2 , 3) ) //R [ 2 ][ 3 ] 18 | 19 | //H 10: t_1_001.cpp(11): #define 20 | //H 08: t_1_001.cpp(11): A(x, y)=x,y 21 | //H 10: t_1_001.cpp(12): #define 22 | //H 08: t_1_001.cpp(12): B(x, y)=[x][y] 23 | //H 10: t_1_001.cpp(13): #define 24 | //H 08: t_1_001.cpp(13): C(x)=B(x) 25 | //H 00: t_1_001.cpp(16): C(A(2,3)), [t_1_001.cpp(13): C(x)=B(x)] 26 | //H 00: t_1_001.cpp(16): A(2,3), [t_1_001.cpp(11): A(x, y)=x,y] 27 | //H 02: 2,3 28 | //H 03: 2,3 29 | //H 02: B(2,3) 30 | //H 00: t_1_001.cpp(13): B(2,3), [t_1_001.cpp(12): B(x, y)=[x][y]] 31 | //H 02: [2][3] 32 | //H 03: [2][3] 33 | //H 03: [2][3] 34 | //H 00: t_1_001.cpp(17): C( A(2 , 3) ), [t_1_001.cpp(13): C(x)=B(x)] 35 | //H 00: t_1_001.cpp(17): A(2 , 3), [t_1_001.cpp(11): A(x, y)=x,y] 36 | //H 02: 2 , 3 37 | //H 03: 2 , 3 38 | //H 02: B( 2 , 3 ) 39 | //H 00: t_1_001.cpp(13): B( 2 , 3 ), [t_1_001.cpp(12): B(x, y)=[x][y]] 40 | //H 02: [ 2 ][ 3 ] 41 | //H 03: [ 2 ][ 3 ] 42 | //H 03: [ 2 ][ 3 ] 43 | -------------------------------------------------------------------------------- /samples/real_positions/instantiate_defined_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | Example: real_positions 4 | 5 | http://www.boost.org/ 6 | 7 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | Software License, Version 1.0. (See accompanying file 9 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | =============================================================================*/ 11 | 12 | #include 13 | 14 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 15 | 16 | #include 17 | 18 | #include 19 | 20 | #include "real_position_token.hpp" // token class 21 | #include // lexer type 22 | 23 | #include 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // 27 | // Explicit instantiation of the defined_grammar_gen template 28 | // with the correct token type. This instantiates the corresponding parse 29 | // function, which in turn instantiates the defined_grammar 30 | // object (see wave/grammars/cpp_defined_grammar.hpp) 31 | // 32 | /////////////////////////////////////////////////////////////////////////////// 33 | 34 | typedef boost::wave::cpplexer::lex_iterator > lexer_type; 35 | 36 | template struct boost::wave::grammars::defined_grammar_gen; 37 | 38 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 39 | 40 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_027.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests delayed macro expansion (rescanning) 11 | 12 | #define CONCAT_1(A, B) A ## B 13 | #define CONCAT_2(A, B) CONCAT_1(A, B) 14 | 15 | #define DELAY(NAME) NAME 16 | 17 | #define A1 a 18 | #define B1 b 19 | 20 | #define A2() a 21 | #define B2() b 22 | 23 | #define LHS ( 24 | #define RHS ) 25 | 26 | //R #line 27 "t_1_027.cpp" 27 | DELAY(CONCAT_1)( a, b ) (); //R ab (); 28 | DELAY(CONCAT_1)(A1, B1)(); //R A1B1(); 29 | DELAY(CONCAT_1) LHS A1, B1 RHS (); //R CONCAT_1 ( a, b )(); 30 | CONCAT_1 ( a, b ) (); //R ab (); 31 | CONCAT_1 ( A1, B1 ) (); //R A1B1 (); 32 | CONCAT_1 LHS a, b RHS (); //R CONCAT_1 ( a, b )(); 33 | //R 34 | DELAY(CONCAT_2)( a, b ) (); //R ab (); 35 | DELAY(CONCAT_2)(A1, B1)(); //R ab(); 36 | DELAY(CONCAT_2) LHS A1, B1 RHS (); //R CONCAT_2 ( a, b )(); 37 | DELAY(CONCAT_2)(A2(), B2())(); //R ab(); 38 | CONCAT_2 ( a, b ) (); //R ab (); 39 | CONCAT_2 ( A1, B1 ) (); //R ab (); 40 | CONCAT_2 LHS a, b RHS (); //R CONCAT_2 ( a, b )(); 41 | CONCAT_2(A2(), B2())(); //R ab(); 42 | -------------------------------------------------------------------------------- /samples/list_includes/instantiate_defined_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: List include dependencies of a given source file 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #include "list_includes.hpp" // config data 14 | 15 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #include "lexertl_iterator.hpp" 23 | 24 | #include 25 | 26 | /////////////////////////////////////////////////////////////////////////////// 27 | // 28 | // Explicit instantiation of the defined_grammar_gen template 29 | // with the correct token type. This instantiates the corresponding parse 30 | // function, which in turn instantiates the defined_grammar 31 | // object (see wave/grammars/cpp_defined_grammar.hpp) 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | typedef boost::wave::cpplexer::lexertl::lex_iterator< 36 | boost::wave::cpplexer::lex_token<> > 37 | lexer_type; 38 | template struct boost::wave::grammars::defined_grammar_gen; 39 | 40 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 41 | 42 | -------------------------------------------------------------------------------- /samples/waveidl/instantiate_defined_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: IDL oriented preprocessor 5 | Explicit instantiation of the defined_grammar template 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "idl.hpp" 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "idllexer/idl_lex_iterator.hpp" 24 | 25 | #include 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Explicit instantiation of the defined_grammar_gen template 30 | // with the correct token type. This instantiates the corresponding parse 31 | // function, which in turn instantiates the defined_grammar 32 | // object (see wave/grammars/cpp_defined_grammar.hpp) 33 | // 34 | /////////////////////////////////////////////////////////////////////////////// 35 | 36 | typedef boost::wave::idllexer::lex_iterator< 37 | boost::wave::cpplexer::lex_token<> > 38 | lexer_type; 39 | template struct boost::wave::grammars::defined_grammar_gen; 40 | 41 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 42 | 43 | -------------------------------------------------------------------------------- /samples/list_includes/instantiate_cpp_exprgrammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: List include dependencies of a given source file 5 | Explicit instantiation of the cpp_expression_grammar parsing 6 | function 7 | 8 | http://www.boost.org/ 9 | 10 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 11 | Software License, Version 1.0. (See accompanying file 12 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 13 | =============================================================================*/ 14 | 15 | #include "list_includes.hpp" // config data 16 | 17 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | /////////////////////////////////////////////////////////////////////////////// 27 | // 28 | // Explicit instantiation of the expression_grammar_gen template with the 29 | // correct token type. This instantiates the corresponding parse function, 30 | // which in turn instantiates the expression_grammar object (see 31 | // wave/grammars/cpp_expression_grammar.hpp) 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | typedef boost::wave::cpplexer::lex_token<> token_type; 36 | 37 | template struct boost::wave::grammars::expression_grammar_gen; 38 | 39 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 40 | 41 | -------------------------------------------------------------------------------- /samples/real_positions/instantiate_cpp_exprgrammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | Example: real_positions 4 | 5 | Explicit instantiation of the cpp_expression_grammar parsing function 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | 22 | #include "real_position_token.hpp" // token class 23 | #include // lexer type 24 | 25 | #include 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Explicit instantiation of the expression_grammar_gen template with the 30 | // correct token type. This instantiates the corresponding parse function, 31 | // which in turn instantiates the expression_grammar object (see 32 | // wave/grammars/cpp_expression_grammar.hpp) 33 | // 34 | /////////////////////////////////////////////////////////////////////////////// 35 | 36 | typedef lex_token<> token_type; 37 | 38 | template struct boost::wave::grammars::expression_grammar_gen; 39 | 40 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 41 | 42 | -------------------------------------------------------------------------------- /samples/token_statistics/instantiate_defined_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: Collect token statistics 5 | Explicit instantiation of the defined_grammar template 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "token_statistics.hpp" 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "xlex_iterator.hpp" 24 | 25 | #include 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Explicit instantiation of the defined_grammar_gen template 30 | // with the correct token type. This instantiates the corresponding parse 31 | // function, which in turn instantiates the defined_grammar 32 | // object (see wave/grammars/cpp_defined_grammar.hpp) 33 | // 34 | /////////////////////////////////////////////////////////////////////////////// 35 | 36 | typedef boost::wave::cpplexer::xlex::xlex_iterator< 37 | boost::wave::cpplexer::lex_token<> > 38 | lexer_type; 39 | template struct boost::wave::grammars::defined_grammar_gen; 40 | 41 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 42 | 43 | -------------------------------------------------------------------------------- /samples/cpp_tokens/instantiate_cpp_exprgrammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: prints out the preprocessed tokens returned by the pp iterator 5 | Explicit instantiation of the cpp_expression_grammar parsing 6 | function 7 | 8 | http://www.boost.org/ 9 | 10 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 11 | Software License, Version 1.0. (See accompanying file 12 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 13 | =============================================================================*/ 14 | 15 | #include "cpp_tokens.hpp" // config data 16 | 17 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 18 | 19 | #include 20 | 21 | #include 22 | 23 | #include "slex_token.hpp" 24 | #include "slex_iterator.hpp" 25 | 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // 30 | // Explicit instantiation of the expression_grammar_gen template with the 31 | // correct token type. This instantiates the corresponding parse function, 32 | // which in turn instantiates the expression_grammar object (see 33 | // wave/grammars/cpp_expression_grammar.hpp) 34 | // 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | typedef boost::wave::cpplexer::slex_token<> token_type; 38 | 39 | template struct boost::wave::grammars::expression_grammar_gen; 40 | 41 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 42 | 43 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_021.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #define SIX (4 + 2.0) 11 | 12 | //R #line 14 "t_2_021.cpp" 13 | //R #pragma command option 14 | #pragma command option 15 | //R #line 17 "t_2_021.cpp" 16 | //R #pragma command option (4 + 2.0) 17 | #pragma command option SIX 18 | //R #line 20 "t_2_021.cpp" 19 | //R #pragma command option[(4 + 2.0)] 20 | #pragma command option[SIX] 21 | //R #line 23 "t_2_021.cpp" 22 | //R #pragma command option(5) 23 | #pragma command option(5) 24 | //R #line 26 "t_2_021.cpp" 25 | //R #pragma command option((4 + 2.0)) 26 | #pragma command option(SIX) 27 | //R #line 29 "t_2_021.cpp" 28 | //R #pragma command (4 + 2.0) 29 | #pragma command SIX 30 | 31 | //H 10: t_2_021.cpp(10): #define 32 | //H 08: t_2_021.cpp(10): SIX=(4 + 2.0) 33 | //H 10: t_2_021.cpp(14): #pragma 34 | //H 10: t_2_021.cpp(17): #pragma 35 | //H 01: t_2_021.cpp(10): SIX 36 | //H 02: (4 + 2.0) 37 | //H 03: (4 + 2.0) 38 | //H 10: t_2_021.cpp(20): #pragma 39 | //H 01: t_2_021.cpp(10): SIX 40 | //H 02: (4 + 2.0) 41 | //H 03: (4 + 2.0) 42 | //H 10: t_2_021.cpp(23): #pragma 43 | //H 10: t_2_021.cpp(26): #pragma 44 | //H 01: t_2_021.cpp(10): SIX 45 | //H 02: (4 + 2.0) 46 | //H 03: (4 + 2.0) 47 | //H 10: t_2_021.cpp(29): #pragma 48 | //H 01: t_2_021.cpp(10): SIX 49 | //H 02: (4 + 2.0) 50 | //H 03: (4 + 2.0) 51 | -------------------------------------------------------------------------------- /samples/waveidl/instantiate_predef_macros.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: IDL oriented preprocessor 5 | Explicit instantiation of the predefined_macros_grammar template 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "idl.hpp" 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "idllexer/idl_lex_iterator.hpp" 24 | 25 | #include 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Explicit instantiation of the predefined_macros_grammar_gen template 30 | // with the correct token type. This instantiates the corresponding pt_parse 31 | // function, which in turn instantiates the cpp_predefined_macros_grammar 32 | // object (see wave/grammars/cpp_predef_macros_grammar.hpp) 33 | // 34 | /////////////////////////////////////////////////////////////////////////////// 35 | 36 | typedef boost::wave::idllexer::lex_iterator< 37 | boost::wave::cpplexer::lex_token<> > 38 | lexer_type; 39 | template struct boost::wave::grammars::predefined_macros_grammar_gen; 40 | 41 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 42 | 43 | -------------------------------------------------------------------------------- /samples/cpp_tokens/cpp_tokens.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: Print out the preprocessed tokens returned by the Wave iterator 5 | 6 | This sample shows, how it is possible to use a custom lexer object and a 7 | custom token type with the Wave library. 8 | 9 | http://www.boost.org/ 10 | 11 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 12 | Software License, Version 1.0. (See accompanying file 13 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 14 | =============================================================================*/ 15 | 16 | #if !defined(CPP_TOKENS_HPP_D6A31137_CE14_4869_9779_6357E2C43187_INCLUDED) 17 | #define CPP_TOKENS_HPP_D6A31137_CE14_4869_9779_6357E2C43187_INCLUDED 18 | 19 | /////////////////////////////////////////////////////////////////////////////// 20 | // include often used files from the stdlib 21 | #include 22 | #include 23 | #include 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // include boost config 27 | #include // global configuration information 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // configure this app here (global configuration constants) 31 | #include "cpp_tokens_config.hpp" 32 | 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // include required boost libraries 35 | #include 36 | #include 37 | 38 | #endif // !defined(CPP_TOKENS_HPP_D6A31137_CE14_4869_9779_6357E2C43187_INCLUDED) 39 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_020.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // tests whether whitespace is correctly handled in macro arguments 11 | 12 | //O --variadics 13 | 14 | #define STRINGIZE1(x) #x 15 | #define STRINGIZE(x) STRINGIZE1(x) 16 | 17 | #define MACRO(...) (__VA_ARGS__) - STRINGIZE((__VA_ARGS__)) 18 | 19 | //R #line 20 "t_9_020.cpp" 20 | MACRO() //R () - "()" 21 | MACRO( ) //R () - "()" 22 | MACRO(a) //R (a) - "(a)" 23 | MACRO( a ) //R ( a ) - "( a )" 24 | MACRO( a ) //R ( a ) - "( a )" 25 | MACRO(a,b) //R (a,b) - "(a,b)" 26 | MACRO(a, b) //R (a, b) - "(a, b)" 27 | MACRO(a ,b) //R (a ,b) - "(a ,b)" 28 | MACRO( a ,b, c ) //R ( a ,b, c ) - "( a ,b, c )" 29 | MACRO( a ,b, c ) //R ( a ,b, c ) - "( a ,b, c )" 30 | 31 | #undef MACRO 32 | #define MACRO(x) [x] 33 | 34 | //R #line 35 "t_9_020.cpp" 35 | MACRO() //R [] 36 | MACRO( ) //R [] 37 | MACRO(123) //R [123] 38 | MACRO( 123 ) //R [ 123 ] 39 | MACRO( 123 ) //R [ 123 ] 40 | 41 | #define A(x) 1 x 3 42 | #define B(x) (1)x(3) 43 | 44 | //R #line 45 "t_9_020.cpp" 45 | A(2) //R 1 2 3 46 | STRINGIZE(A(2)) //R "1 2 3" 47 | STRINGIZE(B(2)) //R "(1)2(3)" 48 | STRINGIZE(B( 2 )) //R "(1) 2 (3)" 49 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_3_002.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests predefined macros 11 | 12 | //R #line 13 "t_3_002.cpp" 13 | __STDC__ //R 1 14 | __STDC_VERSION__ //R __STDC_VERSION__ 15 | __cplusplus //R 199711L 16 | __STDC_HOSTED__ //R __STDC_HOSTED__ 17 | __LINE__ //R 17 18 | __FILE__ //R "$P" 19 | __BASE_FILE__ //R "$F" 20 | __WAVE_HAS_VARIADICS__ //R __WAVE_HAS_VARIADICS__ 21 | __INCLUDE_LEVEL__ //R 0 22 | //R #line 50 "test.cpp" 23 | #line 50 "test.cpp" 24 | __LINE__ //R 50 25 | __FILE__ //R "test.cpp" 26 | __BASE_FILE__ //R "$F" 27 | 28 | 29 | //R #line 56 "test.cpp" 30 | __LINE__ //R 56 31 | __FILE__ //R "test.cpp" 32 | __BASE_FILE__ //R "$F" 33 | 34 | //H 01: (1): __STDC__ 35 | //H 02: 1 36 | //H 03: 1 37 | //H 01: (1): __cplusplus 38 | //H 02: 199711L 39 | //H 03: 199711L 40 | //H 01: (1): __BASE_FILE__ 41 | //H 02: "$F" 42 | //H 03: "$F" 43 | //H 10: t_3_002.cpp(23): #line 44 | //H 17: 50 "test.cpp" (50, "test.cpp") 45 | //H 01: (1): __BASE_FILE__ 46 | //H 02: "$F" 47 | //H 03: "$F" 48 | //H 01: (1): __BASE_FILE__ 49 | //H 02: "$F" 50 | //H 03: "$F" 51 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_028.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests delayed macro expansion (rescanning) 11 | 12 | //O --variadics 13 | 14 | #define CONCAT_1(A, B) A ## B 15 | #define CONCAT_2(A, B) CONCAT_1(A, B) 16 | 17 | #define DELAY(NAME) NAME 18 | 19 | #define A1 a 20 | #define B1 b 21 | 22 | #define A2() a 23 | #define B2() b 24 | 25 | #define LHS ( 26 | #define RHS ) 27 | 28 | //R #line 29 "t_1_028.cpp" 29 | DELAY(CONCAT_1)( a, b ) (); //R ab (); 30 | DELAY(CONCAT_1)(A1, B1)(); //R A1B1(); 31 | DELAY(CONCAT_1) LHS A1, B1 RHS (); //R CONCAT_1 ( a, b )(); 32 | DELAY(CONCAT_1)(A2(), B2())(); //R a b(); 33 | CONCAT_1 ( a, b ) (); //R ab (); 34 | CONCAT_1 ( A1, B1 ) (); //R A1B1 (); 35 | CONCAT_1 LHS a, b RHS (); //R CONCAT_1 ( a, b )(); 36 | CONCAT_1(A2(), B2())(); //R a b(); 37 | //R 38 | DELAY(CONCAT_2)( a, b ) (); //R ab (); 39 | DELAY(CONCAT_2)(A1, B1)(); //R ab(); 40 | DELAY(CONCAT_2) LHS A1, B1 RHS (); //R CONCAT_2 ( a, b )(); 41 | DELAY(CONCAT_2)(A2(), B2())(); //R ab(); 42 | CONCAT_2 ( a, b ) (); //R ab (); 43 | CONCAT_2 ( A1, B1 ) (); //R ab (); 44 | CONCAT_2 LHS a, b RHS (); //R CONCAT_2 ( a, b )(); 45 | CONCAT_2(A2(), B2())(); //R ab(); 46 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_012.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, whether macro definition works when there is no whitespace in between 11 | // the macro name and the defined expansion list 12 | 13 | #define CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y,\ 14 | nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\ 15 | CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,\ 16 | nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) 17 | 18 | //R #line 19 "t_9_012.cpp" 19 | CreateWindowA(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) //R CreateWindowExA(0L, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 20 | 21 | //H 10: t_9_012.cpp(13): #define 22 | //H 08: t_9_012.cpp(13): CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)=CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) 23 | //H 00: t_9_012.cpp(19): CreateWindowA(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), [t_9_012.cpp(13): CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)=CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)] 24 | //H 02: CreateWindowExA(0L, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 25 | //H 03: CreateWindowExA(0L, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) 26 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_029.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests concatination of more than two parameters 11 | 12 | #define CAT3_1(a, b, c) a##b##c 13 | #define CAT3_2(a, b, c) a ## b ## c 14 | 15 | #define CAT4_1(a, b, c, d) a##b##c##d 16 | #define CAT4_2(a, b, c, d) a ## b ## c ## d 17 | 18 | //R #line 19 "t_1_029.cpp" 19 | CAT3_1(1, 0, 0) //R 100 20 | CAT3_2(1, 0, 0) //R 100 21 | //R 22 | CAT4_1(1, 0, 0, 2) //R 1002 23 | CAT4_2(1, 0, 0, 2) //R 1002 24 | 25 | //H 10: t_1_029.cpp(12): #define 26 | //H 08: t_1_029.cpp(12): CAT3_1(a, b, c)=a##b##c 27 | //H 10: t_1_029.cpp(13): #define 28 | //H 08: t_1_029.cpp(13): CAT3_2(a, b, c)=a ## b ## c 29 | //H 10: t_1_029.cpp(15): #define 30 | //H 08: t_1_029.cpp(15): CAT4_1(a, b, c, d)=a##b##c##d 31 | //H 10: t_1_029.cpp(16): #define 32 | //H 08: t_1_029.cpp(16): CAT4_2(a, b, c, d)=a ## b ## c ## d 33 | //H 00: t_1_029.cpp(19): CAT3_1(1, 0, 0), [t_1_029.cpp(12): CAT3_1(a, b, c)=a##b##c] 34 | //H 02: 100 35 | //H 03: 100 36 | //H 00: t_1_029.cpp(20): CAT3_2(1, 0, 0), [t_1_029.cpp(13): CAT3_2(a, b, c)=a ## b ## c] 37 | //H 02: 100 38 | //H 03: 100 39 | //H 00: t_1_029.cpp(22): CAT4_1(1, 0, 0, 2), [t_1_029.cpp(15): CAT4_1(a, b, c, d)=a##b##c##d] 40 | //H 02: 1002 41 | //H 03: 1002 42 | //H 00: t_1_029.cpp(23): CAT4_2(1, 0, 0, 2), [t_1_029.cpp(16): CAT4_2(a, b, c, d)=a ## b ## c ## d] 43 | //H 02: 1002 44 | //H 03: 1002 45 | -------------------------------------------------------------------------------- /tool/build/Jamfile.v2: -------------------------------------------------------------------------------- 1 | # Wave: A Standard compliant C++ preprocessor 2 | # 3 | # Boost Wave Library Build Jamfile 4 | # 5 | # http://www.boost.org/ 6 | # 7 | # Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | # Software License, Version 1.0. (See accompanying file 9 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | 11 | # Make sure all of Wave is compiled with threading disabled. We still need 12 | # to link with Boost.Thread, but no multi-threaded features are being used 13 | # in the Wave tool anyway. 14 | 15 | import feature ; 16 | import option ; 17 | 18 | feature.feature wavetool 19 | : on 20 | : optional composite propagated 21 | ; 22 | 23 | feature.compose on 24 | : BOOST_WAVE_SUPPORT_THREADING=0 25 | ; 26 | 27 | ############################################################################### 28 | project 29 | : requirements 30 | msvc:_SCL_SECURE_NO_DEPRECATE 31 | msvc:_CRT_SECURE_NO_DEPRECATE 32 | ; 33 | 34 | exe wave 35 | : 36 | ../cpp.cpp 37 | /boost//wave 38 | /boost//program_options 39 | /boost//filesystem 40 | /boost//serialization 41 | /boost//system 42 | /boost//thread 43 | /boost//date_time 44 | : 45 | multi 46 | # on 47 | on 48 | : 49 | release 50 | ; 51 | 52 | local bindir = [ option.get bindir : ../../../dist/bin ] ; 53 | local libdir = [ option.get libdir : ../../../dist/lib ] ; 54 | 55 | install dist-bin 56 | : 57 | wave 58 | : 59 | EXE 60 | $(bindir) 61 | : 62 | release 63 | ; 64 | 65 | install dist-lib 66 | : 67 | wave 68 | : 69 | LIB 70 | $(libdir) 71 | : 72 | release 73 | ; 74 | -------------------------------------------------------------------------------- /samples/waveidl/instantiate_cpp_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: IDL oriented preprocessor 5 | Explicit instantiation of the cpp_grammar template 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "idl.hpp" 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include "idllexer/idl_lex_iterator.hpp" 25 | 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // 30 | // Explicit instantiation of the cpp_grammar_gen template with the correct 31 | // token type. This instantiates the corresponding pt_parse function, which 32 | // in turn instantiates the cpp_grammar object 33 | // (see wave/grammars/cpp_grammar.hpp) 34 | // 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | typedef boost::wave::cpplexer::lex_token<> token_type; 38 | typedef boost::wave::idllexer::lex_iterator lexer_type; 39 | typedef std::list > 40 | token_sequence_type; 41 | 42 | template struct boost::wave::grammars::cpp_grammar_gen; 43 | 44 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 45 | 46 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_012.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test, if function like macros are correctly expanded if used as object like 11 | // macros 12 | 13 | #define CAT(a, b) a ## b 14 | #define ARGS (1, 2) 15 | 16 | //R #line 18 "t_1_012.cpp" 17 | //R CAT (1, 2) 18 | CAT ARGS 19 | 20 | #define INVOKE(macro) macro ARGS 21 | 22 | //R #line 24 "t_1_012.cpp" 23 | //R CAT (1, 2) 24 | INVOKE(CAT) 25 | 26 | #define EXPAND(x) x 27 | 28 | //R #line 30 "t_1_012.cpp" 29 | //R 12 30 | EXPAND(CAT ARGS) 31 | 32 | //H 10: t_1_012.cpp(13): #define 33 | //H 08: t_1_012.cpp(13): CAT(a, b)=a ## b 34 | //H 10: t_1_012.cpp(14): #define 35 | //H 08: t_1_012.cpp(14): ARGS=(1, 2) 36 | //H 01: t_1_012.cpp(14): ARGS 37 | //H 02: (1, 2) 38 | //H 03: (1, 2) 39 | //H 10: t_1_012.cpp(20): #define 40 | //H 08: t_1_012.cpp(20): INVOKE(macro)=macro ARGS 41 | //H 00: t_1_012.cpp(24): INVOKE(CAT), [t_1_012.cpp(20): INVOKE(macro)=macro ARGS] 42 | //H 02: CAT ARGS 43 | //H 01: t_1_012.cpp(14): ARGS 44 | //H 02: (1, 2) 45 | //H 03: (1, 2) 46 | //H 03: CAT (1, 2) 47 | //H 10: t_1_012.cpp(26): #define 48 | //H 08: t_1_012.cpp(26): EXPAND(x)=x 49 | //H 00: t_1_012.cpp(30): EXPAND(CAT ARGS), [t_1_012.cpp(26): EXPAND(x)=x] 50 | //H 01: t_1_012.cpp(14): ARGS 51 | //H 02: (1, 2) 52 | //H 03: (1, 2) 53 | //H 02: CAT (1, 2) 54 | //H 00: t_1_012.cpp(30): CAT(1, 2), [t_1_012.cpp(13): CAT(a, b)=a ## b] 55 | //H 02: 12 56 | //H 03: 12 57 | //H 03: 12 58 | -------------------------------------------------------------------------------- /samples/token_statistics/instantiate_cpp_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: Collect token statistics 5 | Explicit instantiation of the cpp_grammar template 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "token_statistics.hpp" 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include "xlex_iterator.hpp" 25 | 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // 30 | // Explicit instantiation of the cpp_grammar_gen template with the correct 31 | // token type. This instantiates the corresponding pt_parse function, which 32 | // in turn instantiates the cpp_grammar object 33 | // (see wave/grammars/cpp_grammar.hpp) 34 | // 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | typedef boost::wave::cpplexer::lex_token<> token_type; 38 | typedef boost::wave::cpplexer::xlex::xlex_iterator lexer_type; 39 | typedef std::list > 40 | token_sequence_type; 41 | 42 | template struct boost::wave::grammars::cpp_grammar_gen; 43 | 44 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 45 | 46 | -------------------------------------------------------------------------------- /samples/list_includes/lexertl/wave_lexertl_config.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #if !defined(BOOST_WAVE_WAVE_LEXERTL_CONFIG_HPP_INCLUDED) 11 | #define BOOST_WAVE_WAVE_LEXERTL_CONFIG_HPP_INCLUDED 12 | 13 | /////////////////////////////////////////////////////////////////////////////// 14 | // If the BOOST_WAVE_LEXERTL_USE_STATIC_TABLES constant is defined to be not 15 | // equal to zero, the lexer will use static pre-compiled dfa tables (as 16 | // included in the file: wave_lexertl_tables.hpp). Enabling the static tables 17 | // makes the code compilable even without having the lexertl library 18 | // available. 19 | #if !defined(BOOST_WAVE_LEXERTL_USE_STATIC_TABLES) 20 | #define BOOST_WAVE_LEXERTL_USE_STATIC_TABLES 0 21 | #endif 22 | 23 | /////////////////////////////////////////////////////////////////////////////// 24 | // If the dfa tables have to be generated at runtime, and the constant 25 | // BOOST_WAVE_LEXERTL_GENERATE_CPP_CODE is defined to be not equal to zero, 26 | // the lexer will write C++ code for static DFA tables. This is useful for 27 | // generating the static tables required for the 28 | // BOOST_WAVE_LEXERTL_USE_STATIC_TABLES as described above. 29 | #if BOOST_WAVE_LEXERTL_USE_STATIC_TABLES != 0 30 | #if !defined(BOOST_WAVE_LEXERTL_GENERATE_CPP_CODE) 31 | #define BOOST_WAVE_LEXERTL_GENERATE_CPP_CODE 0 32 | #endif 33 | #endif 34 | 35 | #endif // !BOOST_WAVE_WAVE_LEXERTL_CONFIG_HPP_INCLUDED 36 | -------------------------------------------------------------------------------- /samples/list_includes/list_includes.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: List include dependencies of a given source file 5 | Configuration data 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #if !defined(LIST_INCLUDES_HPP_843DB412_3AA8_4BCF_8081_AA4A5FDE0BE7_INCLUDED) 15 | #define LIST_INCLUDES_HPP_843DB412_3AA8_4BCF_8081_AA4A5FDE0BE7_INCLUDED 16 | 17 | /////////////////////////////////////////////////////////////////////////////// 18 | // include often used files from the stdlib 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // include boost config 27 | #include // global configuration information 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // build version 31 | #include "list_includes_version.hpp" 32 | 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // configure this app here (global configuration constants) 35 | #include "list_includes_config.hpp" 36 | 37 | /////////////////////////////////////////////////////////////////////////////// 38 | // include required boost libraries 39 | #include 40 | #include 41 | 42 | #endif // !defined(LIST_INCLUDES_HPP_843DB412_3AA8_4BCF_8081_AA4A5FDE0BE7_INCLUDED) 43 | -------------------------------------------------------------------------------- /tool/cpp.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | http://www.boost.org/ 5 | 6 | Copyright (c) 2001-2012 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(CPP_HPP_920D0370_741F_44AF_BF86_F6104BDACF75_INCLUDED) 12 | #define CPP_HPP_920D0370_741F_44AF_BF86_F6104BDACF75_INCLUDED 13 | 14 | /////////////////////////////////////////////////////////////////////////////// 15 | // This file may be used as a precompiled header (if applicable) 16 | 17 | /////////////////////////////////////////////////////////////////////////////// 18 | // include often used files from the stdlib 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | /////////////////////////////////////////////////////////////////////////////// 27 | // include boost config 28 | #include // global configuration information 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | // build version 32 | #include "cpp_version.hpp" 33 | 34 | /////////////////////////////////////////////////////////////////////////////// 35 | // configure this app here (global configuration constants) 36 | #include "cpp_config.hpp" 37 | 38 | /////////////////////////////////////////////////////////////////////////////// 39 | // include required boost libraries 40 | #include 41 | #include 42 | 43 | #endif // !defined(CPP_HPP_920D0370_741F_44AF_BF86_F6104BDACF75_INCLUDED) 44 | -------------------------------------------------------------------------------- /samples/list_includes/instantiate_lexertl_lexer.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | http://www.boost.org/ 5 | 6 | Copyright (c) 2001-2010 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 | #include "list_includes.hpp" // config data 12 | 13 | #if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | #include "lexertl_iterator.hpp" 21 | 22 | /////////////////////////////////////////////////////////////////////////////// 23 | // The following file needs to be included only once throughout the whole 24 | // program. 25 | #include "lexertl/lexertl_lexer.hpp" 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // 29 | // This instantiates the correct 'new_lexer' function, which generates the 30 | // C++ lexer used in this sample. 31 | // 32 | // This is moved into a separate compilation unit to decouple the compilation 33 | // of the C++ lexer from the compilation of the other modules, which helps to 34 | // reduce compilation time. 35 | // 36 | // The template parameter(s) supplied should be identical to the parameters 37 | // supplied while instantiating the context<> template. 38 | // 39 | /////////////////////////////////////////////////////////////////////////////// 40 | 41 | template struct boost::wave::cpplexer::lexertl::new_lexer_gen< 42 | BOOST_WAVE_STRINGTYPE::iterator>; 43 | 44 | #endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 45 | -------------------------------------------------------------------------------- /samples/real_positions/instantiate_cpp_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | Example: real_positions 4 | 5 | Explicit instantiation of the cpp_grammar parsing function 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include "real_position_token.hpp" // token class 24 | #include // lexer type 25 | 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // 30 | // Explicit instantiation of the cpp_grammar_gen template with the correct 31 | // token type. This instantiates the corresponding pt_parse function, which 32 | // in turn instantiates the cpp_grammar object 33 | // (see wave/grammars/cpp_grammar.hpp) 34 | // 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | typedef lex_token<> token_type; 38 | typedef boost::wave::cpplexer::lex_iterator lexer_type; 39 | typedef std::list > 40 | token_sequence_type; 41 | 42 | template struct boost::wave::grammars::cpp_grammar_gen; 43 | 44 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 45 | 46 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_3_003.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | //O --variadics 11 | 12 | // Tests predefined macros 13 | 14 | //R #line 15 "t_3_003.cpp" 15 | __STDC__ //R 1 16 | __STDC_VERSION__ //R __STDC_VERSION__ 17 | __cplusplus //R 199711L 18 | __STDC_HOSTED__ //R __STDC_HOSTED__ 19 | __LINE__ //R 19 20 | __FILE__ //R "$P" 21 | __BASE_FILE__ //R "$F" 22 | __WAVE_HAS_VARIADICS__ //R 1 23 | __INCLUDE_LEVEL__ //R 0 24 | //R #line 50 "test.cpp" 25 | #line 50 "test.cpp" 26 | __LINE__ //R 50 27 | __FILE__ //R "test.cpp" 28 | __BASE_FILE__ //R "$F" 29 | 30 | 31 | //R #line 56 "test.cpp" 32 | __LINE__ //R 56 33 | __FILE__ //R "test.cpp" 34 | __BASE_FILE__ //R "$F" 35 | 36 | //H 01: (1): __STDC__ 37 | //H 02: 1 38 | //H 03: 1 39 | //H 01: (1): __cplusplus 40 | //H 02: 199711L 41 | //H 03: 199711L 42 | //H 01: (1): __BASE_FILE__ 43 | //H 02: "$F" 44 | //H 03: "$F" 45 | //H 01: (1): __WAVE_HAS_VARIADICS__ 46 | //H 02: 1 47 | //H 03: 1 48 | //H 10: t_3_003.cpp(25): #line 49 | //H 17: 50 "test.cpp" (50, "test.cpp") 50 | //H 01: (1): __BASE_FILE__ 51 | //H 02: "$F" 52 | //H 03: "$F" 53 | //H 01: (1): __BASE_FILE__ 54 | //H 02: "$F" 55 | //H 03: "$F" 56 | -------------------------------------------------------------------------------- /include/boost/wave/grammars/cpp_value_error.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | http://www.boost.org/ 5 | 6 | Copyright (c) 2001-2012 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(BOOST_WAVE_CPP_VALUE_ERROR_INCLUDED) 12 | #define BOOST_WAVE_CPP_VALUE_ERROR_INCLUDED 13 | 14 | #include 15 | 16 | // this must occur after all of the includes and before any code appears 17 | #ifdef BOOST_HAS_ABI_HEADERS 18 | #include BOOST_ABI_PREFIX 19 | #endif 20 | 21 | /////////////////////////////////////////////////////////////////////////////// 22 | namespace boost { 23 | namespace wave { 24 | namespace grammars { 25 | 26 | /////////////////////////////////////////////////////////////////////////////// 27 | // 28 | // value_error enum type 29 | // 30 | // This is used to encode any error occurred during the evaluation of a 31 | // conditional preprocessor expression 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | enum value_error { 35 | error_noerror = 0x0, 36 | error_division_by_zero = 0x1, 37 | error_integer_overflow = 0x2, 38 | error_character_overflow = 0x4 39 | }; 40 | 41 | /////////////////////////////////////////////////////////////////////////////// 42 | } // namespace grammars 43 | } // namespace wave 44 | } // namespace boost 45 | 46 | // the suffix header occurs after all of the code 47 | #ifdef BOOST_HAS_ABI_HEADERS 48 | #include BOOST_ABI_SUFFIX 49 | #endif 50 | 51 | #endif // !defined(BOOST_WAVE_CPP_VALUE_ERROR_INCLUDED) 52 | -------------------------------------------------------------------------------- /samples/cpp_tokens/instantiate_cpp_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: prints out the preprocessed tokens returned by the pp iterator 5 | Explicit instantiation of the cpp_grammar parsing function 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "cpp_tokens.hpp" // config data 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | #include "slex_token.hpp" 24 | #include "slex_iterator.hpp" 25 | 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // 30 | // Explicit instantiation of the cpp_grammar_gen template with the correct 31 | // token type. This instantiates the corresponding pt_parse function, which 32 | // in turn instantiates the cpp_grammar object 33 | // (see wave/grammars/cpp_grammar.hpp) 34 | // 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | typedef boost::wave::cpplexer::slex_token<> token_type; 38 | typedef boost::wave::cpplexer::slex::slex_iterator lexer_type; 39 | typedef std::list > 40 | token_sequence_type; 41 | 42 | template struct boost::wave::grammars::cpp_grammar_gen; 43 | 44 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 45 | 46 | -------------------------------------------------------------------------------- /samples/list_includes/instantiate_cpp_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: List include dependencies of a given source file 5 | Explicit instantiation of the cpp_grammar parsing function 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "list_includes.hpp" // config data 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include "lexertl_iterator.hpp" 25 | 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // 30 | // Explicit instantiation of the cpp_grammar_gen template with the correct 31 | // token type. This instantiates the corresponding pt_parse function, which 32 | // in turn instantiates the cpp_grammar object 33 | // (see wave/grammars/cpp_grammar.hpp) 34 | // 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | typedef boost::wave::cpplexer::lex_token<> token_type; 38 | typedef boost::wave::cpplexer::lexertl::lex_iterator lexer_type; 39 | typedef std::list > 40 | token_sequence_type; 41 | 42 | template struct boost::wave::grammars::cpp_grammar_gen; 43 | 44 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 45 | 46 | -------------------------------------------------------------------------------- /samples/token_statistics/instantiate_xlex_lexer.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: Explicit instantiation of the xlex_functor generation function 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #include 14 | 15 | #if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 16 | 17 | #include 18 | 19 | #include 20 | 21 | #include 22 | #include "xlex_iterator.hpp" 23 | 24 | /////////////////////////////////////////////////////////////////////////////// 25 | // The following file needs to be included only once throughout the whole 26 | // program. 27 | #include "xlex/xlex_lexer.hpp" 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // 31 | // This instantiates the correct 'new_lexer' function, which generates the 32 | // C++ lexer used in this sample. 33 | // 34 | // This is moved into a separate compilation unit to decouple the compilation 35 | // of the C++ lexer from the compilation of the other modules, which helps to 36 | // reduce compilation time. 37 | // 38 | // The template parameter(s) supplied should be identical to the parameters 39 | // supplied while instantiating the context<> template. 40 | // 41 | /////////////////////////////////////////////////////////////////////////////// 42 | 43 | template struct boost::wave::cpplexer::xlex::new_lexer_gen; 44 | 45 | #endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 46 | -------------------------------------------------------------------------------- /samples/waveidl/idl.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: IDL oriented preprocessor 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(IDL_HPP_FC7EE131_5CE9_43F2_A713_8D9BBC3C8477_INCLUDED) 14 | #define IDL_HPP_FC7EE131_5CE9_43F2_A713_8D9BBC3C8477_INCLUDED 15 | 16 | /////////////////////////////////////////////////////////////////////////////// 17 | // This file may be used as a precompiled header (if applicable) 18 | 19 | /////////////////////////////////////////////////////////////////////////////// 20 | // include often used files from the stdlib 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // include boost config 30 | #include // global configuration information 31 | 32 | /////////////////////////////////////////////////////////////////////////////// 33 | // build version 34 | #include "idl_version.hpp" 35 | 36 | /////////////////////////////////////////////////////////////////////////////// 37 | // configure this app here (global configuration constants) 38 | #include "idl_config.hpp" 39 | 40 | /////////////////////////////////////////////////////////////////////////////// 41 | // include required boost libraries 42 | #include 43 | #include 44 | 45 | #endif // !defined(IDL_HPP_FC7EE131_5CE9_43F2_A713_8D9BBC3C8477_INCLUDED) 46 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_3_004.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | //O --c99 11 | 12 | // Tests predefined macros 13 | 14 | //R #line 15 "t_3_004.cpp" 15 | __STDC__ //R 1 16 | __STDC_VERSION__ //R 199901L 17 | __cplusplus //R __cplusplus 18 | __STDC_HOSTED__ //R 0 19 | __LINE__ //R 19 20 | __FILE__ //R "$P" 21 | __BASE_FILE__ //R "$F" 22 | __WAVE_HAS_VARIADICS__ //R 1 23 | __INCLUDE_LEVEL__ //R 0 24 | //R #line 50 "test.cpp" 25 | #line 50 "test.cpp" 26 | __LINE__ //R 50 27 | __FILE__ //R "test.cpp" 28 | __BASE_FILE__ //R "$F" 29 | 30 | 31 | //R #line 56 "test.cpp" 32 | __LINE__ //R 56 33 | __FILE__ //R "test.cpp" 34 | __BASE_FILE__ //R "$F" 35 | 36 | //H 01: (1): __STDC__ 37 | //H 02: 1 38 | //H 03: 1 39 | //H 01: (1): __STDC_VERSION__ 40 | //H 02: 199901L 41 | //H 03: 199901L 42 | //H 01: (1): __STDC_HOSTED__ 43 | //H 02: 0 44 | //H 03: 0 45 | //H 01: (1): __BASE_FILE__ 46 | //H 02: "$F" 47 | //H 03: "$F" 48 | //H 01: (1): __WAVE_HAS_VARIADICS__ 49 | //H 02: 1 50 | //H 03: 1 51 | //H 10: t_3_004.cpp(25): #line 52 | //H 17: 50 "test.cpp" (50, "test.cpp") 53 | //H 01: (1): __BASE_FILE__ 54 | //H 02: "$F" 55 | //H 03: "$F" 56 | //H 01: (1): __BASE_FILE__ 57 | //H 02: "$F" 58 | //H 03: "$F" 59 | -------------------------------------------------------------------------------- /src/wave_config_constant.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | Persistent application configuration 4 | 5 | http://www.boost.org/ 6 | 7 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 8 | Software License, Version 1.0. (See accompanying file 9 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | =============================================================================*/ 11 | 12 | #define BOOST_WAVE_SOURCE 1 13 | 14 | // disable stupid compiler warnings 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | /////////////////////////////////////////////////////////////////////////////// 24 | namespace boost { namespace wave { 25 | 26 | /////////////////////////////////////////////////////////////////////////// 27 | // Call this function to test the configuration of the calling application 28 | // against the configuration of the linked library. 29 | BOOST_WAVE_DECL bool 30 | test_configuration(unsigned int config, char const* pragma_keyword, 31 | char const* string_type_str) 32 | { 33 | if (NULL == pragma_keyword || NULL == string_type_str) 34 | return false; 35 | 36 | using namespace std;; // some systems have strcmp in namespace std 37 | if (config != BOOST_WAVE_CONFIG || 38 | strcmp(pragma_keyword, BOOST_WAVE_PRAGMA_KEYWORD) || 39 | strcmp(string_type_str, BOOST_PP_STRINGIZE((BOOST_WAVE_STRINGTYPE)))) 40 | { 41 | return false; 42 | } 43 | return true; 44 | } 45 | 46 | /////////////////////////////////////////////////////////////////////////////// 47 | }} // namespace boost::wave 48 | 49 | -------------------------------------------------------------------------------- /samples/cpp_tokens/instantiate_slex_lexer.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: Print out the preprocessed tokens returned by the Wave iterator 5 | Explicit instantiation of the lex_functor generation function 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "cpp_tokens.hpp" // config data 15 | 16 | #if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | 22 | #include "slex_token.hpp" 23 | #include "slex_iterator.hpp" 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // The following file needs to be included only once throughout the whole 27 | // program. 28 | #include "slex/cpp_slex_lexer.hpp" 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | // 32 | // This instantiates the correct 'new_lexer' function, which generates the 33 | // C++ lexer used in this sample. 34 | // 35 | // This is moved into a separate compilation unit to decouple the compilation 36 | // of the C++ lexer from the compilation of the other modules, which helps to 37 | // reduce compilation time. 38 | // 39 | // The template parameter(s) supplied should be identical to the parameters 40 | // supplied while instantiating the context<> template. 41 | // 42 | /////////////////////////////////////////////////////////////////////////////// 43 | 44 | template struct boost::wave::cpplexer::slex::new_lexer_gen< 45 | std::string::iterator>; 46 | 47 | #endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 48 | -------------------------------------------------------------------------------- /samples/hannibal/translation_unit_skipper.h: -------------------------------------------------------------------------------- 1 | // Hannibal: partial C++ grammar to parse C++ type information 2 | // Copyright (c) 2005-2006 Danny Havenith 3 | // 4 | // Boost.Wave: A Standard compliant C++ preprocessor 5 | // Copyright (c) 2001-2009 Hartmut Kaiser 6 | // 7 | // http://www.boost.org/ 8 | // 9 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 10 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | 12 | #if !defined(HANNIBAL_TRANSLATION_UNIT_SKIPPER_H_INCLUDED) 13 | #define HANNIBAL_TRANSLATION_UNIT_SKIPPER_H_INCLUDED 14 | 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | /////////////////////////////////////////////////////////////////////////////// 23 | struct translation_unit_skipper 24 | : public boost::spirit::classic::grammar 25 | { 26 | template 27 | struct definition 28 | { 29 | definition(translation_unit_skipper const& /*self*/) 30 | { 31 | using namespace boost::spirit::classic; 32 | using namespace boost::wave; 33 | using boost::wave::util::pattern_p; 34 | 35 | skip 36 | = pattern_p(WhiteSpaceTokenType, TokenTypeMask) 37 | | pattern_p(EOLTokenType, TokenTypeMask) 38 | | pattern_p(EOFTokenType, TokenTypeMask) 39 | | comment_p(pattern_p(PPTokenType, TokenTypeMask), 40 | pattern_p(EOLTokenType, TokenTypeMask)) 41 | ; 42 | } 43 | 44 | boost::spirit::classic::rule skip; 45 | 46 | boost::spirit::classic::rule const& 47 | start() const { return skip; } 48 | }; 49 | }; 50 | 51 | #endif // HANNIBAL_TRANSLATION_UNIT_SKIPPER_H_INCLUDED 52 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_2_009.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // The result of macro expansion must be re-tokenized to find header-name 11 | // tokens of either or "file" 12 | 13 | //O -S. 14 | 15 | #if !defined(FILE_002_009_CPP) // avoid #include recursion 16 | #define FILE_002_009_CPP 17 | 18 | #define SYSTEM_HEADER 19 | #define USER_HEADER "t_2_009.cpp" 20 | 21 | //R #line 23 "t_2_009.cpp" 22 | //R including 23 | including 24 | #include SYSTEM_HEADER 25 | 26 | //R #line 28 "t_2_009.cpp" 27 | //R including "t_2_009.cpp" 28 | including "t_2_009.cpp" 29 | #include USER_HEADER 30 | 31 | #endif // FILE_002_009_CPP 32 | 33 | //H 10: t_2_009.cpp(15): #if 34 | //H 11: t_2_009.cpp(15): #if !defined(FILE_002_009_CPP) : 1 35 | //H 10: t_2_009.cpp(16): #define 36 | //H 08: t_2_009.cpp(16): FILE_002_009_CPP= 37 | //H 10: t_2_009.cpp(18): #define 38 | //H 08: t_2_009.cpp(18): SYSTEM_HEADER= 39 | //H 10: t_2_009.cpp(19): #define 40 | //H 08: t_2_009.cpp(19): USER_HEADER="t_2_009.cpp" 41 | //H 10: t_2_009.cpp(24): #include 42 | //H 01: t_2_009.cpp(18): SYSTEM_HEADER 43 | //H 02: 44 | //H 03: 45 | //H 04: 46 | //H 05: $B(t_2_009.cpp) ($B(t_2_009.cpp)) 47 | //H 10: t_2_009.cpp(15): #if 48 | //H 11: t_2_009.cpp(15): #if !defined(FILE_002_009_CPP) : 0 49 | //H 06: 50 | //H 19: $B(t_2_009.cpp): FILE_002_009_CPP 51 | //H 10: t_2_009.cpp(29): #include 52 | //H 01: t_2_009.cpp(19): USER_HEADER 53 | //H 02: "t_2_009.cpp" 54 | //H 03: "t_2_009.cpp" 55 | //H 04: "t_2_009.cpp" 56 | //H 10: t_2_009.cpp(31): #endif 57 | -------------------------------------------------------------------------------- /include/boost/wave/cpplexer/re2clex/cpp_re.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Re2C based C++ lexer 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(CPP_RE_HPP_B76C4F5E_63E9_4B8A_9975_EC32FA6BF027_INCLUDED) 14 | #define CPP_RE_HPP_B76C4F5E_63E9_4B8A_9975_EC32FA6BF027_INCLUDED 15 | 16 | #include 17 | #include 18 | 19 | // this must occur after all of the includes and before any code appears 20 | #ifdef BOOST_HAS_ABI_HEADERS 21 | #include BOOST_ABI_PREFIX 22 | #endif 23 | 24 | // suppress warnings about dependent classes not being exported from the dll 25 | #ifdef BOOST_MSVC 26 | #pragma warning(push) 27 | #pragma warning(disable : 4251 4231 4660) 28 | #endif 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | namespace boost { 32 | namespace wave { 33 | namespace cpplexer { 34 | namespace re2clex { 35 | 36 | struct Scanner; 37 | 38 | /////////////////////////////////////////////////////////////////////////////// 39 | // The scanner function to call whenever a new token is requested 40 | BOOST_WAVE_DECL boost::wave::token_id scan(Scanner *s); 41 | 42 | /////////////////////////////////////////////////////////////////////////////// 43 | } // namespace re2clex 44 | } // namespace cpplexer 45 | } // namespace wave 46 | } // namespace boost 47 | 48 | #ifdef BOOST_MSVC 49 | #pragma warning(pop) 50 | #endif 51 | 52 | // the suffix header occurs after all of the code 53 | #ifdef BOOST_HAS_ABI_HEADERS 54 | #include BOOST_ABI_SUFFIX 55 | #endif 56 | 57 | #endif // !defined(CPP_RE_HPP_B76C4F5E_63E9_4B8A_9975_EC32FA6BF027_INCLUDED) 58 | -------------------------------------------------------------------------------- /samples/real_positions/instantiate_cpp_literalgrs.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | Example: real_positions 4 | 5 | http://www.boost.org/ 6 | 7 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 8 | Software License, Version 1.0. (See accompanying file 9 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | =============================================================================*/ 11 | 12 | #include 13 | 14 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 15 | 16 | #include 17 | 18 | #include 19 | 20 | #include "real_position_token.hpp" // token class 21 | #include // lexer type 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Explicit instantiation of the intlit_grammar_gen, chlit_grammar_gen and 30 | // floatlit_grammar_gen templates with the correct token type. This 31 | // instantiates the corresponding parse function, which in turn instantiates 32 | // the corresponding parser object. 33 | // 34 | /////////////////////////////////////////////////////////////////////////////// 35 | 36 | typedef lex_token<> token_type; 37 | 38 | template struct boost::wave::grammars::intlit_grammar_gen; 39 | #if BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_AUTOSELECT || \ 40 | BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_FORCE_SIGNED 41 | template struct boost::wave::grammars::chlit_grammar_gen; 42 | #endif 43 | template struct boost::wave::grammars::chlit_grammar_gen; 44 | 45 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 46 | 47 | -------------------------------------------------------------------------------- /samples/cpp_tokens/instantiate_cpp_literalgrs.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: prints out the preprocessed tokens returned by the pp iterator 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #include "cpp_tokens.hpp" // config data 14 | 15 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 16 | 17 | #include 18 | 19 | #include 20 | 21 | #include "slex_token.hpp" 22 | #include "slex_iterator.hpp" 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // 30 | // Explicit instantiation of the intlit_grammar_gen, chlit_grammar_gen and 31 | // floatlit_grammar_gen templates with the correct token type. This 32 | // instantiates the corresponding parse function, which in turn instantiates 33 | // the corresponding parser object. 34 | // 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | typedef boost::wave::cpplexer::slex_token<> token_type; 38 | 39 | template struct boost::wave::grammars::intlit_grammar_gen; 40 | #if BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_AUTOSELECT || \ 41 | BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_FORCE_SIGNED 42 | template struct boost::wave::grammars::chlit_grammar_gen; 43 | #endif 44 | template struct boost::wave::grammars::chlit_grammar_gen; 45 | 46 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 47 | 48 | -------------------------------------------------------------------------------- /src/instantiate_cpp_exprgrammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #define BOOST_WAVE_SOURCE 1 11 | 12 | // disable stupid compiler warnings 13 | #include 14 | #include 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | // this must occur after all of the includes and before any code appears 27 | #ifdef BOOST_HAS_ABI_HEADERS 28 | #include BOOST_ABI_PREFIX 29 | #endif 30 | 31 | /////////////////////////////////////////////////////////////////////////////// 32 | // 33 | // Explicit instantiation of the expression_grammar_gen template with the 34 | // correct lexer iterator type. This instantiates the corresponding parse 35 | // function, which in turn instantiates the expression_grammar object (see 36 | // wave/grammars/cpp_expression_grammar.hpp) 37 | // 38 | /////////////////////////////////////////////////////////////////////////////// 39 | 40 | // if you want to use your own token type the following line must be adjusted 41 | typedef boost::wave::cpplexer::lex_token<> token_type; 42 | 43 | // no need to change anything below 44 | template struct boost::wave::grammars::expression_grammar_gen; 45 | 46 | // the suffix header occurs after all of the code 47 | #ifdef BOOST_HAS_ABI_HEADERS 48 | #include BOOST_ABI_SUFFIX 49 | #endif 50 | 51 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 52 | 53 | -------------------------------------------------------------------------------- /samples/list_includes/instantiate_cpp_literalgrs.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: List include dependencies of a given source file 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #include "list_includes.hpp" // config data 14 | 15 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 16 | 17 | #include 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // 30 | // Explicit instantiation of the intlit_grammar_gen, chlit_grammar_gen and 31 | // floatlit_grammar_gen templates with the correct token type. This 32 | // instantiates the corresponding parse function, which in turn instantiates 33 | // the corresponding parser object. 34 | // 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | typedef boost::wave::cpplexer::lex_token<> token_type; 38 | 39 | template struct boost::wave::grammars::intlit_grammar_gen; 40 | #if BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_AUTOSELECT || \ 41 | BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_FORCE_SIGNED 42 | template struct boost::wave::grammars::chlit_grammar_gen; 43 | #endif 44 | template struct boost::wave::grammars::chlit_grammar_gen; 45 | 46 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 47 | 48 | -------------------------------------------------------------------------------- /src/instantiate_defined_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #define BOOST_WAVE_SOURCE 1 11 | 12 | // disable stupid compiler warnings 13 | #include 14 | #include 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | // this must occur after all of the includes and before any code appears 26 | #ifdef BOOST_HAS_ABI_HEADERS 27 | #include BOOST_ABI_PREFIX 28 | #endif 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | // 32 | // Explicit instantiation of the defined_grammar_gen template 33 | // with the correct token type. This instantiates the corresponding parse 34 | // function, which in turn instantiates the defined_grammar 35 | // object (see wave/grammars/cpp_defined_grammar.hpp) 36 | // 37 | /////////////////////////////////////////////////////////////////////////////// 38 | 39 | // if you want to use your own token type the following line must be adjusted 40 | typedef boost::wave::cpplexer::lex_token<> token_type; 41 | 42 | // no need to change anything below 43 | typedef boost::wave::cpplexer::lex_iterator lexer_type; 44 | template struct boost::wave::grammars::defined_grammar_gen; 45 | 46 | // the suffix header occurs after all of the code 47 | #ifdef BOOST_HAS_ABI_HEADERS 48 | #include BOOST_ABI_SUFFIX 49 | #endif 50 | 51 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 52 | 53 | -------------------------------------------------------------------------------- /samples/token_statistics/token_statistics.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: Collect token statistics from the analysed files 5 | 6 | http://www.boost.org/ 7 | 8 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 9 | Software License, Version 1.0. (See accompanying file 10 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 11 | =============================================================================*/ 12 | 13 | #if !defined(TOKEN_STATISTICS_HPP) 14 | #define TOKEN_STATISTICS_HPP 15 | 16 | /////////////////////////////////////////////////////////////////////////////// 17 | // include often used files from the stdlib 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | /////////////////////////////////////////////////////////////////////////////// 24 | // include boost config 25 | #include // global configuration information 26 | #include 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | // build version 30 | #include "token_statistics_version.hpp" 31 | 32 | /////////////////////////////////////////////////////////////////////////////// 33 | // Now include the configuration stuff for the Wave library itself 34 | #include 35 | 36 | /////////////////////////////////////////////////////////////////////////////// 37 | // MSVC specific #pragma's 38 | #if defined(BOOST_MSVC) 39 | #pragma warning (disable: 4355) // 'this' used in base member initializer list 40 | #pragma warning (disable: 4800) // forcing value to bool 'true' or 'false' 41 | #pragma inline_depth(255) 42 | #pragma inline_recursion(on) 43 | #endif // defined(BOOST_MSVC) 44 | 45 | /////////////////////////////////////////////////////////////////////////////// 46 | // include required boost libraries 47 | #include 48 | 49 | #endif // !defined(TOKEN_STATISTICS_HPP) 50 | -------------------------------------------------------------------------------- /src/instantiate_predef_macros.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #define BOOST_WAVE_SOURCE 1 11 | 12 | // disable stupid compiler warnings 13 | #include 14 | #include 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | // this must occur after all of the includes and before any code appears 26 | #ifdef BOOST_HAS_ABI_HEADERS 27 | #include BOOST_ABI_PREFIX 28 | #endif 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | // 32 | // Explicit instantiation of the predefined_macros_grammar_gen template 33 | // with the correct token type. This instantiates the corresponding pt_parse 34 | // function, which in turn instantiates the cpp_predefined_macros_grammar 35 | // object (see wave/grammars/cpp_predef_macros_grammar.hpp) 36 | // 37 | /////////////////////////////////////////////////////////////////////////////// 38 | 39 | // if you want to use your own token type the following line must be adjusted 40 | typedef boost::wave::cpplexer::lex_token<> token_type; 41 | 42 | // no need to change anything below 43 | typedef boost::wave::cpplexer::lex_iterator lexer_type; 44 | template struct boost::wave::grammars::predefined_macros_grammar_gen; 45 | 46 | // the suffix header occurs after all of the code 47 | #ifdef BOOST_HAS_ABI_HEADERS 48 | #include BOOST_ABI_SUFFIX 49 | #endif 50 | 51 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 52 | 53 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_017.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // tests, whether true and false are usable a 'normal' identifiers 11 | 12 | #define true 1 13 | #define false 0 14 | 15 | //R #line 18 "t_9_017.cpp" 16 | //R 1 is defined 17 | #if defined(true) 18 | true is defined 19 | #else 20 | true is not defined 21 | #endif 22 | 23 | //R #line 26 "t_9_017.cpp" 24 | //R 0 is defined 25 | #if defined(false) 26 | false is defined 27 | #else 28 | false is not defined 29 | #endif 30 | 31 | #undef true 32 | #undef false 33 | 34 | //R #line 37 "t_9_017.cpp" 35 | //R true is not defined 36 | #ifndef true 37 | true is not defined 38 | #else 39 | true is defined 40 | #endif 41 | 42 | //R #line 45 "t_9_017.cpp" 43 | //R false is not defined 44 | #ifndef false 45 | false is not defined 46 | #else 47 | false is defined 48 | #endif 49 | 50 | //H 10: t_9_017.cpp(12): #define 51 | //H 08: t_9_017.cpp(12): true=1 52 | //H 10: t_9_017.cpp(13): #define 53 | //H 08: t_9_017.cpp(13): false=0 54 | //H 10: t_9_017.cpp(17): #if 55 | //H 11: t_9_017.cpp(17): #if defined(true): 1 56 | //H 01: t_9_017.cpp(12): true 57 | //H 02: 1 58 | //H 03: 1 59 | //H 10: t_9_017.cpp(19): #else 60 | //H 10: t_9_017.cpp(25): #if 61 | //H 11: t_9_017.cpp(25): #if defined(false): 1 62 | //H 01: t_9_017.cpp(13): false 63 | //H 02: 0 64 | //H 03: 0 65 | //H 10: t_9_017.cpp(27): #else 66 | //H 10: t_9_017.cpp(31): #undef 67 | //H 09: t_9_017.cpp(31): true 68 | //H 10: t_9_017.cpp(32): #undef 69 | //H 09: t_9_017.cpp(32): false 70 | //H 10: t_9_017.cpp(36): #ifndef 71 | //H 11: t_9_017.cpp(36): #ifndef true: 0 72 | //H 10: t_9_017.cpp(38): #else 73 | //H 10: t_9_017.cpp(44): #ifndef 74 | //H 11: t_9_017.cpp(44): #ifndef false: 0 75 | //H 10: t_9_017.cpp(46): #else 76 | -------------------------------------------------------------------------------- /samples/waveidl/instantiate_re2c_lexer.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: IDL oriented preprocessor 5 | Explicit instantiation of the lex_functor generation function 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "idl.hpp" 15 | 16 | #if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "idllexer/idl_lex_iterator.hpp" 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // The following file needs to be included only once throughout the whole 27 | // program. 28 | #include "idllexer/idl_re2c_lexer.hpp" 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | // 32 | // This instantiates the correct 'new_lexer' function, which generates the 33 | // C++ lexer used in this sample. You will have to instantiate the 34 | // new_lexer_gen<> template with the same iterator type, as you have used for 35 | // instantiating the boost::wave::context<> object. 36 | // 37 | // This is moved into a separate compilation unit to decouple the compilation 38 | // of the C++ lexer from the compilation of the other modules, which helps to 39 | // reduce compilation time. 40 | // 41 | // The template parameter(s) supplied should be identical to the first 42 | // parameter supplied while instantiating the boost::wave::context<> template 43 | // (see the file cpp.cpp). 44 | // 45 | /////////////////////////////////////////////////////////////////////////////// 46 | 47 | template struct boost::wave::idllexer::new_lexer_gen< 48 | BOOST_WAVE_STRINGTYPE::iterator>; 49 | 50 | #endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 51 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_4_004.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests, whether invalid expression errors get ignored for 'passive' #elif 11 | // expressions 12 | #define USHRT_MAX 0xffffU 13 | 14 | // The number of bytes in a short. 15 | # if !defined (SIZEOF_SHORT) 16 | # if (USHRT_MAX) == 255U 17 | # define SIZEOF_SHORT 1 18 | # elif (USHRT_MAX) == 65535U 19 | # define SIZEOF_SHORT 2 20 | # elif (USHRT_MAX) == 4294967295U 21 | # define SIZEOF_SHORT 4 22 | # elif (USHRT_MAX) == 18446744073709551615U 23 | # define SIZEOF_SHORT 8 24 | # else 25 | # error: unsupported short size, must be updated for this platform! 26 | # endif /* USHRT_MAX */ 27 | # endif /* !defined (SIZEOF_SHORT) */ 28 | 29 | //R #line 32 "t_4_004.cpp" 30 | //R true 31 | #if SIZEOF_SHORT == 2 32 | true 33 | #else 34 | false 35 | #endif 36 | 37 | //H 10: t_4_004.cpp(12): #define 38 | //H 08: t_4_004.cpp(12): USHRT_MAX=0xffffU 39 | //H 10: t_4_004.cpp(15): # if 40 | //H 11: t_4_004.cpp(15): # if !defined (SIZEOF_SHORT): 1 41 | //H 10: t_4_004.cpp(16): # if 42 | //H 01: t_4_004.cpp(12): USHRT_MAX 43 | //H 02: 0xffffU 44 | //H 03: 0xffffU 45 | //H 11: t_4_004.cpp(16): # if (USHRT_MAX) == 255U: 0 46 | //H 10: t_4_004.cpp(18): # elif 47 | //H 01: t_4_004.cpp(12): USHRT_MAX 48 | //H 02: 0xffffU 49 | //H 03: 0xffffU 50 | //H 11: t_4_004.cpp(18): # elif (USHRT_MAX) == 65535U: 1 51 | //H 10: t_4_004.cpp(19): #define 52 | //H 08: t_4_004.cpp(19): SIZEOF_SHORT=2 53 | //H 10: t_4_004.cpp(20): # elif 54 | //H 10: t_4_004.cpp(22): # elif 55 | //H 10: t_4_004.cpp(27): # endif 56 | //H 10: t_4_004.cpp(31): #if 57 | //H 01: t_4_004.cpp(19): SIZEOF_SHORT 58 | //H 02: 2 59 | //H 03: 2 60 | //H 11: t_4_004.cpp(31): #if SIZEOF_SHORT == 2: 1 61 | //H 10: t_4_004.cpp(33): #else 62 | -------------------------------------------------------------------------------- /samples/waveidl/instantiate_re2c_lexer_str.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | Sample: IDL oriented preprocessor 5 | Explicit instantiation of the lex_functor generation function 6 | 7 | http://www.boost.org/ 8 | 9 | Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost 10 | Software License, Version 1.0. (See accompanying file 11 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | =============================================================================*/ 13 | 14 | #include "idl.hpp" 15 | 16 | #if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "idllexer/idl_lex_iterator.hpp" 24 | 25 | /////////////////////////////////////////////////////////////////////////////// 26 | // The following file needs to be included only once throughout the whole 27 | // program. 28 | #include "idllexer/idl_re2c_lexer.hpp" 29 | 30 | /////////////////////////////////////////////////////////////////////////////// 31 | // 32 | // If you've used another iterator type as std::string::iterator, you have to 33 | // instantiate the new_lexer_gen<> template for this iterator type too. 34 | // The reason is, that the library internally uses the new_lexer_gen<> 35 | // template with a std::string::iterator. (You just have to undefine the 36 | // following line.) 37 | // 38 | // This is moved into a separate compilation unit to decouple the compilation 39 | // of the C++ lexer from the compilation of the other modules, which helps to 40 | // reduce compilation time. 41 | // 42 | // The template parameter(s) supplied should be identical to the first 43 | // parameter supplied while instantiating the boost::wave::context<> template 44 | // (see the file cpp.cpp). 45 | // 46 | /////////////////////////////////////////////////////////////////////////////// 47 | 48 | template struct boost::wave::idllexer::new_lexer_gen; 49 | 50 | #endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0 51 | -------------------------------------------------------------------------------- /src/instantiate_cpp_grammar.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #define BOOST_WAVE_SOURCE 1 11 | 12 | // disable stupid compiler warnings 13 | #include 14 | #include 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | // this must occur after all of the includes and before any code appears 27 | #ifdef BOOST_HAS_ABI_HEADERS 28 | #include BOOST_ABI_PREFIX 29 | #endif 30 | 31 | /////////////////////////////////////////////////////////////////////////////// 32 | // 33 | // Explicit instantiation of the cpp_grammar_gen template with the correct 34 | // token type. This instantiates the corresponding pt_parse function, which 35 | // in turn instantiates the cpp_grammar object 36 | // (see wave/grammars/cpp_grammar.hpp) 37 | // 38 | /////////////////////////////////////////////////////////////////////////////// 39 | 40 | // if you want to use your own token type the following line must be adjusted 41 | typedef boost::wave::cpplexer::lex_token<> token_type; 42 | 43 | // no need to change anything below 44 | typedef boost::wave::cpplexer::lex_iterator lexer_type; 45 | typedef std::list > 46 | token_sequence_type; 47 | 48 | template struct boost::wave::grammars::cpp_grammar_gen; 49 | 50 | // the suffix header occurs after all of the code 51 | #ifdef BOOST_HAS_ABI_HEADERS 52 | #include BOOST_ABI_SUFFIX 53 | #endif 54 | 55 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 56 | 57 | -------------------------------------------------------------------------------- /include/boost/wave/cpplexer/re2clex/aq.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | 4 | http://www.boost.org/ 5 | 6 | Copyright (c) 2001 Daniel C. Nuffer. 7 | Copyright (c) 2001-2012 Hartmut Kaiser. 8 | Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | =============================================================================*/ 11 | 12 | #if !defined(AQ_HPP_A21D9145_B643_44C0_81E7_DB346DD67EE1_INCLUDED) 13 | #define AQ_HPP_A21D9145_B643_44C0_81E7_DB346DD67EE1_INCLUDED 14 | 15 | #include 16 | #include 17 | 18 | // this must occur after all of the includes and before any code appears 19 | #ifdef BOOST_HAS_ABI_HEADERS 20 | #include BOOST_ABI_PREFIX 21 | #endif 22 | 23 | /////////////////////////////////////////////////////////////////////////////// 24 | namespace boost { 25 | namespace wave { 26 | namespace cpplexer { 27 | namespace re2clex { 28 | 29 | typedef std::size_t aq_stdelement; 30 | 31 | typedef struct tag_aq_queuetype 32 | { 33 | std::size_t head; 34 | std::size_t tail; 35 | std::size_t size; 36 | std::size_t max_size; 37 | aq_stdelement* queue; 38 | } aq_queuetype; 39 | 40 | typedef aq_queuetype* aq_queue; 41 | 42 | int aq_enqueue(aq_queue q, aq_stdelement e); 43 | int aq_enqueue_front(aq_queue q, aq_stdelement e); 44 | int aq_serve(aq_queue q, aq_stdelement *e); 45 | int aq_pop(aq_queue q); 46 | #define AQ_EMPTY(q) (q->size == 0) 47 | #define AQ_FULL(q) (q->size == q->max_size) 48 | int aq_grow(aq_queue q); 49 | 50 | BOOST_WAVE_DECL aq_queue aq_create(void); 51 | BOOST_WAVE_DECL void aq_terminate(aq_queue q); 52 | 53 | /////////////////////////////////////////////////////////////////////////////// 54 | } // namespace re2clex 55 | } // namespace cpplexer 56 | } // namespace wave 57 | } // namespace boost 58 | 59 | // the suffix header occurs after all of the code 60 | #ifdef BOOST_HAS_ABI_HEADERS 61 | #include BOOST_ABI_SUFFIX 62 | #endif 63 | 64 | #endif // !defined(AQ_HPP_A21D9145_B643_44C0_81E7_DB346DD67EE1_INCLUDED) 65 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_9_003.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Test, if additional whitespace is inserted at appropriate places. 11 | 12 | #define STRINGIZE(x) STRINGIZE_D(x) 13 | #define STRINGIZE_D(x) #x 14 | 15 | #define X() 1 16 | #define PLUS() + 17 | #define MINUS() - 18 | #define DOT() . 19 | #define GREATER() > 20 | #define LESS() < 21 | 22 | //R #line 23 "t_9_003.cpp" 23 | X()2 //R 1 2 24 | STRINGIZE( X()2 ) //R "12" 25 | //R 26 | X() 2 //R 1 2 27 | STRINGIZE( X() 2 ) //R "1 2" 28 | //R 29 | PLUS()MINUS() //R +- 30 | STRINGIZE( PLUS()MINUS() ) //R "+-" 31 | //R 32 | PLUS()PLUS() //R + + 33 | STRINGIZE( PLUS()PLUS() ) //R "++" 34 | //R 35 | MINUS()MINUS() //R - - 36 | STRINGIZE( MINUS()MINUS() ) //R "--" 37 | //R 38 | DOT()DOT()DOT() //R .. . 39 | STRINGIZE( DOT()DOT()DOT() ) //R "..." 40 | 41 | // the following are regressions reported by Stefan Seefeld 42 | //R #line 43 "t_9_003.cpp" 43 | GREATER()GREATER() //R > > 44 | STRINGIZE( GREATER()GREATER() ) //R ">>" 45 | //R 46 | LESS()LESS() //R < < 47 | STRINGIZE( LESS()LESS() ) //R "<<" 48 | 49 | #define COMMA() , 50 | #define AND() & 51 | #define CHAR() char 52 | #define STAR() * 53 | 54 | // Make sure no whitespace gets inserted in between the operator symbols 55 | //R #line 56 "t_9_003.cpp" 56 | void foo(char&, char) //R void foo(char&, char) 57 | void foo(char *) //R void foo(char *) 58 | void foo(char *&) //R void foo(char *&) 59 | void foo(CHAR()AND()COMMA() CHAR()) //R void foo(char&, char) 60 | void foo(CHAR() STAR()) //R void foo(char *) 61 | void foo(CHAR() STAR()AND()) //R void foo(char *&) 62 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_5_031.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | The tests included in this file were initially taken from the mcpp V2.5 10 | preprocessor validation suite and were modified to fit into the Boost.Wave 11 | unit test requirements. 12 | The original files of the mcpp preprocessor are distributed under the 13 | license reproduced at the end of this file. 14 | =============================================================================*/ 15 | 16 | __FILE__ 17 | __LINE__ 18 | 19 | /*- 20 | * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui 21 | * All rights reserved. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the above copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 32 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 33 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 34 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 35 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 36 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 40 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 41 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 42 | * SUCH DAMAGE. 43 | */ 44 | 45 | -------------------------------------------------------------------------------- /src/instantiate_cpp_literalgrs.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | #define BOOST_WAVE_SOURCE 1 11 | 12 | // disable stupid compiler warnings 13 | #include 14 | #include 15 | 16 | #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | // this must occur after all of the includes and before any code appears 28 | #ifdef BOOST_HAS_ABI_HEADERS 29 | #include BOOST_ABI_PREFIX 30 | #endif 31 | 32 | /////////////////////////////////////////////////////////////////////////////// 33 | // 34 | // Explicit instantiation of the intlit_grammar_gen and chlit_grammar_gen 35 | // templates with the correct token type. This instantiates the corresponding 36 | // parse function, which in turn instantiates the corresponding parser object. 37 | // 38 | /////////////////////////////////////////////////////////////////////////////// 39 | 40 | typedef boost::wave::cpplexer::lex_token<> token_type; 41 | 42 | // no need to change anything below 43 | template struct boost::wave::grammars::intlit_grammar_gen; 44 | #if BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_AUTOSELECT || \ 45 | BOOST_WAVE_WCHAR_T_SIGNEDNESS == BOOST_WAVE_WCHAR_T_FORCE_SIGNED 46 | template struct boost::wave::grammars::chlit_grammar_gen; 47 | #endif 48 | template struct boost::wave::grammars::chlit_grammar_gen; 49 | 50 | // the suffix header occurs after all of the code 51 | #ifdef BOOST_HAS_ABI_HEADERS 52 | #include BOOST_ABI_SUFFIX 53 | #endif 54 | 55 | #endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0 56 | 57 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_007.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | //O --variadics 11 | 12 | // Tests the correctness of parameter replacement, if the parameter is 13 | // adjacent to an operator '##'. 14 | 15 | #define CONCAT(a, b) PRIMITIVE_CONCAT(a, b) 16 | #define PRIMITIVE_CONCAT(a, b) a ## b 17 | 18 | //R #line 20 "t_1_007.cpp" 19 | //R 123 20 | CONCAT(1, PRIMITIVE_CONCAT(2, 3)) 21 | //R #line 23 "t_1_007.cpp" 22 | //R 123 23 | CONCAT(1, CONCAT(2, 3)) 24 | //R #line 26 "t_1_007.cpp" 25 | //R 1 CONCAT(2, 3) 26 | PRIMITIVE_CONCAT(1, CONCAT(2, 3)) 27 | 28 | //H 10: t_1_007.cpp(15): #define 29 | //H 08: t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b) 30 | //H 10: t_1_007.cpp(16): #define 31 | //H 08: t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b 32 | //H 00: t_1_007.cpp(20): CONCAT(1, PRIMITIVE_CONCAT(2, 3)), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] 33 | //H 00: t_1_007.cpp(20): PRIMITIVE_CONCAT(2, 3), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] 34 | //H 02: 23 35 | //H 03: 23 36 | //H 02: PRIMITIVE_CONCAT(1, 23) 37 | //H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(1, 23), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] 38 | //H 02: 123 39 | //H 03: 123 40 | //H 03: 123 41 | //H 00: t_1_007.cpp(23): CONCAT(1, CONCAT(2, 3)), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] 42 | //H 00: t_1_007.cpp(23): CONCAT(2, 3), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] 43 | //H 02: PRIMITIVE_CONCAT(2, 3) 44 | //H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(2, 3), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] 45 | //H 02: 23 46 | //H 03: 23 47 | //H 03: 23 48 | //H 02: PRIMITIVE_CONCAT(1, 23) 49 | //H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(1, 23), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] 50 | //H 02: 123 51 | //H 03: 123 52 | //H 03: 123 53 | //H 00: t_1_007.cpp(26): PRIMITIVE_CONCAT(1, CONCAT(2, 3)), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] 54 | //H 02: 1CONCAT(2, 3) 55 | //H 03: 1CONCAT(2, 3) 56 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_1_003.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | =============================================================================*/ 9 | 10 | // Tests macro expansion order in conjunction with the need to skip expansion 11 | // of the same macro as it is currently expanded. 12 | 13 | #define CONCAT(a, b) a ## b 14 | #define CONCAT_INDIRECT() CONCAT 15 | 16 | //R #line 18 "t_1_003.cpp" 17 | //R CONCAT(1, 2) 18 | CONCAT(CON, CAT)(1, 2) 19 | //R #line 21 "t_1_003.cpp" 20 | //R CONCAT(1, 2) 21 | CONCAT(CON, CAT(1, 2)) 22 | //R #line 24 "t_1_003.cpp" 23 | //R 12 24 | CONCAT(CONCAT_, INDIRECT)()(1, 2) 25 | //R #line 27 "t_1_003.cpp" 26 | //R CONCAT(1, 2) 27 | CONCAT(CONCAT_, INDIRECT())(1, 2) 28 | 29 | //R #line 31 "t_1_003.cpp" 30 | //R 1 CONCAT(2, 3) 31 | CONCAT(1, CONCAT(2, 3)) 32 | 33 | //H 10: t_1_003.cpp(13): #define 34 | //H 08: t_1_003.cpp(13): CONCAT(a, b)=a ## b 35 | //H 10: t_1_003.cpp(14): #define 36 | //H 08: t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT 37 | //H 00: t_1_003.cpp(18): CONCAT(CON, CAT), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] 38 | //H 02: CONCAT 39 | //H 03: CONCAT 40 | //H 00: t_1_003.cpp(21): CONCAT(CON, CAT(1, 2)), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] 41 | //H 02: CONCAT(1, 2) 42 | //H 03: CONCAT(1, 2) 43 | //H 00: t_1_003.cpp(24): CONCAT(CONCAT_, INDIRECT), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] 44 | //H 02: CONCAT_INDIRECT 45 | //H 03: CONCAT_INDIRECT 46 | //H 00: t_1_003.cpp(24): CONCAT_INDIRECT(), [t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT] 47 | //H 02: CONCAT 48 | //H 03: CONCAT 49 | //H 00: t_1_003.cpp(14): CONCAT(1, 2), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] 50 | //H 02: 12 51 | //H 03: 12 52 | //H 00: t_1_003.cpp(27): CONCAT(CONCAT_, INDIRECT()), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] 53 | //H 02: CONCAT_INDIRECT() 54 | //H 00: t_1_003.cpp(27): CONCAT_INDIRECT(), [t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT] 55 | //H 02: CONCAT 56 | //H 03: CONCAT 57 | //H 03: CONCAT 58 | //H 00: t_1_003.cpp(31): CONCAT(1, CONCAT(2, 3)), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] 59 | //H 02: 1CONCAT(2, 3) 60 | //H 03: 1CONCAT(2, 3) 61 | -------------------------------------------------------------------------------- /test/testwave/testfiles/t_5_035_01.hpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | Boost.Wave: A Standard compliant C++ preprocessor library 3 | http://www.boost.org/ 4 | 5 | Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 | Software License, Version 1.0. (See accompanying file 7 | LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | The tests included in this file were initially taken from the mcpp V2.5 10 | preprocessor validation suite and were modified to fit into the Boost.Wave 11 | unit test requirements. 12 | The original files of the mcpp preprocessor are distributed under the 13 | license reproduced at the end of this file. 14 | =============================================================================*/ 15 | 16 | // Tests translation limits. 17 | 18 | #undef NEST 19 | #define NEST 1 20 | 21 | #include "t_5_035_02.hpp" 22 | 23 | /*- 24 | * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui 25 | * All rights reserved. 26 | * 27 | * Redistribution and use in source and binary forms, with or without 28 | * modification, are permitted provided that the following conditions 29 | * are met: 30 | * 1. Redistributions of source code must retain the above copyright 31 | * notice, this list of conditions and the following disclaimer. 32 | * 2. Redistributions in binary form must reproduce the above copyright 33 | * notice, this list of conditions and the following disclaimer in the 34 | * documentation and/or other materials provided with the distribution. 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 37 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 39 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 40 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 41 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 42 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 44 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 45 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 46 | * SUCH DAMAGE. 47 | */ 48 | 49 | --------------------------------------------------------------------------------