From 417acba531f9e4f7e5384bf235919a10178f6291 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Nov 2023 19:05:11 +0800 Subject: [PATCH] save --- CMakeFiles/wjr.dir/compiler_depend.internal | 2 +- CMakeFiles/wjr.dir/compiler_depend.make | 2 +- include/wjr/preprocessor/arithmatic/dec.hpp | 6 +++--- include/wjr/preprocessor/arithmatic/inc.hpp | 1 - include/wjr/preprocessor/compiler/arch.hpp | 6 +++--- .../wjr/preprocessor/compiler/compiler.hpp | 6 +++--- include/wjr/preprocessor/compiler/simd.hpp | 6 +++--- include/wjr/preprocessor/details.hpp | 7 ++++++- include/wjr/preprocessor/details/basic.hpp | 13 +++++++------ main.cpp | 4 ++-- wjr | Bin 17928 -> 17928 bytes 11 files changed, 29 insertions(+), 24 deletions(-) diff --git a/CMakeFiles/wjr.dir/compiler_depend.internal b/CMakeFiles/wjr.dir/compiler_depend.internal index 276a4fd3..47295db0 100644 --- a/CMakeFiles/wjr.dir/compiler_depend.internal +++ b/CMakeFiles/wjr.dir/compiler_depend.internal @@ -268,8 +268,8 @@ CMakeFiles/wjr.dir/main.cpp.o /usr/lib/gcc/x86_64-redhat-linux/8/include/wbnoinvdintrin.h /usr/lib/gcc/x86_64-redhat-linux/8/include/pkuintrin.h /root/wjr/include/wjr/preprocessor/details.hpp - /root/wjr/include/wjr/preprocessor/details/repeat.hpp /root/wjr/include/wjr/preprocessor/details/iota.hpp + /root/wjr/include/wjr/preprocessor/details/repeat.hpp /root/wjr/include/wjr/preprocessor/queue.hpp /root/wjr/include/wjr/preprocessor/queue/call.hpp /root/wjr/include/wjr/preprocessor/queue/basic.hpp diff --git a/CMakeFiles/wjr.dir/compiler_depend.make b/CMakeFiles/wjr.dir/compiler_depend.make index dcfe5843..a83a60f4 100644 --- a/CMakeFiles/wjr.dir/compiler_depend.make +++ b/CMakeFiles/wjr.dir/compiler_depend.make @@ -267,8 +267,8 @@ CMakeFiles/wjr.dir/main.cpp.o: main.cpp \ /usr/lib/gcc/x86_64-redhat-linux/8/include/wbnoinvdintrin.h \ /usr/lib/gcc/x86_64-redhat-linux/8/include/pkuintrin.h \ include/wjr/preprocessor/details.hpp \ - include/wjr/preprocessor/details/repeat.hpp \ include/wjr/preprocessor/details/iota.hpp \ + include/wjr/preprocessor/details/repeat.hpp \ include/wjr/preprocessor/queue.hpp \ include/wjr/preprocessor/queue/call.hpp \ include/wjr/preprocessor/queue/basic.hpp diff --git a/include/wjr/preprocessor/arithmatic/dec.hpp b/include/wjr/preprocessor/arithmatic/dec.hpp index 1efff1f9..5105ac69 100644 --- a/include/wjr/preprocessor/arithmatic/dec.hpp +++ b/include/wjr/preprocessor/arithmatic/dec.hpp @@ -1,5 +1,5 @@ -#ifndef WJR_PREPROCESSOR_ARITHMATIC_HPP__ -#define WJR_PREPROCESSOR_ARITHMATIC_HPP__ +#ifndef WJR_PREPROCESSOR_ARITHMATIC_DEC_HPP__ +#define WJR_PREPROCESSOR_ARITHMATIC_DEC_HPP__ #define WJR_PP_DEC(x) WJR_PP_DEC_I(x) @@ -71,4 +71,4 @@ #define WJR_PP_DEC_63 62 #define WJR_PP_DEC_64 63 -#endif // WJR_PREPROCESSOR_ARITHMATIC_HPP__ \ No newline at end of file +#endif // WJR_PREPROCESSOR_ARITHMATIC_DEC_HPP__ \ No newline at end of file diff --git a/include/wjr/preprocessor/arithmatic/inc.hpp b/include/wjr/preprocessor/arithmatic/inc.hpp index 3d4dd549..33708619 100644 --- a/include/wjr/preprocessor/arithmatic/inc.hpp +++ b/include/wjr/preprocessor/arithmatic/inc.hpp @@ -2,7 +2,6 @@ #define WJR_PREPROCESSOR_ARITHMATIC_INC_HPP__ #define WJR_PP_INC(x) WJR_PP_INC_I(x) - #define WJR_PP_INC_I(x) WJR_PP_INC_##x #define WJR_PP_INC_0 1 diff --git a/include/wjr/preprocessor/compiler/arch.hpp b/include/wjr/preprocessor/compiler/arch.hpp index 50798749..434c34f0 100644 --- a/include/wjr/preprocessor/compiler/arch.hpp +++ b/include/wjr/preprocessor/compiler/arch.hpp @@ -1,5 +1,5 @@ -#ifndef WJR_PREPROCESSOR_COMPILER_ARCH_H__ -#define WJR_PREPROCESSOR_COMPILER_ARCH_H__ +#ifndef WJR_PREPROCESSOR_COMPILER_ARCH_HPP__ +#define WJR_PREPROCESSOR_COMPILER_ARCH_HPP__ #if defined(__pnacl__) || defined(__CLR_VER) #define WJR_VM @@ -43,4 +43,4 @@ #define CPU_UNKNOWN #endif -#endif // !WJR_PREPROCESSOR_COMPILER_ARCH_H__ \ No newline at end of file +#endif // !WJR_PREPROCESSOR_COMPILER_ARCH_HPP__ \ No newline at end of file diff --git a/include/wjr/preprocessor/compiler/compiler.hpp b/include/wjr/preprocessor/compiler/compiler.hpp index a1f0433a..2e1d8ef6 100644 --- a/include/wjr/preprocessor/compiler/compiler.hpp +++ b/include/wjr/preprocessor/compiler/compiler.hpp @@ -1,5 +1,5 @@ -#ifndef WJR_PREPROCESSOR_COMPILER_COMPILER_H__ -#define WJR_PREPROCESSOR_COMPILER_COMPILER_H__ +#ifndef WJR_PREPROCESSOR_COMPILER_COMPILER_HPP__ +#define WJR_PREPROCESSOR_COMPILER_COMPILER_HPP__ #include #include @@ -93,4 +93,4 @@ #endif #endif -#endif // !WJR_PREPROCESSOR_COMPILER_COMPILER_H__ \ No newline at end of file +#endif // !WJR_PREPROCESSOR_COMPILER_COMPILER_HPP__ \ No newline at end of file diff --git a/include/wjr/preprocessor/compiler/simd.hpp b/include/wjr/preprocessor/compiler/simd.hpp index 033939f5..d7af714d 100644 --- a/include/wjr/preprocessor/compiler/simd.hpp +++ b/include/wjr/preprocessor/compiler/simd.hpp @@ -1,5 +1,5 @@ -#ifndef WJR_PREPROCESSOR_COMPILER_SIMD_H__ -#define WJR_PREPROCESSOR_COMPILER_SIMD_H__ +#ifndef WJR_PREPROCESSOR_COMPILER_SIMD_HPP__ +#define WJR_PREPROCESSOR_COMPILER_SIMD_HPP__ #if defined(_MSC_VER) /* Microsoft C/C++-compatible compiler */ @@ -113,4 +113,4 @@ #define WJR_XOP 0 #endif -#endif // ! WJR_PREPROCESSOR_COMPILER_SIMD_H__ +#endif // ! WJR_PREPROCESSOR_COMPILER_SIMD_HPP__ \ No newline at end of file diff --git a/include/wjr/preprocessor/details.hpp b/include/wjr/preprocessor/details.hpp index 46bb1456..18408b61 100644 --- a/include/wjr/preprocessor/details.hpp +++ b/include/wjr/preprocessor/details.hpp @@ -2,7 +2,12 @@ #define WJR_PREPROCESSOR_DETAILS_HPP__ #include -#include #include +#include +#include + +#define WJR_PP_TABLE_DEF() WJR_PP_HOLDER, 1 +#define WJR_PP_IS_TABLE(TABLE, KEY) \ + WJR_PP_BOOL_NOT(WJR_PP_IS_NULLPTR(WJR_PP_MAP_FIND(TABLE, KEY))) #endif // ! WJR_PREPROCESSOR_DETAILS_HPP__ \ No newline at end of file diff --git a/include/wjr/preprocessor/details/basic.hpp b/include/wjr/preprocessor/details/basic.hpp index 55523794..e21204ad 100644 --- a/include/wjr/preprocessor/details/basic.hpp +++ b/include/wjr/preprocessor/details/basic.hpp @@ -35,10 +35,7 @@ _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, N, ...) \ N -#define WJR_PP_HOLDER -#define WJR_PP_NULLPTR - -#define WJR_PP_IS_NULLPTR(VAL) WJR_PP_IS_NULLPTR_I(WJR_PP_IS_NULLPTR##VAL, 0) +#define WJR_PP_IS_NULLPTR(VAL) WJR_PP_IS_NULLPTR_I(WJR_PP_CONCAT(WJR_PP_IS_NULLPTR_, VAL), 0) #define WJR_PP_IS_NULLPTR_I(...) WJR_PP_IS_NULLPTR_II(__VA_ARGS__) #define WJR_PP_IS_NULLPTR_II(HOLDER, VAL, ...) VAL #define WJR_PP_IS_NULLPTR_WJR_PP_NULLPTR WJR_PP_HOLDER, 1 @@ -48,13 +45,17 @@ // if MAP ## KEY is defined as WJR_PP_MAP_DEF, then return VAL // else return WJR_PP_NULLPTR #define WJR_PP_MAP_FIND(MAP, KEY) WJR_PP_MAP_FIND_I(MAP, KEY) -#define WJR_PP_MAP_FIND_I(MAP, KEY) WJR_PP_MAP_FIND_II(MAP##KEY, WJR_PP_NULLPTR) +#define WJR_PP_MAP_FIND_I(MAP, KEY) \ + WJR_PP_MAP_FIND_II(WJR_PP_CONCAT(MAP, KEY), WJR_PP_NULLPTR) #define WJR_PP_MAP_FIND_II(...) WJR_PP_MAP_FIND_III(__VA_ARGS__) #define WJR_PP_MAP_FIND_III(HOLDER, VAL, ...) VAL +// Most macros rely on this macro. +// If there are tokens such as (), [], ->that cannot be connected in macro parameters, +// then this macro needs to be used for conversion #define WJR_PP_DEF_VAR(VAR) _WJR_PP_FROM_VAR(VAR) -#define WJR_PP_FROM_VAR(VAR) WJR_PP_FROM_VAR_I(WJR_PP_FROM_VAR##VAR, VAR) +#define WJR_PP_FROM_VAR(VAR) WJR_PP_FROM_VAR_I(WJR_PP_CONCAT(WJR_PP_FROM_VAR, VAR), VAR) #define WJR_PP_FROM_VAR_I(...) WJR_PP_FROM_VAR_II(__VA_ARGS__) #define WJR_PP_FROM_VAR_II(HOLDER, VAL, ...) VAL #define WJR_PP_FROM_VAR_WJR_PP_FROM_VAR(VAR) WJR_PP_HOLDER, VAR diff --git a/main.cpp b/main.cpp index a5787cc8..71f57a08 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,7 @@ #include #include int main() { -#define WJR_PP_MAP_inline WJR_PP_MAP_DEF - std::cout << WJR_PP_STR(WJR_PP_EXPAND(WJR_PP_MAP(WJR_PP_MAP_, inline))) << '\n'; +#define WJR_PP_FUNC_INLINE WJR_PP_TABLE_DEF() + std::cout << WJR_PP_STR((WJR_PP_IS_TABLE(WJR_PP_FUNC_, INLINE))) << '\n'; return 0; } diff --git a/wjr b/wjr index a7924d7ba34d95f1e25c339306621b31e42f7b67..d4fbf71bdda42304ab8061daf830d0319696a45b 100644 GIT binary patch delta 58 zcmV-A0LA}^i~)#@0kDJu6i9}g!&Qvh3`Q6WXOvDtAeeh9yt9}B9RvXbv$h8E0Rt#8 QDYL5xy*U9CvuQ$~18~q3KmY&$ delta 60 zcmV-C0K@-?i~)#@0kDJu6d%{5<;ykgoV%R9F)4$GK~!?TzI9RvXZv$h8E0Ru1q S0JEzIy*ZQg0uZx!LXZP9AQ>9~