Subject: Re: (SC22WG14.166) Re: support for symbolic character names

From: Masahiro SEKIGUCHI <[email-masked]>
Date: Wed, 8 Jan 92 18:06:25 JST

> > What is the purpose of these two functions?  Or, in other words,
> > what kind of application will use them?

> The mechanism is to support portability of international C programs.

Great.

> It is a lowercase-o-with-stroke. If I want to write a portable
> program, which tests for this letter, then it is very difficult.

O.K.  I agree with you on the point ``it is very difficult.''
but, I don't agree the idea of ``a facility to do such a job
easier will increase international portability of applications.''

> It depends on the execution character set. In the one I am really
> using now (IBM865) it is one value, in ISO8859-1 it is another,
> and in MacIntosh it is yet another.

And, in my system, there is no such character.

My point is following: If an application *must* check whether a
character is an o-with-stroke, it *cannot* be internationally
portable.

With your proposal, you could write a ``pseudo-portable'' program which
tests against o-with-stroke like:

	if (wc == L'\<o/>') ...

but it will cause an error like "character(s) specified by a symbolic
name notation is not avalable."  Is this a portable program?

Or, with your function version, your could write:

	if (wc == scntowc("<o/>")) ...

This version will be compiled successfully in all countries, but will
or will not work appropriately...  On my system in Japanese locale,
scntowc("<o/>") will return WEOF, and ``...'' part will never be
executed.  If this code is used, for example, as a part of menu driver,
I will not able to select an item represented by o-with-stroke.

My solution to menu drivers is using messaging facility.

For example, with XPG3 style messing facility, I can write (This code
might look lengthy, but the first three lines can be done at the
startup phase.) :

	item_3_selector = catgets(cd, SET_MENU, MSG_ITEM_3_SELECTOR);
	mbtowc(NULL, NULL, 0);
	mbtowc(&item_3_wchar, item_3_selector, strlen(item_3_selector));
	if (wc == item_3_wchar) ...

In my code, the character wc is compared against is determined by
locale, so users can select items by their most natural keys, e.g.,

for English:

	E) EXECUTE
	Q) QUIT
	ENTER SELECTION:

for German:

	A) AUSFUEHREN
	B) BEENDEN
	AUSWAHL ANGEBEN:

and you can use o-with-stroke for Danish if you want.

>The mechanism is much in line with current documenter software
>like TeX or SGML that has such symbolic names for "weird" characters.

Yes.  We can use such names safely in TeX, because TeX defines its own
codeset (and because it supplies public doman fonts. :-)  The case is
different from C applications.