New installation mechanism

This commit is contained in:
ceriel
1991-08-27 09:41:49 +00:00
parent af110e350a
commit cfd793a8af
20 changed files with 880 additions and 61 deletions

View File

@@ -1,5 +1,5 @@
GCIPM.c
Makefile
proto.make
cclash.1
cclash.c
cid.1

69
util/cmisc/proto.make Normal file
View File

@@ -0,0 +1,69 @@
# $Header$
#PARAMS do not remove this line!
SRC_DIR = $(SRC_HOME)/util/cmisc
TARGET_BIN = $(TARGET_HOME)/bin
TARGET_MAN = $(TARGET_HOME)/man
CFLAGS = $(COPTIONS)
LDFLAGS = $(LDOPTIONS)
LINTFLAGS = $(LINTOPTIONS)
all: cid cclash prid tabgen
install: all
cp cid cclash prid tabgen $(TARGET_BIN)
cp $(SRC_DIR)/cid.1 $(SRC_DIR)/cclash.1 $(SRC_DIR)/prid.1 $(SRC_DIR)/tabgen.1 $(TARGET_MAN)
cmp: all
-cmp cid $(TARGET_BIN)/cid
-cmp cclash $(TARGET_BIN)/cclash
-cmp prid $(TARGET_BIN)/prid
-cmp tabgen $(TARGET_BIN)/tabgen
-cmp $(SRC_DIR)/cid.1 $(TARGET_MAN)/cid.1
-cmp $(SRC_DIR)/cclash.1 $(TARGET_MAN)/cclash.1
-cmp $(SRC_DIR)/prid.1 $(TARGET_MAN)/prid.1
-cmp $(SRC_DIR)/tabgen.1 $(TARGET_MAN)/tabgen.1
clean:
rm -f *.$(SUF) cid cclash prid tabgen
pr:
@pr $(SRC_DIR)/proto.make $(SRC_DIR)/cclash.c $(SRC_DIR)/cid.c \
$(SRC_DIR)/prid.c $(SRC_DIR)/GCIPM.c $(SRC_DIR)/tabgen.c
opr:
make pr | opr
tabgen: tabgen.$(SUF)
$(CC) $(LDFLAGS) -o tabgen tabgen.$(SUF)
cid: cid.$(SUF) GCIPM.$(SUF)
$(CC) $(LDFLAGS) -o cid cid.$(SUF) GCIPM.$(SUF)
cclash: cclash.$(SUF) GCIPM.$(SUF)
$(CC) $(LDFLAGS) -o cclash cclash.$(SUF) GCIPM.$(SUF)
prid: prid.$(SUF) GCIPM.$(SUF)
$(CC) $(LDFLAGS) -o prid prid.$(SUF) GCIPM.$(SUF)
lint:
$(LINT) $(LINTFLAGS) $(SRC_DIR)/cid.c $(SRC_DIR)/GCIPM.c
$(LINT) $(LINTFLAGS) $(SRC_DIR)/prid.c $(SRC_DIR)/GCIPM.c
$(LINT) $(LINTFLAGS) $(SRC_DIR)/cclash.c $(SRC_DIR)/GCIPM.c
$(LINT) $(LINTFLAGS) $(SRC_DIR)/tabgen.c
tabgen.$(SUF): $(SRC_DIR)/tabgen.c
$(CC) -c $(CFLAGS) $(SRC_DIR)/tabgen.c
cid.$(SUF): $(SRC_DIR)/cid.c
$(CC) -c $(CFLAGS) $(SRC_DIR)/cid.c
prid.$(SUF): $(SRC_DIR)/prid.c
$(CC) -c $(CFLAGS) $(SRC_DIR)/prid.c
cclash.$(SUF): $(SRC_DIR)/cclash.c
$(CC) -c $(CFLAGS) $(SRC_DIR)/cclash.c
GCIPM.$(SUF): $(SRC_DIR)/GCIPM.c
$(CC) -c $(CFLAGS) $(SRC_DIR)/GCIPM.c

View File

@@ -60,13 +60,6 @@ Initialize all internal table values to \fIstr\fP. if \fIstr\fP is not
given, this command is equivalent to the C command.
.IP S\fInum\fP
Set the table size to \fInum\fP entries. The default size is 128.
.IP H\fIfilename\fP
Create tables which can be indexed by the full range of characters,
rather than 0..127. As this depends on the implementation of 'char'
in C (signed or unsigned), this also generates a file \fIfilename\fP,
with a #define for the constant "CharOffset". The generated tables can
be indexed by first adding "CharOffset" to the base of the table.
If \fIfilename\fP is not given, "charoffset.h" is used.
.SH "AN EXAMPLE"
.PP
The next example is a part of the \fItabgen\fP description of the

View File

@@ -25,18 +25,14 @@ char OutputForm[MAXBUF] = "%s,\n";
/* format for spitting out a string */
char *Table[MAXTAB];
char *ProgCall; /* callname of this program */
int signedch = 0; /* set if characters are signed */
int TabSize = 128; /* default size of generated table */
char *InitialValue; /* initial value of all table entries */
#define CHROFFSETFILE "charoffset.h"
char *chroffsetfile = 0;
extern char *malloc(), *strcpy();
main(argc, argv)
char *argv[];
{
if (((char) -1) < 0) signedch = 1;
ProgCall = *argv++;
argc--;
@@ -50,24 +46,8 @@ main(argc, argv)
}
}
}
if (chroffsetfile) MkCharIndex();
exit(0);
}
MkCharIndex()
{
/* Assumption: 8 bit bytes, ASCII character set */
FILE *fp;
if ((fp = fopen(chroffsetfile, "w")) == NULL) {
fprintf(stderr, "%s: cannot write file %s\n", ProgCall, chroffsetfile);
exit(1);
}
if (signedch) {
fputs("#define CharOffset 128\n", fp);
}
else fputs("#define CharOffset 0\n", fp);
fclose(fp);
/*NOTREACHED*/
}
char *
@@ -126,16 +106,6 @@ option(str)
}
else InitTable(str);
break;
case 'H': /* create include file for character offset,
and create tables which can be indexed by the
full range of characters, rather than 0..127,
by adding "CharOffset" to the base.
*/
if (*++str == '\0') {
chroffsetfile = CHROFFSETFILE;
}
else chroffsetfile = ++str;
break;
case 'S':
{
register i = atoi(++str);
@@ -232,14 +202,14 @@ c_proc(str, Name)
ch = quoted(&str);
}
else {
ch = *str++;
ch = *str++ & 0377;
}
if (*str == '-') {
if (*++str == '\\') {
ch2 = quoted(&str);
}
else {
if (ch2 = *str++);
if (ch2 = (*str++ & 0377));
else str--;
}
if (ch > ch2) {
@@ -255,23 +225,20 @@ c_proc(str, Name)
if (! setval(ch, name)) return 0;
}
}
if (chroffsetfile) Table[256] = Table[0];
return 1;
}
#define ind(X) (chroffsetfile && signedch?(X>=128?X-128:X+128):X)
int
setval(ch, nm)
char *nm;
{
register char **p = &Table[ind(ch)];
register char **p = &Table[ch];
if (ch < 0 || ch >= TabSize) {
fprintf(stderr, "Illegal index: %d\n", ch);
return 0;
}
if (*(p = &Table[ind(ch)])) {
if (*(p = &Table[ch])) {
fprintf(stderr, "Warning: redefinition of index %d\n", ch);
}
*p = nm;