Reviewed by: ache and wollman (long ago)

isctype.c:
o The tolower() and toupper() functions duplicated too much code
  and were out of date (surprise).  This didn't matter because
  it was difficult to call them.
o Change formatting to be more like that in <ctype.h> (with
  extra parentheses as in the macros).  Perhaps this file should
  be machine generated or everything should be handled like
  __tolower() so that no code is repeated.

nomacros.c:
o Instead of looking at _USE_CTYPE_INLINE_ to see what <ctype.h>
  has done, set _EXTERNALIZE_CTYPE_INLINES_ to tell <ctype.h>
  what to do, so that we don't have anything left to do.  Note
  that code is now generated even if inlines are used by default.
  This allows users to switch to non-inline versions.
This commit is contained in:
bde 1995-04-07 11:52:17 +00:00
parent d60c039cdc
commit 76e6f5422f
2 changed files with 11 additions and 52 deletions

View File

@ -43,7 +43,6 @@
static char sccsid[] = "@(#)isctype.c 8.3 (Berkeley) 2/24/94";
#endif /* LIBC_SCCS and not lint */
#define _ANSI_LIBRARY
#include <ctype.h>
#undef isalnum
@ -51,7 +50,7 @@ int
isalnum(c)
int c;
{
return(__istype((c), (_A|_D)));
return (__istype((c), (_A|_D)));
}
#undef isalpha
@ -67,7 +66,7 @@ int
isascii(c)
int c;
{
return((c & ~0x7F) == 0);
return (((c) & ~0x7F) == 0);
}
#undef isblank
@ -155,7 +154,7 @@ int
toascii(c)
int c;
{
return (c & 0177);
return ((c) & 0x7F);
}
#undef tolower
@ -163,7 +162,7 @@ int
tolower(c)
int c;
{
return((c & _CRMASK) ? ___tolower(c) : _CurrentRuneLocale->maplower[c]);
return (__tolower(c));
}
#undef toupper
@ -171,5 +170,5 @@ int
toupper(c)
int c;
{
return((c & _CRMASK) ? ___toupper(c) : _CurrentRuneLocale->mapupper[c]);
return (__toupper(c));
}

View File

@ -1,49 +1,9 @@
#include <ctype.h>
#include <rune.h>
#if !defined(_USE_CTYPE_INLINE_) && !defined(_USE_CTYPE_MACROS_)
/*
* See comments in <machine/ansi.h>
* Tell <ctype.h> to generate extern versions of all its inline
* functions. The extern versions get called if the system doesn't
* support inlines or the user defines _DONT_USE_CTYPE_INLINE_
* before including <ctype.h>.
*/
int
__istype(c, f)
_BSD_RUNE_T_ c;
unsigned long f;
{
if (c < 0)
c = (unsigned char) c;
return ((((c & _CRMASK) ? ___runetype(c)
: _CurrentRuneLocale->runetype[c]) & f) ? 1 : 0);
}
#define _EXTERNALIZE_CTYPE_INLINES_
int
__isctype(_BSD_RUNE_T_ c, unsigned long f)
_BSD_RUNE_T_ c;
unsigned long f;
{
if (c < 0)
c = (unsigned char) c;
return ((((c & _CRMASK) ? 0
: _DefaultRuneLocale.runetype[c]) & f) ? 1 : 0);
}
_BSD_RUNE_T_
toupper(c)
_BSD_RUNE_T_ c;
{
if (c < 0)
c = (unsigned char) c;
return ((c & _CRMASK) ?
___toupper(c) : _CurrentRuneLocale->mapupper[c]);
}
_BSD_RUNE_T_
tolower(c)
_BSD_RUNE_T_ c;
{
if (c < 0)
c = (unsigned char) c;
return ((c & _CRMASK) ?
___tolower(c) : _CurrentRuneLocale->maplower[c]);
}
#endif
#include <ctype.h>