On Wed, 06 Dec 2006 22:36:16 +0100 Roland Mainz wrote:
> Danek Duvall wrote:
> > On Wed, Dec 06, 2006 at 12:50:52PM -0800, April Chin wrote:
> > > For building l10n messages for the ksh93 project, we need to use ksh93 
> > > itself
> > > and the AT&T libraries it uses--libast, libshell, libcmd, and libdll.
> > > This process also requires using another AT&T library,
> > > libpp, which will not be part of the Solaris release, although
> > > it has dependencies on (and should probably be kept in sync with) libast.
> > 
> > Ah.  This last was not something I was aware of.  Can you explain what this
> > library

> Some kind of C preprocessor library required for the AST
> msgcc/msgcpp/etc. tools which are used to create the localisation
> (=l10n) catalogs.

background:
we chose to write sw to scrape l10n strings from source rather than
adopt explicit macros and/or functions for each l10n string

this is done by a process that models the c compiler:
"preprocess" source to extract strings (msgcpp)
"compile" source to produce a .mso string object (msgcc -c)
"link" .mso string objects and .msg gencat(1) input to produce a C locale .msg 

.mso files contain raw strings and string-identifier maps
e.g., to handle cases like
        const char diagnostic_1[] = "diagnostic message 1";
in one source file and
        error(level, diagnostic_1);
in another file
the link phase resolves identifiers to strings

doing it this way allows us to use the build system cc infrastructure
to do l10n (generate .mso instead of .o, generate .msg instead of a.out/.a/.so)
it also makes the source readable, and puts 99% of the l10n machinery
outside of the source, i.e., the l10n machinery could change without
wholesale source change

the few strings not caught by msgcpp are manually tagged with function-like 
macros
most of these strings are in library functions that construct messages
from multiple string fragments

msgcpp is based on the libpp library that implements the preprocessing phases 
of ISO C;
a per-compiler probe file, automatically generated by running probes against 
the cc
it models, morphs the ISO C defaults to match cc-specific quirks

the handiest libpp function is pplex() which returns the next preprocessed token
msgcpp uses this to extract strings and string variable declarations/assignments

-- Glenn Fowler -- AT&T Research, Florham Park NJ --


Reply via email to