Deleted unused include files dbm.h and pcc.h.

Deleted library functions stty() and gtty().
PicoC built in mips16 mode, without floating point support.
This commit is contained in:
Serge Vakulenko
2015-06-24 19:19:46 -07:00
parent ea7c1415d7
commit 81a8a8379d
17 changed files with 535 additions and 851 deletions

View File

@@ -1,28 +0,0 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)dbm.h 5.1 (Berkeley) 3/27/86
*/
#ifndef NULL
/*
* this is lunacy, we no longer use it (and never should have
* unconditionally defined it), but, this whole file is for
* backwards compatability - someone may rely on this.
*/
#define NULL ((char *) 0)
#endif
#include <ndbm.h>
datum fetch();
datum firstkey();
datum nextkey();
#if 0
datum makdatum();
datum firsthash();
long calchash();
long hashinc();
#endif

View File

@@ -36,36 +36,6 @@
#ifndef _LIMITS_H_
#define _LIMITS_H_
/*
* We don't need this crud at the moment so save on abuse of the C
* preprocessor by not doing the defines.
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_TZNAME_MAX 3
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_EQUIV_CLASS_MAX 2
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX 255
*/
#include <machine/limits.h>
/* #include <sys/syslimits.h> */
#endif /* !_LIMITS_H_ */

View File

