xref: /titanic_44/usr/src/lib/libast/sparcv9/include/ast/ccode.h (revision 6e91bba0d6c6bdabbba62cefae583715a4a58e2a)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2009 AT&T Intellectual Property          *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                    by AT&T Intellectual Property                     *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 
26 /*
27  * Glenn Fowler
28  * AT&T Research
29  *
30  * character code map interface
31  *
32  * NOTE: used for mapping between 8-bit character encodings
33  *	 ISO character sets are handled by sfio
34  */
35 
36 #ifndef _CHARCODE_H
37 #if !defined(__PROTO__)
38 #include <prototyped.h>
39 #endif
40 #if !defined(__LINKAGE__)
41 #define __LINKAGE__		/* 2004-08-11 transition */
42 #endif
43 
44 #define _CHARCODE_H	1
45 
46 #include <ast.h>
47 #include <ast_ccode.h>
48 
49 typedef struct Ccmap_s
50 {
51 	const char*	name;	/* code set name		*/
52 	const char*	match;	/* strmatch() pattern		*/
53 	const char*	desc;	/* code set description		*/
54 	const char*	canon;	/* canonical name format	*/
55 	const char*	index;	/* default index		*/
56 	int		ccode;	/* <ccode.h> code index		*/
57 	__V_*		data;	/* map specific data		*/
58 } Ccmap_t;
59 
60 #if _BLD_ast && defined(__EXPORT__)
61 #undef __MANGLE__
62 #define __MANGLE__ __LINKAGE__		__EXPORT__
63 #endif
64 
65 extern __MANGLE__ unsigned char*	_ccmap __PROTO__((int, int));
66 extern __MANGLE__ __V_*		_ccmapcpy __PROTO__((unsigned char*, __V_*, const __V_*, size_t));
67 extern __MANGLE__ __V_*		_ccmapstr __PROTO__((unsigned char*, __V_*, size_t));
68 
69 extern __MANGLE__ int		ccmapid __PROTO__((const char*));
70 extern __MANGLE__ char*		ccmapname __PROTO__((int));
71 extern __MANGLE__ __V_*		ccnative __PROTO__((__V_*, const __V_*, size_t));
72 extern __MANGLE__ Ccmap_t*		ccmaplist __PROTO__((Ccmap_t*));
73 
74 #undef __MANGLE__
75 #define __MANGLE__ __LINKAGE__
76 
77 #define CCOP(i,o)		((i)==(o)?0:(((o)<<8)|(i)))
78 #define CCIN(x)			((x)&0xFF)
79 #define CCOUT(x)		(((x)>>8)&0xFF)
80 #define CCCONVERT(x)		((x)&0xFF00)
81 
82 #define CCCVT(x)		CCMAP(x,0)
83 #define CCMAP(i,o)		((i)==(o)?(unsigned char*)0:_ccmap(i,o))
84 #define CCMAPCHR(m,c)		((m)?(m)[c]:(c))
85 #define CCMAPCPY(m,t,f,n)	((m)?_ccmapcpy(m,t,f,n):memcpy(t,f,n))
86 #define CCMAPSTR(m,s,n)		((m)?_ccmapstr(m,s,n):(__V_*)(s))
87 
88 #define ccmap(i,o)		CCMAP(i,o)
89 #define ccmapchr(m,c)		CCMAPCHR(m,c)
90 #define ccmapcpy(m,t,f,n)	CCMAPCPY(m,t,f,n)
91 #define ccmapstr(m,s,n)		CCMAPSTR(m,s,n)
92 
93 #define CCMAPC(c,i,o)		((i)==(o)?(c):CCMAP(i,o)[c])
94 #define CCMAPM(t,f,n,i,o)	((i)==(o)?memcpy(t,f,n):_ccmapcpy(CCMAP(i,o),t,f,n))
95 #define CCMAPS(s,n,i,o)		((i)==(o)?(__V_*)(s):_ccmapstr(CCMAP(i,o),s,n))
96 
97 #define ccmapc(c,i,o)		CCMAPC(c,i,o)
98 #define ccmapm(t,f,n,i,o)	CCMAPM(t,f,n,i,o)
99 #define ccmaps(s,n,i,o)		CCMAPS(s,n,i,o)
100 
101 #endif
102