PIPS
|
#include <config.h>
#include "printf-parse.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "xsize.h"
Go to the source code of this file.
Macros | |
#define | PRINTF_PARSE printf_parse |
Formatted output to strings. More... | |
#define | CHAR_T char |
#define | DIRECTIVE char_directive |
#define | DIRECTIVES char_directives |
#define | REGISTER_ARG(_index_, _type_) |
Functions | |
int | PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) |
Get size_t, NULL. More... | |
#define CHAR_T char |
Definition at line 42 of file printf-parse.c.
#define DIRECTIVE char_directive |
Definition at line 43 of file printf-parse.c.
#define DIRECTIVES char_directives |
Definition at line 44 of file printf-parse.c.
#define PRINTF_PARSE printf_parse |
Formatted output to strings.
Copyright (C) 1999-2000, 2002-2003, 2006-2014 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see http://www.gnu.org/licenses/.
This file can be parametrized with the following macros: CHAR_T The element type of the format string. CHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters in the format string are ASCII. DIRECTIVE Structure denoting a format directive. Depends on CHAR_T. DIRECTIVES Structure denoting the set of format directives of a format string. Depends on CHAR_T. PRINTF_PARSE Function that parses a format string. Depends on CHAR_T. STATIC Set to 'static' to declare the function static. ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
Specification.
Default parameters.
Definition at line 41 of file printf-parse.c.
#define REGISTER_ARG | ( | _index_, | |
_type_ | |||
) |
int PRINTF_PARSE | ( | const CHAR_T * | format, |
DIRECTIVES * | d, | ||
arguments * | a | ||
) |
Get size_t, NULL.
Get intmax_t.
malloc(), realloc(), free().
memcpy().
errno.
Checked size_t computations.
pointer into format
number of regular arguments consumed
allocated elements of d->dir
allocated elements of a->arg
pointer to next directive
Initialize the next directive.
Test for positional argument.
Positional argument 0.
n too large, would lead to out of memory later.
Read the flags.
Parse the field width.
Test for positional argument.
Positional argument 0.
n too large, would lead to out of memory later.
arg_posn wrapped around.
Parse the precision.
Test for positional argument.
Positional argument 0.
n too large, would lead to out of memory later.
arg_posn wrapped around.
Parse argument type/size specifiers.
intmax_t = long long
intmax_t = long
'z' is standardized in ISO C 99, but glibc uses 'Z' because the warning facility in gcc-2.95.2 understands only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784).
size_t = long long
size_t = long
ptrdiff_t = long long
ptrdiff_t = long
Read the conversion character.
If 'long long' exists and is the same as 'long', we parse "lld" into TYPE_LONGINT.
If 'unsigned long long' exists and is the same as 'unsigned long', we parse "llu" into TYPE_ULONGINT.
If 'long long' exists and is the same as 'long', we parse "lln" into TYPE_COUNT_LONGINT_POINTER.
Unknown conversion character.
arg_posn wrapped around.
Overflow, would lead to out of memory.
Out of memory.
Definition at line 83 of file printf-parse.c.
References arguments::arg, ARG_NONE, CHAR_T, arguments::count, cp, arguments::direct_alloc_arg, DIRECTIVE, error, FLAG_ALT, FLAG_GROUP, FLAG_LEFT, FLAG_SHOWSIGN, FLAG_SPACE, FLAG_ZERO, free(), int, intmax_t, malloc(), N_DIRECT_ALLOC_ARGUMENTS, N_DIRECT_ALLOC_DIRECTIVES, REGISTER_ARG, size_overflow_p, TYPE_CHAR, TYPE_COUNT_INT_POINTER, TYPE_COUNT_LONGINT_POINTER, TYPE_COUNT_SCHAR_POINTER, TYPE_COUNT_SHORT_POINTER, TYPE_DOUBLE, TYPE_INT, TYPE_LONGDOUBLE, TYPE_LONGINT, TYPE_NONE, TYPE_POINTER, TYPE_SCHAR, TYPE_SHORT, TYPE_STRING, TYPE_UCHAR, TYPE_UINT, TYPE_ULONGINT, TYPE_USHORT, xsum(), and xtimes.