@@ -1,229 +0,0 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)pcc.h 5.1 (Berkeley) 5/30/85
*/
/*
* This file contains definitions for all the constants and structures
* needed to use the intermediate code files generated and read by
* the Portable C Compiler and related compilers.
*
* Rules for changing this code:
* 1) All op values must be integer constants -- this permits us to run
* a 'sed' script on this file to create %term declarations for yacc.
* 2) Because the PCC uses fancy ASG and UNARY macros, assignment
* operators must have values 1 greater than corresponding normal
* operators, and unary operators must have values 2 greater ditto.
* 3) Ops used only by f1 must have values >= 150 (PCCF_FORTOPS).
* 4) Other language-dependent ops must have values >= 200.
*/
# ifndef PCC_TOKENS
# define PCC_TOKENS 0
# define PCC_ERROR 1 /* an error node */
# define PCC_FREE 2 /* an unused node */
/*
* Constants.
*/
# define PCC_STRING 3 /* a string constant */
# define PCC_ICON 4 /* an integer constant */
# define PCC_FCON 5 /* a floating point constant */
# define PCC_DCON 6 /* a double precision f.p. constant */
/*
* Leaf types.
*/
# define PCC_NAME 7 /* an identifier */
# define PCC_REG 8 /* a register */
# define PCC_OREG 9 /* register and offset */
# define PCC_CCODES 10 /* condition codes */
# define PCC_FLD 11 /* a bit field */
/*
* Arithmetic operators.
*/
# define PCC_PLUS 12 /* + */
# define PCC_PLUSEQ 13 /* += */
# define PCC_UPLUS 14 /* unary + (for completeness) */
# define PCC_MINUS 15 /* - */
# define PCC_MINUSEQ 16 /* -= */
# define PCC_UMINUS 17 /* unary - */
# define PCC_MUL 18 /* * */
# define PCC_MULEQ 19 /* *= */
/* Reserve a slot for 'unary *', which is PCC jargon for PCC_DEREF (yech) */
# define PCC_DIV 21 /* / */
# define PCC_DIVEQ 22 /* /= */
# define PCC_MOD 23 /* % */
# define PCC_MODEQ 24 /* %= */
# define PCC_INCR 25 /* ++ */
# define PCC_DECR 26 /* -- */
# define PCC_ASSIGN 27 /* = (these last 3 are stretching it) */
/*
* Bit operators.
*/
# define PCC_AND 28 /* & */
# define PCC_ANDEQ 29 /* &= */
/* Reserve a slot for 'unary &', jargon for PCC_ADDROF */
# define PCC_OR 31 /* | */
# define PCC_OREQ 32 /* |= */
# define PCC_ER 33 /* ^ */
# define PCC_EREQ 34 /* ^= */
# define PCC_LS 35 /* << */
# define PCC_LSEQ 36 /* <<= */
# define PCC_RS 37 /* >> */
# define PCC_RSEQ 38 /* >>= */
# define PCC_COMPL 39 /* ~ */
/*
* Booleans.
*/
# define PCC_EQ 40 /* == */
# define PCC_NE 41 /* != */
# define PCC_LE 42 /* <= */
# define PCC_LT 43 /* < */
# define PCC_GE 44 /* >= */
# define PCC_GT 45 /* > */
# define PCC_ULE 46 /* unsigned <= */
# define PCC_ULT 47 /* unsigned < */
# define PCC_UGE 48 /* unsigned >= */
# define PCC_UGT 49 /* unsigned > */
# define PCC_QUEST 50 /* ? (for conditional expressions) */
# define PCC_COLON 51 /* : (for conditional expressions) */
# define PCC_ANDAND 52 /* && */
# define PCC_OROR 53 /* || */
# define PCC_NOT 54 /* ! */
/*
* Function calls.
*/
# define PCC_CALL 55 /* call by value */
/* no ASG */
# define PCC_UCALL 57 /* call with no arguments */
# define PCC_FORTCALL 58 /* call by reference? */
/* no ASG */
# define PCC_UFORTCALL 60 /* ??? */
# ifdef INLINE
# define PCC_INLINE 61 /* inline function */
/* no ASG */
# define PCC_UINLINE 63 /* inline with no arguments */
# endif INLINE
/*
* Referencing and dereferencing.
*/
# define PCC_DEREF 20 /* * */
# define PCC_ADDROF 30 /* & */
/*
* Special structure operators.
*/
# define PCC_DOT 64 /* . */
# define PCC_STREF 65 /* -> */
# define PCC_STASG 66 /* structure assignment */
# define PCC_STARG 67 /* an argument of type structure */
# define PCC_STCALL 68 /* a function of type structure */
/* no ASG */
# define PCC_USTCALL 70 /* unary structure function */
/*
* Conversions.
*/
# define PCC_SCONV 71 /* scalar conversion */
# define PCC_PCONV 72 /* pointer conversion */
# define PCC_PMCONV 73 /* pointer multiply conversion */
# define PCC_PVCONV 74 /* pointer divide conversion */
# define PCC_CAST 75 /* redundant? */
/*
* Bracket types.
*/
# define PCC_LB 76 /* [ */
# define PCC_RB 77 /* ] */
/*
* Comma nodes.
*/
# define PCC_COMOP 78 /* , (in expressions) */
# define PCC_CM 79 /* , (in argument lists) */
/*
* Miscellaneous.
*/
# define PCC_FORCE 80 /* result of last expression goes in r0 */
# define PCC_GOTO 81 /* unconditional goto */
# define PCC_CBRANCH 82 /* goto label if !test */
# define PCC_RETURN 83 /* return from function */
# define PCC_INIT 84 /* initialized data */
# define PCC_TYPE 85 /* a type */
# define PCC_CLASS 86 /* a storage class */
# define PCC_MAXOP 86 /* highest numbered PCC op */
/*
* Special codes for interfacing to /lib/f1.
*/
# define PCCF_FORTOPS 150
# define PCCF_FTEXT 150 /* pass literal assembler text */
# define PCCF_FEXPR 151 /* a statement */
# define PCCF_FSWITCH 152 /* not implemented */
# define PCCF_FLBRAC 153 /* beginning of subroutine */
# define PCCF_FRBRAC 154 /* end of subroutine */
# define PCCF_FEOF 155 /* end of file */
# define PCCF_FARIF 156 /* not implemented */
# define PCCF_FLABEL 157 /* an f77 label */
# endif PCC_TOKENS
/*
* Types, as encoded in intermediate file cookies.
*/
# define PCCT_UNDEF 0
# define PCCT_FARG 1 /* function argument */
# define PCCT_CHAR 2
# define PCCT_SHORT 3
# define PCCT_INT 4
# define PCCT_LONG 5
# define PCCT_FLOAT 6
# define PCCT_DOUBLE 7
# define PCCT_STRTY 8
# define PCCT_UNIONTY 9
# define PCCT_ENUMTY 10
# define PCCT_MOETY 11 /* member of enum */
# define PCCT_UCHAR 12
# define PCCT_USHORT 13
# define PCCT_UNSIGNED 14
# define PCCT_ULONG 15
/*
* Type modifiers.
*/
# define PCCTM_PTR 020
# define PCCTM_FTN 040
# define PCCTM_ARY 060
# define PCCTM_BASETYPE 017
# define PCCTM_TYPESHIFT 2
/*
* Useful macros. 'PCCOM' macros apply to ops.
*/
# define PCCOM_ASG 1+
# define PCCOM_UNARY 2+
# define PCCOM_NOASG (-1)+
# define PCCOM_NOUNARY (-2)+
# define PCCM_TRIPLE(op, var, type) \
((op) | ((var) << 8) | (long) (type) << 16)
# define PCCM_TEXT(s) \
PCCM_TRIPLE(PCCF_FTEXT, (strlen(s) + 3) / 4, 0)
# define PCCM_ADDTYPE(t, m) \
((((t) &~ PCCTM_BASETYPE) << PCCTM_TYPESHIFT) | \
(m) | ((t) & PCCTM_BASETYPE))

