1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
/* Copyright (c) 1992 AT&T - All rights reserved. */
/* Plan 9 C library interface */
typedef unsigned char uchar;
typedef unsigned short Rune;
#define sprint sprintf
#define dup(a,b) dup2(a,b)
#define seek(a,b,c) lseek(a,b,c)
#define create(name, mode, perm) creat(name, perm)
#define exec(a,b) execv(a,b)
#define USED(a)
#define SET(a)
#define _exits(v) if (v!=0) _exit(1); else _exit(0)
enum
{
OREAD = 0, /* open for read */
OWRITE = 1, /* open for write */
ORDWR = 2, /* open for read/write */
ERRLEN = 64 /* length of error message */
};
enum
{
UTFmax = 3, /* maximum bytes per rune */
Runesync = 0x80, /* cannot represent part of a utf sequence (<) */
Runeself = 0x80, /* rune and utf sequences are the same (<) */
Runeerror = 0x80 /* decoding error in utf */
};
/*
* new rune routines
*/
extern int runetochar(char*, Rune*);
extern int chartorune(Rune*, char*);
extern int runelen(long);
extern int fullrune(char*, int);
/*
* rune routines from converted str routines
*/
extern long utflen(char*); /* was countrune */
extern char* utfrune(char*, long);
extern char* utfrrune(char*, long);
extern char* utfutf(char*, char*);
/*
* Miscellaneous functions
*/
extern void fprint(int, char *, ...);
extern int notify (void(*)(void *, char *));
extern int errstr(char *);
extern char* getuser(void);
extern void exits(char*);
|