xref: /titanic_44/usr/src/lib/libast/common/include/mc.h (revision e24ad0477f696e85e5b6abbf799db570859969a6)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 #pragma prototyped
23 
24 /*
25  * machine independent binary message catalog interface
26  *
27  * file layout
28  * all numbers are sfputu() format
29  *
30  *	4 char magic (^M^S^G0)
31  *	<method locale YYYY-MM-DD>\0
32  *	(<optional strings>\0)*
33  *	\0
34  *	string table size
35  *	#msgs total
36  *	#max set number
37  *	#set-id 1
38  *	#msgs in set 1
39  *	 ...
40  *	#set-id #sets
41  *	#msgs in set #sets
42  *	end of sets (0)
43  *	msg(1,1) size
44  *	 ...
45  *	msg(#sets,#msgs) size
46  *	string table
47  */
48 
49 #ifndef _MC_H
50 #define _MC_H
51 
52 #include <ast.h>
53 
54 #define MC_MAGIC	"\015\023\007\000"
55 #define MC_MAGIC_SIZE	4
56 
57 #define MC_SET_MAX	1023
58 #define MC_NUM_MAX	32767
59 
60 #define MC_NLS		(1<<10)
61 
62 #define MC_MESSAGE_SET(s)	mcindex(s,NiL,NiL,NiL)
63 
64 typedef struct
65 {
66 	char**		msg;
67 	int		num;
68 	int		gen;
69 } Mcset_t;
70 
71 typedef struct
72 {
73 	Mcset_t*	set;
74 	int		num;
75 	int		gen;
76 	char*		translation;
77 #ifdef _MC_PRIVATE_
78 	_MC_PRIVATE_
79 #endif
80 } Mc_t;
81 
82 #if _BLD_ast && defined(__EXPORT__)
83 #define extern		__EXPORT__
84 #endif
85 
86 extern char*		mcfind(char*, const char*, const char*, int, int);
87 extern Mc_t*		mcopen(Sfio_t*);
88 extern char*		mcget(Mc_t*, int, int, const char*);
89 extern int		mcput(Mc_t*, int, int, const char*);
90 extern int		mcdump(Mc_t*, Sfio_t*);
91 extern int		mcindex(const char*, char**, int*, int*);
92 extern int		mcclose(Mc_t*);
93 
94 #undef	extern
95 
96 #endif
97