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