View File

@@ -87,10 +87,10 @@ OBJS += inet_addr.o inet_network.o inet_netof.o \
inet_ntoa.o inet_lnaof.o inet_maddr.o
# libc/compat
OBJS += creat.o ftime.o gethostid.o gtty.o memccpy.o memchr.o \
OBJS += creat.o ftime.o gethostid.o memccpy.o memchr.o \
memcmp.o memcpy.o memset.o nice.o pause.o rand.o \
sethostid.o setregid.o setreuid.o setrgid.o setruid.o \
sigcompat.o strchr.o strrchr.o stty.o times.o tmpnam.o \
sigcompat.o strchr.o strrchr.o times.o tmpnam.o \
utime.o
# libc/runtime

View File

@@ -757,7 +757,6 @@ file /include/arpa/inet.h
file /include/assert.h
file /include/ctype.h
file /include/curses.h
file /include/dbm.h
file /include/fcntl.h
file /include/float.h
file /include/fstab.h
@@ -785,7 +784,6 @@ file /include/mtab.h
file /include/ndbm.h
file /include/nlist.h
file /include/paths.h
file /include/pcc.h
file /include/psout.h
file /include/pwd.h
file /include/ranlib.h

View File

@@ -17,7 +17,6 @@
#include <stdlib.h>
#include <sgtty.h>
#include <string.h>
//#include <strings.h>
#include <sys/time.h>
#define kbytes(size) (((size) + 1023) / 1024)
@@ -79,7 +78,7 @@ main(argc, argv)
twidth = 80;
if (isatty(1)) {
qflg = Cflg = 1;
(void) gtty(1, &sgbuf);
ioctl(1, TIOCGETP, &sgbuf);
if (ioctl(1, TIOCGWINSZ, &win) != -1)
twidth = (win.ws_col == 0 ? 80 : win.ws_col);
if ((sgbuf.sg_flags & XTABS) != XTABS)

View File

@@ -1455,7 +1455,8 @@ initterm ()
struct winsize win;
retry:
if (!(no_tty = gtty(fileno(stdout), &otty))) {
no_tty = ioctl(fileno(stdout), TIOCGETP, &otty);
if (no_tty == 0) {
if (ioctl(fileno(stdout), TIOCLGET, &lmode) < 0) {
perror("TIOCLGET");
exit(1);
@@ -1548,8 +1549,8 @@ retry:
if ((shell = getenv("SHELL")) == NULL)
shell = _PATH_BSHELL;
}
no_intty = gtty(fileno(stdin), &otty);
gtty(fileno(stderr), &otty);
no_intty = ioctl(fileno(stdin), TIOCGETP, &otty);
ioctl(fileno(stderr), TIOCGETP, &otty);
savetty = otty;
hardtabs = !(otty.sg_flags & XTABS);
if (! no_tty) {

View File

@@ -2,43 +2,36 @@ TOPSRC = $(shell cd ../../..; pwd)
include $(TOPSRC)/target.mk
#CC=gcc
CFLAGS+= -g -DUNIX_HOST -DVER='"1.0"' -DFILENAME_MAX=64 -DL_tmpnam=30 -DCLOCKS_PER_SEC=80000000 -DPATH_MAX=200 -Os -Werror
LIBS=-lm -lc
CFLAGS += -g -DUNIX_HOST -DVER='"1.0"' -DFILENAME_MAX=64 \
-DL_tmpnam=30 -DCLOCKS_PER_SEC=80000000 -DPATH_MAX=200 \
-DNO_FP -Os -Werror -mips16
LIBS = -lm -lc
TARGET = picoc
SRCS = picoc.c table.c lex.c parse.c expression.c heap.c type.c \
variable.c clibrary.c platform.c include.c debug.c \
platform/platform_unix.c platform/library_unix.c \
cstdlib/stdio.c cstdlib/math.c cstdlib/string.c cstdlib/stdlib.c \
cstdlib/time.c cstdlib/errno.c cstdlib/ctype.c cstdlib/stdbool.c \
cstdlib/unistd.c retrobsd.c
OBJS := $(SRCS:%.c=%.o)
TARGET = picoc
SRCS = picoc.c table.c lex.c parse.c expression.c heap.c type.c \
variable.c clibrary.c platform.c include.c debug.c \
platform/platform_unix.c platform/library_unix.c \
cstdlib/stdio.c cstdlib/math.c cstdlib/string.c cstdlib/stdlib.c \
cstdlib/time.c cstdlib/errno.c cstdlib/ctype.c cstdlib/stdbool.c \
cstdlib/unistd.c retrobsd.c
OBJS := $(SRCS:%.c=%.o)
all: $(TARGET)
all: $(TARGET)
$(TARGET): $(OBJS)
${CC} ${LDFLAGS} -o ${TARGET}.elf ${OBJS} ${LIBS}
${OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis
${SIZE} ${TARGET}.elf
${ELF2AOUT} ${TARGET}.elf $@
$(TARGET): $(OBJS)
${CC} ${LDFLAGS} -o ${TARGET}.elf ${OBJS} ${LIBS}
${OBJDUMP} -S ${TARGET}.elf > ${TARGET}.dis
${SIZE} ${TARGET}.elf
${ELF2AOUT} ${TARGET}.elf $@
install: $(TARGET)
cp $(TARGET) $(TOPSRC)/bin
install: $(TARGET)
cp $(TARGET) $(TOPSRC)/bin
test: all
(cd tests; make test)
test: all
(cd tests; make test)
clean:
rm -f $(TARGET) $(OBJS) *~ *.elf *.dis
count:
@echo "Core:"
@cat picoc.h interpreter.h picoc.c table.c lex.c parse.c expression.c platform.c heap.c type.c variable.c include.c debug.c | grep -v '^[ ]*/\*' | grep -v '^[ ]*$$' | wc
@echo ""
@echo "Everything:"
@cat $(SRCS) *.h */*.h | wc
.PHONY: clibrary.c
rm -f $(TARGET) *.o */*.o *~ *.elf *.dis
picoc.o: picoc.c picoc.h
table.o: table.c interpreter.h platform.h

View File

@@ -9,7 +9,7 @@ TOPSRC = $(shell cd ../../..; pwd)
include $(TOPSRC)/target.mk
#include $(TOPSRC)/cross.mk
CFLAGS += -O
CFLAGS += -O -Wall -Werror
OBJS = boggle.o
MAN = boggle.0
MANSRC = boggle.6

File diff suppressed because it is too large Load Diff

View File

@@ -11,19 +11,19 @@ char new[MAX], old[MAX];
int main ()
{
register int i, j;
register int i, j;
old[0] = '\0';
while (fgets(&new[0], MAX, stdin) != NULL) {
for (i=0; i<MAX && old[i]==new[i]; i++);
if (i >= MAX) {
fprintf(stderr, "long word\n");
return 1;
}
putc(i, stdout);
for (j=0; (old[j]=new[j]) != '\n'; j++);
old[j] = '\0';
fputs(&old[i], stdout);
}
return 0;
old[0] = '\0';
while (fgets(&new[0], MAX, stdin) != NULL) {
for (i=0; i<MAX && old[i]==new[i]; i++);
if (i >= MAX) {
fprintf(stderr, "long word\n");
return 1;
}
putc(i, stdout);
for (j=0; (old[j]=new[j]) != '\n'; j++);
old[j] = '\0';
fputs(&old[i], stdout);
}
return 0;
}

View File

@@ -12,6 +12,7 @@ include $(TOPSRC)/target.mk
#include $(TOPSRC)/cross.mk
#CFLAGS = -O -Werror -DCROSS
CFLAGS += -Wall -Werror
OBJS = extern.o crib.o support.o cards.o score.o io.o
TOBJS = test.o cards.o score.o io.o extern.o
MAN = cribbage.0

View File

@@ -130,7 +130,7 @@ BOOLEAN cut(mycrib, pos)
BOOLEAN mycrib;
int pos;
{
register int i, cardx;
register int i;
BOOLEAN win = FALSE;
if (mycrib) {
@@ -193,7 +193,7 @@ BOOLEAN mycrib;
register int i, j, k;
register int l;
register int cnum, pnum, sum;
register BOOLEAN myturn, mego, ugo, last, played;
register BOOLEAN myturn, mego, ugo, last, played = 0;
cnum = pnum = CINHAND;
for (i = 0; i < CINHAND; i++) { /* make copies of hands */
@@ -366,7 +366,6 @@ BOOLEAN playhand(mycrib)
BOOLEAN mycrib;
{
register int deckpos;
extern char Msgbuf[];
werase(Compwin);
@@ -486,7 +485,6 @@ int main(argc, argv)
int argc;
char *argv[];
{
register char *p;
BOOLEAN playing;
char *s; /* for reading arguments */
char bust; /* flag for arg reader */
@@ -567,4 +565,5 @@ char *argv[];
}
bye(0);
return 0;
}

View File

@@ -289,8 +289,8 @@ int infrom(hand, n, prompt)
*/
int readchar()
{
register int cnt, y, x;
auto char c;
register int cnt;
char c;
over:
cnt = 0;
@@ -495,7 +495,6 @@ void wait_for(ch)
*/
void do_wait()
{
register int line;
static char prompt[] = { '-', '-', 'M', 'o', 'r', 'e', '-', '-', '\0' };
if (Mpos + sizeof prompt < MSG_X)

View File

@@ -8,14 +8,14 @@ include $(TOPSRC)/target.mk
CFLAGS += ${DEFS} -Os
SRCS = creat.c ftime.c gethostid.c gtty.c memccpy.c memchr.c memcmp.c \
SRCS = creat.c ftime.c gethostid.c memccpy.c memchr.c memcmp.c \
memcpy.c memset.c nice.c pause.c rand.c sethostid.c \
setregid.c setreuid.c setrgid.c setruid.c sigcompat.c \
strchr.c strrchr.c stty.c times.c tmpnam.c utime.c
OBJS = creat.o ftime.o gethostid.o gtty.o memccpy.o memchr.o memcmp.o \
strchr.c strrchr.c times.c tmpnam.c utime.c
OBJS = creat.o ftime.o gethostid.o memccpy.o memchr.o memcmp.o \
memcpy.o memset.o nice.o pause.o rand.o sethostid.o \
setregid.o setreuid.o setrgid.o setruid.o sigcompat.o \
strchr.o strrchr.o stty.o times.o tmpnam.o utime.o
strchr.o strrchr.o times.o tmpnam.o utime.o
compat.a: ${OBJS}
@echo "buiding compat.a"

View File

@@ -1,17 +0,0 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
/*
* Writearound to old gtty system call.
*/
#include <sgtty.h>
int
gtty(fd, ap)
struct sgtty *ap;
{
return ioctl(fd, TIOCGETP, ap);
}

View File

@@ -1,17 +0,0 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
/*
* Writearound to old stty system call.
*/
#include <sgtty.h>
int
stty(fd, ap)
struct sgtty *ap;
{
return ioctl (fd, TIOCSETP, ap);
}