P99
p99_paste.h
Go to the documentation of this file.
1 /* This may look like nonsense, but it really is -*- mode: C; coding: utf-8 -*- */
2 /* */
3 /* Except for parts copied from previous work and as explicitly stated below, */
4 /* the authors and copyright holders for this work are as follows: */
5 /* (C) copyright 2010-2013 Jens Gustedt, INRIA, France */
6 /* (C) copyright 2012 William Morris */
7 /* */
8 /* This file is free software; it is part of the P99 project. */
9 /* */
10 /* Licensed under the Apache License, Version 2.0 (the "License"); */
11 /* you may not use this file except in compliance with the License. */
12 /* You may obtain a copy of the License at */
13 /* */
14 /* http://www.apache.org/licenses/LICENSE-2.0 */
15 /* */
16 /* Unless required by applicable law or agreed to in writing, software */
17 /* distributed under the License is distributed on an "AS IS" BASIS, */
18 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
19 /* See the License for the specific language governing permissions and */
20 /* limitations under the License. */
21 /* */
22 #ifndef P99_PASTE_H_
23 # define P99_PASTE_H_
24 
31 #include "p99_generated.h"
32 
38 /* This was inspired by BOOST's PP_CAT macro. Using such a thing avoids
39  to define multiple levels of expansion for each macro. */
40 #define P99_PASTE0()
41 #define P99_PASTE1(_1) _1
42 
61 #define P99_CAT2(_1, _2) _1 ## _2
62 
82 #define P99_PASTE2(_1, _2) P99_CAT2(_1, _2)
83 #define P99_PASTE3(_1, _2, _3) \
84  P99_PASTE2(P99_PASTE2(_1, _2), _3)
85 #define P99_PASTE4(_1, _2, _3, _4) \
86  P99_PASTE2(P99_PASTE3(_1, _2, _3), _4)
87 #define P99_PASTE5(_1, _2, _3, _4, _5) \
88  P99_PASTE2(P99_PASTE4(_1, _2, _3, _4), _5)
89 #define P99_PASTE6(_1, _2, _3, _4, _5, _6) \
90  P99_PASTE2(P99_PASTE5(_1, _2, _3, _4, _5), _6)
91 
92 #define P99_PASTID0()
93 #define P99_PASTID1(ID) ID
94 #define P00_PASTID2(ID0, ID1) ID0 ## _ ## ID1
95 #define P99_PASTID2(ID0, ID1) P99_IF_EMPTY(ID1)(P00_PASTID2(ID0, p007))(P00_PASTID2(ID0, ID1))
96 
97 #define P99_PASTID(...) P99_PASTE2(P99_PASTID, P99_NARG(__VA_ARGS__))(__VA_ARGS__)
98 
99 #ifndef P00_DOCUMENT_MULTIPLE_ARGUMENT
100 #define P00_DOCUMENT_TYPE_ARGUMENT(MACRO, N)
101 #define P00_DOCUMENT_TYPE_IDENTIFIER_ARGUMENT(MACRO, N)
102 #define P00_DOCUMENT_MULTIPLE_ARGUMENT(MACRO, N)
103 #define P00_DOCUMENT_WARN_VLA_ARGUMENT(MACRO, N)
104 #define P00_DOCUMENT_IDENTIFIER_ARGUMENT(MACRO, N)
105 #define P00_DOCUMENT_PERMITTED_ARGUMENT(MACRO, N)
106 #define P00_DOCUMENT_STATEMENT_ARGUMENT(MACRO, N)
107 #define P00_DOCUMENT_DECLARATION_ARGUMENT(MACRO, N)
108 #define P00_DOCUMENT_MACRO_ARGUMENT(MACRO, N)
109 #define P00_DOCUMENT_NUMBER_ARGUMENT(MACRO, N)
110 #define P00_DOCUMENT_DESIGNATOR_ARGUMENT(MACRO, N)
111 #endif
112 
118 #endif /* !P99_PASTE_H_ */
p99_generated.h
automatically generated macros to handle variadic macros.