#pragma once $$ Please, use Pump to convert this source file to valid C++ header. $$ Note that lines in this file could be longer than 80 symbols. $var n = 199 $range i 0..n /*! \internal */ #ifndef PREPROCESSOR_GEN_H_ #error "Direct inclusion of this file is not allowed, include preprocessor.h" // For the sake of sane code completion. #include "preprocessor.h" #endif #undef PREPROCESSOR_GEN_H_ //////////////////////////////////////////////////////////////////////////////// #define PP_COUNT_IMPL(...) PP_CONCAT(PP_COUNT_CONST_, PP_COUNT_IMPL_0 __VA_ARGS__) $for i [[ #define PP_COUNT_CONST_PP_COUNT_IMPL_$i $i ]] $for i [[ #define PP_COUNT_IMPL_$i(_) PP_COUNT_IMPL_$(i+1) ]] //////////////////////////////////////////////////////////////////////////////// #define PP_KILL_IMPL(seq, index) PP_CONCAT(PP_KILL_IMPL_, index) seq #define PP_KILL_IMPL_0 $for i [[ #define PP_KILL_IMPL_$(i+1)(_) PP_KILL_IMPL_$i ]] //////////////////////////////////////////////////////////////////////////////// #define PP_ELEMENT_IMPL(seq, index) PP_ELEMENT_IMPL_A((PP_CONCAT(PP_ELEMENT_IMPL_, index) seq)) #define PP_ELEMENT_IMPL_A(x) PP_ELEMENT_IMPL_C(PP_ELEMENT_IMPL_B x) #define PP_ELEMENT_IMPL_B(x, _) x #define PP_ELEMENT_IMPL_C(x) x #define PP_ELEMENT_IMPL_0(x) x, PP_NIL $for i [[ #define PP_ELEMENT_IMPL_$(i+1)(_) PP_ELEMENT_IMPL_$i ]] //////////////////////////////////////////////////////////////////////////////// #define PP_HEAD_IMPL(seq) PP_ELEMENT_IMPL(seq, 0) //////////////////////////////////////////////////////////////////////////////// #define PP_TAIL_IMPL(seq) PP_KILL_IMPL(seq, 1) //////////////////////////////////////////////////////////////////////////////// #define PP_FOR_EACH_IMPL(what, seq) PP_CONCAT(PP_FOR_EACH_IMPL_, PP_COUNT(seq))(what, seq) #define PP_FOR_EACH_IMPL_0(what, seq) $for i [[ #define PP_FOR_EACH_IMPL_$(i+1)(what, seq) what(PP_HEAD(seq)) PP_FOR_EACH_IMPL_$i(what, PP_TAIL(seq)) ]] //////////////////////////////////////////////////////////////////////////////// /*! \endinternal */