9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] libXg/rune.c for latin-1
@ 2001-12-07 12:21 Boyd Roberts
  0 siblings, 0 replies; only message in thread
From: Boyd Roberts @ 2001-12-07 12:21 UTC (permalink / raw)
  To: 9fans

For those of us who use sam [on unix] in latin-1 environments UTF is
a real problem.

Yes, I'd like to use Plan 9 UTF everywhere, but it's not really an
option given I edit everything with sam and smashing latin-1 files
is not an option.

What follows is the least odious hack (tm) for pure unix environments;
it's pretty much a compile time decision.  Recall that both sam
and samterm use Runes and adding extra command line options or
changing the sam/samterm protocol are much worse options.

I could have played tricks with the Rune constants, but I thought
that would just degrade the code, confuse the issue and generally
mess things up, so I added a very visually obvious #define:


% diff -e libXg/OLDrune.c libXg/rune.c
204c
                if(LATIN_1_OK(c) || c < Runeself) {
.
173c
        if(LATIN_1_OK(c) || c < Runesync)               /* not part of utf
sequence */
.
157c
                if(LATIN_1_OK(c) || c < Tx)
.
139c
                if(LATIN_1_OK(c) || c <= Rune1)
.
96c
        if(LATIN_1_OK(c) || c <= Rune1) {
.
41c
        if(LATIN_1_OK(c) || c < Tx) {
.
5a
#define LATIN_1_OK(c)   ((c) <= 0xFF)

.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-12-07 12:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-07 12:21 [9fans] libXg/rune.c for latin-1 Boyd Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).