diff arogue7/io.c @ 219:f9ef86cf22b2

Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default.
author John "Elwin" Edwards
date Fri, 19 Feb 2016 21:02:28 -0500
parents b786053d2f37
children
line wrap: on
line diff
--- a/arogue7/io.c	Sun Feb 07 14:39:21 2016 -0500
+++ b/arogue7/io.c	Fri Feb 19 21:02:28 2016 -0500
@@ -30,7 +30,10 @@
 static char msgbuf[BUFSIZ];
 static int newpos = 0;
 
+void doadd(char *fmt, va_list ap);
+
 /*VARARGS1*/
+void
 msg(char *fmt, ...)
 {
     va_list ap;
@@ -58,6 +61,7 @@
 /*
  * add things to the current message
  */
+void
 addmsg(char *fmt, ...)
 {
     va_list ap;
@@ -71,7 +75,8 @@
  * Display a new msg (giving him a chance to see the previous one if it
  * is up there with the --More--)
  */
-endmsg()
+void
+endmsg(void)
 {
     /* Needed to track where we are for 5.0 (PC) curses */
     register int x, y;
@@ -111,6 +116,7 @@
     draw(msgw);
 }
 
+void
 doadd(char *fmt, va_list ap)
 {
 
@@ -127,9 +133,8 @@
  *	flgptr will be NULL if we don't know what the monster is yet!
  */
 
-step_ok(y, x, can_on_monst, flgptr)
-register int y, x, can_on_monst;
-register struct thing *flgptr;
+bool
+step_ok(int y, int x, int can_on_monst, struct thing *flgptr)
 {
     /* can_on_monst = MONSTOK if all we care about are physical obstacles */
     register struct linked_list *item;
@@ -188,7 +193,8 @@
  *	returns true if it is ok for type to shoot over ch
  */
 
-shoot_ok(ch)
+bool
+shoot_ok(char ch)
 {
     switch (ch)
     {
@@ -209,7 +215,8 @@
  *	getchar.
  */
 
-readchar()
+int
+readchar(void)
 {
     int ch;
 
@@ -227,10 +234,11 @@
 /*
  * status:
  *	Display the important stats line.  Keep the cursor where it was.
+ *	display: if TRUE, display unconditionally
  */
 
-status(display)
-bool display;	/* is TRUE, display unconditionally */
+void
+status(bool display)
 {
     register struct stats *stat_ptr, *max_ptr;
     register int oy, ox, temp;
@@ -358,8 +366,8 @@
  * wait_for
  *	Sit around until the guy types the right key
  */
-wait_for(ch)
-register char ch;
+void
+wait_for(char ch)
 {
     register char c;
 
@@ -383,10 +391,9 @@
  *	typed and then redraw the starting screen.
  */
 
-over_win(oldwin, newin, maxy, maxx, cursory, cursorx, redraw)
-WINDOW *oldwin, *newin;
-int maxy, maxx, cursory, cursorx;
-char redraw;
+void
+over_win(WINDOW *oldwin, WINDOW *newin, int maxy, int maxx, int cursory, 
+         int cursorx, char redraw)
 {
     static char blanks[LINELEN+1];
     register int line, i;
@@ -436,9 +443,8 @@
  *	function used to display a window and wait before returning
  */
 
-show_win(scr, message)
-register WINDOW *scr;
-char *message;
+void
+show_win(WINDOW *scr, char *message)
 {
     mvwaddstr(scr, 0, 0, message);
     touchwin(scr);
@@ -453,9 +459,8 @@
  * dbotline:
  *	Displays message on bottom line and waits for a space to return
  */
-dbotline(scr,message)
-WINDOW *scr;
-char *message;
+void
+dbotline(WINDOW *scr, char *message)
 {
 	mvwaddstr(scr,lines-1,0,message);
 	draw(scr);
@@ -467,8 +472,8 @@
  * restscr:
  *	Restores the screen to the terminal
  */
-restscr(scr)
-WINDOW *scr;
+void
+restscr(WINDOW *scr)
 {
 	clearok(scr,TRUE);
 	touchwin(scr);
@@ -481,10 +486,7 @@
  */
 
 unsigned long
-netread(error, size, stream)
-int *error;
-int size;
-FILE *stream;
+netread(int *error, int size, FILE *stream)
 {
     unsigned long result = 0L,	/* What we read in */
 		  partial;	/* Partial value */
@@ -519,12 +521,13 @@
 /*
  * netwrite:
  *	Write out a byte, short, or long machine independently.
+ *	value: What to write
+ *	size: How much to write out
+ *	stream: Where to write it
  */
 
-netwrite(value, size, stream)
-unsigned long value;	/* What to write */
-int size;	/* How much to write out */
-FILE *stream;	/* Where to write it */
+int
+netwrite(unsigned long value, int size, FILE *stream)
 {
     int i;	/* Goes through value one byte at a time */
     char outc;	/* The next character to be written */