background image
Functional specification
58
CDE/Motif PST
CDEnext
RETURN VALUE
(XpSetLocaleHinter) None.
(XpGetLocaleHinter) The contextual information for the currently installed hinter.
DESCRIPTION
Since (to date) there is no single industry standard for locale values, locale information about the current
client required by
XpCreateContext
,
XpGetPrinterList
and
XpGetPdmStartParams
is at
best considered a "hint" when transmitted to the X Print Server and PDM. In single vendor environments,
the locale hint should be consistent and understood. In multi-vendor environments however, the locale hint
may or may not be understood. The caller locale will be used as the fallback default.
XpSetLocaleHinter
and
XpGetLocaleHinter
access hooks that are used register more advanced
hint generators. By default, Xp uses a hinter proc that calls
setlocale(3C)
on the
CTYPE
category on
POSIX systems, and
hinter_desc
is
NULL
.
XpSetLocaleHinter
sets the
hinter_proc
and
hinter_desc
which will be subsequently used
by the Xp calls requiring a locale hint (see above).
hinter_proc
is the function that will generate the
locale hint (for example, "C"), and
hinter_desc
is a string, with or without the embeddable keyword
%locale%
, that provides a higher level context for the results of
hinter_proc
.
If
hinter_proc
is set to
NULL
, then the default Xp hinter proc is installed.
XpSetLocaleHinter
makes its own private copy of
hinter_desc
prior to returning.
An example set call might look as follows:
XpSetLocaleHinter(
my_hinter, "%locale%;CDElocale" );
Where
my_hinter
might look as follows:
char *my_hinter()
{
/*
* Use setlocale() to retrieve the current locale.
*/
return( my_x_strdup( setlocale(LC_CTYPE, (char *) NULL) ) );
}
The signature for
hinter_proc
is defined in
<X11/extensions/Print.h>
as follows:
typedef char * (*XPHinterProc)();
hinter_proc
is expected to return a string that can be freed using
XFree(3C)
by the Xp calls
themselves.
XpGetLocaleHinter
gets the currently installed
hinter_proc
and
hinter_desc
. The caller is
expected to
XFree(3C)
the returned
hinter_desc
.
If both
hinter_desc
and the results of
hinter_proc
are non-
NULL
, and the keyword
%locale%
is
found in
hinter_desc
, then the keyword will be replaced with the result of
hinter_proc
. The
resulting string will be used as the locale hint by the Xp calls.