[comp.os.minix] Where is isascii

ast@cs.vu.nl (Andy Tanenbaum) (02/01/90)

In article <2300@psueea.UUCP> kirkenda@eecs.UUCP (Steve Kirkendall) writes:
>The Minix <ctype.h> macros are only defined for values over the range [-1,127].
>According to the definition you've quoted, they should be defined over the
>range [-1,255] for the Minix compilers.  We have to extend the _ctype[] array.

If ANSI requires the range 0-255, I'll do it.  What section of the draft
standard specifies that one has to handle 128-255?  What values should
one put in the table above 127?  All 0s?

Andy Tanenbaum (ast@cs.vu.nl)

henry@utzoo.uucp (Henry Spencer) (02/02/90)

In article <2300@psueea.UUCP> kirkenda@eecs.UUCP (Steve Kirkendall) writes:
>...can we assume that all terminals hooked up to a given computer
>will use the same character set? ...

If not, the kernel (or something associated with it) should translate.
Madness and chaos will ensue if every application has to be prepared for
multiple character sets in its input.
-- 
1972: Saturn V #15 flight-ready|     Henry Spencer at U of Toronto Zoology
1990: birds nesting in engines | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

henry@utzoo.uucp (Henry Spencer) (02/02/90)

In article <5257@star.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes:
>If ANSI requires the range 0-255, I'll do it.  What section of the draft
>standard specifies that one has to handle 128-255?  What values should
>one put in the table above 127?  All 0s?

The intro to 4.3 says the values of the isxxx functions are defined on
all values representable as "unsigned char", plus EOF.  Unless you've
done something very strange to the compiler :-), unsigned char is 0-255.

How you set the values for the high characters is a good question.  All
zeros appears to be legitimate, and might be the simplest thing.  (I'm
tempted to say that the values should follow ISO Latin 1, but that's
asking for trouble since lots of hardware isn't set up to deal with
ISO Latin 1 yet.)
-- 
1972: Saturn V #15 flight-ready|     Henry Spencer at U of Toronto Zoology
1990: birds nesting in engines | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) (02/02/90)

<ctype.h> indeed is very messy. There is much code around which, e.g.,
does tolower(x) without checking in advance if x is an upper case letter.
This is wrong on the machines I work on since the tolower macro just adds
'a'-'A'. I don't know if some versions of tolower do the check, but this
has lead to errors in the past.

Christoph van Wuellen.

702WFG%SCRVMSYS.BITNET@cornellc.cit.cornell.edu (bill gunshannon) (02/03/90)

>From:         Christoph van Wuellen <HBO043%DJUKFA11.BITNET@CUNYVM.CUNY.EDU>
>
><ctype.h> indeed is very messy. There is much code around which, e.g.,
>does tolower(x) without checking in advance if x is an upper case letter.
>This is wrong on the machines I work on since the tolower macro just adds
>'a'-'A'. I don't know if some versions of tolower do the check, but this
>has lead to errors in the past.

A quick galnce at my SYS V  manual says: "The macro _tolower requires an
uppercase letter as its argument; its result is the corresponding lowercase
letter.  Arguments outside the domain cause undefined results."

I haven' read it specificly but I doubt that ANSI or POSIX have made any
substantial change to this philosophy.  I would say it is up to the
programmer to make sure he only passes it valid data.  After all, isn't
that why we have "isupper()"??  :-)

                                          bill gunshannon
                                       702WFG@SCRVMSYS.BITNET

peter@ficc.uu.net (Peter da Silva) (02/03/90)

> I would say it is up to the programmer to make sure he only passes [tolower]
> valid data.  After all, isn't that why we have "isupper()"??  :-)

#define isupper(c) (tolower(c) != (c)) /* :-> */
-- 
 _--_|\  Peter da Silva. +1 713 274 5180. <peter@ficc.uu.net>.
/      \
\_.--._/ Xenix Support -- it's not just a job, it's an adventure!
      v  "Have you hugged your wolf today?" `-_-'