TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
generique.h
1/****************************************************************************
2* Copyright (c) 2022, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16
17#ifndef generique_inclus
18
19#define generique_inclus
20
21/* macros to paste tokens together to form new names */
22/* 4.2BSD and System V cpp's have different mechanisms for
23 pasting tokens together, but 4.3BSD agrees with System V.
24 ANSI C has defined a new way.
25*/
26
27#if defined(__STDC__) || defined (__STDCPP__) || defined (MICROSOFT)
28/* ANSI C preprocessors will not expand the arguments to a macro;
29 * so we need to add a level of indirection to allow macro expansion of
30 * arguments. (Reiser preprocessors allowed the first arg to be expanded;
31 * this method will allow both to be expanded, which is better than none.)
32 */
33#define name2(a,b) _name2_aux(a,b)
34#define _name2_aux(a,b) a##b
35#define name3(a,b,c) _name3_aux(a,b,c)
36#define _name3_aux(a,b,c) a##b##c
37#define name4(a,b,c,d) _name4_aux(a,b,c,d)
38#define _name4_aux(a,b,c,d) a##b##c##d
39
40#else
41
42#ifdef pyr
43/*
44 * Pyramid run SVR3, but its cpp uses the BSD4.2 version of argument pasting
45 */
46#define name2(a,b) a \
47 b
48#define name3(a,b,c) a \
49 b \
50 c
51#define name4(a,b,c,d) a \
52 b \
53 c \
54 d
55#else
56/*
57 * Most non-ANSI cpps use the "null comment" method
58 */
59#define name2(a,b) a/**/b
60#define name3(a,b,c) a/**/b/**/c
61#define name4(a,b,c,d) a/**/b/**/c/**/d
62#endif
63
64#endif
65
66#define declare(a,t) name2(declare_,a)(t)
67#define implemente(a,t) name2(implemente_,a)(t)
68
69// GF nouvelle macro pour fabriquer des vrais noms pour les listes, les Deriv, les Ref,
70#ifdef _COMPILE_AVEC_GCC_
71#define string_macro_trio(a,b) _inter_name(b)
72#define _inter_name(a) #a
73#else
74#define string_macro_trio(a,b) a
75#endif
76#endif