Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 12, 2023
1 parent bd816cf commit 417acba
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CMakeFiles/wjr.dir/compiler_depend.internal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeFiles/wjr.dir/compiler_depend.make
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions include/wjr/preprocessor/arithmatic/dec.hpp
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -71,4 +71,4 @@
#define WJR_PP_DEC_63 62
#define WJR_PP_DEC_64 63

#endif // WJR_PREPROCESSOR_ARITHMATIC_HPP__
#endif // WJR_PREPROCESSOR_ARITHMATIC_DEC_HPP__
1 change: 0 additions & 1 deletion include/wjr/preprocessor/arithmatic/inc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions include/wjr/preprocessor/compiler/arch.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -43,4 +43,4 @@
#define CPU_UNKNOWN
#endif

#endif // !WJR_PREPROCESSOR_COMPILER_ARCH_H__
#endif // !WJR_PREPROCESSOR_COMPILER_ARCH_HPP__
6 changes: 3 additions & 3 deletions include/wjr/preprocessor/compiler/compiler.hpp
Original file line number Diff line number Diff line change
@@ -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 <wjr/preprocessor/compiler/has.hpp>
#include <wjr/preprocessor/compiler/arch.hpp>
Expand Down Expand Up @@ -93,4 +93,4 @@
#endif
#endif

#endif // !WJR_PREPROCESSOR_COMPILER_COMPILER_H__
#endif // !WJR_PREPROCESSOR_COMPILER_COMPILER_HPP__
6 changes: 3 additions & 3 deletions include/wjr/preprocessor/compiler/simd.hpp
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down Expand Up @@ -113,4 +113,4 @@
#define WJR_XOP 0
#endif

#endif // ! WJR_PREPROCESSOR_COMPILER_SIMD_H__
#endif // ! WJR_PREPROCESSOR_COMPILER_SIMD_HPP__
7 changes: 6 additions & 1 deletion include/wjr/preprocessor/details.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
#define WJR_PREPROCESSOR_DETAILS_HPP__

#include <wjr/preprocessor/details/basic.hpp>
#include <wjr/preprocessor/details/repeat.hpp>
#include <wjr/preprocessor/details/iota.hpp>
#include <wjr/preprocessor/details/repeat.hpp>
#include <wjr/preprocessor/logical/basic.hpp>

#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__
13 changes: 7 additions & 6 deletions include/wjr/preprocessor/details/basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iostream>
#include <wjr/preprocessor.hpp>
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;
}
Binary file modified wjr
Binary file not shown.

0 comments on commit 417acba

Please sign in to comment.