Introduction
Introduction Statistics Contact Development Disclaimer Help
fmt.h - 9base - revived minimalist port of Plan 9 userland to Unix
git clone git://git.suckless.org/9base
Log
Files
Refs
README
LICENSE
---
fmt.h (3921B)
---
1 #ifndef _FMT_H_
2 #define _FMT_H_ 1
3 #if defined(__cplusplus)
4 extern "C" {
5 #endif
6 /*
7 * The authors of this software are Rob Pike and Ken Thompson.
8 * Copyright (c) 2002 by Lucent Technologies.
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose without fee is hereby granted, provided that this entire noti…
11 * is included in all copies of any software which is or includes a copy
12 * or modification of this software and in all copies of the supporting
13 * documentation for such software.
14 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLI…
15 * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES…
16 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
17 * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
18 */
19
20 #include <stdarg.h>
21 #include <utf.h>
22
23 typedef struct Fmt Fmt;
24 struct Fmt{
25 unsigned char runes; /* output buffer is r…
26 void *start; /* of buffer */
27 void *to; /* current place in the …
28 void *stop; /* end of the buffer; …
29 int (*flush)(Fmt *); /* called when to == stop */
30 void *farg; /* to make flush a clo…
31 int nfmt; /* num chars formatted s…
32 va_list args; /* args passed to do…
33 Rune r; /* % format Rune */
34 int width;
35 int prec;
36 unsigned long flags;
37 char *decimal; /* decimal point; cannot be "" */
38
39 /* For %'d */
40 char *thousands; /* separator for thousands */
41
42 /*
43 * Each char is an integer indicating #digits before next separa…
44 * \xFF: no more grouping (or \x7F; defined to be CHAR_MA…
45 * \x00: repeat previous indefinitely
46 * \x**: count that many
47 */
48 char *grouping; /* descriptor of separator…
49 };
50
51 enum{
52 FmtWidth = 1,
53 FmtLeft = FmtWidth << 1,
54 FmtPrec = FmtLeft << 1,
55 FmtSharp = FmtPrec << 1,
56 FmtSpace = FmtSharp << 1,
57 FmtSign = FmtSpace << 1,
58 FmtApost = FmtSign << 1,
59 FmtZero = FmtApost << 1,
60 FmtUnsigned = FmtZero << 1,
61 FmtShort = FmtUnsigned << 1,
62 FmtLong = FmtShort << 1,
63 FmtVLong = FmtLong << 1,
64 FmtComma = FmtVLong << 1,
65 FmtByte = FmtComma << 1,
66 FmtLDouble = FmtByte << 1,
67
68 FmtFlag = FmtLDouble << 1
69 };
70
71 extern int (*fmtdoquote)(int);
72
73 /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/fmt/?*.c | grep -v static |grep -…
74 int dofmt(Fmt *f, char *fmt);
75 int dorfmt(Fmt *f, const Rune *fmt);
76 double fmtcharstod(int(*f)(void*), void *vp);
77 int fmtfdflush(Fmt *f);
78 int fmtfdinit(Fmt *f, int fd, char *buf, int size);
79 int fmtinstall(int c, int (*f)(Fmt*));
80 int fmtnullinit(Fmt*);
81 void fmtlocaleinit(Fmt*, char*, char*, char*);
82 int fmtprint(Fmt *f, char *fmt, ...);
83 int fmtrune(Fmt *f, int r);
84 int fmtrunestrcpy(Fmt *f, Rune *s);
85 int fmtstrcpy(Fmt *f, char *s);
86 char* fmtstrflush(Fmt *f);
87 int fmtstrinit(Fmt *f);
88 double fmtstrtod(const char *as, char **aas);
89 int fmtvprint(Fmt *f, char *fmt, va_list args);
90 int fprint(int fd, char *fmt, ...);
91 int print(char *fmt, ...);
92 void quotefmtinstall(void);
93 int quoterunestrfmt(Fmt *f);
94 int quotestrfmt(Fmt *f);
95 Rune* runefmtstrflush(Fmt *f);
96 int runefmtstrinit(Fmt *f);
97 Rune* runeseprint(Rune *buf, Rune *e, char *fmt, ...);
98 Rune* runesmprint(char *fmt, ...);
99 int runesnprint(Rune *buf, int len, char *fmt, ...);
100 int runesprint(Rune *buf, char *fmt, ...);
101 Rune* runevseprint(Rune *buf, Rune *e, char *fmt, va_list…
102 Rune* runevsmprint(char *fmt, va_list args);
103 int runevsnprint(Rune *buf, int len, char *fmt, va_list a…
104 char* seprint(char *buf, char *e, char *fmt, ...);
105 char* smprint(char *fmt, ...);
106 int snprint(char *buf, int len, char *fmt, ...);
107 int sprint(char *buf, char *fmt, ...);
108 int vfprint(int fd, char *fmt, va_list args);
109 char* vseprint(char *buf, char *e, char *fmt, va_list arg…
110 char* vsmprint(char *fmt, va_list args);
111 int vsnprint(char *buf, int len, char *fmt, va_list args);
112
113 #if defined(__cplusplus)
114 }
115 #endif
116 #endif
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.