vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

utf.h (2256B)


      1 /*
      2  * The authors of this software are Rob Pike and Ken Thompson.
      3  *              Copyright (c) 1998-2002 by Lucent Technologies.
      4  * Permission to use, copy, modify, and distribute this software for any
      5  * purpose without fee is hereby granted, provided that this entire notice
      6  * is included in all copies of any software which is or includes a copy
      7  * or modification of this software and in all copies of the supporting
      8  * documentation for such software.
      9  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
     10  * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
     11  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
     12  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
     13  */
     14 #ifndef _UTF_H_
     15 #define _UTF_H_ 1
     16 #if defined(__cplusplus)
     17 extern "C" { 
     18 #endif
     19 
     20 enum
     21 {
     22 	UTFmax		= 3,		/* maximum bytes per rune */
     23 	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
     24 	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
     25 	Runeerror	= 0xFFFD		/* decoding error in UTF */
     26 };
     27 
     28 /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */
     29 int		chartorune(Rune *rune, char *str);
     30 int		fullrune(char *str, int n);
     31 int		isalpharune(Rune c);
     32 int		islowerrune(Rune c);
     33 int		isspacerune(Rune c);
     34 int		istitlerune(Rune c);
     35 int		isupperrune(Rune c);
     36 int		runelen(long c);
     37 int		runenlen(Rune *r, int nrune);
     38 Rune*		runestrcat(Rune *s1, Rune *s2);
     39 Rune*		runestrchr(Rune *s, Rune c);
     40 int		runestrcmp(Rune *s1, Rune *s2);
     41 Rune*		runestrcpy(Rune *s1, Rune *s2);
     42 Rune*		runestrdup(Rune *s) ;
     43 Rune*		runestrecpy(Rune *s1, Rune *es1, Rune *s2);
     44 long		runestrlen(Rune *s);
     45 Rune*		runestrncat(Rune *s1, Rune *s2, long n);
     46 int		runestrncmp(Rune *s1, Rune *s2, long n);
     47 Rune*		runestrncpy(Rune *s1, Rune *s2, long n);
     48 Rune*		runestrrchr(Rune *s, Rune c);
     49 Rune*		runestrstr(Rune *s1, Rune *s2);
     50 int		runetochar(char *str, Rune *rune);
     51 Rune		tolowerrune(Rune c);
     52 Rune		totitlerune(Rune c);
     53 Rune		toupperrune(Rune c);
     54 char*		utfecpy(char *to, char *e, char *from);
     55 int		utflen(char *s);
     56 int		utfnlen(char *s, long m);
     57 char*		utfrrune(char *s, long c);
     58 char*		utfrune(char *s, long c);
     59 char*		utfutf(char *s1, char *s2);
     60 
     61 #if defined(__cplusplus)
     62 }
     63 #endif
     64 #endif