mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
clean up for unix port
This commit is contained in:
parent
5c8a042171
commit
e5aa96acbf
58 changed files with 160 additions and 127 deletions
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
@ -339,10 +339,12 @@ __ifmt(Fmt *f)
|
||||||
* Unsigned verbs
|
* Unsigned verbs
|
||||||
*/
|
*/
|
||||||
switch(f->r){
|
switch(f->r){
|
||||||
case 'o':
|
/* unsigned by default only on Unix
|
||||||
case 'u':
|
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X':
|
case 'X':
|
||||||
|
*/
|
||||||
|
case 'o':
|
||||||
|
case 'u':
|
||||||
fl |= FmtUnsigned;
|
fl |= FmtUnsigned;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -402,7 +404,9 @@ __ifmt(Fmt *f)
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(!(fl & FmtUnsigned)){
|
if(fl & FmtUnsigned)
|
||||||
|
fl &= ~(FmtSign|FmtSpace);
|
||||||
|
else{
|
||||||
if(isv && (vlong)vu < 0){
|
if(isv && (vlong)vu < 0){
|
||||||
vu = -(vlong)vu;
|
vu = -(vlong)vu;
|
||||||
neg = 1;
|
neg = 1;
|
||||||
|
@ -410,8 +414,6 @@ __ifmt(Fmt *f)
|
||||||
u = -(long)u;
|
u = -(long)u;
|
||||||
neg = 1;
|
neg = 1;
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
fl &= ~(FmtSign|FmtSpace); /* no + for unsigned conversions */
|
|
||||||
}
|
}
|
||||||
p = buf + sizeof buf - 1;
|
p = buf + sizeof buf - 1;
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ dorfmt(Fmt *f, const Rune *fmt)
|
||||||
f->stop = s;
|
f->stop = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt = __fmtdispatch(f, fmt, 1);
|
fmt = __fmtdispatch(f, (Rune*)fmt, 1);
|
||||||
if(fmt == nil)
|
if(fmt == nil)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <fmt.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
#include "nan.h"
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
@ -64,7 +64,11 @@ static Convfmt knownfmt[] = {
|
||||||
'p', __ifmt,
|
'p', __ifmt,
|
||||||
'r', __errfmt,
|
'r', __errfmt,
|
||||||
's', __strfmt,
|
's', __strfmt,
|
||||||
'u', __flagfmt, /* in Unix, __ifmt */
|
#ifdef PLAN9PORT
|
||||||
|
'u', __flagfmt,
|
||||||
|
#else
|
||||||
|
'u', __ifmt,
|
||||||
|
#endif
|
||||||
'x', __ifmt,
|
'x', __ifmt,
|
||||||
0, nil,
|
0, nil,
|
||||||
};
|
};
|
||||||
|
@ -103,7 +107,7 @@ __fmtinstall(int c, Fmts f)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fmtinstall(int c, Fmts f)
|
fmtinstall(int c, int (*f)(Fmt*))
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dofmt -- format to a buffer
|
* dofmt -- format to a buffer
|
||||||
* the number of characters formatted is returned,
|
* the number of characters formatted is returned,
|
||||||
|
@ -18,29 +19,6 @@
|
||||||
* if the buffer is ever filled, flush is called.
|
* if the buffer is ever filled, flush is called.
|
||||||
* it should reset the buffer and return whether formatting should continue.
|
* it should reset the buffer and return whether formatting should continue.
|
||||||
*/
|
*/
|
||||||
#define uchar _fmtuchar
|
|
||||||
#define ushort _fmtushort
|
|
||||||
#define uint _fmtuint
|
|
||||||
#define ulong _fmtulong
|
|
||||||
#define vlong _fmtvlong
|
|
||||||
#define uvlong _fmtuvlong
|
|
||||||
|
|
||||||
#ifndef USED
|
|
||||||
#define USED(x) if(x);else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef unsigned char uchar;
|
|
||||||
typedef unsigned short ushort;
|
|
||||||
typedef unsigned int uint;
|
|
||||||
typedef unsigned long ulong;
|
|
||||||
|
|
||||||
#ifndef NOVLONGS
|
|
||||||
typedef unsigned long long uvlong;
|
|
||||||
typedef long long vlong;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef nil
|
|
||||||
#define nil 0 /* cannot be ((void*)0) because used for function pointers */
|
|
||||||
|
|
||||||
typedef int (*Fmts)(Fmt*);
|
typedef int (*Fmts)(Fmt*);
|
||||||
|
|
||||||
|
@ -54,31 +32,36 @@ struct Quoteinfo
|
||||||
int nbytesout; /* number of bytes that will be generated */
|
int nbytesout; /* number of bytes that will be generated */
|
||||||
};
|
};
|
||||||
|
|
||||||
void *__fmtflush(Fmt*, void*, int);
|
/* Edit .+1,/^$/ |cfn |grep -v static | grep __ */
|
||||||
void *__fmtdispatch(Fmt*, void*, int);
|
double __Inf(int sign);
|
||||||
int __floatfmt(Fmt*, double);
|
double __NaN(void);
|
||||||
int __fmtpad(Fmt*, int);
|
int __badfmt(Fmt *f);
|
||||||
int __rfmtpad(Fmt*, int);
|
int __charfmt(Fmt *f);
|
||||||
int __fmtFdFlush(Fmt*);
|
int __countfmt(Fmt *f);
|
||||||
|
int __efgfmt(Fmt *fmt);
|
||||||
int __efgfmt(Fmt*);
|
int __errfmt(Fmt *f);
|
||||||
int __charfmt(Fmt*);
|
int __flagfmt(Fmt *f);
|
||||||
int __runefmt(Fmt*);
|
int __fmtFdFlush(Fmt *f);
|
||||||
int __runesfmt(Fmt*);
|
int __fmtcpy(Fmt *f, const void *vm, int n, int sz);
|
||||||
int __countfmt(Fmt*);
|
void* __fmtdispatch(Fmt *f, void *fmt, int isrunes);
|
||||||
int __flagfmt(Fmt*);
|
void * __fmtflush(Fmt *f, void *t, int len);
|
||||||
int __percentfmt(Fmt*);
|
void __fmtlock(void);
|
||||||
int __ifmt(Fmt*);
|
int __fmtpad(Fmt *f, int n);
|
||||||
int __strfmt(Fmt*);
|
double __fmtpow10(int n);
|
||||||
int __badfmt(Fmt*);
|
int __fmtrcpy(Fmt *f, const void *vm, int n);
|
||||||
int __fmtcpy(Fmt*, const void*, int, int);
|
void __fmtunlock(void);
|
||||||
int __fmtrcpy(Fmt*, const void*, int n);
|
int __ifmt(Fmt *f);
|
||||||
int __errfmt(Fmt *f);
|
int __isInf(double d, int sign);
|
||||||
|
int __isNaN(double d);
|
||||||
double __fmtpow10(int);
|
int __needsquotes(char *s, int *quotelenp);
|
||||||
|
int __percentfmt(Fmt *f);
|
||||||
void __fmtlock(void);
|
void __quotesetup(char *s, Rune *r, int nin, int nout, Quoteinfo *q, int sharp, int runesout);
|
||||||
void __fmtunlock(void);
|
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)\
|
#define FMTCHAR(f, t, s, c)\
|
||||||
do{\
|
do{\
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,20 @@
|
||||||
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Plan 9 port version must include libc.h in order to
|
||||||
|
* get Plan 9 debugging malloc, which sometimes returns
|
||||||
|
* different pointers than the standard malloc.
|
||||||
|
*/
|
||||||
|
#ifdef PLAN9PORT
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
|
#else
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "plan9.h"
|
||||||
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fmtStrFlush(Fmt *f)
|
fmtStrFlush(Fmt *f)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
|
#include "fmtdef.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
fprint(int fd, char *fmt, ...)
|
fprint(int fd, char *fmt, ...)
|
||||||
|
|
|
@ -5,24 +5,17 @@
|
||||||
* same byte ordering.
|
* same byte ordering.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nan.h"
|
#include "plan9.h"
|
||||||
|
#include "fmt.h"
|
||||||
|
#include "fmtdef.h"
|
||||||
|
|
||||||
#if defined (__APPLE__) || (__powerpc__)
|
#if defined (__APPLE__) || (__powerpc__)
|
||||||
#define _NEEDLL
|
#define _NEEDLL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef unsigned long long uvlong;
|
|
||||||
typedef unsigned long ulong;
|
|
||||||
|
|
||||||
#ifdef _NEEDLL
|
|
||||||
static uvlong uvnan = 0x7FF0000000000001LL;
|
|
||||||
static uvlong uvinf = 0x7FF0000000000000LL;
|
|
||||||
static uvlong uvneginf = 0xFFF0000000000000LL;
|
|
||||||
#else
|
|
||||||
static uvlong uvnan = ((uvlong)0x7FF00000<<32)|0x00000001;
|
static uvlong uvnan = ((uvlong)0x7FF00000<<32)|0x00000001;
|
||||||
static uvlong uvinf = ((uvlong)0x7FF00000<<32)|0x00000000;
|
static uvlong uvinf = ((uvlong)0x7FF00000<<32)|0x00000000;
|
||||||
static uvlong uvneginf = ((uvlong)0xFFF00000<<32)|0x00000000;
|
static uvlong uvneginf = ((uvlong)0xFFF00000<<32)|0x00000000;
|
||||||
#endif
|
|
||||||
|
|
||||||
double
|
double
|
||||||
__NaN(void)
|
__NaN(void)
|
||||||
|
@ -72,5 +65,3 @@ __isInf(double d, int sign)
|
||||||
else
|
else
|
||||||
return x==uvneginf;
|
return x==uvneginf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
|
#include "fmtdef.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
print(char *fmt, ...)
|
print(char *fmt, ...)
|
||||||
|
|
|
@ -11,9 +11,20 @@
|
||||||
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Plan 9 port version must include libc.h in order to
|
||||||
|
* get Plan 9 debugging malloc, which sometimes returns
|
||||||
|
* different pointers than the standard malloc.
|
||||||
|
*/
|
||||||
|
#ifdef PLAN9PORT
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
|
#else
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "plan9.h"
|
||||||
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
runeFmtStrFlush(Fmt *f)
|
runeFmtStrFlush(Fmt *f)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utf.h"
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
|
#include "fmtdef.h"
|
||||||
|
|
||||||
char*
|
char*
|
||||||
seprint(char *buf, char *e, char *fmt, ...)
|
seprint(char *buf, char *e, char *fmt, ...)
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
|
#include "fmtdef.h"
|
||||||
|
|
||||||
char*
|
char*
|
||||||
smprint(char *fmt, ...)
|
smprint(char *fmt, ...)
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
|
#include "fmtdef.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
snprint(char *buf, int len, char *fmt, ...)
|
snprint(char *buf, int len, char *fmt, ...)
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <fmt.h>
|
#include <fmt.h>
|
||||||
|
#include "plan9.h"
|
||||||
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -17,15 +17,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "nan.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
#ifndef nelem
|
|
||||||
#define nelem(x) (sizeof(x)/sizeof *(x))
|
|
||||||
#endif
|
|
||||||
#define nil ((void*)0)
|
|
||||||
#define ulong _fmtulong
|
|
||||||
typedef unsigned long ulong;
|
|
||||||
|
|
||||||
static ulong
|
static ulong
|
||||||
umuldiv(ulong a, ulong b, ulong c)
|
umuldiv(ulong a, ulong b, ulong c)
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <utf.h>
|
#include <utf.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
|
#include "fmtdef.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "fmtdef.h"
|
#include "fmtdef.h"
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
runestrcat(Rune *s1, Rune *s2)
|
runestrcat(Rune *s1, Rune *s2)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
runestrchr(Rune *s, Rune c)
|
runestrchr(Rune *s, Rune c)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
runestrcmp(Rune *s1, Rune *s2)
|
runestrcmp(Rune *s1, Rune *s2)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
runestrcpy(Rune *s1, Rune *s2)
|
runestrcpy(Rune *s1, Rune *s2)
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
runestrdup(Rune *s)
|
runestrdup(Rune *s)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
runestrecpy(Rune *s1, Rune *es1, Rune *s2)
|
runestrecpy(Rune *s1, Rune *es1, Rune *s2)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
long
|
long
|
||||||
runestrlen(Rune *s)
|
runestrlen(Rune *s)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
runestrncat(Rune *s1, Rune *s2, long n)
|
runestrncat(Rune *s1, Rune *s2, long n)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
runestrncmp(Rune *s1, Rune *s2, long n)
|
runestrncmp(Rune *s1, Rune *s2, long n)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
runestrncpy(Rune *s1, Rune *s2, long n)
|
runestrncpy(Rune *s1, Rune *s2, long n)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
runestrrchr(Rune *s, Rune c)
|
runestrrchr(Rune *s, Rune c)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return pointer to first occurrence of s2 in s1,
|
* Return pointer to first occurrence of s2 in s1,
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* alpha ranges -
|
* alpha ranges -
|
||||||
|
@ -1030,8 +1030,7 @@ Rune __totitle1[] =
|
||||||
0x01f3, 499, /* dz Dz */
|
0x01f3, 499, /* dz Dz */
|
||||||
};
|
};
|
||||||
|
|
||||||
static
|
static Rune*
|
||||||
Rune*
|
|
||||||
bsearch(Rune c, Rune *t, int n, int ne)
|
bsearch(Rune c, Rune *t, int n, int ne)
|
||||||
{
|
{
|
||||||
Rune *p;
|
Rune *p;
|
||||||
|
|
|
@ -1,14 +1,33 @@
|
||||||
#define uchar _utfuchar
|
/*
|
||||||
#define ushort _utfushort
|
* compiler directive on Plan 9
|
||||||
#define uint _utfuint
|
*/
|
||||||
#define ulong _utfulong
|
#ifndef USED
|
||||||
#define vlong _utfvlong
|
#define USED(x) if(x);else
|
||||||
#define uvlong _utfuvlong
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* easiest way to make sure these are defined
|
||||||
|
*/
|
||||||
|
#define uchar _fmtuchar
|
||||||
|
#define ushort _fmtushort
|
||||||
|
#define uint _fmtuint
|
||||||
|
#define ulong _fmtulong
|
||||||
|
#define vlong _fmtvlong
|
||||||
|
#define uvlong _fmtuvlong
|
||||||
typedef unsigned char uchar;
|
typedef unsigned char uchar;
|
||||||
typedef unsigned short ushort;
|
typedef unsigned short ushort;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
||||||
|
typedef unsigned long long uvlong;
|
||||||
|
typedef long long vlong;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nil cannot be ((void*)0) on ANSI C,
|
||||||
|
* because it is used for function pointers
|
||||||
|
*/
|
||||||
|
#undef nil
|
||||||
|
#define nil 0
|
||||||
|
|
||||||
|
#undef nelem
|
||||||
|
#define nelem ((void*)0)
|
||||||
|
|
||||||
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
|
|
||||||
#define nil ((void*)0)
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
utfecpy(char *to, char *e, char *from)
|
utfecpy(char *to, char *e, char *from)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
utflen(char *s)
|
utflen(char *s)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
utfnlen(char *s, long m)
|
utfnlen(char *s, long m)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
utfrrune(char *s, long c)
|
utfrrune(char *s, long c)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
utfrune(char *s, long c)
|
utfrune(char *s, long c)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "plan9.h"
|
||||||
#include "utf.h"
|
#include "utf.h"
|
||||||
#include "utfdef.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue