paul@455 | 1 | /* |
paul@455 | 2 | * Format specifiers for output. |
paul@455 | 3 | * |
paul@479 | 4 | * Copyright (C) 2022, 2023 Paul Boddie <paul@boddie.org.uk> |
paul@455 | 5 | * |
paul@455 | 6 | * This program is free software; you can redistribute it and/or |
paul@455 | 7 | * modify it under the terms of the GNU General Public License as |
paul@455 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@455 | 9 | * the License, or (at your option) any later version. |
paul@455 | 10 | * |
paul@455 | 11 | * This program is distributed in the hope that it will be useful, |
paul@455 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@455 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@455 | 14 | * GNU General Public License for more details. |
paul@455 | 15 | * |
paul@455 | 16 | * You should have received a copy of the GNU General Public License |
paul@455 | 17 | * along with this program; if not, write to the Free Software |
paul@455 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@455 | 19 | * Boston, MA 02110-1301, USA |
paul@455 | 20 | */ |
paul@455 | 21 | |
paul@455 | 22 | #pragma once |
paul@455 | 23 | |
paul@455 | 24 | #include <stdint.h> |
paul@455 | 25 | |
paul@455 | 26 | /* In principle, the PR macros in inttypes.h should be usable, but some strange |
paul@455 | 27 | conflict seems to arise when building programs using them, resulting in |
paul@455 | 28 | errors when the macros are used. */ |
paul@455 | 29 | |
paul@455 | 30 | #define pFMT32 "" |
paul@455 | 31 | |
paul@455 | 32 | #if __WORDSIZE == 64 |
paul@455 | 33 | #define pFMT64 "l" |
paul@464 | 34 | #define pFMTword pFMT64 |
paul@455 | 35 | #else |
paul@455 | 36 | #define pFMT64 "ll" |
paul@464 | 37 | #define pFMTword pFMT32 |
paul@455 | 38 | #endif |
paul@455 | 39 | |
paul@455 | 40 | /* See: systypes/base.h */ |
paul@455 | 41 | |
paul@458 | 42 | #define pFMToffset "ll" |
paul@479 | 43 | #define pFMTnotify_flags "ll" |
paul@458 | 44 | |
paul@458 | 45 | /* Alternative for size_t or ssize_t (%z). */ |
paul@458 | 46 | |
paul@458 | 47 | #if __WORDSIZE == 32 |
paul@458 | 48 | #define pFMTsize pFMT32 |
paul@458 | 49 | #else |
paul@458 | 50 | #define pFMTsize "l" |
paul@458 | 51 | #endif |
paul@455 | 52 | |
paul@464 | 53 | /* Other format specifiers. */ |
paul@464 | 54 | |
paul@464 | 55 | #define pFMTnlink pFMTword |
paul@464 | 56 | |
paul@455 | 57 | // vim: tabstop=2 expandtab shiftwidth=2 |