removed ctype.c, the library functions are generated

This commit is contained in:
eck 1989-11-23 10:43:15 +00:00
parent d50600e263
commit 4734150614
4 changed files with 127 additions and 0 deletions

View file

@ -0,0 +1,15 @@
isalnum.c
isalpha.c
iscntrl.c
isdigit.c
isgraph.c
islower.c
isprint.c
ispunct.c
isspace.c
isupper.c
isxdigit.c
isascii.c
toupper.c
tolower.c
chartab.c

View file

@ -0,0 +1,33 @@
CFLAGS=-L -LIB
.SUFFIXES: .o .e .c
.e.o:
$(CC) $(CFLAGS) -c -o $@ $*.e
genfiles: genfiles.c
$(CC) genfiles.c -o genfiles
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
genfiles
isalnum.o:
isalpha.o:
iscntrl.o:
isdigit.o:
isgraph.o:
islower.o:
isprint.o:
ispunct.o:
isspace.o:
isupper.o:
isxdigit.o:
isascii.o:
tolower.o:
toupper.o:
chartab.o:

View file

@ -0,0 +1,28 @@
%
% CHARACTER CLASSES
%
% the actual size is all unsigned chars + EOF == 257 characters
% , but we store the first element explicitely
%
% The _P contains ",-.", which means from "," to ".". These are the
% three characters ",-."
%
%S256
%C
_C:\000-\037\177
_C|_S:\f\n\r\t\v
_S:\040
_P:!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~
_N:0-9
_U|_X:A-F
_L|_X:a-f
_U:G-Z
_L:g-z
%T#include <ctype.h>
%T
%Tint __x;
%T
%Tchar __ctype[] = {
%T0,
%p
%T};

View file

@ -0,0 +1,51 @@
#include <stdio.h>
#if __STDC__ == 1
#include <stdlib.h>
#include <string.h>
#else
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#endif
#define UCHAR_MAX 256
char *functab[] = {
"isalnum",
"isalpha",
"iscntrl",
"isdigit",
"isgraph",
"islower",
"isprint",
"ispunct",
"isspace",
"isupper",
"isxdigit",
"isascii",
"toupper",
"tolower",
NULL,
};
char buf[100];
int
main()
{
register char **name;
register int i;
FILE *file;
name = functab;
while (*name) {
strcpy(buf, *name);
strcat(buf, ".c");
if (!(file = fopen(buf,"w"))) exit(EXIT_FAILURE);
fprintf(file,"int (%s)(int c) {\n", *name);
fprintf(file,"\treturn %s(c);\n", *name);
fprintf(file,"}\n");
fclose(file);
name++;
}
exit(EXIT_SUCCESS);
}