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