You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by pg...@sweng.stortek.com on 1999/11/30 19:36:46 UTC

OS/390 Translation (Was: [PATCH]Apache 1.3.9 Port to OS/390 Unix System Services)

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

Re: OS/390 Translation (Was: [PATCH]Apache 1.3.9 Port to OS/390 Unix System Services)

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Tue, Nov 30, 1999 at 11:36:46AM -0700, pg@sweng.stortek.com wrote:
> 
> o If LOCALE specifies a degenerate (non-bijective) translation,
>   results are likely to be chaotic.
> 

But this case could also be detected at runtime. Question is what to do
if you detect it: bail out? fall back to some default?


    Martin
-- 
<Ma...@MchP.Siemens.De>             |    Fujitsu Siemens
Fon: +49-89-636-46021, FAX: +49-89-636-41143 | 81730  Munich,  Germany