cpplib utf8, status?

Janek Kozicki janek_listy@wp.pl
Wed Apr 28 09:45:00 GMT 2010

Manuel López-Ibáñez said:     (by the date of Mon, 26 Apr 2010 17:30:18 +0200)

> I added all this to the wiki for future reference:
> http://gcc.gnu.org/wiki/FAQ#utf8_identifiers
> Feel free to improve it.

Thank you :) If I optimize this more, I will add it there.

> > Joseph S. Myers said:     (by the date of Mon, 26 Apr 2010 14:15:06 +0000 (UTC))
> >> By using the \uNNNN or \UNNNNNNNN syntax.  For example, pipe your code
> >> through
> >>
> >> perl -pe 'BEGIN { binmode STDIN, ":utf8"; } s/(.)/ord($1) < 128 ? $1 : sprintf("\\U%08x", ord($1))/ge;'

Joseph, now that it works - perhaps it is possible to implement above
conversion somewhere within cpplib, or even preprocessor? Just a very
crude one, experimental, that works only with UTF-8. I could make a
lengthy lookup table, with records like Δ : \U00000394

And then somewhere in preprocessor (?) or cpplib (where?) there would
be just one extra line, that would filter the input characters
assuming utf-8. A very non-portable, and a very crude solution. But
at least something to start with.

If you see a single point in the source code, where I could add such
a filter, please tell me where it is. Perhaps I'll try to make a
patch for that.

best regards
Janek Kozicki                               http://janek.kozicki.pl/

More information about the Gcc mailing list