xref: /onnv-gate/usr/src/lib/libc/inc/msgfmt.h (revision 6793:c47834199660)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*6793Smuffin  * Common Development and Distribution License (the "License").
6*6793Smuffin  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*6793Smuffin  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*6793Smuffin  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _MSGFMT_H
270Sstevel@tonic-gate #define	_MSGFMT_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
31*6793Smuffin #include <stdint.h>
32*6793Smuffin #include <stddef.h>
33*6793Smuffin 
340Sstevel@tonic-gate #ifdef	__cplusplus
350Sstevel@tonic-gate extern "C" {
360Sstevel@tonic-gate #endif
370Sstevel@tonic-gate 
380Sstevel@tonic-gate /*
390Sstevel@tonic-gate  *	Sun MO file format
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  *
440Sstevel@tonic-gate  *		+-------------------------------+
450Sstevel@tonic-gate  *		| (int) middle message id       |
460Sstevel@tonic-gate  *		+-------------------------------+
470Sstevel@tonic-gate  *		| (int) total # of messages     |
480Sstevel@tonic-gate  *		+-------------------------------+
490Sstevel@tonic-gate  *		| (int) total msgid length      |
500Sstevel@tonic-gate  *		+-------------------------------+
510Sstevel@tonic-gate  *		| (int) total msgstr length     |
520Sstevel@tonic-gate  *		+-------------------------------+
530Sstevel@tonic-gate  *		| (int) size of msg_struct size	|
540Sstevel@tonic-gate  *		+-------------------------------+
550Sstevel@tonic-gate  *		+-------------------------------+
560Sstevel@tonic-gate  *		| (int) less                    |
570Sstevel@tonic-gate  *		+-------------------------------+
580Sstevel@tonic-gate  *		| (int) more                    |
590Sstevel@tonic-gate  *		+-------------------------------+
600Sstevel@tonic-gate  *		| (int) msgid offset            |
610Sstevel@tonic-gate  *		+-------------------------------+
620Sstevel@tonic-gate  *		| (int) msgstr offset           |
630Sstevel@tonic-gate  *		+-------------------------------+
640Sstevel@tonic-gate  *			................
650Sstevel@tonic-gate  *		+-------------------------------+
660Sstevel@tonic-gate  *		| (variable str) msgid          |
670Sstevel@tonic-gate  *		+-------------------------------+
680Sstevel@tonic-gate  *		| (variable str) msgid          |
690Sstevel@tonic-gate  *		+-------------------------------+
700Sstevel@tonic-gate  *			................
710Sstevel@tonic-gate  *		+-------------------------------+
720Sstevel@tonic-gate  *		| (variable str) msgid          |
730Sstevel@tonic-gate  *		+-------------------------------+
740Sstevel@tonic-gate  *		+-------------------------------+
750Sstevel@tonic-gate  *		| (variable str) msgstr         |
760Sstevel@tonic-gate  *		+-------------------------------+
770Sstevel@tonic-gate  *		| (variable str) msgstr         |
780Sstevel@tonic-gate  *		+-------------------------------+
790Sstevel@tonic-gate  *			................
800Sstevel@tonic-gate  *		+-------------------------------+
810Sstevel@tonic-gate  *		| (variable str) msgstr         |
820Sstevel@tonic-gate  *		+-------------------------------+
830Sstevel@tonic-gate  */
840Sstevel@tonic-gate 
850Sstevel@tonic-gate struct msg_info {
860Sstevel@tonic-gate 	int	msg_mid;			/* middle message id */
870Sstevel@tonic-gate 	int	msg_count;			/* total # of messages */
880Sstevel@tonic-gate 	int	str_count_msgid;	/* total msgid length */
890Sstevel@tonic-gate 	int	str_count_msgstr;	/* total msgstr length */
900Sstevel@tonic-gate 	int	msg_struct_size;	/* size of msg_struct_size */
910Sstevel@tonic-gate };
920Sstevel@tonic-gate 
930Sstevel@tonic-gate struct msg_struct {
940Sstevel@tonic-gate 	int	less;				/* index of left leaf */
950Sstevel@tonic-gate 	int	more;				/* index of right leaf */
960Sstevel@tonic-gate 	int	msgid_offset;		/* msgid offset */
970Sstevel@tonic-gate 	int msgstr_offset;		/* msgstr offset */
980Sstevel@tonic-gate };
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate #define	MSG_STRUCT_SIZE		(sizeof (struct msg_struct))
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate /*
1030Sstevel@tonic-gate  * The following is the size of the old msg_struct used be defined
1040Sstevel@tonic-gate  * in usr/src/cmd/msgfmt/msgfmt.c.
1050Sstevel@tonic-gate  * Old msg_struct contained:
1060Sstevel@tonic-gate  * struct msg_struct {
1070Sstevel@tonic-gate  *		char	*msgid;
1080Sstevel@tonic-gate  *		char	*msgstr;
1090Sstevel@tonic-gate  *		int	msgid_offset;
1100Sstevel@tonic-gate  *		int	msgstr_offset;
1110Sstevel@tonic-gate  *		struct msg_struct	*next;
1120Sstevel@tonic-gate  * };
1130Sstevel@tonic-gate  */
1140Sstevel@tonic-gate #define	OLD_MSG_STRUCT_SIZE	20
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate #define	LEAFINDICATOR		-99
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate /*
1190Sstevel@tonic-gate  *	GNU MO file format
1200Sstevel@tonic-gate  */
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate /*
1230Sstevel@tonic-gate  *
1240Sstevel@tonic-gate  *             +-----------------------------------------+
125*6793Smuffin  *           0 | (uint32_t) magic number                 |
1260Sstevel@tonic-gate  *             +-----------------------------------------+
127*6793Smuffin  *           4 | (uint32_t) format revision              |
1280Sstevel@tonic-gate  *             +-----------------------------------------+
129*6793Smuffin  *           8 | (uint32_t) number of strings            | == N
1300Sstevel@tonic-gate  *             +-----------------------------------------+
131*6793Smuffin  *          12 | (uint32_t) offset of msgid table        | == O
1320Sstevel@tonic-gate  *             +-----------------------------------------+
133*6793Smuffin  *          16 | (uint32_t) offset of msgstr table       | == T
1340Sstevel@tonic-gate  *             +-----------------------------------------+
135*6793Smuffin  *          20 | (uint32_t) size of hashing table        | == S
1360Sstevel@tonic-gate  *             +-----------------------------------------+
137*6793Smuffin  *          24 | (uint32_t) offset of hashing table      | == H
1380Sstevel@tonic-gate  *             +-----------------------------------------+
1390Sstevel@tonic-gate  *             +-----------------------------------------+
140*6793Smuffin  *           O | (uint32_t) length of 0th msgid          |
1410Sstevel@tonic-gate  *             +-----------------------------------------+
142*6793Smuffin  *         O+4 | (uint32_t) offset of 0th msgid          | == M(0)
1430Sstevel@tonic-gate  *             +-----------------------------------------+
1440Sstevel@tonic-gate  *             ...............................
1450Sstevel@tonic-gate  *             +-----------------------------------------+
146*6793Smuffin  * O+((N-1)*8) | (uint32_t) length of (N-1)th msgid      |
1470Sstevel@tonic-gate  *             +-----------------------------------------+
148*6793Smuffin  * O+((N-1)*8) | (uint32_t) offset of (N-1)th msgid      | == M(N-1)
1490Sstevel@tonic-gate  *       +4    +-----------------------------------------+
1500Sstevel@tonic-gate  *             +-----------------------------------------+
151*6793Smuffin  *           T | (uint32_t) length of 0th msgstr         |
152*6793Smuffin  *             +-----------------------------------------+
153*6793Smuffin  *         T+4 | (uint32_t) offset of 0th msgstr         | == Q(0)
1540Sstevel@tonic-gate  *             +-----------------------------------------+
1550Sstevel@tonic-gate  *             ...............................
1560Sstevel@tonic-gate  *             +-----------------------------------------+
157*6793Smuffin  * T+((N-1)*8) | (uint32_t) length of (N-1)th msgstr     |
1580Sstevel@tonic-gate  *             +-----------------------------------------+
159*6793Smuffin  * T+((N-1)*8) | (uint32_t) offset of (N-1)th msgstr     | == Q(N-1)
1600Sstevel@tonic-gate  *       +4    +-----------------------------------------+
161*6793Smuffin  *             +-----------------------------------------+
162*6793Smuffin  *           H | (uint32_t) start hashing table          |
1630Sstevel@tonic-gate  *             +-----------------------------------------+
1640Sstevel@tonic-gate  *             ...............................
1650Sstevel@tonic-gate  *             +-----------------------------------------+
166*6793Smuffin  *   H + S * 4 | (uint32_t) end hashing table            |
167*6793Smuffin  *             +-----------------------------------------+
1680Sstevel@tonic-gate  *             +-----------------------------------------+
1690Sstevel@tonic-gate  *        M(0) | NULL terminated 0th msgid string        |
1700Sstevel@tonic-gate  *             +-----------------------------------------+
1710Sstevel@tonic-gate  *        M(1) | NULL terminated 1st msgid string        |
1720Sstevel@tonic-gate  *             +-----------------------------------------+
1730Sstevel@tonic-gate  *             ...............................
1740Sstevel@tonic-gate  *             +-----------------------------------------+
1750Sstevel@tonic-gate  *      M(N-1) | NULL terminated (N-1)th msgid string    |
1760Sstevel@tonic-gate  *             +-----------------------------------------+
177*6793Smuffin  *             +-----------------------------------------+
1780Sstevel@tonic-gate  *        Q(0) | NULL terminated 0th msgstr string       |
1790Sstevel@tonic-gate  *             +-----------------------------------------+
1800Sstevel@tonic-gate  *        Q(1) | NULL terminated 1st msgstr string       |
1810Sstevel@tonic-gate  *             +-----------------------------------------+
1820Sstevel@tonic-gate  *             ...............................
1830Sstevel@tonic-gate  *             +-----------------------------------------+
1840Sstevel@tonic-gate  *      Q(N-1) | NULL terminated (N-1)th msgstr string   |
1850Sstevel@tonic-gate  *             +-----------------------------------------+
1860Sstevel@tonic-gate  */
1870Sstevel@tonic-gate 
188*6793Smuffin /*
189*6793Smuffin  *	GNU MO file format (Revision 1)
190*6793Smuffin  */
191*6793Smuffin /*
192*6793Smuffin  *
193*6793Smuffin  *             +-----------------------------------------------+
194*6793Smuffin  *           0 | (uint32_t) magic number                       |
195*6793Smuffin  *             +-----------------------------------------------+
196*6793Smuffin  *           4 | (uint32_t) format revision                    |
197*6793Smuffin  *             +-----------------------------------------------+
198*6793Smuffin  *           8 | (uint32_t) number of strings                  | == N
199*6793Smuffin  *             +-----------------------------------------------+
200*6793Smuffin  *          12 | (uint32_t) offset of msgid table              | == O
201*6793Smuffin  *             +-----------------------------------------------+
202*6793Smuffin  *          16 | (uint32_t) offset of msgstr table             | == T
203*6793Smuffin  *             +-----------------------------------------------+
204*6793Smuffin  *          20 | (uint32_t) size of hashing table              | == S
205*6793Smuffin  *             +-----------------------------------------------+
206*6793Smuffin  *          24 | (uint32_t) offset of hashing table            | == H
207*6793Smuffin  *             +-----------------------------------------------+
208*6793Smuffin  *          32 | (uint32_t) number of dynamic macros           | == M
209*6793Smuffin  *             +-----------------------------------------------+
210*6793Smuffin  *          36 | (uint32_t) offset of dynamic macros           | == P
211*6793Smuffin  *             +-----------------------------------------------+
212*6793Smuffin  *          40 | (uint32_t) number of dynamic strings          | == D
213*6793Smuffin  *             +-----------------------------------------------+
214*6793Smuffin  *          44 | (uint32_t) offset of dynamic msgid tbl        | == A
215*6793Smuffin  *             +-----------------------------------------------+
216*6793Smuffin  *          48 | (uint32_t) offset of dynamic msgstr tbl       | == B
217*6793Smuffin  *             +-----------------------------------------------+
218*6793Smuffin  *             +-----------------------------------------------+
219*6793Smuffin  *           O | (uint32_t) length of 0th msgid                |
220*6793Smuffin  *             +-----------------------------------------------+
221*6793Smuffin  *         O+4 | (uint32_t) offset of 0th msgid                | == M(0)
222*6793Smuffin  *             +-----------------------------------------------+
223*6793Smuffin  *             ...............................
224*6793Smuffin  *             +-----------------------------------------------+
225*6793Smuffin  * O+((N-1)*8) | (uint32_t) length of (N-1)th msgid            |
226*6793Smuffin  *             +-----------------------------------------------+
227*6793Smuffin  * O+((N-1)*8) | (uint32_t) offset of (N-1)th msgid            | == M(N-1)
228*6793Smuffin  *       +4    +-----------------------------------------------+
229*6793Smuffin  *             +-----------------------------------------------+
230*6793Smuffin  *           T | (uint32_t) length of 0th msgstr               |
231*6793Smuffin  *             +-----------------------------------------------+
232*6793Smuffin  *         T+4 | (uint32_t) offset of 0th msgstr               | == Q(0)
233*6793Smuffin  *             +-----------------------------------------------+
234*6793Smuffin  *             ...............................
235*6793Smuffin  *             +-----------------------------------------------+
236*6793Smuffin  * T+((N-1)*8) | (uint32_t) length of (N-1)th msgstr           |
237*6793Smuffin  *             +-----------------------------------------------+
238*6793Smuffin  * T+((N-1)*8) | (uint32_t) offset of (N-1)th msgstr           | == Q(N-1)
239*6793Smuffin  *       +4    +-----------------------------------------------+
240*6793Smuffin  *             +-----------------------------------------------+
241*6793Smuffin  *           H | (uint32_t) start hashing table                |
242*6793Smuffin  *             +-----------------------------------------------+
243*6793Smuffin  *             ...............................
244*6793Smuffin  *             +-----------------------------------------------+
245*6793Smuffin  *   H + S * 4 | (uint32_t) end hashing table                  |
246*6793Smuffin  *             +-----------------------------------------------+
247*6793Smuffin  *             +-----------------------------------------------+
248*6793Smuffin  *           P | (uint32_t) length of 0th macro                |
249*6793Smuffin  *             +-----------------------------------------------+
250*6793Smuffin  *         P+4 | (uint32_t) offset of 0th macro                | == C(0)
251*6793Smuffin  *             +-----------------------------------------------+
252*6793Smuffin  *             ...............................
253*6793Smuffin  *             +-----------------------------------------------+
254*6793Smuffin  * P+((M-1)*8) | (uint32_t) length of (M-1)th macro            |
255*6793Smuffin  *             +-----------------------------------------------+
256*6793Smuffin  * P+((M-1)*8) | (uint32_t) offset of (M-1)th macro            | == C(M-1)
257*6793Smuffin  *       +4    +-----------------------------------------------+
258*6793Smuffin  *             +-----------------------------------------------+
259*6793Smuffin  *           A | (uint32_t) offset of 0th d_msgid              | == L(0)
260*6793Smuffin  *             +-----------------------------------------------+
261*6793Smuffin  *             ...............................
262*6793Smuffin  *             +-----------------------------------------------+
263*6793Smuffin  * A+((D-1)*4) | (uint32_t) offset of (D-1)th d_msgid          | == L(D-1)
264*6793Smuffin  *             +-----------------------------------------------+
265*6793Smuffin  *             +-----------------------------------------------+
266*6793Smuffin  *           B | (uint32_t) offset of 0th d_msgstr             | == E(0)
267*6793Smuffin  *             +-----------------------------------------------+
268*6793Smuffin  *             ...............................
269*6793Smuffin  *             +-----------------------------------------------+
270*6793Smuffin  * B+((D-1)*4) | (uint32_t) offset of (D-1)th d_msgstr         | == E(D-1)
271*6793Smuffin  *             +-----------------------------------------------+
272*6793Smuffin  *             +-----------------------------------------------+
273*6793Smuffin  *        L(0) | (uint32_t) offset of 0th d_msgid message      | == F(0)
274*6793Smuffin  *             +-----------------------------------------------+
275*6793Smuffin  *      L(0)+4 | (uint32_t) length of 0th fixed substring      |
276*6793Smuffin  *             +-----------------------------------------------+
277*6793Smuffin  *      L(0)+8 | (uint32_t) index to a dynamic macro           |
278*6793Smuffin  *             +-----------------------------------------------+
279*6793Smuffin  *             ...............................
280*6793Smuffin  *             +-----------------------------------------------+
281*6793Smuffin  *     L(0)+4+ | (uint32_t) length of (m-1)th fixed substring  |
282*6793Smuffin  *   ((m-1)*8) +-----------------------------------------------+
283*6793Smuffin  *     L(0)+8+ | (uint32_t) NOMORE_DYNAMIC_STR                 |
284*6793Smuffin  *   ((m-1)*8) +-----------------------------------------------+
285*6793Smuffin  *             +-----------------------------------------------+
286*6793Smuffin  *      L(D-1) | (uint32_t) offset of 0th d_msgid message      | == F(D-1)
287*6793Smuffin  *             +-----------------------------------------------+
288*6793Smuffin  *    L(D-1)+4 | (uint32_t) length of 0th fixed substring      |
289*6793Smuffin  *             +-----------------------------------------------+
290*6793Smuffin  *    L(D-1)+8 | (uint32_t) index to a dynamic macro           |
291*6793Smuffin  *             +-----------------------------------------------+
292*6793Smuffin  *             ...............................
293*6793Smuffin  *             +-----------------------------------------------+
294*6793Smuffin  *    L(D-1)+4 | (uint32_t) length of (m-1)th fixed substring  |
295*6793Smuffin  *   ((m-1)*8) +-----------------------------------------------+
296*6793Smuffin  *    L(D-1)+8 | (uint32_t) NOMORE_DYNAMIC_STR                 |
297*6793Smuffin  *   ((m-1)*8) +-----------------------------------------------+
298*6793Smuffin  *             +-----------------------------------------------+
299*6793Smuffin  *        E(0) | (uint32_t) offset of 0th d_msgstr message     | == G(0)
300*6793Smuffin  *             +-----------------------------------------------+
301*6793Smuffin  *      E(0)+4 | (uint32_t) length of 0th fixed substring      |
302*6793Smuffin  *             +-----------------------------------------------+
303*6793Smuffin  *      E(0)+8 | (uint32_t) index to a dynamic macro           |
304*6793Smuffin  *             +-----------------------------------------------+
305*6793Smuffin  *             ...............................
306*6793Smuffin  *             +-----------------------------------------------+
307*6793Smuffin  *     E(0)+4+ | (uint32_t) length of (m-1)th fixed substring  |
308*6793Smuffin  *   ((m-1)*8) +-----------------------------------------------+
309*6793Smuffin  *     E(0)+8+ | (uint32_t) NOMORE_DYNAMIC_STR                 |
310*6793Smuffin  *   ((m-1)*8) +-----------------------------------------------+
311*6793Smuffin  *             +-----------------------------------------------+
312*6793Smuffin  *      E(D-1) | (uint32_t) offset of 0th d_msgstr message     | == G(D-1)
313*6793Smuffin  *             +-----------------------------------------------+
314*6793Smuffin  *    E(D-1)+4 | (uint32_t) length of 0th fixed substring      |
315*6793Smuffin  *             +-----------------------------------------------+
316*6793Smuffin  *    E(D-1)+8 | (uint32_t) index to a dynamic macro           |
317*6793Smuffin  *             +-----------------------------------------------+
318*6793Smuffin  *             ...............................
319*6793Smuffin  *             +-----------------------------------------------+
320*6793Smuffin  *    E(D-1)+4 | (uint32_t) length of (m-1)th fixed substring  |
321*6793Smuffin  *   ((m-1)*8) +-----------------------------------------------+
322*6793Smuffin  *    E(D-1)+8 | (uint32_t) NOMORE_DYNAMIC_STR                 |
323*6793Smuffin  *   ((m-1)*8) +-----------------------------------------------+
324*6793Smuffin  *             +-----------------------------------------------+
325*6793Smuffin  *        M(0) | NULL terminated 0th msgid string              |
326*6793Smuffin  *             +-----------------------------------------------+
327*6793Smuffin  *        M(1) | NULL terminated 1st msgid string              |
328*6793Smuffin  *             +-----------------------------------------------+
329*6793Smuffin  *             ...............................
330*6793Smuffin  *             +-----------------------------------------------+
331*6793Smuffin  *      M(N-1) | NULL terminated (N-1)th msgid string          |
332*6793Smuffin  *             +-----------------------------------------------+
333*6793Smuffin  *        Q(0) | NULL terminated 0th msgstr string             |
334*6793Smuffin  *             +-----------------------------------------------+
335*6793Smuffin  *        Q(1) | NULL terminated 1st msgstr string             |
336*6793Smuffin  *             +-----------------------------------------------+
337*6793Smuffin  *             ...............................
338*6793Smuffin  *             +-----------------------------------------------+
339*6793Smuffin  *      Q(N-1) | NULL terminated (N-1)th msgstr string         |
340*6793Smuffin  *             +-----------------------------------------------+
341*6793Smuffin  *             +-----------------------------------------------+
342*6793Smuffin  *        C(0) | NULL terminated 0th macro                     |
343*6793Smuffin  *             +-----------------------------------------------+
344*6793Smuffin  *             ...............................
345*6793Smuffin  *             +-----------------------------------------------+
346*6793Smuffin  *      C(M-1) | NULL terminated (M-1)th macro                 |
347*6793Smuffin  *             +-----------------------------------------------+
348*6793Smuffin  *             +-----------------------------------------------+
349*6793Smuffin  *        F(0) | NULL terminated 0th dynamic msgid string      |
350*6793Smuffin  *             +-----------------------------------------------+
351*6793Smuffin  *             ...............................
352*6793Smuffin  *             +-----------------------------------------------+
353*6793Smuffin  *      F(D-1) | NULL terminated (D-1)th dynamic msgid string  |
354*6793Smuffin  *             +-----------------------------------------------+
355*6793Smuffin  *             +-----------------------------------------------+
356*6793Smuffin  *        G(0) | NULL terminated 0th dynamic msgstr string     |
357*6793Smuffin  *             +-----------------------------------------------+
358*6793Smuffin  *             ...............................
359*6793Smuffin  *             +-----------------------------------------------+
360*6793Smuffin  *      G(D-1) | NULL terminated (D-1)th dynamic msgstr string |
361*6793Smuffin  *             +-----------------------------------------------+
362*6793Smuffin  */
363*6793Smuffin 
364*6793Smuffin #define	GNU_MAGIC			0x950412de
365*6793Smuffin #define	GNU_MAGIC_SWAPPED		0xde120495
366*6793Smuffin #define	GNU_REVISION			0
367*6793Smuffin #define	GNU_REVISION_0_0		0
368*6793Smuffin #define	GNU_REVISION_0_0_SWAPPED	0
369*6793Smuffin #define	GNU_REVISION_0_1		0x00000001
370*6793Smuffin #define	GNU_REVISION_0_1_SWAPPED	0x01000000
371*6793Smuffin #define	GNU_REVISION_1_1		0x00010001
372*6793Smuffin #define	GNU_REVISION_1_1_SWAPPED	0x01000100
373*6793Smuffin #define	NOMORE_DYNAMIC_MACRO		0xffffffff
374*6793Smuffin 
375*6793Smuffin enum gnu_msgidstr {
376*6793Smuffin 	MSGID = 0,
377*6793Smuffin 	MSGSTR = 1
378*6793Smuffin };
3790Sstevel@tonic-gate 
3800Sstevel@tonic-gate struct gnu_msg_info {
381*6793Smuffin 	uint32_t	magic;
382*6793Smuffin 	uint32_t	revision;
383*6793Smuffin 	uint32_t	num_of_str;
384*6793Smuffin 	uint32_t	off_msgid_tbl;
385*6793Smuffin 	uint32_t	off_msgstr_tbl;
386*6793Smuffin 	uint32_t	sz_hashtbl;
387*6793Smuffin 	uint32_t	off_hashtbl;
388*6793Smuffin };
389*6793Smuffin 
390*6793Smuffin struct gnu_msg_rev1_info {
391*6793Smuffin 	uint32_t	num_of_dynamic_macro;
392*6793Smuffin 	uint32_t	off_dynamic_macro;
393*6793Smuffin 	uint32_t	num_of_dynamic_str;
394*6793Smuffin 	uint32_t	off_dynamic_msgid_tbl;
395*6793Smuffin 	uint32_t	off_dynamic_msgstr_tbl;
3960Sstevel@tonic-gate };
3970Sstevel@tonic-gate 
3980Sstevel@tonic-gate struct gnu_msg_ent {
399*6793Smuffin 	uint32_t	len;
400*6793Smuffin 	uint32_t	offset;
401*6793Smuffin };
402*6793Smuffin 
403*6793Smuffin struct gnu_dynamic_ent {
404*6793Smuffin 	uint32_t	len;
405*6793Smuffin 	uint32_t	idx;
406*6793Smuffin };
407*6793Smuffin 
408*6793Smuffin struct gnu_dynamic_tbl {
409*6793Smuffin 	uint32_t	offset;
410*6793Smuffin 	struct gnu_dynamic_ent	entry[1];
4110Sstevel@tonic-gate };
4120Sstevel@tonic-gate 
4130Sstevel@tonic-gate #ifdef	__cplusplus
4140Sstevel@tonic-gate }
4150Sstevel@tonic-gate #endif
4160Sstevel@tonic-gate 
4170Sstevel@tonic-gate #endif /* _MSGFMT_H */
418