| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
/* Copyright 2014 Emil Renner Berthing <[email protected]> */ |
| 3 |
#pragma once |
| 4 |
|
| 5 |
#include <stddef.h> |
| 6 |
|
| 7 |
enum { /* C type: */ |
| 8 |
PA_INT, /* int */ |
| 9 |
PA_CHAR, /* int, cast to char */ |
| 10 |
PA_WCHAR, /* wide char */ |
| 11 |
PA_STRING, /* const char *, a '\0'-terminated string */ |
| 12 |
PA_WSTRING, /* const wchar_t *, wide character string */ |
| 13 |
PA_POINTER, /* void * */ |
| 14 |
PA_FLOAT, /* float */ |
| 15 |
PA_DOUBLE, /* double */ |
| 16 |
PA_LAST, |
| 17 |
}; |
| 18 |
|
| 19 |
/* Flag bits that can be set in a type returned by `parse_printf_format'. */ |
| 20 |
#define PA_FLAG_MASK 0xff00 |
| 21 |
#define PA_FLAG_LONG_LONG (1 << 8) |
| 22 |
#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG |
| 23 |
#define PA_FLAG_LONG (1 << 9) |
| 24 |
#define PA_FLAG_SHORT (1 << 10) |
| 25 |
#define PA_FLAG_PTR (1 << 11) |
| 26 |
|
| 27 |
size_t parse_printf_format(const char *fmt, size_t n, int *types); |