xref: /illumos-gate/usr/src/lib/libc/inc/msgfmt.h (revision 1da57d55)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*f13ac639Smuffin  * Common Development and Distribution License (the "License").
6*f13ac639Smuffin  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*f13ac639Smuffin  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*f13ac639Smuffin  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _MSGFMT_H
277c478bd9Sstevel@tonic-gate #define	_MSGFMT_H
287c478bd9Sstevel@tonic-gate 
29*f13ac639Smuffin #include <stdint.h>
30*f13ac639Smuffin #include <stddef.h>
31*f13ac639Smuffin 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  *	Sun MO file format
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  *
427c478bd9Sstevel@tonic-gate  *		+-------------------------------+
437c478bd9Sstevel@tonic-gate  *		| (int) middle message id       |
447c478bd9Sstevel@tonic-gate  *		+-------------------------------+
457c478bd9Sstevel@tonic-gate  *		| (int) total # of messages     |
467c478bd9Sstevel@tonic-gate  *		+-------------------------------+
477c478bd9Sstevel@tonic-gate  *		| (int) total msgid length      |
487c478bd9Sstevel@tonic-gate  *		+-------------------------------+
497c478bd9Sstevel@tonic-gate  *		| (int) total msgstr length     |
507c478bd9Sstevel@tonic-gate  *		+-------------------------------+
517c478bd9Sstevel@tonic-gate  *		| (int) size of msg_struct size	|
527c478bd9Sstevel@tonic-gate  *		+-------------------------------+
537c478bd9Sstevel@tonic-gate  *		+-------------------------------+
547c478bd9Sstevel@tonic-gate  *		| (int) less                    |
557c478bd9Sstevel@tonic-gate  *		+-------------------------------+
567c478bd9Sstevel@tonic-gate  *		| (int) more                    |
577c478bd9Sstevel@tonic-gate  *		+-------------------------------+
587c478bd9Sstevel@tonic-gate  *		| (int) msgid offset            |
597c478bd9Sstevel@tonic-gate  *		+-------------------------------+
607c478bd9Sstevel@tonic-gate  *		| (int) msgstr offset           |
617c478bd9Sstevel@tonic-gate  *		+-------------------------------+
627c478bd9Sstevel@tonic-gate  *			................
637c478bd9Sstevel@tonic-gate  *		+-------------------------------+
647c478bd9Sstevel@tonic-gate  *		| (variable str) msgid          |
657c478bd9Sstevel@tonic-gate  *		+-------------------------------+
667c478bd9Sstevel@tonic-gate  *		| (variable str) msgid          |
677c478bd9Sstevel@tonic-gate  *		+-------------------------------+
687c478bd9Sstevel@tonic-gate  *			................
697c478bd9Sstevel@tonic-gate  *		+-------------------------------+
707c478bd9Sstevel@tonic-gate  *		| (variable str) msgid          |
717c478bd9Sstevel@tonic-gate  *		+-------------------------------+
727c478bd9Sstevel@tonic-gate  *		+-------------------------------+
737c478bd9Sstevel@tonic-gate  *		| (variable str) msgstr         |
747c478bd9Sstevel@tonic-gate  *		+-------------------------------+
757c478bd9Sstevel@tonic-gate  *		| (variable str) msgstr         |
767c478bd9Sstevel@tonic-gate  *		+-------------------------------+
777c478bd9Sstevel@tonic-gate  *			................
787c478bd9Sstevel@tonic-gate  *		+-------------------------------+
797c478bd9Sstevel@tonic-gate  *		| (variable str) msgstr         |
807c478bd9Sstevel@tonic-gate  *		+-------------------------------+
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate struct msg_info {
847c478bd9Sstevel@tonic-gate 	int	msg_mid;			/* middle message id */
857c478bd9Sstevel@tonic-gate 	int	msg_count;			/* total # of messages */
867c478bd9Sstevel@tonic-gate 	int	str_count_msgid;	/* total msgid length */
877c478bd9Sstevel@tonic-gate 	int	str_count_msgstr;	/* total msgstr length */
887c478bd9Sstevel@tonic-gate 	int	msg_struct_size;	/* size of msg_struct_size */
897c478bd9Sstevel@tonic-gate };
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate struct msg_struct {
927c478bd9Sstevel@tonic-gate 	int	less;				/* index of left leaf */
937c478bd9Sstevel@tonic-gate 	int	more;				/* index of right leaf */
947c478bd9Sstevel@tonic-gate 	int	msgid_offset;		/* msgid offset */
957c478bd9Sstevel@tonic-gate 	int msgstr_offset;		/* msgstr offset */
967c478bd9Sstevel@tonic-gate };
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #define	MSG_STRUCT_SIZE		(sizeof (struct msg_struct))
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * The following is the size of the old msg_struct used be defined
1027c478bd9Sstevel@tonic-gate  * in usr/src/cmd/msgfmt/msgfmt.c.
1037c478bd9Sstevel@tonic-gate  * Old msg_struct contained:
1047c478bd9Sstevel@tonic-gate  * struct msg_struct {
1057c478bd9Sstevel@tonic-gate  *		char	*msgid;
1067c478bd9Sstevel@tonic-gate  *		char	*msgstr;
1077c478bd9Sstevel@tonic-gate  *		int	msgid_offset;
1087c478bd9Sstevel@tonic-gate  *		int	msgstr_offset;
1097c478bd9Sstevel@tonic-gate  *		struct msg_struct	*next;
1107c478bd9Sstevel@tonic-gate  * };
1117c478bd9Sstevel@tonic-gate  */
1127c478bd9Sstevel@tonic-gate #define	OLD_MSG_STRUCT_SIZE	20
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate #define	LEAFINDICATOR		-99
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  *	GNU MO file format
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  *
1227c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
123*f13ac639Smuffin  *           0 | (uint32_t) magic number                 |
1247c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
125*f13ac639Smuffin  *           4 | (uint32_t) format revision              |
1267c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
127*f13ac639Smuffin  *           8 | (uint32_t) number of strings            | == N
1287c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
129*f13ac639Smuffin  *          12 | (uint32_t) offset of msgid table        | == O
1307c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
131*f13ac639Smuffin  *          16 | (uint32_t) offset of msgstr table       | == T
1327c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
133*f13ac639Smuffin  *          20 | (uint32_t) size of hashing table        | == S
1347c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
135*f13ac639Smuffin  *          24 | (uint32_t) offset of hashing table      | == H
1367c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1377c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
138*f13ac639Smuffin  *           O | (uint32_t) length of 0th msgid          |
1397c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
140*f13ac639Smuffin  *         O+4 | (uint32_t) offset of 0th msgid          | == M(0)
1417c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1427c478bd9Sstevel@tonic-gate  *             ...............................
1437c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
144*f13ac639Smuffin  * O+((N-1)*8) | (uint32_t) length of (N-1)th msgid      |
1457c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
146*f13ac639Smuffin  * O+((N-1)*8) | (uint32_t) offset of (N-1)th msgid      | == M(N-1)
1477c478bd9Sstevel@tonic-gate  *       +4    +-----------------------------------------+
1487c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
149*f13ac639Smuffin  *           T | (uint32_t) length of 0th msgstr         |
150*f13ac639Smuffin  *             +-----------------------------------------+
151*f13ac639Smuffin  *         T+4 | (uint32_t) offset of 0th msgstr         | == Q(0)
1527c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1537c478bd9Sstevel@tonic-gate  *             ...............................
1547c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
155*f13ac639Smuffin  * T+((N-1)*8) | (uint32_t) length of (N-1)th msgstr     |
1567c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
157*f13ac639Smuffin  * T+((N-1)*8) | (uint32_t) offset of (N-1)th msgstr     | == Q(N-1)
1587c478bd9Sstevel@tonic-gate  *       +4    +-----------------------------------------+
159*f13ac639Smuffin  *             +-----------------------------------------+
160*f13ac639Smuffin  *           H | (uint32_t) start hashing table          |
1617c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1627c478bd9Sstevel@tonic-gate  *             ...............................
1637c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
164*f13ac639Smuffin  *   H + S * 4 | (uint32_t) end hashing table            |
165*f13ac639Smuffin  *             +-----------------------------------------+
1667c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1677c478bd9Sstevel@tonic-gate  *        M(0) | NULL terminated 0th msgid string        |
1687c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1697c478bd9Sstevel@tonic-gate  *        M(1) | NULL terminated 1st msgid string        |
1707c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1717c478bd9Sstevel@tonic-gate  *             ...............................
1727c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1737c478bd9Sstevel@tonic-gate  *      M(N-1) | NULL terminated (N-1)th msgid string    |
1747c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
175*f13ac639Smuffin  *             +-----------------------------------------+
1767c478bd9Sstevel@tonic-gate  *        Q(0) | NULL terminated 0th msgstr string       |
1777c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1787c478bd9Sstevel@tonic-gate  *        Q(1) | NULL terminated 1st msgstr string       |
1797c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1807c478bd9Sstevel@tonic-gate  *             ...............................
1817c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1827c478bd9Sstevel@tonic-gate  *      Q(N-1) | NULL terminated (N-1)th msgstr string   |
1837c478bd9Sstevel@tonic-gate  *             +-----------------------------------------+
1847c478bd9Sstevel@tonic-gate  */
1857c478bd9Sstevel@tonic-gate 
186*f13ac639Smuffin /*
187*f13ac639Smuffin  *	GNU MO file format (Revision 1)
188*f13ac639Smuffin  */
189*f13ac639Smuffin /*
190*f13ac639Smuffin  *
191*f13ac639Smuffin  *             +-----------------------------------------------+
192*f13ac639Smuffin  *           0 | (uint32_t) magic number                       |
193*f13ac639Smuffin  *             +-----------------------------------------------+
194*f13ac639Smuffin  *           4 | (uint32_t) format revision                    |
195*f13ac639Smuffin  *             +-----------------------------------------------+
196*f13ac639Smuffin  *           8 | (uint32_t) number of strings                  | == N
197*f13ac639Smuffin  *             +-----------------------------------------------+
198*f13ac639Smuffin  *          12 | (uint32_t) offset of msgid table              | == O
199*f13ac639Smuffin  *             +-----------------------------------------------+
200*f13ac639Smuffin  *          16 | (uint32_t) offset of msgstr table             | == T
201*f13ac639Smuffin  *             +-----------------------------------------------+
202*f13ac639Smuffin  *          20 | (uint32_t) size of hashing table              | == S
203*f13ac639Smuffin  *             +-----------------------------------------------+
204*f13ac639Smuffin  *          24 | (uint32_t) offset of hashing table            | == H
205*f13ac639Smuffin  *             +-----------------------------------------------+
206*f13ac639Smuffin  *          32 | (uint32_t) number of dynamic macros           | == M
207*f13ac639Smuffin  *             +-----------------------------------------------+
208*f13ac639Smuffin  *          36 | (uint32_t) offset of dynamic macros           | == P
209*f13ac639Smuffin  *             +-----------------------------------------------+
210*f13ac639Smuffin  *          40 | (uint32_t) number of dynamic strings          | == D
211*f13ac639Smuffin  *             +-----------------------------------------------+
212*f13ac639Smuffin  *          44 | (uint32_t) offset of dynamic msgid tbl        | == A
213*f13ac639Smuffin  *             +-----------------------------------------------+
214*f13ac639Smuffin  *          48 | (uint32_t) offset of dynamic msgstr tbl       | == B
215*f13ac639Smuffin  *             +-----------------------------------------------+
216*f13ac639Smuffin  *             +-----------------------------------------------+
217*f13ac639Smuffin  *           O | (uint32_t) length of 0th msgid                |
218*f13ac639Smuffin  *             +-----------------------------------------------+
219*f13ac639Smuffin  *         O+4 | (uint32_t) offset of 0th msgid                | == M(0)
220*f13ac639Smuffin  *             +-----------------------------------------------+
221*f13ac639Smuffin  *             ...............................
222*f13ac639Smuffin  *             +-----------------------------------------------+
223*f13ac639Smuffin  * O+((N-1)*8) | (uint32_t) length of (N-1)th msgid            |
224*f13ac639Smuffin  *             +-----------------------------------------------+
225*f13ac639Smuffin  * O+((N-1)*8) | (uint32_t) offset of (N-1)th msgid            | == M(N-1)
226*f13ac639Smuffin  *       +4    +-----------------------------------------------+
227*f13ac639Smuffin  *             +-----------------------------------------------+
228*f13ac639Smuffin  *           T | (uint32_t) length of 0th msgstr               |
229*f13ac639Smuffin  *             +-----------------------------------------------+
230*f13ac639Smuffin  *         T+4 | (uint32_t) offset of 0th msgstr               | == Q(0)
231*f13ac639Smuffin  *             +-----------------------------------------------+
232*f13ac639Smuffin  *             ...............................
233*f13ac639Smuffin  *             +-----------------------------------------------+
234*f13ac639Smuffin  * T+((N-1)*8) | (uint32_t) length of (N-1)th msgstr           |
235*f13ac639Smuffin  *             +-----------------------------------------------+
236*f13ac639Smuffin  * T+((N-1)*8) | (uint32_t) offset of (N-1)th msgstr           | == Q(N-1)
237*f13ac639Smuffin  *       +4    +-----------------------------------------------+
238*f13ac639Smuffin  *             +-----------------------------------------------+
239*f13ac639Smuffin  *           H | (uint32_t) start hashing table                |
240*f13ac639Smuffin  *             +-----------------------------------------------+
241*f13ac639Smuffin  *             ...............................
242*f13ac639Smuffin  *             +-----------------------------------------------+
243*f13ac639Smuffin  *   H + S * 4 | (uint32_t) end hashing table                  |
244*f13ac639Smuffin  *             +-----------------------------------------------+
245*f13ac639Smuffin  *             +-----------------------------------------------+
246*f13ac639Smuffin  *           P | (uint32_t) length of 0th macro                |
247*f13ac639Smuffin  *             +-----------------------------------------------+
248*f13ac639Smuffin  *         P+4 | (uint32_t) offset of 0th macro                | == C(0)
249*f13ac639Smuffin  *             +-----------------------------------------------+
250*f13ac639Smuffin  *             ...............................
251*f13ac639Smuffin  *             +-----------------------------------------------+
252*f13ac639Smuffin  * P+((M-1)*8) | (uint32_t) length of (M-1)th macro            |
253*f13ac639Smuffin  *             +-----------------------------------------------+
254*f13ac639Smuffin  * P+((M-1)*8) | (uint32_t) offset of (M-1)th macro            | == C(M-1)
255*f13ac639Smuffin  *       +4    +-----------------------------------------------+
256*f13ac639Smuffin  *             +-----------------------------------------------+
257*f13ac639Smuffin  *           A | (uint32_t) offset of 0th d_msgid              | == L(0)
258*f13ac639Smuffin  *             +-----------------------------------------------+
259*f13ac639Smuffin  *             ...............................
260*f13ac639Smuffin  *             +-----------------------------------------------+
261*f13ac639Smuffin  * A+((D-1)*4) | (uint32_t) offset of (D-1)th d_msgid          | == L(D-1)
262*f13ac639Smuffin  *             +-----------------------------------------------+
263*f13ac639Smuffin  *             +-----------------------------------------------+
264*f13ac639Smuffin  *           B | (uint32_t) offset of 0th d_msgstr             | == E(0)
265*f13ac639Smuffin  *             +-----------------------------------------------+
266*f13ac639Smuffin  *             ...............................
267*f13ac639Smuffin  *             +-----------------------------------------------+
268*f13ac639Smuffin  * B+((D-1)*4) | (uint32_t) offset of (D-1)th d_msgstr         | == E(D-1)
269*f13ac639Smuffin  *             +-----------------------------------------------+
270*f13ac639Smuffin  *             +-----------------------------------------------+
271*f13ac639Smuffin  *        L(0) | (uint32_t) offset of 0th d_msgid message      | == F(0)
272*f13ac639Smuffin  *             +-----------------------------------------------+
273*f13ac639Smuffin  *      L(0)+4 | (uint32_t) length of 0th fixed substring      |
274*f13ac639Smuffin  *             +-----------------------------------------------+
275*f13ac639Smuffin  *      L(0)+8 | (uint32_t) index to a dynamic macro           |
276*f13ac639Smuffin  *             +-----------------------------------------------+
277*f13ac639Smuffin  *             ...............................
278*f13ac639Smuffin  *             +-----------------------------------------------+
279*f13ac639Smuffin  *     L(0)+4+ | (uint32_t) length of (m-1)th fixed substring  |
280*f13ac639Smuffin  *   ((m-1)*8) +-----------------------------------------------+
281*f13ac639Smuffin  *     L(0)+8+ | (uint32_t) NOMORE_DYNAMIC_STR                 |
282*f13ac639Smuffin  *   ((m-1)*8) +-----------------------------------------------+
283*f13ac639Smuffin  *             +-----------------------------------------------+
284*f13ac639Smuffin  *      L(D-1) | (uint32_t) offset of 0th d_msgid message      | == F(D-1)
285*f13ac639Smuffin  *             +-----------------------------------------------+
286*f13ac639Smuffin  *    L(D-1)+4 | (uint32_t) length of 0th fixed substring      |
287*f13ac639Smuffin  *             +-----------------------------------------------+
288*f13ac639Smuffin  *    L(D-1)+8 | (uint32_t) index to a dynamic macro           |
289*f13ac639Smuffin  *             +-----------------------------------------------+
290*f13ac639Smuffin  *             ...............................
291*f13ac639Smuffin  *             +-----------------------------------------------+
292*f13ac639Smuffin  *    L(D-1)+4 | (uint32_t) length of (m-1)th fixed substring  |
293*f13ac639Smuffin  *   ((m-1)*8) +-----------------------------------------------+
294*f13ac639Smuffin  *    L(D-1)+8 | (uint32_t) NOMORE_DYNAMIC_STR                 |
295*f13ac639Smuffin  *   ((m-1)*8) +-----------------------------------------------+
296*f13ac639Smuffin  *             +-----------------------------------------------+
297*f13ac639Smuffin  *        E(0) | (uint32_t) offset of 0th d_msgstr message     | == G(0)
298*f13ac639Smuffin  *             +-----------------------------------------------+
299*f13ac639Smuffin  *      E(0)+4 | (uint32_t) length of 0th fixed substring      |
300*f13ac639Smuffin  *             +-----------------------------------------------+
301*f13ac639Smuffin  *      E(0)+8 | (uint32_t) index to a dynamic macro           |
302*f13ac639Smuffin  *             +-----------------------------------------------+
303*f13ac639Smuffin  *             ...............................
304*f13ac639Smuffin  *             +-----------------------------------------------+
305*f13ac639Smuffin  *     E(0)+4+ | (uint32_t) length of (m-1)th fixed substring  |
306*f13ac639Smuffin  *   ((m-1)*8) +-----------------------------------------------+
307*f13ac639Smuffin  *     E(0)+8+ | (uint32_t) NOMORE_DYNAMIC_STR                 |
308*f13ac639Smuffin  *   ((m-1)*8) +-----------------------------------------------+
309*f13ac639Smuffin  *             +-----------------------------------------------+
310*f13ac639Smuffin  *      E(D-1) | (uint32_t) offset of 0th d_msgstr message     | == G(D-1)
311*f13ac639Smuffin  *             +-----------------------------------------------+
312*f13ac639Smuffin  *    E(D-1)+4 | (uint32_t) length of 0th fixed substring      |
313*f13ac639Smuffin  *             +-----------------------------------------------+
314*f13ac639Smuffin  *    E(D-1)+8 | (uint32_t) index to a dynamic macro           |
315*f13ac639Smuffin  *             +-----------------------------------------------+
316*f13ac639Smuffin  *             ...............................
317*f13ac639Smuffin  *             +-----------------------------------------------+
318*f13ac639Smuffin  *    E(D-1)+4 | (uint32_t) length of (m-1)th fixed substring  |
319*f13ac639Smuffin  *   ((m-1)*8) +-----------------------------------------------+
320*f13ac639Smuffin  *    E(D-1)+8 | (uint32_t) NOMORE_DYNAMIC_STR                 |
321*f13ac639Smuffin  *   ((m-1)*8) +-----------------------------------------------+
322*f13ac639Smuffin  *             +-----------------------------------------------+
323*f13ac639Smuffin  *        M(0) | NULL terminated 0th msgid string              |
324*f13ac639Smuffin  *             +-----------------------------------------------+
325*f13ac639Smuffin  *        M(1) | NULL terminated 1st msgid string              |
326*f13ac639Smuffin  *             +-----------------------------------------------+
327*f13ac639Smuffin  *             ...............................
328*f13ac639Smuffin  *             +-----------------------------------------------+
329*f13ac639Smuffin  *      M(N-1) | NULL terminated (N-1)th msgid string          |
330*f13ac639Smuffin  *             +-----------------------------------------------+
331*f13ac639Smuffin  *        Q(0) | NULL terminated 0th msgstr string             |
332*f13ac639Smuffin  *             +-----------------------------------------------+
333*f13ac639Smuffin  *        Q(1) | NULL terminated 1st msgstr string             |
334*f13ac639Smuffin  *             +-----------------------------------------------+
335*f13ac639Smuffin  *             ...............................
336*f13ac639Smuffin  *             +-----------------------------------------------+
337*f13ac639Smuffin  *      Q(N-1) | NULL terminated (N-1)th msgstr string         |
338*f13ac639Smuffin  *             +-----------------------------------------------+
339*f13ac639Smuffin  *             +-----------------------------------------------+
340*f13ac639Smuffin  *        C(0) | NULL terminated 0th macro                     |
341*f13ac639Smuffin  *             +-----------------------------------------------+
342*f13ac639Smuffin  *             ...............................
343*f13ac639Smuffin  *             +-----------------------------------------------+
344*f13ac639Smuffin  *      C(M-1) | NULL terminated (M-1)th macro                 |
345*f13ac639Smuffin  *             +-----------------------------------------------+
346*f13ac639Smuffin  *             +-----------------------------------------------+
347*f13ac639Smuffin  *        F(0) | NULL terminated 0th dynamic msgid string      |
348*f13ac639Smuffin  *             +-----------------------------------------------+
349*f13ac639Smuffin  *             ...............................
350*f13ac639Smuffin  *             +-----------------------------------------------+
351*f13ac639Smuffin  *      F(D-1) | NULL terminated (D-1)th dynamic msgid string  |
352*f13ac639Smuffin  *             +-----------------------------------------------+
353*f13ac639Smuffin  *             +-----------------------------------------------+
354*f13ac639Smuffin  *        G(0) | NULL terminated 0th dynamic msgstr string     |
355*f13ac639Smuffin  *             +-----------------------------------------------+
356*f13ac639Smuffin  *             ...............................
357*f13ac639Smuffin  *             +-----------------------------------------------+
358*f13ac639Smuffin  *      G(D-1) | NULL terminated (D-1)th dynamic msgstr string |
359*f13ac639Smuffin  *             +-----------------------------------------------+
360*f13ac639Smuffin  */
361*f13ac639Smuffin 
362*f13ac639Smuffin #define	GNU_MAGIC			0x950412de
363*f13ac639Smuffin #define	GNU_MAGIC_SWAPPED		0xde120495
364*f13ac639Smuffin #define	GNU_REVISION			0
365*f13ac639Smuffin #define	GNU_REVISION_0_0		0
366*f13ac639Smuffin #define	GNU_REVISION_0_0_SWAPPED	0
367*f13ac639Smuffin #define	GNU_REVISION_0_1		0x00000001
368*f13ac639Smuffin #define	GNU_REVISION_0_1_SWAPPED	0x01000000
369*f13ac639Smuffin #define	GNU_REVISION_1_1		0x00010001
370*f13ac639Smuffin #define	GNU_REVISION_1_1_SWAPPED	0x01000100
371*f13ac639Smuffin #define	NOMORE_DYNAMIC_MACRO		0xffffffff
372*f13ac639Smuffin 
373*f13ac639Smuffin enum gnu_msgidstr {
374*f13ac639Smuffin 	MSGID = 0,
375*f13ac639Smuffin 	MSGSTR = 1
376*f13ac639Smuffin };
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate struct gnu_msg_info {
379*f13ac639Smuffin 	uint32_t	magic;
380*f13ac639Smuffin 	uint32_t	revision;
381*f13ac639Smuffin 	uint32_t	num_of_str;
382*f13ac639Smuffin 	uint32_t	off_msgid_tbl;
383*f13ac639Smuffin 	uint32_t	off_msgstr_tbl;
384*f13ac639Smuffin 	uint32_t	sz_hashtbl;
385*f13ac639Smuffin 	uint32_t	off_hashtbl;
386*f13ac639Smuffin };
387*f13ac639Smuffin 
388*f13ac639Smuffin struct gnu_msg_rev1_info {
389*f13ac639Smuffin 	uint32_t	num_of_dynamic_macro;
390*f13ac639Smuffin 	uint32_t	off_dynamic_macro;
391*f13ac639Smuffin 	uint32_t	num_of_dynamic_str;
392*f13ac639Smuffin 	uint32_t	off_dynamic_msgid_tbl;
393*f13ac639Smuffin 	uint32_t	off_dynamic_msgstr_tbl;
3947c478bd9Sstevel@tonic-gate };
3957c478bd9Sstevel@tonic-gate 
3967c478bd9Sstevel@tonic-gate struct gnu_msg_ent {
397*f13ac639Smuffin 	uint32_t	len;
398*f13ac639Smuffin 	uint32_t	offset;
399*f13ac639Smuffin };
400*f13ac639Smuffin 
401*f13ac639Smuffin struct gnu_dynamic_ent {
402*f13ac639Smuffin 	uint32_t	len;
403*f13ac639Smuffin 	uint32_t	idx;
404*f13ac639Smuffin };
405*f13ac639Smuffin 
406*f13ac639Smuffin struct gnu_dynamic_tbl {
407*f13ac639Smuffin 	uint32_t	offset;
408*f13ac639Smuffin 	struct gnu_dynamic_ent	entry[1];
4097c478bd9Sstevel@tonic-gate };
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4127c478bd9Sstevel@tonic-gate }
4137c478bd9Sstevel@tonic-gate #endif
4147c478bd9Sstevel@tonic-gate 
4157c478bd9Sstevel@tonic-gate #endif /* _MSGFMT_H */
416