Parcourir la source

Added prototyping stuff

ceriel il y a 30 ans
Parent
commit
f3fd5ba24b

+ 9 - 1
modules/src/input/inp_pkg.body

@@ -97,6 +97,8 @@ INP_PRIVATE struct INP_buffer_header *INP_head, *INP_free;
 	returned.  *size is initialized with the buffer length.
 */
 
+_PROTOTYPE(INP_PRIVATE int INP_rdfile, (File *, char *, long *, char **));
+
 INP_PRIVATE int
 INP_rdfile(fd, fn, size, pbuf)
 	register File *fd;
@@ -134,6 +136,7 @@ INP_rdfile(fd, fn, size, pbuf)
 
 INP_PRIVATE struct INP_i_buf *i_ptr;
 
+_PROTOTYPE(INP_PRIVATE char * INP_pbuf, (void));
 INP_PRIVATE char *
 INP_pbuf()
 {
@@ -153,6 +156,9 @@ INP_pbuf()
 
 /*	Input buffer administration: INP_push_bh() and INP_pop_bh()
 */
+_PROTOTYPE(INP_PRIVATE struct INP_buffer_header *INP_push_bh, (void));
+_PROTOTYPE(INP_PRIVATE int INP_pop_bh, (void));
+
 INP_PRIVATE struct INP_buffer_header *
 INP_push_bh()
 {
@@ -205,11 +211,12 @@ INP_pop_bh()
 /*	low level I/O routine : read one block from current input
 	stream : INP_rdblock
 */
+_PROTOTYPE(INP_PRIVATE int INP_rdblock, (File *, char *, int *));
 
 INP_PRIVATE int
 INP_rdblock(fd, buf, n)
 	File *fd;
-	char buf[];
+	char *buf;
 	int *n;
 {
 
@@ -224,6 +231,7 @@ INP_rdblock(fd, buf, n)
 /*	Miscellaneous routines :
 	INP_mk_filename()
 */
+_PROTOTYPE(INP_PRIVATE int INP_mk_filename, (char *, char *, char **));
 
 /*	INP_mk_filename() concatenates a dir and filename.
 */

+ 7 - 9
modules/src/input/inp_pkg.spec

@@ -16,6 +16,8 @@
 	to work. Its default value is 1.
 */
 
+#include <ansi.h>
+
 /* INPUT PRIMITIVES */
 
 #define	LoadChar(dest)	((dest = *_ipp++) || (dest = loadbuf()))
@@ -29,15 +31,11 @@
 
 extern char *_ipp;
 
-#if __STDC__
-int loadbuf(void);
-int InsertFile(char *, char **, char **);
-int InsertText(char *, int);
-#else
-extern int loadbuf();
-extern int InsertFile();
-extern int InsertText();
-#endif
+_PROTOTYPE(int loadbuf, (void));
+_PROTOTYPE(int AtEoIT, (void));
+_PROTOTYPE(int AtEoIF, (void));
+_PROTOTYPE(int InsertFile, (char *, char **, char **));
+_PROTOTYPE(int InsertText, (char *, int));
 
 /*	int InsertFile(filename, table, result)
 		char *filename; 

+ 2 - 2
modules/src/input/proto.make

@@ -18,9 +18,10 @@ libinput.$(LIBSUF):	$(OBJECTS)
 		$(RANLIB) libinput.$(LIBSUF)
 
 install:	all
+		-mkdir $(MOD_DIR)/lib
+		-mkdir $(MOD_DIR)/pkg
 		cp libinput.$(LIBSUF) $(MOD_DIR)/lib/libinput.$(LIBSUF)
 		$(RANLIB) $(MOD_DIR)/lib/libinput.$(LIBSUF)
-		cp $(SRC_DIR)/input.3 $(MOD_DIR)/man/input.3
 		cp $(SRC_DIR)/inp_pkg.body $(MOD_DIR)/pkg/inp_pkg.body
 		cp $(SRC_DIR)/inp_pkg.spec $(MOD_DIR)/pkg/inp_pkg.spec
 		if [ $(DO_MACHINE_INDEP) = y ] ; \
@@ -31,7 +32,6 @@ cmp:		all
 		-cmp libinput.$(LIBSUF) $(MOD_DIR)/lib/libinput.$(LIBSUF)
 		-cmp $(SRC_DIR)/inp_pkg.body $(MOD_DIR)/pkg/inp_pkg.body
 		-cmp $(SRC_DIR)/inp_pkg.spec $(MOD_DIR)/pkg/inp_pkg.spec
-		-cmp $(SRC_DIR)/input.3 $(MOD_DIR)/man/input.3
 
 pr:
 		@pr $(SRC_DIR)/proto.make $(SRC_DIR)/inp_pkg.spec $(SRC_DIR)/inp_pkg.body $(SRC_DIR)/AtEoIF.c $(SRC_DIR)/AtEoIT.c

+ 1 - 0
modules/src/object/.distr

@@ -1,6 +1,7 @@
 proto.make
 object.3
 object.h
+obj.h
 rd.c
 rd_arhdr.c
 rd_bytes.c

+ 79 - 0
modules/src/object/obj.h

@@ -0,0 +1,79 @@
+/* $Header$ */
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+#include <local.h>
+#include <stdio.h>
+#include <out.h>
+#include <ranlib.h>
+#include <arch.h>
+#include "object.h"
+
+#if ! defined(CHAR_UNSIGNED)
+#define CHAR_UNSIGNED 0
+#endif
+
+#if CHAR_UNSIGNED
+#define Xchar(ch)	(ch)
+#else
+#define Xchar(ch)	((ch) & 0377)
+#endif
+
+#if ! defined(BYTE_ORDER)
+#define BYTE_ORDER 0x3210
+#endif
+
+#if (BYTE_ORDER == 0x3210 || BYTE_ORDER == 0x1032)
+#define uget2(c)	(Xchar((c)[0]) | ((unsigned) Xchar((c)[1]) << 8))
+#define Xput2(i, c)	(((c)[0] = (i)), ((c)[1] = (i) >> 8))
+#define put2(i, c)	{ register int j = (i); Xput2(j, c); }
+#else
+#define uget2(c)	(* ((unsigned short *) (c)))
+#define Xput2(i, c)	(* ((short *) (c)) = (i))
+#define put2(i, c)	Xput2(i, c)
+#endif
+
+#define get2(c)		((short) uget2(c))
+
+#if BYTE_ORDER != 0x0123
+#define get4(c)		(uget2(c) | ((long) uget2((c)+2) << 16))
+#define put4(l, c)	{ register long x=(l); \
+			  Xput2((int)x,c); \
+			  Xput2((int)(x>>16),(c)+2); \
+			}
+#else
+#define get4(c)		(* ((long *) (c)))
+#define put4(l, c)	(* ((long *) (c)) = (l))
+#endif
+
+#define SECTCNT	3	/* number of sections with own output buffer */
+#if BIGMACHINE
+#define WBUFSIZ	(8*BUFSIZ)
+#else
+#define WBUFSIZ	BUFSIZ
+#endif
+
+struct fil {
+	int	cnt;
+	char	*pnow;
+	char	*pbegin;
+	long	currpos;
+	int	fd;
+	char	pbuf[WBUFSIZ];
+};
+
+extern struct fil __parts[];
+
+#define	PARTEMIT	0
+#define	PARTRELO	(PARTEMIT+SECTCNT)
+#define	PARTNAME	(PARTRELO+1)
+#define	PARTCHAR	(PARTNAME+1)
+#ifdef SYMDBUG
+#define PARTDBUG	(PARTCHAR+1)
+#else
+#define PARTDBUG	(PARTCHAR+0)
+#endif
+#define	NPARTS		(PARTDBUG + 1)
+
+#define getsect(s)      (PARTEMIT+((s)>=(SECTCNT-1)?(SECTCNT-1):(s)))

+ 30 - 28
modules/src/object/object.3

@@ -13,70 +13,72 @@ and write ACK-object files and libraries
 .B #include <arch.h>
 .br
 .B #include <ranlib.h>
+.br
+.B #include <object.h>
 .PP
 .B int wr_open(filename)
 .br
 .B char *filename;
 .PP
-.B wr_close()
+.B void wr_close()
 .PP
-.B wr_ohead(head)
+.B void wr_ohead(head)
 .br
 .B struct outhead *head;
 .PP
-.B wr_sect(sect, cnt)
+.B void wr_sect(sect, cnt)
 .br
 .B struct outsect *sect;
 .br
 .B unsigned int cnt;
 .PP
-.B wr_outsect(sectionnr)
+.B void wr_outsect(sectionnr)
 .br
 .B int sectionnr;
 .PP
-.B wr_emit(emit, cnt)
+.B void wr_emit(emit, cnt)
 .br
 .B char *emit;
 .br
 .B long cnt;
 .PP
-.B wr_putc(ch)
+.B void wr_putc(ch)
 .PP
-.B wr_relo(relo, cnt)
+.B void wr_relo(relo, cnt)
 .br
 .B struct outrelo *relo;
 .br
 .B unsigned int cnt;
 .PP
-.B wr_name(name, cnt)
+.B void wr_name(name, cnt)
 .br
-.B struct name *name;
+.B struct outname *name;
 .br
 .B unsigned int cnt;
 .PP
-.B wr_string(stringaddr, cnt)
+.B void wr_string(stringaddr, cnt)
 .br
 .B char *stringaddr;
 .br
 .B long cnt;
 .PP
-.B wr_arhdr(fd, arhdr)
+.B void wr_arhdr(fd, arhdr)
 .br
 .B struct ar_hdr *arhdr;
 .PP
-.B wr_ranlib(fd, ran, cnt)
+.B void wr_ranlib(fd, ran, cnt)
 .br
 .B struct ranlib *ran;
 .br
 .B long cnt;
 .PP
-.B wr_int2(fd, i)
+.B void wr_int2(fd, i)
 .PP
-.B wr_long(fd, l)
+.B void wr_long(fd, l)
 .br
 .B long l;
 .PP
-.B wr_bytes(fd, buf, l)
+.B void wr_bytes(fd, buf, l)
 .br
 .B char *buf;
 .br
@@ -88,45 +90,45 @@ and write ACK-object files and libraries
 .PP
 .B int rd_fdopen(fd)
 .PP
-.B rd_close()
+.B void rd_close()
 .PP
-.B rd_ohead(head)
+.B void rd_ohead(head)
 .br
 .B struct outhead *head;
 .PP
-.B rd_sect(sect, cnt)
+.B void rd_sect(sect, cnt)
 .br
 .B struct outsect *sect;
 .br
 .B unsigned int cnt;
 .PP
-.B rd_outsect(sectionnr)
+.B void rd_outsect(sectionnr)
 .br
 .B int sectionnr;
 .PP
-.B rd_emit(emit, cnt)
+.B void rd_emit(emit, cnt)
 .br
 .B char *emit;
 .br
 .B long cnt;
 .PP
-.B rd_relo(relo, cnt)
+.B void rd_relo(relo, cnt)
 .br
 .B struct outrelo *relo;
 .br
 .B unsigned int cnt;
 .PP
-.B rd_rew_relo(head)
+.B void rd_rew_relo(head)
 .br
 .B struct outhead *head;
 .PP
-.B rd_name(name, cnt)
+.B void rd_name(name, cnt)
 .br
-.B struct name *name;
+.B struct outname *name;
 .br
 .B unsigned int cnt;
 .PP
-.B rd_string(stringaddr, cnt)
+.B void rd_string(stringaddr, cnt)
 .br
 .B char *stringaddr;
 .br
@@ -136,7 +138,7 @@ and write ACK-object files and libraries
 .br
 .B struct ar_hdr *arhdr;
 .PP
-.B rd_ranlib(fd, ran, cnt)
+.B void rd_ranlib(fd, ran, cnt)
 .br
 .B struct ranlib *ran;
 .br
@@ -148,13 +150,13 @@ and write ACK-object files and libraries
 .PP
 .B long rd_long(fd)
 .PP
-.B rd_bytes(fd, buf, l)
+.B void rd_bytes(fd, buf, l)
 .br
 .B char *buf;
 .br
 .B long l;
 .PP
-.B rd_fd()
+.B int rd_fd()
 .SH DESCRIPTION
 These routines come in handy when reading or writing ACK-object files
 or libraries. No checking is performed.

+ 39 - 69
modules/src/object/object.h

@@ -3,73 +3,43 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <local.h>
-#include <stdio.h>
 
-#if ! defined(CHAR_UNSIGNED)
-#define CHAR_UNSIGNED 0
-#endif
-
-#if CHAR_UNSIGNED
-#define Xchar(ch)	(ch)
-#else
-#define Xchar(ch)	((ch) & 0377)
-#endif
-
-#if ! defined(BYTE_ORDER)
-#define BYTE_ORDER 0x3210
-#endif
-
-#if (BYTE_ORDER == 0x3210 || BYTE_ORDER == 0x1032)
-#define uget2(c)	(Xchar((c)[0]) | ((unsigned) Xchar((c)[1]) << 8))
-#define Xput2(i, c)	(((c)[0] = (i)), ((c)[1] = (i) >> 8))
-#define put2(i, c)	{ register int j = (i); Xput2(j, c); }
-#else
-#define uget2(c)	(* ((unsigned short *) (c)))
-#define Xput2(i, c)	(* ((short *) (c)) = (i))
-#define put2(i, c)	Xput2(i, c)
-#endif
-
-#define get2(c)		((short) uget2(c))
-
-#if BYTE_ORDER != 0x0123
-#define get4(c)		(uget2(c) | ((long) uget2((c)+2) << 16))
-#define put4(l, c)	{ register long x=(l); \
-			  Xput2((int)x,c); \
-			  Xput2((int)(x>>16),(c)+2); \
-			}
-#else
-#define get4(c)		(* ((long *) (c)))
-#define put4(l, c)	(* ((long *) (c)) = (l))
-#endif
-
-#define SECTCNT	3	/* number of sections with own output buffer */
-#if BIGMACHINE
-#define WBUFSIZ	(8*BUFSIZ)
-#else
-#define WBUFSIZ	BUFSIZ
-#endif
-
-struct fil {
-	int	cnt;
-	char	*pnow;
-	char	*pbegin;
-	long	currpos;
-	int	fd;
-	char	pbuf[WBUFSIZ];
-};
-
-extern struct fil __parts[];
-
-#define	PARTEMIT	0
-#define	PARTRELO	(PARTEMIT+SECTCNT)
-#define	PARTNAME	(PARTRELO+1)
-#define	PARTCHAR	(PARTNAME+1)
-#ifdef SYMDBUG
-#define PARTDBUG	(PARTCHAR+1)
-#else
-#define PARTDBUG	(PARTCHAR+0)
-#endif
-#define	NPARTS		(PARTDBUG + 1)
-
-#define getsect(s)      (PARTEMIT+((s)>=(SECTCNT-1)?(SECTCNT-1):(s)))
+#include <ansi.h>
+
+#ifndef __OBJECT_INCLUDED__
+#define __OBJECT_INCLUDED__
+
+_PROTOTYPE(int wr_open, (char *f));
+_PROTOTYPE(void wr_close, (void));
+_PROTOTYPE(void wr_ohead, (struct outhead *h));
+_PROTOTYPE(void wr_sect, (struct outsect *s, unsigned int c));
+_PROTOTYPE(void wr_outsect, (int sectno));
+_PROTOTYPE(void wr_emit, (char *b, long c));
+_PROTOTYPE(void wr_putc, (int c));
+_PROTOTYPE(void wr_relo, (struct outrelo *r, unsigned int c));
+_PROTOTYPE(void wr_name, (struct outname *n, unsigned int c));
+_PROTOTYPE(void wr_string, (char *s, long c));
+_PROTOTYPE(void wr_arhdr, (int fd, struct ar_hdr *a));
+_PROTOTYPE(void wr_ranlib, (int fd, struct ranlib *r, long cnt));
+_PROTOTYPE(void wr_int2, (int fd, int i));
+_PROTOTYPE(void wr_long, (int fd, long l));
+_PROTOTYPE(void wr_bytes, (int fd, char *buf, long l));
+_PROTOTYPE(int rd_open, (char *f));
+_PROTOTYPE(int rd_fdopen, (int f));
+_PROTOTYPE(void rd_close, (void));
+_PROTOTYPE(void rd_ohead, (struct outhead *h));
+_PROTOTYPE(void rd_sect, (struct outsect *s, unsigned int c));
+_PROTOTYPE(void rd_outsect, (int sectno));
+_PROTOTYPE(void rd_emit, (char *b, long c));
+_PROTOTYPE(void rd_relo, (struct outrelo *r, unsigned int c));
+_PROTOTYPE(void rd_rew_relo, (struct outhead *head));
+_PROTOTYPE(void rd_name, (struct outname *n, unsigned int c));
+_PROTOTYPE(void rd_string, (char *s, long c));
+_PROTOTYPE(int rd_arhdr, (int fd, struct ar_hdr *a));
+_PROTOTYPE(void rd_ranlib, (int fd, struct ranlib *r, long cnt));
+_PROTOTYPE(int rd_int2, (int fd));
+_PROTOTYPE(long rd_long, (int fd));
+_PROTOTYPE(void rd_bytes, (int fd, char *buf, long l));
+_PROTOTYPE(int rd_fd, (void));
+
+#endif /* __OBJECT_INCLUDED__ */

+ 5 - 3
modules/src/object/proto.make

@@ -2,7 +2,7 @@
 
 SRC_DIR = $(SRC_HOME)/modules/src/object
 MOD_DIR = $(TARGET_HOME)/modules
-INCLUDES = -I$(TARGET_HOME)/h -I$(TARGET_HOME)/config -I$(SRC_DIR)
+INCLUDES = -I$(TARGET_HOME)/h -I$(MOD_DIR)/h -I$(TARGET_HOME)/config -I$(SRC_DIR)
 CFLAGS = $(INCLUDES) $(COPTIONS)
 
 CFILES =	$(SRC_DIR)/rd_arhdr.c $(SRC_DIR)/wr_arhdr.c \
@@ -22,16 +22,18 @@ OFILES =	rd.$(SUF) rd_arhdr.$(SUF) rd_int2.$(SUF) rd_long.$(SUF) \
 all:		libobject.$(LIBSUF)
 
 install:	all
+		-mkdir $(MOD_DIR)/lib
+		-mkdir $(MOD_DIR)/h
 		cp libobject.$(LIBSUF) $(MOD_DIR)/lib/libobject.$(LIBSUF)
 		$(RANLIB) $(MOD_DIR)/lib/libobject.$(LIBSUF)
-		cp $(SRC_DIR)/object.3 $(MOD_DIR)/man/object.3
+		cp $(SRC_DIR)/object.h $(MOD_DIR)/h/object.h
 		if [ $(DO_MACHINE_INDEP) = y ] ; \
 		then	mk_manpage $(SRC_DIR)/object.3 $(TARGET_HOME) ; \
 		fi
 
 compare:	all
 		-cmp libobject.$(LIBSUF) $(MOD_DIR)/lib/libobject.$(LIBSUF)
-		-cmp $(SRC_DIR)/object.3 $(MOD_DIR)/man/object.3
+		-cmp $(SRC_DIR)/object.h $(MOD_DIR)/h/object.h
 
 pr:
 		@pr $(SRC_DIR)/proto.make $(SRC_DIR)/object.h $(CFILES)

+ 14 - 3
modules/src/object/rd.c

@@ -3,8 +3,7 @@
  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  * See the copyright notice in the ACK home directory, in the file "Copyright".
  */
-#include <out.h>
-#include "object.h"
+#include "obj.h"
 
 extern long		lseek();
 
@@ -42,7 +41,7 @@ static long		rd_base;
 
 static int sectionnr;
 
-static
+static void
 OUTREAD(p, b, n)
 	char *b;
 	long n;
@@ -73,6 +72,7 @@ rd_open(f)
 
 static int offcnt;
 
+int
 rd_fdopen(fd)
 {
 	register int i;
@@ -90,6 +90,7 @@ rd_fdopen(fd)
 	return 1;
 }
 
+void
 rd_close()
 {
 
@@ -97,11 +98,13 @@ rd_close()
 	outfile = -1;
 }
 
+int
 rd_fd()
 {
 	return outfile;
 }
 
+void
 rd_ohead(head)
 	register struct outhead	*head;
 {
@@ -135,6 +138,7 @@ rd_ohead(head)
 #endif
 }
 
+void
 rd_rew_relos(head)
 	register struct outhead *head;
 {
@@ -143,6 +147,7 @@ rd_rew_relos(head)
 	BEGINSEEK(PARTRELO, off);
 }
 
+void
 rd_sect(sect, cnt)
 	register struct outsect	*sect;
 	register unsigned int	cnt;
@@ -168,6 +173,7 @@ rd_sect(sect, cnt)
 	}
 }
 
+void
 rd_outsect(s)
 {
 	OUTSECT(s);
@@ -177,6 +183,7 @@ rd_outsect(s)
 /*
  * We don't have to worry about byte order here.
  */
+void
 rd_emit(emit, cnt)
 	char		*emit;
 	long		cnt;
@@ -185,6 +192,7 @@ rd_emit(emit, cnt)
 	offset[sectionnr] += cnt;
 }
 
+void
 rd_relo(relo, cnt)
 	register struct outrelo	*relo;
 	register unsigned int cnt;
@@ -208,6 +216,7 @@ rd_relo(relo, cnt)
 	}
 }
 
+void
 rd_name(name, cnt)
 	register struct outname	*name;
 	register unsigned int cnt;
@@ -231,6 +240,7 @@ rd_name(name, cnt)
 	}
 }
 
+void
 rd_string(addr, len)
 	char *addr;
 	long len;
@@ -240,6 +250,7 @@ rd_string(addr, len)
 }
 
 #ifdef SYMDBUG
+void
 rd_dbug(buf, size)
 	char		*buf;
 	long		size;