1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
/*************************************************************************
* Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Details at https://graphviz.org
*************************************************************************/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/* Public header file for the sfio library
**
** Written by Kiem-Phong Vo
*/
#include "config.h"
#include <limits.h>
#include <stdio.h>
#include <sys/types.h>
/* formatting environment */
typedef struct _sffmt_s Sffmt_t;
typedef int (*Sffmtext_f)(void *, Sffmt_t *);
struct _sffmt_s {
Sffmtext_f extf; /* function to process arguments */
char *form; /* format string to stack */
int fmt; /* format character */
ssize_t size; /* object size */
int flags; /* formatting flags */
int width; /* width of field */
int precis; /* precision required */
int base; /* conversion base */
const char *t_str; /* type string */
ssize_t n_str; /* length of t_str */
};
#define SFFMT_SSHORT 00000010 /* 'hh' flag, char */
#define SFFMT_TFLAG 00000020 /* 't' flag, ptrdiff_t */
#define SFFMT_ZFLAG 00000040 /* 'z' flag, size_t */
#define SFFMT_LEFT 00000100 /* left-justification */
#define SFFMT_SIGN 00000200 /* must have a sign */
#define SFFMT_BLANK 00000400 /* if not signed, prepend a blank */
#define SFFMT_ZERO 00001000 /* zero-padding on the left */
#define SFFMT_ALTER 00002000 /* alternate formatting */
#define SFFMT_THOUSAND 00004000 /* thousand grouping */
#define SFFMT_SKIP 00010000 /* skip assignment in scanf() */
#define SFFMT_SHORT 00020000 /* 'h' flag */
#define SFFMT_LONG 00040000 /* 'l' flag */
#define SFFMT_LLONG 00100000 /* 'll' flag */
#define SFFMT_LDOUBLE 00200000 /* 'L' flag */
#define SFFMT_VALUE 00400000 /* value is returned */
#define SFFMT_ARGPOS 01000000 /* getting arg for $ patterns */
#define SFFMT_IFLAG 02000000 /* 'I' flag */
#define SFFMT_JFLAG 04000000 /* 'j' flag, intmax_t */
#define SFFMT_SET 07777770 /* flags settable on calling extf */
extern ssize_t _Sfi;
extern int sfprint(FILE*, Sffmt_t *format);
extern int sfvscanf(FILE *, Sffmt_t *format);
/* miscellaneous function analogues of fast in-line functions */
extern ssize_t sfslen(void);
#ifdef __cplusplus
}
#endif
|