/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include "lint.h"
#include "mtlib.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <langinfo.h>
#include "libc.h"
#include "_loc_path.h"
#include "msgfmt.h"
#include "gettext.h"
#ifdef GETTEXT_DEBUG
#include "plural_parser.h"
#include <stdarg.h>
#endif
static const char *category_name[] = {
"/LC_CTYPE/",
"/LC_NUMERIC/",
"/LC_TIME/",
"/LC_COLLATE/",
"/LC_MONETARY/",
"/LC_MESSAGES/"
};
static const int category_name_len[] = {
10,
12,
9,
12,
13,
13
};
/*
* mk_msgfile
*
* INPUT
* mp - uses the following members:
* msgfile - buffer to store the pathname to the message file
* binding - directory pathname bound to specified domain
* cblen - length of binding
* locale - locale name
* domain - domain name
* category - category
* domain_len - length of domain name
*
* OUTPUT
* mp->msgfile - pathname to the message file is stored
*
* RETURN
* mp->msgfile is returned
*/
char *
{
char *p;
#ifdef GETTEXT_DEBUG
#endif
p += totallen;
if (*(p - 1) != '/') {
totallen++;
if (totallen >= MAXPATHLEN)
return (NULL);
*p++ = '/';
}
if (totallen > MAXPATHLEN)
return (NULL);
p += loclen;
p += catlen;
p += mp->domain_len;
#ifdef GETTEXT_DEBUG
gprintf(0, "*************** Exiting mk_msgfile\n");
#endif
}
char *
{
char *p;
p += *totallen;
if (*(p - 1) != '/') {
(*totallen)++;
if (*totallen >= MAXPATHLEN)
return (NULL);
*p++ = '/';
}
*totallen += *suffix_len;
if (*totallen > MAXPATHLEN)
return (NULL);
return (p);
}
/*
* check_cache
*
* INPUT
* mp - may use the following members:
* msgfile - pathname to the message catalog file
* hash_domain - hash id of this domain
*
* RETURN
* non-NULL
* pointer to the Msg_node object of the current message catalog
* found in the cache
*
* NULL
* this message catalog does not exist in the cache
*/
Msg_node *
{
#ifdef GETTEXT_DEBUG
#endif
if (cur_msg &&
/*
* msgfile is the same as the previous message file
*/
#ifdef GETTEXT_DEBUG
gprintf(0, "*** cache found\n");
gprintf(0, "************* exiting check_cache\n");
#endif
return (cur_msg);
}
while (mnp) {
#ifdef GETTEXT_DEBUG
gprintf(0, "========== descending the list\n");
gprintf(0, " hashid: %d, hash_domain: %d\n",
#endif
#ifdef GETTEXT_DEBUG
gprintf(0, "*** cache found\n");
gprintf(0, "******* exiting check_cache\n");
#endif
return (mnp);
}
}
#ifdef GETTEXT_DEBUG
gprintf(0, "*** cache not found\n");
gprintf(0, "******* exiting check_cache\n");
#endif
return (NULL);
}
char *
{
char *codeset;
#ifdef GETTEXT_DEBUG
gprintf(0, "*************** get_codeset(\"%s\")\n",
#endif
/* no codeset is bound to this domain */
}
#ifdef GETTEXT_DEBUG
gprintf(0, "*************** existing get_codeset(\"%s\")\n",
#endif
return (codeset);
}
/*
* get_hashid (hashpjw)
*
* Calculates the hash value from the specified string.
* Actual hashid will be mod(hash value, PRIME_NUMBER).
*
* Ref: Compilers - Principles, Techniques, and Tools
* Aho, Sethi, and Ullman
*/
{
const unsigned char *p = (unsigned char *)str;
uint32_t h = 0;
uint32_t g;
for (; *p; p++) {
h = (h << 4) + *p;
g = h & 0xf0000000;
if (g) {
h = h ^ (g >> 24);
h = h ^ g;
}
}
if (len)
return (h);
}
{
uint32_t r;
r = (n << 24) | ((n & 0xff00) << 8) |
((n >> 8) & 0xff00) | (n >> 24);
return (r);
}
#ifdef GETTEXT_DEBUG
static uint32_t
struct gnu_msg_ent *m)
{
char *ms;
num_of_str = p->num_of_str;
while ((i = p->hash_table[idx]) != 0) {
ms = (i <= num_of_str) ?
/* found */
return (i);
}
}
/* not found */
return (0);
}
void
{
struct gnu_msg_ent *m;
char *ms;
enum gnu_msgidstr v;
int x;
#ifdef GETTEXT_DEBUG_DYMMSG
for (x = 0; x < p->num_of_d_str; x++) {
gprintf(0, "str: \"%s\"\n",
}
}
#endif
#ifdef GETTEXT_DEBUG_HASHTBL
gprintf(0, "******** dynamic hash table\n");
for (x = 0; x < p->hash_size; x++) {
}
#endif
#ifdef GETTEXT_DEBUG_CHECK_STMSGID
gprintf(0, "******** sanity check of static msgid\n");
m = (struct gnu_msg_ent *)(uintptr_t)
for (x = 0; x < p->num_of_str; x++) {
if (hidx == 0) {
gprintf(0,
"failed to find this msg in the hash table\n");
} else {
if (hidx != x + 1) {
gprintf(0, "hash table mismatch\n");
}
}
}
#endif
#ifdef GETTEXT_DEBUG_CHECK_DYMMSGID
gprintf(0, "******* sanity check of dynamic msgid\n");
m = (struct gnu_msg_ent *)(uintptr_t)
for (x = 0; x < p->num_of_d_str; x++) {
if (hidx == 0) {
gprintf(0,
"failed to find this msg in the hash table\n");
} else {
gprintf(0, "hash table mismatch\n");
}
}
}
#endif
}
void
{
while (level-- > 0) {
}
}
void
printlist(void)
{
gprintf(0, "=== Printing default list and regural list\n");
gprintf(0, " Default domain=<%s>, binding=<%s>\n",
while (ppp) {
gprintf(0, " domain=<%s>, binding=<%s>, codeset=<%s>\n",
}
}
void
{
}
void
{
(void *)smnp->msg_file_info);
}
void
{
struct gnu_msg_rev1_info *a =
(struct gnu_msg_rev1_info *)(uintptr_t)
((char *)gmnp->msg_file_info +
sizeof (struct gnu_msg_info));
}
(void *)gmnp->conv_msgstr);
}
void
{
static const char *op_name[] = {
"NULL", "INIT", "EXP",
"NUM", "VAR", "?", ":", "||",
"&&", "==", "!=", ">", "<",
">=", "<=", "+", "-", "*", "/",
"%", "!", "(", ")", "ERR"
};
case 0:
case T_NUM:
break;
case T_VAR:
break;
}
break;
case 1:
break;
case 2:
break;
case 3:
break;
}
}
void
{
"UNKNOWN TYPE");
}
void
{
"NULL");
}
void
{
"NULL");
"NULL");
}
void
{
} else {
}
} else {
}
} else {
}
} else {
}
} else {
}
}
#endif