1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

DtHelp: use system locales.

This commit is contained in:
Liang Chang 2022-01-18 08:55:17 +08:00
parent 3c67bd0cb1
commit f3965ed394
11 changed files with 117 additions and 314 deletions

View file

@ -1324,21 +1324,51 @@ char *
_DtHelpCeGetCcdfVolLocale ( _DtHelpCeGetCcdfVolLocale (
_DtHelpVolume vol) _DtHelpVolume vol)
{ {
char *locale = NULL; char *locale, *ptr, *resStr;
char *charSet; char *mResStr = NULL;
char *mLang = NULL;
char *lang = "C";
char *defLocale = "C.UTF-8";
CcdfVolumePtr ccdfVol = GetCcdfVolumePtr(vol); CcdfVolumePtr ccdfVol = GetCcdfVolumePtr(vol);
errno = 0; errno = 0;
locale = GetResourceString(ccdfVol->volDb, NULL, "CharSet", "charSet");
if (_DtHelpCeStrchr(locale, ".", 1, &charSet) != 0)
{
charSet = locale;
_DtHelpCeXlateOpToStdLocale(DtLCX_OPER_CCDF,charSet,&locale,NULL,NULL);
/* charset is owned by the volume Xrm database; don't free */
}
else if (NULL != locale)
locale = strdup(locale);
/* resStr is owned by the volume Xrm database; don't free */
resStr = GetResourceString(ccdfVol->volDb, NULL, "CharSet", "charSet");
if (resStr == NULL || *resStr == '\0')
{
locale = strdup(defLocale);
goto done;
}
mResStr = strdup(resStr);
if (_DtHelpCeStrchr(mResStr, ".", 1, &ptr) == 0)
{
*ptr++ = '\0';
if (mResStr == NULL || *mResStr == '\0' || ptr == NULL || *ptr == '\0')
locale = strdup(defLocale);
else
locale = strdup(resStr);
goto done;
}
mLang = _DtHelpGetLocale();
if (_DtHelpCeStrrchr(mLang, ".", 1, &ptr) == 0)
{
*ptr = '\0';
if (mLang != NULL && *mLang != '\0') lang = mLang;
}
asprintf(&locale, "%s.%s", lang, resStr);
done:
free(mLang);
free(mResStr);
return locale; return locale;
} /* End _DtHelpCeGetCcdfVolLocale */ } /* End _DtHelpCeGetCcdfVolLocale */

View file

