1 /*@ Internal: opposite of code-ou.h. 2 * 3 * Copyright (c) 2003 - 2020 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>. 4 * SPDX-License-Identifier: ISC 5 * 6 * Permission to use, copy, modify, and/or distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 #ifndef su_CODE_H 19 # error su/code-in.h must be included after su/code.h 20 #endif 21 #ifdef su_CODE_IN_H 22 # error su/code-ou.h must be included before including su/code-in.h again 23 #endif 24 #define su_CODE_IN_H 25 /* LANG */ 26 #undef C_LANG 27 #undef C_DECL_BEGIN 28 #undef C_DECL_END 29 #define C_LANG su_C_LANG 30 #define C_DECL_BEGIN su_C_DECL_BEGIN 31 #define C_DECL_END su_C_DECL_END 32 #define NSPC_BEGIN su_NSPC_BEGIN 33 #define NSPC_END su_NSPC_END 34 #define NSPC_USE su_NSPC_USE 35 #define NSPC su_NSPC 36 #if defined su_CXX_HEADER || (defined su_SOURCE && !su_C_LANG) 37 # define CLASS_NO_COPY su_CLASS_NO_COPY 38 # define SELFTHIS_RET su_SELFTHIS_RET 39 # define PUB su_PUB 40 # define PRO su_PRO 41 # define PRI su_PRI 42 # define STA su_STA 43 # define VIR su_VIR 44 # define OVR su_OVR 45 # define OVRX su_OVRX 46 #endif 47 #define S su_S 48 #define R su_R 49 #define C su_C 50 #define NIL su_NIL 51 #define SHADOW su_SHADOW 52 #if defined su_HEADER || defined su_CXX_HEADER 53 # ifdef su_SOURCE 54 # define EXPORT su_EXPORT 55 # define EXPORT_DATA su_EXPORT_DATA 56 # define IMPORT su_IMPORT 57 # define IMPORT_DATA su_IMPORT_DATA 58 # endif 59 #elif defined mx_HEADER 60 # ifdef mx_SOURCE 61 # define EXPORT su_EXPORT 62 # define EXPORT_DATA su_EXPORT_DATA 63 # define IMPORT su_IMPORT 64 # define IMPORT_DATA su_IMPORT_DATA 65 # endif 66 #elif defined rf_HEADER 67 # ifdef rf_SOURCE 68 # define EXPORT su_EXPORT 69 # define EXPORT_DATA su_EXPORT_DATA 70 # define IMPORT su_IMPORT 71 # define IMPORT_DATA su_IMPORT_DATA 72 # endif 73 #endif 74 #ifndef EXPORT 75 # define EXPORT su_IMPORT 76 # define EXPORT_DATA su_IMPORT_DATA 77 # define IMPORT su_IMPORT 78 # define IMPORT_DATA su_IMPORT_DATA 79 #endif 80 #define CTA su_CTA 81 #define LCTA su_LCTA 82 #define CTAV su_CTAV 83 #define LCTAV su_LCTAV 84 #define MCTA su_MCTA 85 /* CC */ 86 #define INLINE su_INLINE 87 #define SINLINE su_SINLINE 88 #define LIKELY su_LIKELY 89 #define UNLIKELY su_UNLIKELY 90 /* SUPPORT MACROS+ */ 91 #undef ABS 92 #undef CLIP 93 #undef IS_POW2 94 #undef MAX 95 #undef MIN 96 #undef ROUND_DOWN 97 #undef ROUND_DOWN2 98 #undef ROUND_UP 99 #undef ROUND_UP2 100 #define ABS su_ABS 101 #define CLIP su_CLIP 102 #define IS_POW2 su_IS_POW2 103 #define MAX su_MAX 104 #define MIN su_MIN 105 #define ROUND_DOWN su_ROUND_DOWN 106 #define ROUND_DOWN2 su_ROUND_DOWN2 107 #define ROUND_UP su_ROUND_UP 108 #define ROUND_UP2 su_ROUND_UP2 109 #define ALIGNOF su_ALIGNOF 110 #define P_ALIGN su_P_ALIGN 111 #define Z_ALIGN_OVER su_Z_ALIGN_OVER 112 #define Z_ALIGN su_Z_ALIGN 113 #define Z_ALIGN_PZ su_Z_ALIGN_PZ 114 /* ASSERT series */ 115 #define ASSERT_INJ su_ASSERT_INJ 116 #define ASSERT_INJOR su_ASSERT_INJOR 117 #define ASSERT_NB su_ASSERT_NB 118 #define ASSERT su_ASSERT 119 #define ASSERT_LOC su_ASSERT_LOC 120 #define ASSERT_EXEC su_ASSERT_EXEC 121 #define ASSERT_EXEC_LOC su_ASSERT_EXEC_LOC 122 #define ASSERT_JUMP su_ASSERT_JUMP 123 #define ASSERT_JUMP_LOC su_ASSERT_JUMP_LOC 124 #define ASSERT_RET su_ASSERT_RET 125 #define ASSERT_RET_LOC su_ASSERT_RET_LOC 126 #define ASSERT_RET_VOID su_ASSERT_RET_VOID 127 #define ASSERT_RET_VOID_LOC su_ASSERT_RET_VOID_LOC 128 #define ASSERT_NYD_EXEC su_ASSERT_NYD_EXEC 129 #define ASSERT_NYD_EXEC_LOC su_ASSERT_NYD_EXEC_LOC 130 #define ASSERT_NYD su_ASSERT_NYD 131 #define ASSERT_NYD_LOC su_ASSERT_NYD_LOC 132 #define BITENUM_IS su_BITENUM_IS 133 #define BITENUM_MASK su_BITENUM_MASK 134 #define DBG su_DBG 135 #define NDGB su_NDBG 136 #define DBGOR su_DBGOR 137 #define DVL su_DVL 138 #define NDVL su_NDVL 139 #define DVLOR su_DVLOR 140 #define FIELD_INITN su_FIELD_INITN 141 #define FIELD_INITI su_FIELD_INITI 142 #define FIELD_OFFSETOF su_FIELD_OFFSETOF 143 #define FIELD_RANGEOF su_FIELD_RANGEOF 144 #define FIELD_SIZEOF su_FIELD_SIZEOF 145 #define MT su_MT 146 #define NELEM su_NELEM 147 /* Not-Yet-Dead macros TODO stubs */ 148 #define NYD_OU_LABEL su_NYD_OU_LABEL 149 #define su__NYD_IN do{ 150 #define su__NYD_OU goto NYD_OU_LABEL;NYD_OU_LABEL:;}while(0) 151 #define su__NYD do{}while(0) 152 #if defined NDEBUG || (!defined su_HAVE_DEBUG && !defined su_HAVE_DEVEL) 153 # define NYD_IN su__NYD_IN 154 # define NYD_OU su__NYD_OU 155 # define NYD su__NYD 156 #elif defined su_HAVE_DEVEL 157 # define NYD_IN if(1){su_nyd_chirp(1, __FILE__, __LINE__, su_FUN); 158 # define NYD_OU \ 159 goto NYD_OU_LABEL;NYD_OU_LABEL:\ 160 su_nyd_chirp(2, __FILE__, __LINE__, su_FUN);}else{} 161 # define NYD if(0){}else{su_nyd_chirp(0, __FILE__, __LINE__, su_FUN);} 162 #else 163 # define NYD_IN do{su_nyd_chirp(1, __FILE__, __LINE__, su_FUN); 164 # define NYD_OU \ 165 goto NYD_OU_LABEL;NYD_OU_LABEL:\ 166 su_nyd_chirp(2, __FILE__, __LINE__, su_FUN);}while(0) 167 # define NYD do{su_nyd_chirp(0, __FILE__, __LINE__, su_FUN);}while(0) 168 #endif 169 /**/ 170 #ifdef NYD2_ENABLE 171 # undef NYD2_ENABLE 172 # define NYD2_IN NYD_IN 173 # define NYD2_OU NYD_OU 174 # define NYD2 NYD 175 #else 176 # define NYD2_IN su__NYD_IN 177 # define NYD2_OU su__NYD_OU 178 # define NYD2 su__NYD 179 #endif 180 #define P2UZ su_P2UZ 181 #define PCMP su_PCMP 182 /* Translation: may NOT set errno! */ 183 #undef _ 184 #undef N_ 185 #undef V_ 186 #ifdef mx_SOURCE 187 # undef A_ 188 # define A_(S) S 189 # ifdef mx_HAVE_UISTRINGS 190 # define _(S) S 191 # define N_(S) S 192 # define V_(S) S 193 # else 194 # define _(S) su_empty 195 # define N_(S) "" 196 # define V_(S) su_empty 197 # endif 198 #elif defined su_SOURCE 199 # define _(S) S 200 # define N_(S) S 201 # define V_(S) S 202 #endif 203 #define SMP su_SMP 204 #define UCMP su_UCMP 205 #define UNCONST su_UNCONST 206 #define UNVOLATILE su_UNVOLATILE 207 #define UNALIGN su_UNALIGN 208 #define UNINIT su_UNINIT 209 #define UNINIT_DECL su_UNINIT_DECL 210 #define UNUSED su_UNUSED 211 #define VFIELD_SIZE su_VFIELD_SIZE 212 #define VSTRUCT_SIZEOF su_VSTRUCT_SIZEOF 213 /* POD TYPE SUPPORT (only if !C++) */ 214 #if defined su_HEADER ||\ 215 ((defined su_SOURCE || defined mx_SOURCE) && su_C_LANG) 216 # define ul su_ul 217 # define ui su_ui 218 # define us su_us 219 # define uc su_uc 220 # define sl su_sl 221 # define si su_si 222 # define ss su_ss 223 # define sc su_sc 224 # define u8 su_u8 225 # define s8 su_s8 226 # define u16 su_u16 227 # define s16 su_s16 228 # define u32 su_u32 229 # define s32 su_s32 230 # define u64 su_u64 231 # define s64 su_s64 232 # define uz su_uz 233 # define sz su_sz 234 # define up su_up 235 # define sp su_sp 236 # define FAL0 su_FAL0 237 # define TRU1 su_TRU1 238 # define TRU2 su_TRU2 239 # define TRUM1 su_TRUM1 240 # define boole su_boole 241 #endif /* su_HEADER || ((su_SOURCE || mx_SOURCE) && su_C_LANG) */ 242 #define U8_MAX su_U8_MAX 243 #define S8_MIN su_S8_MIN 244 #define S8_MAX su_S8_MAX 245 #define U16_MAX su_U16_MAX 246 #define S16_MIN su_S16_MIN 247 #define S16_MAX su_S16_MAX 248 #define U32_MAX su_U32_MAX 249 #define S32_MIN su_S32_MIN 250 #define S32_MAX su_S32_MAX 251 #define U64_MAX su_U64_MAX 252 #define S64_MIN su_S64_MIN 253 #define S64_MAX su_S64_MAX 254 #define U64_C su_U64_C 255 #define S64_C su_S64_C 256 #define UZ_MAX su_UZ_MAX 257 #define SZ_MIN su_SZ_MIN 258 #define SZ_MAX su_SZ_MAX 259 #define UZ_BITS su_UZ_BITS 260 /* MEMORY */ 261 #define su_ALLOCATE su_MEM_ALLOCATE 262 #define su_ALLOCATE_LOC su_MEM_ALLOCATE_LOC 263 #define su_REALLOCATE su_MEM_REALLOCATE 264 #define su_REALLOCATE_LOC su_MEM_REALLOCATE_LOC 265 #define su_ALLOC su_MEM_ALLOC 266 #define su_ALLOC_LOC su_MEM_ALLOC_LOC 267 #define su_ALLOC_LOCOR su_MEM_ALLOC_LOCOR 268 #define su_ALLOC_N su_MEM_ALLOC_N 269 #define su_ALLOC_N_LOC su_MEM_ALLOC_N_LOC 270 #define su_ALLOC_N_LOCOR su_MEM_ALLOC_N_LOCOR 271 #define su_CALLOC su_MEM_CALLOC 272 #define su_CALLOC_LOC su_MEM_CALLOC_LOC 273 #define su_CALLOC_LOCOR su_MEM_CALLOC_LOCOR 274 #define su_CALLOC_N su_MEM_CALLOC_N 275 #define su_CALLOC_N_LOC su_MEM_CALLOC_N_LOC 276 #define su_CALLOC_N_LOCOR su_MEM_CALLOC_N_LOCOR 277 #define su_REALLOC su_MEM_REALLOC 278 #define su_REALLOC_LOC su_MEM_REALLOC_LOC 279 #define su_REALLOC_LOCOR su_MEM_REALLOC_LOCOR 280 #define su_REALLOC_N su_MEM_REALLOC_N 281 #define su_REALLOC_N_LOC su_MEM_REALLOC_N_LOC 282 #define su_REALLOC_N_LOCOR su_MEM_REALLOC_N_LOCOR 283 #define su_TALLOC su_MEM_TALLOC 284 #define su_TALLOC_LOC su_MEM_TALLOC_LOC 285 #define su_TALLOC_LOCOR su_MEM_TALLOC_LOCOR 286 #define su_TCALLOC su_MEM_TCALLOC 287 #define su_TCALLOC_LOC su_MEM_TCALLOC_LOC 288 #define su_TCALLOC_LOCOR su_MEM_TCALLOC_LOCOR 289 #define su_TREALLOC su_MEM_TREALLOC 290 #define su_TREALLOC_LOC su_MEM_TREALLOC_LOC 291 #define su_TREALLOC_LOCOR su_MEM_TREALLOC_LOCOR 292 #define su_TALLOCF su_MEM_TALLOCF 293 #define su_TALLOCF_LOC su_MEM_TALLOCF_LOC 294 #define su_TALLOCF_LOCOR su_MEM_TALLOCF_LOCOR 295 #define su_TCALLOCF su_MEM_TCALLOCF 296 #define su_TCALLOCF_LOC su_MEM_TCALLOCF_LOC 297 #define su_TCALLOCF_LOCOR su_MEM_TCALLOCF_LOCOR 298 #define su_TREALLOCF su_MEM_TREALLOCF 299 #define su_TREALLOCF_LOC su_MEM_TREALLOCF_LOC 300 #define su_TREALLOCF_LOCOR su_MEM_TREALLOCF_LOCOR 301 #define su_FREE su_MEM_FREE 302 #define su_FREE_LOC su_MEM_FREE_LOC 303 #define su_FREE_LOCOR su_MEM_FREE_LOCOR 304 #if !su_C_LANG 305 # define su_NEW su_MEM_NEW 306 # define su_NEW_LOC su_MEM_NEW_LOC 307 # define su_NEW_LOCOR su_MEM_NEW_LOCOR 308 # define su_CNEW su_MEM_CNEW 309 # define su_CNEW_LOC su_MEM_CNEW_LOC 310 # define su_CNEW_LOCOR su_MEM_CNEW_LOCOR 311 # define su_NEW_HEAP su_MEM_NEW_HEAP 312 # define su_NEW_HEAP_LOC su_MEM_NEW_HEAP_LOC 313 # define su_NEW_HEAP_LOCOR su_MEM_NEW_HEAP_LOCOR 314 # define su_DEL su_MEM_DEL 315 # define su_DEL_LOC su_MEM_DEL_LOC 316 # define su_DEL_LOCOR su_MEM_DEL_LOCOR 317 # define su_DEL_HEAP su_MEM_DEL_HEAP 318 # define su_DEL_HEAP_LOC su_MEM_DEL_HEAP_LOC 319 # define su_DEL_HEAP_LOCOR su_MEM_DEL_HEAP_LOCOR 320 # define su_DEL_PRIVATE su_MEM_DEL_PRIVATE 321 # define su_DEL_PRIVATE_LOC su_MEM_DEL_PRIVATE_LOC 322 # define su_DEL_PRIVATE_LOCOR su_MEM_DEL_PRIVATE_LOCOR 323 # define su_DEL_HEAP_PRIVATE su_MEM_DEL_HEAP_PRIVATE 324 # define su_DEL_HEAP_PRIVATE_LOC su_MEM_DEL_HEAP_PRIVATE_LOC 325 # define su_DEL_HEAP_PRIVATE_LOCOR su_MEM_DEL_HEAP_PRIVATE_LOCOR 326 #endif /* !C_LANG */ 327 #ifdef su_MEM_BAG_SELF 328 # ifdef su_HAVE_MEM_BAG_AUTO 329 # define su_AUTO_ALLOC su_MEM_BAG_SELF_AUTO_ALLOC 330 # define su_AUTO_ALLOC_LOC su_MEM_BAG_SELF_AUTO_ALLOC_LOC 331 # define su_AUTO_ALLOC_LOCOR su_MEM_BAG_SELF_AUTO_ALLOC_LOCOR 332 # define su_AUTO_ALLOC_N su_MEM_BAG_SELF_AUTO_ALLOC_N 333 # define su_AUTO_ALLOC_N_LOC su_MEM_BAG_SELF_AUTO_ALLOC_N_LOC 334 # define su_AUTO_ALLOC_N_LOCOR su_MEM_BAG_SELF_AUTO_ALLOC_N_LOCOR 335 # define su_AUTO_CALLOC su_MEM_BAG_SELF_AUTO_CALLOC 336 # define su_AUTO_CALLOC_LOC su_MEM_BAG_SELF_AUTO_CALLOC_LOC 337 # define su_AUTO_CALLOC_LOCOR su_MEM_BAG_SELF_AUTO_CALLOC_LOCOR 338 # define su_AUTO_CALLOC_N su_MEM_BAG_SELF_AUTO_CALLOC_N 339 # define su_AUTO_CALLOC_N_LOC su_MEM_BAG_SELF_AUTO_CALLOC_N_LOC 340 # define su_AUTO_CALLOC_N_LOCOR su_MEM_BAG_SELF_AUTO_CALLOC_N_LOCOR 341 # define su_AUTO_TALLOC su_MEM_BAG_SELF_AUTO_TALLOC 342 # define su_AUTO_TALLOC_LOC su_MEM_BAG_SELF_AUTO_TALLOC_LOC 343 # define su_AUTO_TALLOC_LOCOR su_MEM_BAG_SELF_AUTO_TALLOC_LOCOR 344 # define su_AUTO_TCALLOC su_MEM_BAG_SELF_AUTO_TCALLOC 345 # define su_AUTO_TCALLOC_LOC su_MEM_BAG_SELF_AUTO_TCALLOC_LOC 346 # define su_AUTO_TCALLOC_LOCOR su_MEM_BAG_SELF_AUTO_TCALLOC_LOCOR 347 # endif /* su_HAVE_MEM_BAG_AUTO */ 348 # ifdef su_HAVE_MEM_BAG_LOFI 349 # define su_LOFI_ALLOC su_MEM_BAG_SELF_LOFI_ALLOC 350 # define su_LOFI_ALLOC_LOC su_MEM_BAG_SELF_LOFI_ALLOC_LOC 351 # define su_LOFI_ALLOC_LOCOR su_MEM_BAG_SELF_LOFI_ALLOC_LOCOR 352 # define su_LOFI_ALLOC_N su_MEM_BAG_SELF_LOFI_ALLOC_N 353 # define su_LOFI_ALLOC_N_LOC su_MEM_BAG_SELF_LOFI_ALLOC_N_LOC 354 # define su_LOFI_ALLOC_N_LOCOR su_MEM_BAG_SELF_LOFI_ALLOC_N_LOCOR 355 # define su_LOFI_CALLOC su_MEM_BAG_SELF_LOFI_CALLOC 356 # define su_LOFI_CALLOC_LOC su_MEM_BAG_SELF_LOFI_CALLOC_LOC 357 # define su_LOFI_CALLOC_LOCOR su_MEM_BAG_SELF_LOFI_CALLOC_LOCOR 358 # define su_LOFI_CALLOC_N su_MEM_BAG_SELF_LOFI_CALLOC_N 359 # define su_LOFI_CALLOC_N_LOC su_MEM_BAG_SELF_LOFI_CALLOC_N_LOC 360 # define su_LOFI_CALLOC_N_LOCOR su_MEM_BAG_SELF_LOFI_CALLOC_N_LOCOR 361 # define su_LOFI_TALLOC su_MEM_BAG_SELF_LOFI_TALLOC 362 # define su_LOFI_TALLOC_LOC su_MEM_BAG_SELF_LOFI_TALLOC_LOC 363 # define su_LOFI_TALLOC_LOCOR su_MEM_BAG_SELF_LOFI_TALLOC_LOCOR 364 # define su_LOFI_TCALLOC su_MEM_BAG_SELF_LOFI_TCALLOC 365 # define su_LOFI_TCALLOC_LOC su_MEM_BAG_SELF_LOFI_TCALLOC_LOC 366 # define su_LOFI_TCALLOC_LOCOR su_MEM_BAG_SELF_LOFI_TCALLOC_LOCOR 367 # define su_LOFI_FREE su_MEM_BAG_SELF_LOFI_FREE 368 # define su_LOFI_FREE_LOC su_MEM_BAG_SELF_LOFI_FREE_LOC 369 # define su_LOFI_FREE_LOCOR su_MEM_BAG_SELF_LOFI_FREE_LOCOR 370 # endif /* su_HAVE_MEM_BAG_LOFI */ 371 #endif /* su_MEM_BAG_SELF */ 372 /* s-it-mode */ 373