Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_posix/sys/src/cmd/unix/drawterm/libc/fmtdef.h – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/*
2
 * dofmt -- format to a buffer
3
 * the number of characters formatted is returned,
4
 * or -1 if there was an error.
5
 * if the buffer is ever filled, flush is called.
6
 * it should reset the buffer and return whether formatting should continue.
7
 */
8
 
9
typedef int (*Fmts)(Fmt*);
10
 
11
typedef struct Quoteinfo Quoteinfo;
12
struct Quoteinfo
13
{
14
	int	quoted;		/* if set, string must be quoted */
15
	int	nrunesin;	/* number of input runes that can be accepted */
16
	int	nbytesin;	/* number of input bytes that can be accepted */
17
	int	nrunesout;	/* number of runes that will be generated */
18
	int	nbytesout;	/* number of bytes that will be generated */
19
};
20
 
21
/* Edit .+1,/^$/ |cfn |grep -v static | grep __ */
22
double       __Inf(int sign);
23
double       __NaN(void);
24
int          __badfmt(Fmt *f);
25
int          __charfmt(Fmt *f);
26
int          __countfmt(Fmt *f);
27
int          __efgfmt(Fmt *fmt);
28
int          __errfmt(Fmt *f);
29
int          __flagfmt(Fmt *f);
30
int          __fmtFdFlush(Fmt *f);
31
int          __fmtcpy(Fmt *f, const void *vm, int n, int sz);
32
void*        __fmtdispatch(Fmt *f, void *fmt, int isrunes);
33
void *       __fmtflush(Fmt *f, void *t, int len);
34
void         __fmtlock(void);
35
int          __fmtpad(Fmt *f, int n);
36
double       __fmtpow10(int n);
37
int          __fmtrcpy(Fmt *f, const void *vm, int n);
38
void         __fmtunlock(void);
39
int          __ifmt(Fmt *f);
40
int          __isInf(double d, int sign);
41
int          __isNaN(double d);
42
int          __needsquotes(char *s, int *quotelenp);
43
int          __percentfmt(Fmt *f);
44
void         __quotesetup(char *s, Rune *r, int nin, int nout, Quoteinfo *q, int sharp, int runesout);
45
int          __quotestrfmt(int runesin, Fmt *f);
46
int          __rfmtpad(Fmt *f, int n);
47
int          __runefmt(Fmt *f);
48
int          __runeneedsquotes(Rune *r, int *quotelenp);
49
int          __runesfmt(Fmt *f);
50
int          __strfmt(Fmt *f);
51
 
52
#define FMTCHAR(f, t, s, c)\
53
	do{\
54
	if(t + 1 > (char*)s){\
55
		t = __fmtflush(f, t, 1);\
56
		if(t != nil)\
57
			s = f->stop;\
58
		else\
59
			return -1;\
60
	}\
61
	*t++ = c;\
62
	}while(0)
63
 
64
#define FMTRCHAR(f, t, s, c)\
65
	do{\
66
	if(t + 1 > (Rune*)s){\
67
		t = __fmtflush(f, t, sizeof(Rune));\
68
		if(t != nil)\
69
			s = f->stop;\
70
		else\
71
			return -1;\
72
	}\
73
	*t++ = c;\
74
	}while(0)
75
 
76
#define FMTRUNE(f, t, s, r)\
77
	do{\
78
	Rune _rune;\
79
	int _runelen;\
80
	if(t + UTFmax > (char*)s && t + (_runelen = runelen(r)) > (char*)s){\
81
		t = __fmtflush(f, t, _runelen);\
82
		if(t != nil)\
83
			s = f->stop;\
84
		else\
85
			return -1;\
86
	}\
87
	if(r < Runeself)\
88
		*t++ = r;\
89
	else{\
90
		_rune = r;\
91
		t += runetochar(t, &_rune);\
92
	}\
93
	}while(0)
94
 
95
#ifdef va_copy
96
#	define VA_COPY(a,b) va_copy(a,b)
97
#	define VA_END(a) va_end(a)
98
#else
99
#	define VA_COPY(a,b) (a) = (b)
100
#	define VA_END(a)
101
#endif
102
 
103
#define PLAN9PORT