@ -74,6 +74,7 @@
#include "FormatSDLI.h" #include "FormatSDLI.h"
#include "StringFuncsI.h" #include "StringFuncsI.h"
#include "UtilSDLI.h" #include "UtilSDLI.h"
#include "HelpXlate.h"
#ifdef NLS16 #ifdef NLS16
#endif #endif
@ -89,7 +90,7 @@ static int ProcessEntry (
/******** End Private Function Declarations ********/ /******** End Private Function Declarations ********/
/******** Private Variable Declarations ********/ /******** Private Variable Declarations ********/
static const char *IsoString = "ISO-8859-1"; static const char *IsoString = "UTF-8";
static const CESDLVolume DefaultSdlVolume = static const CESDLVolume DefaultSdlVolume =
{ {
NULL, /* _DtCvSegment *sdl_info; */ NULL, /* _DtCvSegment *sdl_info; */

View file

@ -475,9 +475,9 @@ _DtHelpFormatAsciiFile(
{ {
_DtHelpCeCopyDefFontAttrList (&fontAttrs); _DtHelpCeCopyDefFontAttrList (&fontAttrs);
fontAttrs.spacing = _DtHelpFontSpacingMono; fontAttrs.spacing = _DtHelpFontSpacingMono;
_DtHelpCeXlateOpToStdLocale(DtLCX_OPER_SETLOCALE,
setlocale(LC_CTYPE,NULL), NULL, _DtHelpCeGetLcCtype(NULL, &(fontAttrs.language),
&(fontAttrs.language), &(fontAttrs.char_set)); &(fontAttrs.char_set));
/* /*
* fill out the ui information * fill out the ui information
@ -494,8 +494,7 @@ _DtHelpFormatAsciiFile(
/* /*
* get the formatting structure. * get the formatting structure.
*/ */
varHandle = __DtHelpCeSetUpVars(fontAttrs.language, varHandle = __DtHelpCeSetUpVars(&myUiInfo);
fontAttrs.char_set, &myUiInfo);
if (varHandle == NULL) if (varHandle == NULL)
{ {
free(fontAttrs.language); free(fontAttrs.language);
@ -585,12 +584,8 @@ _DtHelpFormatAsciiString(
*ret_handle = NULL; *ret_handle = NULL;
_DtHelpCeCopyDefFontAttrList (&fontAttrs); _DtHelpCeCopyDefFontAttrList (&fontAttrs);
_DtHelpCeXlateOpToStdLocale(DtLCX_OPER_SETLOCALE,setlocale(LC_CTYPE,NULL), _DtHelpCeGetLcCtype(NULL, &(fontAttrs.language), &(fontAttrs.char_set));
NULL, &(fontAttrs.language), varHandle = __DtHelpCeSetUpVars(&myUiInfo);
&(fontAttrs.char_set));
varHandle = __DtHelpCeSetUpVars(fontAttrs.language, fontAttrs.char_set,
&myUiInfo);
if (varHandle == NULL) if (varHandle == NULL)
{ {
free(fontAttrs.language); free(fontAttrs.language);
@ -678,12 +673,8 @@ _DtHelpFormatAsciiStringDynamic(
*ret_handle = NULL; *ret_handle = NULL;
_DtHelpCeCopyDefFontAttrList (&fontAttrs); _DtHelpCeCopyDefFontAttrList (&fontAttrs);
_DtHelpCeXlateOpToStdLocale(DtLCX_OPER_SETLOCALE,setlocale(LC_CTYPE,NULL), _DtHelpCeGetLcCtype(NULL, &(fontAttrs.language), &(fontAttrs.char_set));
NULL, &(fontAttrs.language), varHandle = __DtHelpCeSetUpVars(&myUiInfo);
&(fontAttrs.char_set));
varHandle = __DtHelpCeSetUpVars(fontAttrs.language, fontAttrs.char_set,
&myUiInfo);
if (varHandle == NULL) if (varHandle == NULL)
{ {
free(fontAttrs.language); free(fontAttrs.language);

View file

@ -318,7 +318,6 @@ static int SegmentSave(
*****************************************************************************/ *****************************************************************************/
static const char *Specials = "<\n\\ "; static const char *Specials = "<\n\\ ";
static const char *SpaceString = " "; static const char *SpaceString = " ";
static const char *CString = "C";
static const char *Period = "."; static const char *Period = ".";
static const char *Slash = "/"; static const char *Slash = "/";
@ -472,6 +471,7 @@ GetMbLen (
char *ptr; char *ptr;
char *langPart = NULL; char *langPart = NULL;
char *codePart = NULL; char *codePart = NULL;
char *mLang = NULL;
/* /*
* strip spaces * strip spaces
@ -494,34 +494,32 @@ GetMbLen (
*ptr++ = '\0'; *ptr++ = '\0';
langPart = strdup(font_str); langPart = strdup(font_str);
codePart = strdup(ptr); codePart = strdup(ptr);
goto done;
} }
/* /*
* old CCDF volume * old CCDF volume
*/ */
else if (font_str == NULL || *font_str == '\0') codePart = strdup("UTF-8");
{ else codePart = strdup(font_str);
_DtHelpCeXlateOpToStdLocale(DtLCX_OPER_CCDF, font_str,
NULL, &langPart, &codePart);
/*
* if the language is not specified for the code set,
* get the environment's.
*/
if (strcmp(langPart, "?") == 0)
{
free(langPart);
langPart = _DtHelpGetLocale(); mLang = _DtHelpGetLocale();
if (langPart == NULL || *langPart == '\0')
langPart = strdup((char *) CString); if (_DtHelpCeStrrchr(mLang, Period, MB_CUR_MAX, &ptr) == 0)
else if (_DtHelpCeStrrchr(langPart, "_", MB_CUR_MAX, &ptr) == 0) {
*ptr = '\0';
else if (_DtHelpCeStrrchr(langPart, Period, MB_CUR_MAX, &ptr) == 0)
*ptr = '\0'; *ptr = '\0';
if (mLang != NULL && *mLang != '\0')
{
langPart = strdup(mLang);
goto done;
} }
} }
cur_vars->cur_mb_max = _DtHelpCeGetMbLen(langPart, codePart); langPart = strdup("C");
done:
cur_vars->cur_mb_max = MB_CUR_MAX;
/* /*
* now set the return variables * now set the return variables
@ -535,6 +533,8 @@ GetMbLen (
*set_ptr = codePart; *set_ptr = codePart;
else else
free(codePart); free(codePart);
free(mLang);
} }
/****************************************************************************** /******************************************************************************
@ -4121,7 +4121,7 @@ Format(
/* /*
* change the character set to the returned character set * change the character set to the returned character set
* Assume that the charset is 'iso8859' if not specified. * Assume that the charset is 'UTF-8' if not specified.
*/ */
cur_vars->cur_mb_max = 1; cur_vars->cur_mb_max = 1;
if (NULL != charSet) if (NULL != charSet)
@ -4355,7 +4355,7 @@ FormatCCDFTitle(
/* /*
* change the character set to the returned character set * change the character set to the returned character set
* Assume that the charset is 'iso8859' if not specified. * Assume that the charset is 'UTF-8' if not specified.
*/ */
cur_vars->cur_mb_max = 1; cur_vars->cur_mb_max = 1;
if (NULL != charSet) if (NULL != charSet)
@ -4794,7 +4794,7 @@ FormatExpandedToc(
* *
*****************************************************************************/ *****************************************************************************/
/****************************************************************************** /******************************************************************************
* Function: VarHandle *__DtHelpCeSetUpVars (char *rd_buf, grow_size) * Function: VarHandle *__DtHelpCeSetUpVars (_FrmtUiInfo *ui_info)
* *
* Parameters: * Parameters:
* *
@ -4807,8 +4807,6 @@ FormatExpandedToc(
******************************************************************************/ ******************************************************************************/
VarHandle VarHandle
__DtHelpCeSetUpVars( __DtHelpCeSetUpVars(
char *lang,
char *code_set,
_FrmtUiInfo *ui_info) _FrmtUiInfo *ui_info)
{ {
FormatVariables *newVars; FormatVariables *newVars;
@ -4817,7 +4815,7 @@ __DtHelpCeSetUpVars(
*newVars = DefVars; *newVars = DefVars;
newVars->ui_info = ui_info; newVars->ui_info = ui_info;
newVars->topic_mb_max = _DtHelpCeGetMbLen(lang, code_set); newVars->topic_mb_max = MB_CUR_MAX;
newVars->cur_mb_max = newVars->topic_mb_max; newVars->cur_mb_max = newVars->topic_mb_max;
return ((VarHandle) newVars); return ((VarHandle) newVars);
@ -5447,7 +5445,7 @@ _DtHelpCeGetCcdfVolTitleChunks(
*/ */
charSet = _DtHelpCeGetCcdfVolLocale(volume); charSet = _DtHelpCeGetCcdfVolLocale(volume);
if (charSet == NULL) if (charSet == NULL)
charSet = strdup("C.ISO-8859-1"); charSet = strdup("C.UTF-8");
titleStr = _DtHelpCeGetCcdfVolTitle(volume); titleStr = _DtHelpCeGetCcdfVolTitle(volume);
if (titleStr != NULL) if (titleStr != NULL)

View file

@ -83,8 +83,6 @@ extern int __DtHelpCeProcessString(
int ret_on_nl, int ret_on_nl,
_DtHelpFontHints *font_attr); _DtHelpFontHints *font_attr);
extern VarHandle __DtHelpCeSetUpVars ( extern VarHandle __DtHelpCeSetUpVars (
char *lang,
char *code_set,
_FrmtUiInfo *ui_info); _FrmtUiInfo *ui_info);
#endif /* _DtHelpFormatCCDFI_h */ #endif /* _DtHelpFormatCCDFI_h */

View file

@ -840,10 +840,8 @@ _DtHelpFormatManPage(
*/ */
_DtHelpCeCopyDefFontAttrList (&fontAttr); _DtHelpCeCopyDefFontAttrList (&fontAttr);
fontAttr.spacing = _DtHelpFontSpacingMono; fontAttr.spacing = _DtHelpFontSpacingMono;
_DtHelpCeXlateOpToStdLocale(DtLCX_OPER_SETLOCALE,setlocale(LC_CTYPE,NULL), _DtHelpCeGetLcCtype(NULL, &(fontAttr.language), &(fontAttr.char_set));
NULL, &(fontAttr.language), &(fontAttr.char_set)); myVars = __DtHelpCeSetUpVars(&myUiInfo);
myVars = __DtHelpCeSetUpVars(fontAttr.language, fontAttr.char_set, &myUiInfo);
if (myVars == NULL) if (myVars == NULL)
{ {
free(fontAttr.language); free(fontAttr.language);

View file

@ -1556,7 +1556,7 @@ static SDLElementAttrList SdlDocAttrList[] =
{ SDL_ATTR_PRODVER , SdlAttrValueImplied , NULL }, { SDL_ATTR_PRODVER , SdlAttrValueImplied , NULL },
{ SDL_ATTR_LICENSE , SdlAttrValueImplied , NULL }, { SDL_ATTR_LICENSE , SdlAttrValueImplied , NULL },
{ SDL_ATTR_LANGUAGE , SdlAttrValueImplied , "C" }, { SDL_ATTR_LANGUAGE , SdlAttrValueImplied , "C" },
{ SDL_ATTR_CHARSET , SdlAttrValueImplied , IsoStr }, { SDL_ATTR_CHARSET , SdlAttrValueImplied , "UTF-8"},
{ SDL_ATTR_AUTHOR , SdlAttrValueImplied , NULL }, { SDL_ATTR_AUTHOR , SdlAttrValueImplied , NULL },
{ SDL_ATTR_VERSION , SdlAttrValueImplied , NULL }, { SDL_ATTR_VERSION , SdlAttrValueImplied , NULL },
{ SDL_ATTR_FRST_PG , SdlAttrValueImplied , NULL }, { SDL_ATTR_FRST_PG , SdlAttrValueImplied , NULL },
@ -4638,9 +4638,7 @@ SetUp (
/* /*
* determine mb_len should be based on lang/charset. * determine mb_len should be based on lang/charset.
*/ */
frmt_struct->mb_len = _DtHelpCeGetMbLen( frmt_struct->mb_len = MB_CUR_MAX;
_DtHelpFontHintsLang(*(frmt_struct->my_fonts)),
_DtHelpFontHintsCharSet(*(frmt_struct->my_fonts)));
frmt_struct->toss = toss; frmt_struct->toss = toss;
frmt_struct->ui_info = ui_info; frmt_struct->ui_info = ui_info;
@ -5605,9 +5603,8 @@ ParseElementAttr(
if (SDLIsStrAttrSet(my_struct->el_info, SDL_ATTR_LANGUAGE) if (SDLIsStrAttrSet(my_struct->el_info, SDL_ATTR_LANGUAGE)
|| SDLIsStrAttrSet(my_struct->el_info, SDL_ATTR_CHARSET)) || SDLIsStrAttrSet(my_struct->el_info, SDL_ATTR_CHARSET))
my_struct->mb_len = _DtHelpCeGetMbLen( my_struct->mb_len = MB_CUR_MAX;
_DtHelpFontHintsLang(*(my_struct->my_fonts)),
_DtHelpFontHintsCharSet(*(my_struct->my_fonts)));
/* /*
* Do some specific work for containers. * Do some specific work for containers.
*/ */

View file

@ -2493,26 +2493,24 @@ static Boolean OpenVolForSearch(
if (curVol->gotLocale == False) if (curVol->gotLocale == False)
{ {
char *ptr = NULL;
curVol->stdLocale = _DtHelpGetVolumeLocale(curVol->volHandle); curVol->stdLocale = _DtHelpGetVolumeLocale(curVol->volHandle);
/* get the op-specific locales; the strings are default values */
_DtHelpCeXlateStdToOpLocale(DtLCX_OPER_ICONV3,curVol->stdLocale, if (_DtHelpCeStrchr(curVol->stdLocale, ".", 1, &ptr) == 0)
"iso88591",&curVol->iconv3Codeset); {
++ptr;
if (ptr == NULL || *ptr == '\0') ptr = NULL;
}
curVol->iconv3Codeset = strdup(ptr ? ptr : "UTF-8");
curVol->gotLocale = True; curVol->gotLocale = True;
} }
openedVolume = True; openedVolume = True;
/* get the codeset of the application's locale, if haven't gotten it */ /* get the codeset of the application's locale, if haven't gotten it */
if ( NULL == hw->help_dialog.srch.iconv3Codeset ) if ( NULL == hw->help_dialog.srch.iconv3Codeset )
{ _DtHelpCeGetLcCtype(NULL, NULL, &(hw->help_dialog.srch.iconv3Codeset));
char * locale = NULL;
_DtHelpCeXlateOpToStdLocale(DtLCX_OPER_SETLOCALE,
setlocale(LC_CTYPE,NULL),&locale,NULL,NULL);
/* get the op-specific locales; the strings are default values */
/* impt: XlateStdToOpLocale() call requires a locale, not a codeset */
_DtHelpCeXlateStdToOpLocale(DtLCX_OPER_ICONV3,locale,
"iso88591",&hw->help_dialog.srch.iconv3Codeset);
XtFree(locale);
}
/** only saves or changes the locale if necessary **/ /** only saves or changes the locale if necessary **/
/* create an iconv3 context to convert codeset of */ /* create an iconv3 context to convert codeset of */

View file

@ -25,7 +25,7 @@
$FILEBEG$: HelpXlate.c $FILEBEG$: HelpXlate.c
$PROJECT$: Cde 1.0 $PROJECT$: Cde 1.0
$COMPONENT$: DtXlate service $COMPONENT$: DtXlate service
$1LINER$: Implements a translation service using tables and regex search $1LINER$: Implements a translation service
$COPYRIGHT$: $COPYRIGHT$:
(c) Copyright 1993, 1994 Hewlett-Packard Company (c) Copyright 1993, 1994 Hewlett-Packard Company
(c) Copyright 1993, 1994 International Business Machines Corp. (c) Copyright 1993, 1994 International Business Machines Corp.
@ -35,227 +35,36 @@ $END$
**************************************************************************** ****************************************************************************
************************************<+>*************************************/ ************************************<+>*************************************/
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/param.h> /* MAXPATHLEN */ #include <locale.h>
#include <time.h>
/* for Xrm */
#include <X11/Intrinsic.h>
/*================================================================= /*=================================================================
$SHAREDBEG$: This header appears in all appropriate DtXlate topics $SHAREDBEG$: This header appears in all appropriate DtXlate topics
=======================================================$SKIP$======*/ =======================================================$SKIP$======*/
/*$INCLUDE$*/ /*$INCLUDE$*/
#include "HelpXlate.h" #include "StringFuncsI.h"
#include "Lock.h"
/*$END$*/ /*$END$*/
static char MyPlatform[_DtPLATFORM_MAX_LEN+1]; void _DtHelpCeGetLcCtype(char **locale, char **lang, char **charset) {
static _DtXlateDb MyDb = NULL; char *ptr;
static int ExecVer; char *mLang = NULL;
static int CompVer; char *mCharset = NULL;
char *mLocale = setlocale(LC_CTYPE, NULL);
static const char *DfltStdCharset = "ISO-8859-1"; if (mLocale) mLocale = strdup(mLocale);
static const char *DfltStdLang = "C";
/*========================================================*/ if (_DtHelpCeStrchr(mLocale, ".", 1, &ptr) == 0) {
/*================== Private routines ====================*/ *ptr++ = '\0';
/*========================================================*/ if (mLocale != NULL && *mLocale != '\0') mLang = strdup(mLocale);
/****************************************************************************** if (ptr != NULL && *ptr != '\0') mCharset = strdup(ptr);
* Function: static int OpenLcxDb ()
*
* Parameters: none
*
* Return Value: 0: ok
* -1: error
*
* errno Values:
*
* Purpose: Opens the Ce-private Lcx database
*
*****************************************************************************/
static int
OpenLcxDb (void)
{
time_t time1 = 0;
time_t time2 = 0;
static short MyProcess = False;
static short MyFirst = True;
/*
* wait 30 sec. until another thread or enter is done modifying the table
*/
while (MyProcess == True)
{
/* if time out, return */
if (time(&time2) == (time_t)-1)
return -1;
if (time1 == 0)
time1 = time2;
else if (time2 - time1 >= (time_t)30)
return -1;
} }
_DtHelpProcessLock(); if (lang) *lang = strdup(mLang ? mLang : "C");
if (MyFirst == True) if (charset) *charset = strdup(mCharset ? mCharset : "UTF-8");
{ if (locale) *locale = strdup(mLocale ? mLocale : "C.UTF-8");
MyProcess = True;
if (_DtLcxOpenAllDbs(&MyDb) == 0 &&
_DtXlateGetXlateEnv(MyDb,MyPlatform,&ExecVer,&CompVer) != 0)
{
_DtLcxCloseDb(&MyDb);
MyDb = NULL;
}
MyFirst = False;
MyProcess = False;
}
_DtHelpProcessUnlock();
return (MyDb == NULL ? -1 : 0 ); free(mLang);
free(mCharset);
free(mLocale);
} }
/******************************************************************************
* Function: int _DtHelpCeXlateStdToOpLocale ( char *operation, char *stdLoc
ale,
* char *dflt_opLocale, char **ret_opLocale
)
*
* Parameters:
* operation operation whose locale value will be retrieved
* stdLocale standard locale value
* dflt_opLocale operation-specific locale-value
* This is the default value used in error case
* ret_opLocale operation-specific locale-value placed here
* Caller must free this string.
*
* Return Value:
*
* Purpose: Gets an operation-specific locale string given the standard string
*
*****************************************************************************/
void
_DtHelpCeXlateStdToOpLocale (
char *operation,
char *stdLocale,
char *dflt_opLocale,
char **ret_opLocale)
{
int result = OpenLcxDb();
_DtHelpProcessLock();
if (result == 0)
{
(void) _DtLcxXlateStdToOp(MyDb, MyPlatform, CompVer,
operation, stdLocale, NULL, NULL, NULL, ret_opLocale);
}
_DtHelpProcessUnlock();
/* if translation fails, use a default value */
if (ret_opLocale && (result != 0 || *ret_opLocale == NULL))
{
if (dflt_opLocale) *ret_opLocale = strdup(dflt_opLocale);
else if (stdLocale) *ret_opLocale = strdup(stdLocale);
}
}
/******************************************************************************
* Function: int _DtHelpCeXlateOpToStdLocale (char *operation, char *opLocale
,
* char **ret_stdLocale, char **ret_stdLang, char **ret_
stdSet)
*
* Parameters:
* operation Operation associated with the locale value
* opLocale An operation-specific locale string
* ret_locale Returns the std locale
* Caller must free this string.
* ret_stdLang Returns the std language & territory string.
* Caller must free this string.
* ret_stdSet Returns the std code set string.
* Caller must free this string.
*
* Return Value:
*
* Purpose: Gets the standard locale given an operation and its locale
*
*****************************************************************************/
void
_DtHelpCeXlateOpToStdLocale (
char *operation,
char *opLocale,
char **ret_stdLocale,
char **ret_stdLang,
char **ret_stdSet)
{
int result = OpenLcxDb();
_DtHelpProcessLock();
if (result == 0)
{
(void) _DtLcxXlateOpToStd(MyDb, MyPlatform, CompVer,
operation,opLocale,
ret_stdLocale, ret_stdLang, ret_stdSet, NULL);
}
_DtHelpProcessUnlock();
/* if failed, give default values */
if (ret_stdLocale != NULL && (result != 0 || *ret_stdLocale == NULL))
{
*ret_stdLocale = malloc(
strlen(DfltStdLang)+strlen(DfltStdCharset)+3);
sprintf(*ret_stdLocale,"%s.%s",DfltStdLang,DfltStdCharset);
}
if (ret_stdLang != NULL && (result != 0 || *ret_stdLang == NULL))
*ret_stdLang = strdup(DfltStdLang);
if (ret_stdSet != NULL && (result != 0 || *ret_stdSet == NULL))
*ret_stdSet = strdup(DfltStdCharset);
}
/******************************************************************************
* Function: int _DtHelpCeGetMbLen (char *lang, char *char_set)
*
* Parameters:
* lang Represents the language. A NULL value
* defaults to "C".
* char_set Represents the character set. A NULL
* value value defaults to "ISO-8859-1"
*
* Return Value: Returns the MB_CUR_MAX for the combination
* lang.charset.
*
* errno Values:
*
* Purpose: To determine the maximum number of bytes required to display
* a character if/when the environment is set to 'lang.charset'
*
*****************************************************************************/
int
_DtHelpCeGetMbLen (
char *lang,
char *char_set)
{
int retLen = 1;
if (lang == NULL)
lang = (char *)DfltStdLang;
if (char_set == NULL)
char_set = (char *)DfltStdCharset;
_DtHelpProcessLock();
if (OpenLcxDb() == 0)
{
/* if translation is present, lang.charset are a multibyte locale */
if (_DtLcxXlateStdToOp(MyDb, MyPlatform, CompVer, DtLCX_OPER_MULTIBYTE,
NULL, lang, char_set, NULL, NULL) == 0)
retLen = MB_CUR_MAX;
}
_DtHelpProcessUnlock();
return retLen;
}

View file

@ -28,7 +28,7 @@
** **
** Project: DtXlate ** Project: DtXlate
** **
** Description: DtHelp-specific table-based translation services ** Description: DtHelp-specific translation services
** **
** (c) Copyright 1993, 1994 Hewlett-Packard Company ** (c) Copyright 1993, 1994 Hewlett-Packard Company
** (c) Copyright 1993, 1994 International Business Machines Corp. ** (c) Copyright 1993, 1994 International Business Machines Corp.
@ -41,25 +41,12 @@
#ifndef _DtHELP_XLATE_I #ifndef _DtHELP_XLATE_I
#define _DtHELP_XLATE_I #define _DtHELP_XLATE_I
#include <Dt/LocaleXlate.h>
#include <Dt/XlationSvc.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Functions */ /* Functions */
void _DtHelpCeXlateOpToStdLocale( void _DtHelpCeGetLcCtype(char **locale, char **lang, char **charset);
char *operation,
char *opLocale,
char **ret_locale,
char **ret_lang,
char **ret_set);
void _DtHelpCeXlateStdToOpLocale(
char *operation,
char *stdLocale,
char *dflt_opLocale,
char **ret_opLocale);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -706,8 +706,6 @@ void _DtHelpCeCompressSpace (
* Purpose: * Purpose:
* Converts string from fromCode to toCode using iconv(3) * Converts string from fromCode to toCode using iconv(3)
* It expects the codeset strings to be iconv(3) compatible. * It expects the codeset strings to be iconv(3) compatible.
* Generally, compatible strings can be retrieved using
* the _DtHelpCeXlateStdToOpLocale() call.
* *
* Comments: * Comments:
* iconv(3) is standardized in XPG4, which is just starting * iconv(3) is standardized in XPG4, which is just starting
@ -760,8 +758,6 @@ int _DtHelpCeIconvStr1Step(
* Opens an iconv table/algorithm to convert string from * Opens an iconv table/algorithm to convert string from
* fromCode to toCode using iconv(3) * fromCode to toCode using iconv(3)
* It expects the codeset strings to be iconv(3) compatible. * It expects the codeset strings to be iconv(3) compatible.
* Generally, compatible strings can be retrieved using
* the _DtHelpCeXlateStdToOpLocale() call.
* *
* Comments: * Comments:
* iconv(3) is standardized in XPG4, which is just starting * iconv(3) is standardized in XPG4, which is just starting