Browse Source

removed ctype.c, the library functions are generated

eck 34 years ago
parent
commit
6998494800

+ 15 - 0
lang/cem/libcc.ansi/ctype/LIST

@@ -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

+ 33 - 0
lang/cem/libcc.ansi/ctype/Makefile

@@ -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:

+ 28 - 0
lang/cem/libcc.ansi/ctype/char.tab

@@ -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};

+ 51 - 0
lang/cem/libcc.ansi/ctype/genfiles.c

@@ -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);
+}