1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 1998, 2001 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _MSGFMT_H 28*7c478bd9Sstevel@tonic-gate #define _MSGFMT_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* 37*7c478bd9Sstevel@tonic-gate * Sun MO file format 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate /* 41*7c478bd9Sstevel@tonic-gate * 42*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 43*7c478bd9Sstevel@tonic-gate * | (int) middle message id | 44*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 45*7c478bd9Sstevel@tonic-gate * | (int) total # of messages | 46*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 47*7c478bd9Sstevel@tonic-gate * | (int) total msgid length | 48*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 49*7c478bd9Sstevel@tonic-gate * | (int) total msgstr length | 50*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 51*7c478bd9Sstevel@tonic-gate * | (int) size of msg_struct size | 52*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 53*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 54*7c478bd9Sstevel@tonic-gate * | (int) less | 55*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 56*7c478bd9Sstevel@tonic-gate * | (int) more | 57*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 58*7c478bd9Sstevel@tonic-gate * | (int) msgid offset | 59*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 60*7c478bd9Sstevel@tonic-gate * | (int) msgstr offset | 61*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 62*7c478bd9Sstevel@tonic-gate * ................ 63*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 64*7c478bd9Sstevel@tonic-gate * | (variable str) msgid | 65*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 66*7c478bd9Sstevel@tonic-gate * | (variable str) msgid | 67*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 68*7c478bd9Sstevel@tonic-gate * ................ 69*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 70*7c478bd9Sstevel@tonic-gate * | (variable str) msgid | 71*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 72*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 73*7c478bd9Sstevel@tonic-gate * | (variable str) msgstr | 74*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 75*7c478bd9Sstevel@tonic-gate * | (variable str) msgstr | 76*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 77*7c478bd9Sstevel@tonic-gate * ................ 78*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 79*7c478bd9Sstevel@tonic-gate * | (variable str) msgstr | 80*7c478bd9Sstevel@tonic-gate * +-------------------------------+ 81*7c478bd9Sstevel@tonic-gate */ 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate struct msg_info { 84*7c478bd9Sstevel@tonic-gate int msg_mid; /* middle message id */ 85*7c478bd9Sstevel@tonic-gate int msg_count; /* total # of messages */ 86*7c478bd9Sstevel@tonic-gate int str_count_msgid; /* total msgid length */ 87*7c478bd9Sstevel@tonic-gate int str_count_msgstr; /* total msgstr length */ 88*7c478bd9Sstevel@tonic-gate int msg_struct_size; /* size of msg_struct_size */ 89*7c478bd9Sstevel@tonic-gate }; 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate struct msg_struct { 92*7c478bd9Sstevel@tonic-gate int less; /* index of left leaf */ 93*7c478bd9Sstevel@tonic-gate int more; /* index of right leaf */ 94*7c478bd9Sstevel@tonic-gate int msgid_offset; /* msgid offset */ 95*7c478bd9Sstevel@tonic-gate int msgstr_offset; /* msgstr offset */ 96*7c478bd9Sstevel@tonic-gate }; 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate #define MSG_STRUCT_SIZE (sizeof (struct msg_struct)) 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate /* 101*7c478bd9Sstevel@tonic-gate * The following is the size of the old msg_struct used be defined 102*7c478bd9Sstevel@tonic-gate * in usr/src/cmd/msgfmt/msgfmt.c. 103*7c478bd9Sstevel@tonic-gate * Old msg_struct contained: 104*7c478bd9Sstevel@tonic-gate * struct msg_struct { 105*7c478bd9Sstevel@tonic-gate * char *msgid; 106*7c478bd9Sstevel@tonic-gate * char *msgstr; 107*7c478bd9Sstevel@tonic-gate * int msgid_offset; 108*7c478bd9Sstevel@tonic-gate * int msgstr_offset; 109*7c478bd9Sstevel@tonic-gate * struct msg_struct *next; 110*7c478bd9Sstevel@tonic-gate * }; 111*7c478bd9Sstevel@tonic-gate */ 112*7c478bd9Sstevel@tonic-gate #define OLD_MSG_STRUCT_SIZE 20 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate #define LEAFINDICATOR -99 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate /* 117*7c478bd9Sstevel@tonic-gate * GNU MO file format 118*7c478bd9Sstevel@tonic-gate */ 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate /* 121*7c478bd9Sstevel@tonic-gate * 122*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 123*7c478bd9Sstevel@tonic-gate * 0 | (unsigned int) magic number | 124*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 125*7c478bd9Sstevel@tonic-gate * 4 | (unsigned int) format revision | 126*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 127*7c478bd9Sstevel@tonic-gate * 8 | (unsigned int) number of strings | == N 128*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 129*7c478bd9Sstevel@tonic-gate * 12 | (unsigned int) offset of msgid table | == O 130*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 131*7c478bd9Sstevel@tonic-gate * 16 | (unsigned int) offset of msgstr table | == T 132*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 133*7c478bd9Sstevel@tonic-gate * 20 | (unsigned int) size of hashing table | == S 134*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 135*7c478bd9Sstevel@tonic-gate * 24 | (unsigned int) offset of hashing table | == H 136*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 137*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 138*7c478bd9Sstevel@tonic-gate * O | (unsigned int) length of 0th msgid | 139*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 140*7c478bd9Sstevel@tonic-gate * O+4 | (unsigned int) offset of 0th msgid | == M(0) 141*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 142*7c478bd9Sstevel@tonic-gate * ............................... 143*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 144*7c478bd9Sstevel@tonic-gate * O+((N-1)*8) | (unsigned int) length of (N-1)th msgid | 145*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 146*7c478bd9Sstevel@tonic-gate * O+((N-1)*8) | (unsigned int) offset of (N-1)th msgid | == M(N-1) 147*7c478bd9Sstevel@tonic-gate * +4 +-----------------------------------------+ 148*7c478bd9Sstevel@tonic-gate * T | (unsigned int) length of 0th msgstr | 149*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 150*7c478bd9Sstevel@tonic-gate * T+4 | (unsigned int) offset of 0th msgstr | == Q(0) 151*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 152*7c478bd9Sstevel@tonic-gate * ............................... 153*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 154*7c478bd9Sstevel@tonic-gate * T+((N-1)*8) | (unsigned int) length of (N-1)th msgstr | 155*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 156*7c478bd9Sstevel@tonic-gate * T+((N-1)*8) | (unsigned int) offset of (N-1)th msgstr | == Q(N-1) 157*7c478bd9Sstevel@tonic-gate * +4 +-----------------------------------------+ 158*7c478bd9Sstevel@tonic-gate * H | (unsigned int) start hashing table | 159*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 160*7c478bd9Sstevel@tonic-gate * ............................... 161*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 162*7c478bd9Sstevel@tonic-gate * H + S * 4 | (unsigned int) end hashing table | 163*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 164*7c478bd9Sstevel@tonic-gate * M(0) | NULL terminated 0th msgid string | 165*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 166*7c478bd9Sstevel@tonic-gate * M(1) | NULL terminated 1st msgid string | 167*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 168*7c478bd9Sstevel@tonic-gate * ............................... 169*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 170*7c478bd9Sstevel@tonic-gate * M(N-1) | NULL terminated (N-1)th msgid string | 171*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 172*7c478bd9Sstevel@tonic-gate * Q(0) | NULL terminated 0th msgstr string | 173*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 174*7c478bd9Sstevel@tonic-gate * Q(1) | NULL terminated 1st msgstr string | 175*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 176*7c478bd9Sstevel@tonic-gate * ............................... 177*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 178*7c478bd9Sstevel@tonic-gate * Q(N-1) | NULL terminated (N-1)th msgstr string | 179*7c478bd9Sstevel@tonic-gate * +-----------------------------------------+ 180*7c478bd9Sstevel@tonic-gate */ 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate #define GNU_MAGIC 0x950412de 183*7c478bd9Sstevel@tonic-gate #define GNU_MAGIC_SWAPPED 0xde120495 184*7c478bd9Sstevel@tonic-gate #define GNU_REVISION 0 185*7c478bd9Sstevel@tonic-gate #define GNU_REVISION_SWAPPED 0 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate struct gnu_msg_info { 188*7c478bd9Sstevel@tonic-gate unsigned int magic; 189*7c478bd9Sstevel@tonic-gate unsigned int revision; 190*7c478bd9Sstevel@tonic-gate unsigned int num_of_str; 191*7c478bd9Sstevel@tonic-gate unsigned int off_msgid_tbl; 192*7c478bd9Sstevel@tonic-gate unsigned int off_msgstr_tbl; 193*7c478bd9Sstevel@tonic-gate unsigned int sz_hashtbl; 194*7c478bd9Sstevel@tonic-gate unsigned int off_hashtbl; 195*7c478bd9Sstevel@tonic-gate }; 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate struct gnu_msg_ent { 198*7c478bd9Sstevel@tonic-gate unsigned int len; 199*7c478bd9Sstevel@tonic-gate unsigned int offset; 200*7c478bd9Sstevel@tonic-gate }; 201*7c478bd9Sstevel@tonic-gate 202*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 203*7c478bd9Sstevel@tonic-gate } 204*7c478bd9Sstevel@tonic-gate #endif 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate #endif /* _MSGFMT_H */ 207