1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/mbdyn.h,v 1.46 2017/01/12 14:45:48 masarati Exp $ */ 2 /* 3 * MBDyn (C) is a multibody analysis code. 4 * http://www.mbdyn.org 5 * 6 * Copyright (C) 1996-2017 7 * 8 * Pierangelo Masarati <masarati@aero.polimi.it> 9 * Paolo Mantegazza <mantegazza@aero.polimi.it> 10 * 11 * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano 12 * via La Masa, 34 - 20156 Milano, Italy 13 * http://www.aero.polimi.it 14 * 15 * Changing this copyright notice is forbidden. 16 * 17 * This program is free software; you can redistribute it and/or modify 18 * it under the terms of the GNU General Public License as published by 19 * the Free Software Foundation (version 2 of the License). 20 * 21 * 22 * This program is distributed in the hope that it will be useful, 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 * GNU General Public License for more details. 26 * 27 * You should have received a copy of the GNU General Public License 28 * along with this program; if not, write to the Free Software 29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 */ 31 32 #ifndef MBDYN_H 33 #define MBDYN_H 34 35 /* Global typedefs (unused yet) */ 36 typedef double mbReal; 37 typedef int mbInt; 38 typedef long int mbLong; 39 typedef long int mbFlag; 40 41 /* Math typedefs (deprecated; will be obsoleted) */ 42 #ifndef HAVE_F2C_H /* defined in "f2c.h" */ 43 typedef long int flag; /* boolean return value; will be obsoleted by "bool" */ 44 #endif /* !HAVE_F2C_H */ 45 #if 0 46 typedef unsigned int Index; 47 #endif 48 typedef int Int; 49 typedef long int Lint; 50 typedef double Real; 51 52 /* signal types */ 53 #if defined(HAVE_SIGNAL) && !defined(__FreeBSD__) && !defined(__DragonFly__) 54 #ifndef HAVE___SIGHANDLER_T 55 #ifndef HAVE_SIGHANDLER_T 56 typedef void (*__sighandler_t)(int); 57 #else /* HAVE_SIGHANDLER_T */ 58 typedef sighandler_t __sighandler_t; 59 #endif /* HAVE_SIGHANDLER_T */ 60 #endif /* !HAVE___SIGHANDLER_T */ 61 #endif /* HAVE_SIGNAL */ 62 63 /* sig_atomic_t */ 64 #ifndef HAVE_SIG_ATOMIC_T 65 typedef int sig_atomic_t; 66 #endif /* HAVE_SIG_ATOMIC_T */ 67 68 /* replacement for bool */ 69 #ifdef HAVE_BOOL 70 #ifdef NEED_BOOL_H 71 #include <bool.h> 72 #endif /* NEED_BOOL_H */ 73 #else /* !HAVE_BOOL */ 74 typedef int bool; 75 enum { 76 false = 0, 77 true = 1 78 }; 79 #endif /* !HAVE_BOOL */ 80 81 /* decides whether to build include capability in parser */ 82 #if defined(HAVE_GETCWD) && defined(HAVE_CHDIR) 83 #define USE_INCLUDE_PARSER 84 #endif /* defined(HAVE_GETCWD) && defined(HAVE_CHDIR) */ 85 86 /* Global macros */ 87 #ifdef __cplusplus 88 89 /* Global variables */ 90 extern int fSilent; 91 extern int fPedantic; 92 93 #define silent_output \ 94 (::fSilent > 0) 95 #define silent_out \ 96 (::fSilent < 1) 97 #define silent_err \ 98 (::fSilent < 2) 99 100 #define silent_cout(arg) \ 101 do { \ 102 if (silent_out) { \ 103 std::cout << arg; \ 104 } \ 105 } while (0) 106 107 #define silent_cerr(arg) \ 108 do { \ 109 if (silent_err) { \ 110 std::cerr << arg; \ 111 } \ 112 } while (0) 113 114 #define pedantic_output \ 115 (::fPedantic > 0) 116 #define pedantic_out \ 117 (::fPedantic > 1) 118 #define pedantic_err \ 119 (::fPedantic > 0) 120 121 #define pedantic_cout(arg) \ 122 do { \ 123 if (pedantic_out) { \ 124 std::cout << arg; \ 125 } \ 126 } while (0) 127 128 #define pedantic_cerr(arg) \ 129 do { \ 130 if (pedantic_err) { \ 131 std::cerr << arg; \ 132 } \ 133 } while (0) 134 135 #endif /* __cplusplus */ 136 137 /* Debug levels (from 0x0001 to 0x0080 are reserved) */ 138 enum { 139 MYDEBUG_RESERVED_MASK = 0x000000FFU, 140 141 MYDEBUG_INPUT = 0x00000100U, 142 MYDEBUG_ASSEMBLY = 0x00000200U, 143 MYDEBUG_DERIVATIVES = 0x00000400U, 144 MYDEBUG_FSTEPS = 0x00000800U, 145 MYDEBUG_MEM = 0x00001000U, 146 MYDEBUG_MPI = 0x00002000U, 147 MYDEBUG_PRED = 0x00004000U, 148 MYDEBUG_RESIDUAL = 0x00008000U, 149 MYDEBUG_SOL = 0x00010000U, 150 MYDEBUG_INIT = 0x00020000U, 151 MYDEBUG_OUTPUT = 0x00040000U, 152 MYDEBUG_JAC = 0x00080000U, 153 154 MYDEBUG_MASK = ((~0) & (~MYDEBUG_RESERVED_MASK)) 155 }; 156 157 #ifdef USE_RTAI 158 /* visible to all */ 159 extern void *rtmbdyn_rtai_task; 160 #endif /* USE_RTAI */ 161 162 #ifndef LINE_MAX 163 #define LINE_MAX (2000) 164 #endif /* LINE_MAX */ 165 166 #define STRLENOF(s) (sizeof(s) - 1) 167 168 #endif /* MBDYN_H */ 169 170