httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p.@sweng.stortek.com
Subject OS/390 Translation (Was: [PATCH]Apache 1.3.9 Port to OS/390 Unix System Services)
Date Tue, 30 Nov 1999 18:36:46 GMT
In a recent note, Ovies Brabson said:

> Date: Tue, 30 Nov 1999 04:41:43 -0800
> 
> const unsigned char os_toebcdic[256] = {
>     0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f:           */
> 
I've been testing doing this at runtime with:

    +#ifdef   OS390
    +/* Use OS/390's built-in translation function to initialize tables.
    + */
    +static void InitTables()
    +{
    +    register int i, j;
    +
    +    for (i = 0; i<256; i++) os_toebcdic[i] = i;
    +
    +    __atoe_l((char *) os_toebcdic, 256);
    +    for (i = 0; i<256; i++) {
    +        j = os_toebcdic[i];
    +        os_toascii_strictly[j] = os_toascii[j] = i;
    +    }
    +    os_toascii[012] = 012;
    +    os_toascii[015] = 015;
    +
    +    Initted = 1;
    +}
    +#endif /*OS390*/

Advantages:

o Shorter source code; less exposure to typos.

o Adapts automatically to user's LOCALE.

Disadvantages:

o If user executes with LOCALE different from when tarball was
  extracted, results are unpredictable.

o If LOCALE specifies a degenerate (non-bijective) translation,
  results are likely to be chaotic.

o Tables must occupy writeable, as opposed to shared, memory.

-- gil
-- 
StorageTek
INFORMATION made POWERFUL

Mime
View raw message