| 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 |
| 14 |
extern "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 |
#include <limits.h> |
| 25 |
#include <stdio.h> |
| 26 |
#include <sys/types.h> |
| 27 |
|
| 28 |
/* formatting environment */ |
| 29 |
typedef struct _sffmt_s Sffmt_t; |
| 30 |
typedef int (*Sffmtext_f)(void *, Sffmt_t *); |
| 31 |
struct _sffmt_s { |
| 32 |
Sffmtext_f extf; /* function to process arguments */ |
| 33 |
|
| 34 |
char *form; /* format string to stack */ |
| 35 |
|
| 36 |
int fmt; /* format character */ |
| 37 |
ssize_t size; /* object size */ |
| 38 |
int flags; /* formatting flags */ |
| 39 |
int width; /* width of field */ |
| 40 |
int precis; /* precision required */ |
| 41 |
int base; /* conversion base */ |
| 42 |
|
| 43 |
const char *t_str; /* type string */ |
| 44 |
ssize_t n_str; /* length of t_str */ |
| 45 |
}; |
| 46 |
|
| 47 |
#define SFFMT_SSHORT 00000010 /* 'hh' flag, char */ |
| 48 |
#define SFFMT_TFLAG 00000020 /* 't' flag, ptrdiff_t */ |
| 49 |
#define SFFMT_ZFLAG 00000040 /* 'z' flag, size_t */ |
| 50 |
|
| 51 |
#define SFFMT_LEFT 00000100 /* left-justification */ |
| 52 |
#define SFFMT_SIGN 00000200 /* must have a sign */ |
| 53 |
#define SFFMT_BLANK 00000400 /* if not signed, prepend a blank */ |
| 54 |
#define SFFMT_ZERO 00001000 /* zero-padding on the left */ |
| 55 |
#define SFFMT_ALTER 00002000 /* alternate formatting */ |
| 56 |
#define SFFMT_THOUSAND 00004000 /* thousand grouping */ |
| 57 |
#define SFFMT_SKIP 00010000 /* skip assignment in scanf() */ |
| 58 |
#define SFFMT_SHORT 00020000 /* 'h' flag */ |
| 59 |
#define SFFMT_LONG 00040000 /* 'l' flag */ |
| 60 |
#define SFFMT_LLONG 00100000 /* 'll' flag */ |
| 61 |
#define SFFMT_LDOUBLE 00200000 /* 'L' flag */ |
| 62 |
#define SFFMT_VALUE 00400000 /* value is returned */ |
| 63 |
#define SFFMT_ARGPOS 01000000 /* getting arg for $ patterns */ |
| 64 |
#define SFFMT_IFLAG 02000000 /* 'I' flag */ |
| 65 |
#define SFFMT_JFLAG 04000000 /* 'j' flag, intmax_t */ |
| 66 |
#define SFFMT_SET 07777770 /* flags settable on calling extf */ |
| 67 |
|
| 68 |
extern ssize_t _Sfi; |
| 69 |
|
| 70 |
extern int sfprint(FILE*, Sffmt_t *format); |
| 71 |
extern int sfvscanf(FILE *, Sffmt_t *format); |
| 72 |
|
| 73 |
/* miscellaneous function analogues of fast in-line functions */ |
| 74 |
extern ssize_t sfslen(void); |
| 75 |
|
| 76 |
#ifdef __cplusplus |
| 77 |
} |
| 78 |
#endif |