Re: Jive -> Kernel (International Linux)

William Sowerbutts (btg@thepentagon.com)
Sun, 19 Jan 1997 01:24:00 +0000


Replying to my own posts! Umpteenth sign of madness, you know ...

At 00:31 19/01/97 +0000, I wrote:
>look at this code fragment:
>
> [snip]
>
>Anyone care to take up the #define mega-challenge?

me! me!

okay, why not do this:

file named dialects.h:
---------------------------
#ifdef LANGUAGE_ENGLISH
#define HELLO "Good day to you, fine sir."
#define BYE "Toodle pip!"
#define PANIC "Gosh! This is most unusual, don't you know?"
#endif

#ifdef LANGUAGE_JIVE
#define HELLO "'Sup, dude?"
#define BYE "Laters, honcho"
#define PANIC "De kernel be bugger'd"
#define BROKEN_DISK "Dis disk be goin' t'boogie"
#endif

#ifndef HELLO
#define HELLO "Generic greeting"
#endif

#ifndef BYE
#define BYE "Generic dismissal"
#endif

#ifndef PANIC
#define PANIC "Kernel Panic!"
#endif

#ifndef BROKEN_DISK
#define BROKEN_DISK "This disk is broken"
#endif
---------------------------

Get the idea? The chosen language has a shot at defining any strings it
can, then everything else is generic. Clever use of preprocessor directives
and wrapping each individual #define in #ifndef...#endif blocks, and not
allocating undefined strings to generic defaults until the very end, should
allow us to copy with primary, secondary (or more) languages.

Right.

Unless, of course, there's a better plan brewing?

_________________________________________________________________________
William R Sowerbutts (BtG) btg@thepentagon.com
Coder / Guru / Nrrrd http://www.users.dircon.co.uk/~guru/
main(){char*s=">#=0> ^#X@#@^7=";int c=0,m;for(;c<15;c++)for
(m=-1;m<7;putchar(m++/6&c%3/2?10:s[c]-31&1<<m?42:32));}