updates from p9p
This commit is contained in:
@ -1,3 +1,17 @@
|
||||
/*
|
||||
* The authors of this software are Rob Pike and Ken Thompson.
|
||||
* Copyright (c) 2002 by Lucent Technologies.
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose without fee is hereby granted, provided that this entire notice
|
||||
* is included in all copies of any software which is or includes a copy
|
||||
* or modification of this software and in all copies of the supporting
|
||||
* documentation for such software.
|
||||
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
|
||||
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* dofmt -- format to a buffer
|
||||
* the number of characters formatted is returned,
|
||||
@ -18,33 +32,41 @@ struct Quoteinfo
|
||||
int nbytesout; /* number of bytes that will be generated */
|
||||
};
|
||||
|
||||
void *_fmtflush(Fmt*, void*, int);
|
||||
void *_fmtdispatch(Fmt*, void*, int);
|
||||
int _floatfmt(Fmt*, double);
|
||||
int _fmtpad(Fmt*, int);
|
||||
int _rfmtpad(Fmt*, int);
|
||||
int _fmtFdFlush(Fmt*);
|
||||
|
||||
int _efgfmt(Fmt*);
|
||||
int _charfmt(Fmt*);
|
||||
int _countfmt(Fmt*);
|
||||
int _flagfmt(Fmt*);
|
||||
int _percentfmt(Fmt*);
|
||||
int _ifmt(Fmt*);
|
||||
int _runefmt(Fmt*);
|
||||
int _runesfmt(Fmt*);
|
||||
int _strfmt(Fmt*);
|
||||
int _badfmt(Fmt*);
|
||||
int _fmtcpy(Fmt*, void*, int, int);
|
||||
int _fmtrcpy(Fmt*, void*, int n);
|
||||
|
||||
void _fmtlock(void);
|
||||
void _fmtunlock(void);
|
||||
/* Edit .+1,/^$/ |cfn |grep -v static | grep __ */
|
||||
double __Inf(int sign);
|
||||
double __NaN(void);
|
||||
int __badfmt(Fmt *f);
|
||||
int __charfmt(Fmt *f);
|
||||
int __countfmt(Fmt *f);
|
||||
int __efgfmt(Fmt *fmt);
|
||||
int __errfmt(Fmt *f);
|
||||
int __flagfmt(Fmt *f);
|
||||
int __fmtFdFlush(Fmt *f);
|
||||
int __fmtcpy(Fmt *f, const void *vm, int n, int sz);
|
||||
void* __fmtdispatch(Fmt *f, void *fmt, int isrunes);
|
||||
void * __fmtflush(Fmt *f, void *t, int len);
|
||||
void __fmtlock(void);
|
||||
int __fmtpad(Fmt *f, int n);
|
||||
double __fmtpow10(int n);
|
||||
int __fmtrcpy(Fmt *f, const void *vm, int n);
|
||||
void __fmtunlock(void);
|
||||
int __ifmt(Fmt *f);
|
||||
int __isInf(double d, int sign);
|
||||
int __isNaN(double d);
|
||||
int __needsquotes(char *s, int *quotelenp);
|
||||
int __percentfmt(Fmt *f);
|
||||
void __quotesetup(char *s, Rune *r, int nin, int nout, Quoteinfo *q, int sharp, int runesout);
|
||||
int __quotestrfmt(int runesin, Fmt *f);
|
||||
int __rfmtpad(Fmt *f, int n);
|
||||
int __runefmt(Fmt *f);
|
||||
int __runeneedsquotes(Rune *r, int *quotelenp);
|
||||
int __runesfmt(Fmt *f);
|
||||
int __strfmt(Fmt *f);
|
||||
|
||||
#define FMTCHAR(f, t, s, c)\
|
||||
do{\
|
||||
if(t + 1 > (char*)s){\
|
||||
t = _fmtflush(f, t, 1);\
|
||||
t = __fmtflush(f, t, 1);\
|
||||
if(t != nil)\
|
||||
s = f->stop;\
|
||||
else\
|
||||
@ -56,7 +78,7 @@ void _fmtunlock(void);
|
||||
#define FMTRCHAR(f, t, s, c)\
|
||||
do{\
|
||||
if(t + 1 > (Rune*)s){\
|
||||
t = _fmtflush(f, t, sizeof(Rune));\
|
||||
t = __fmtflush(f, t, sizeof(Rune));\
|
||||
if(t != nil)\
|
||||
s = f->stop;\
|
||||
else\
|
||||
@ -70,7 +92,7 @@ void _fmtunlock(void);
|
||||
Rune _rune;\
|
||||
int _runelen;\
|
||||
if(t + UTFmax > (char*)s && t + (_runelen = runelen(r)) > (char*)s){\
|
||||
t = _fmtflush(f, t, _runelen);\
|
||||
t = __fmtflush(f, t, _runelen);\
|
||||
if(t != nil)\
|
||||
s = f->stop;\
|
||||
else\
|
||||
@ -83,3 +105,12 @@ void _fmtunlock(void);
|
||||
t += runetochar(t, &_rune);\
|
||||
}\
|
||||
}while(0)
|
||||
|
||||
#ifdef va_copy
|
||||
# define VA_COPY(a,b) va_copy(a,b)
|
||||
# define VA_END(a) va_end(a)
|
||||
#else
|
||||
# define VA_COPY(a,b) (a) = (b)
|
||||
# define VA_END(a)
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user