realXY_begin.h (3772B)
1 /* Copyright (C) 2013-2023, 2025 Vincent Forest (vaplv@free.fr) 2 * 3 * The RSys library is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published 5 * by the Free Software Foundation, either version 3 of the License, or 6 * (at your option) any later version. 7 * 8 * The RSys library is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with the RSys library. If not, see <http://www.gnu.org/licenses/>. */ 15 16 /* This file can be included once */ 17 #if defined(REALXY_BEGIN_H) 18 #error The realXY_begin.h header is already included 19 #endif 20 #define REALXY_BEGIN_H 21 22 /* Check that the expected arguments are defined */ 23 #if !defined(REALX_DIMENSION__) \ 24 || !defined(REALY_DIMENSION__) \ 25 || !defined(REAL_TYPE__) 26 #error Missing arguments 27 #endif 28 29 #if defined(REALX_REALXY_FUNC__) \ 30 || defined(REALXY_CAST__) \ 31 || defined(REALXY_CTOR__) \ 32 || defined(REALXY_FUNC__) \ 33 || defined(REALXY_REALX_FUNC__) \ 34 || defined(REALXY_REALXY_FUNC__) \ 35 || defined(REALY_FUNC__) \ 36 || defined(SIZEOF_REALXY__) 37 #error Unexpected macro definition 38 #endif 39 40 /* Define the name generator for the realX x realXY -> realXY functions */ 41 #define REALX_REALXY_FUNC__(Func) \ 42 REALX_FUNC__(CONCAT(CONCAT(CONCAT( \ 43 mul, REAL_LETTER__), REALX_DIMENSION__), REALY_DIMENSION__)) 44 45 /* Define the realXY cast functions name */ 46 #define REALXY_CAST__ REALXY_FUNC__ (CONCAT(set_, CONCAT( \ 47 REAL_LETTER_TYPE_COMPATIBLE__, CONCAT(REALX_DIMENSION__, REALY_DIMENSION__)))) 48 49 /* Define the realXY constructor name */ 50 #define REALXY_CTOR__ \ 51 CONCAT(CONCAT(REAL_LETTER__, REALX_DIMENSION__), REALY_DIMENSION__) 52 53 /* Define the function name generators */ 54 #define REALXY_FUNC__(Func) \ 55 CONCAT(CONCAT(CONCAT(CONCAT \ 56 (REAL_LETTER__, REALX_DIMENSION__), REALY_DIMENSION__), _), Func) 57 58 /* Define the name generator for the realXY x realX -> realX functions */ 59 #define REALXY_REALX_FUNC__(Func) \ 60 REALXY_FUNC__(CONCAT(CONCAT(mul, REAL_LETTER__), REALX_DIMENSION__)) 61 62 /* Define the name generator for the realXY x realXY -> realXY functions */ 63 #define REALXY_REALXY_FUNC__(Func) \ 64 REALXY_FUNC__(CONCAT(CONCAT(CONCAT( \ 65 Func, REAL_LETTER__), REALX_DIMENSION__), REALY_DIMENSION__)) 66 67 /* Define the function name generator for the realY functions */ 68 #define REALY_FUNC__(Func) \ 69 CONCAT(CONCAT(CONCAT(REAL_LETTER__, REALY_DIMENSION__), _), Func) 70 71 #define SIZEOF_REALXY__ sizeof(REAL_TYPE__[REALX_DIMENSION__*REALY_DIMENSION__]) 72 73 /* Check the validity of the dimensions */ 74 #include "rsys.h" 75 STATIC_ASSERT 76 (REALX_DIMENSION__ > 1 && REALY_DIMENSION__ > 1, Unexpected_value); 77 78 #include "realX_begin.h"