From e701e2e2ec7703c50993455b7efa611ac2ae8794 Mon Sep 17 00:00:00 2001 From: eck Date: Wed, 24 Oct 1990 17:19:50 +0000 Subject: [PATCH] added to*() routines: a macro is impossible --- lang/cem/libcc.ansi/ctype/.distr | 2 ++ lang/cem/libcc.ansi/ctype/Makefile | 4 ++-- lang/cem/libcc.ansi/ctype/char.tab | 2 -- lang/cem/libcc.ansi/ctype/genfiles | 2 +- lang/cem/libcc.ansi/ctype/tolower.c | 5 +++++ lang/cem/libcc.ansi/ctype/toupper.c | 5 +++++ 6 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 lang/cem/libcc.ansi/ctype/tolower.c create mode 100644 lang/cem/libcc.ansi/ctype/toupper.c diff --git a/lang/cem/libcc.ansi/ctype/.distr b/lang/cem/libcc.ansi/ctype/.distr index b052351a1..b159e6c0b 100644 --- a/lang/cem/libcc.ansi/ctype/.distr +++ b/lang/cem/libcc.ansi/ctype/.distr @@ -1,4 +1,6 @@ LIST Makefile +toupper.c +tolower.c char.tab genfiles diff --git a/lang/cem/libcc.ansi/ctype/Makefile b/lang/cem/libcc.ansi/ctype/Makefile index 3a20ca5ab..56ef72a02 100644 --- a/lang/cem/libcc.ansi/ctype/Makefile +++ b/lang/cem/libcc.ansi/ctype/Makefile @@ -4,12 +4,12 @@ clean: isxdigit.o isascii.o tolower.o toupper.o chartab.o \ isalnum.c isalpha.c iscntrl.c isdigit.c isgraph.c \ islower.c isprint.c ispunct.c isspace.c isupper.c \ - isxdigit.c isascii.c tolower.c toupper.c chartab.c \ + isxdigit.c isascii.c chartab.c \ OLIST chartab.c: char.tab tabgen -fchar.tab > chartab.c isalnum.c isalpha.c iscntrl.c isdigit.c isgraph.c islower.c isprint.c \ -ispunct.c isspace.c isupper.c isxdigit.c isascii.c tolower.c toupper.c: genfiles +ispunct.c isspace.c isupper.c isxdigit.c isascii.c: genfiles sh genfiles diff --git a/lang/cem/libcc.ansi/ctype/char.tab b/lang/cem/libcc.ansi/ctype/char.tab index eafe7d486..f0dd0c7cd 100644 --- a/lang/cem/libcc.ansi/ctype/char.tab +++ b/lang/cem/libcc.ansi/ctype/char.tab @@ -20,8 +20,6 @@ _U:G-Z _L:g-z %T#include %T -%Tint __x; -%T %Tchar __ctype[] = { %T0, %p diff --git a/lang/cem/libcc.ansi/ctype/genfiles b/lang/cem/libcc.ansi/ctype/genfiles index 7c115e991..5b63b8ec9 100644 --- a/lang/cem/libcc.ansi/ctype/genfiles +++ b/lang/cem/libcc.ansi/ctype/genfiles @@ -1,6 +1,6 @@ for i in isalnum isalpha iscntrl isdigit isgraph islower isprint \ - ispunct isspace isupper isxdigit isascii toupper tolower + ispunct isspace isupper isxdigit isascii do sed "s/xxxx/$i/" > $i.c << 'EOF' #include diff --git a/lang/cem/libcc.ansi/ctype/tolower.c b/lang/cem/libcc.ansi/ctype/tolower.c new file mode 100644 index 000000000..ff95ae0d8 --- /dev/null +++ b/lang/cem/libcc.ansi/ctype/tolower.c @@ -0,0 +1,5 @@ +#include + +int tolower(int c) { + return isupper(c) ? c - 'A' + 'a' : c ; +} diff --git a/lang/cem/libcc.ansi/ctype/toupper.c b/lang/cem/libcc.ansi/ctype/toupper.c new file mode 100644 index 000000000..521ae5569 --- /dev/null +++ b/lang/cem/libcc.ansi/ctype/toupper.c @@ -0,0 +1,5 @@ +#include + +int toupper(int c) { + return islower(c) ? c - 'a' + 'A' : c ; +}