From 3936117409cf27503dff2c5d4d2ba20840a85873 Mon Sep 17 00:00:00 2001 From: lukem Date: Fri, 10 Oct 1997 13:36:01 +0000 Subject: WARNSify --- gomoku/bdinit.c | 19 +++++----- gomoku/bdisp.c | 35 ++++++++++++------- gomoku/gomoku.6 | 12 +++---- gomoku/gomoku.h | 47 ++++++++++++++++++++++--- gomoku/main.c | 38 +++++++++++++------- gomoku/makemove.c | 18 ++++++---- gomoku/pickmove.c | 101 ++++++++++++++++++++++++++++++++---------------------- gomoku/stoc.c | 24 +++++++------ 8 files changed, 192 insertions(+), 102 deletions(-) (limited to 'gomoku') diff --git a/gomoku/bdinit.c b/gomoku/bdinit.c index dcbbcaca..2a803297 100644 --- a/gomoku/bdinit.c +++ b/gomoku/bdinit.c @@ -1,4 +1,4 @@ -/* $NetBSD: bdinit.c,v 1.3 1997/01/03 01:35:24 cgd Exp $ */ +/* $NetBSD: bdinit.c,v 1.4 1997/10/10 13:36:01 lukem Exp $ */ /* * Copyright (c) 1994 @@ -36,23 +36,25 @@ * SUCH DAMAGE. */ +#include #ifndef lint #if 0 static char sccsid[] = "from: @(#)bdinit.c 8.2 (Berkeley) 5/3/95"; #else -static char rcsid[] = "$NetBSD: bdinit.c,v 1.3 1997/01/03 01:35:24 cgd Exp $"; +__RCSID("$NetBSD: bdinit.c,v 1.4 1997/10/10 13:36:01 lukem Exp $"); #endif #endif /* not lint */ #include #include "gomoku.h" +void bdinit(bp) struct spotstr *bp; { - register int i, j, r; - register struct spotstr *sp; - register struct combostr *cbp; + int i, j, r; + struct spotstr *sp; + struct combostr *cbp; movenum = 1; @@ -173,11 +175,12 @@ bdinit(bp) * As pieces are played, it can make frames not overlap if there are no * common open spaces shared between the two frames. */ +void init_overlap() { - register struct spotstr *sp1, *sp2; - register struct combostr *cbp; - register int i, f, r, n, d1, d2; + struct spotstr *sp1, *sp2; + struct combostr *cbp; + int i, f, r, n, d1, d2; int mask, bmask, vertex, s; u_char *str; short *ip; diff --git a/gomoku/bdisp.c b/gomoku/bdisp.c index 689b0687..b530f32a 100644 --- a/gomoku/bdisp.c +++ b/gomoku/bdisp.c @@ -1,4 +1,4 @@ -/* $NetBSD: bdisp.c,v 1.4 1997/01/03 01:35:25 cgd Exp $ */ +/* $NetBSD: bdisp.c,v 1.5 1997/10/10 13:36:02 lukem Exp $ */ /* * Copyright (c) 1994 @@ -36,18 +36,18 @@ * SUCH DAMAGE. */ +#include #ifndef lint #if 0 static char sccsid[] = "@(#)bdisp.c 8.2 (Berkeley) 5/3/95"; #else -static char rcsid[] = "$NetBSD: bdisp.c,v 1.4 1997/01/03 01:35:25 cgd Exp $"; +__RCSID("$NetBSD: bdisp.c,v 1.5 1997/10/10 13:36:02 lukem Exp $"); #endif #endif /* not lint */ -#include "gomoku.h" -#include -#include #include +#include +#include "gomoku.h" #define SCRNH 24 /* assume 24 lines for the moment */ #define SCRNW 80 /* assume 80 chars for the moment */ @@ -58,6 +58,7 @@ static char pcolor[] = "*O.?"; /* * Initialize screen display. */ +void cursinit() { @@ -70,6 +71,7 @@ cursinit() /* * Restore screen display. */ +void cursfini() { @@ -83,9 +85,10 @@ cursfini() /* * Initialize board display. */ +void bdisp_init() { - register int i, j; + int i, j; /* top border */ for (i = 1; i < BSZ1; i++) { @@ -114,6 +117,7 @@ bdisp_init() /* * Update who is playing whom. */ +void bdwho(update) int update; { @@ -137,10 +141,11 @@ bdwho(update) /* * Update the board display after a move. */ +void bdisp() { - register int i, j, c; - register struct spotstr *sp; + int i, j, c; + struct spotstr *sp; for (j = BSZ1; --j > 0; ) { for (i = 1; i < BSZ1; i++) { @@ -165,11 +170,12 @@ bdisp() /* * Dump board display to a file. */ +void bdump(fp) FILE *fp; { - register int i, j, c; - register struct spotstr *sp; + int i, j, c; + struct spotstr *sp; /* top border */ fprintf(fp, " A B C D E F G H J K L M N O P Q R S T\n"); @@ -203,6 +209,7 @@ bdump(fp) /* * Display a transcript entry */ +void dislog(str) char *str; { @@ -223,6 +230,8 @@ dislog(str) /* * Display a question. */ + +void ask(str) char *str; { @@ -235,14 +244,16 @@ ask(str) refresh(); } +int getline(buf, size) char *buf; int size; { - register char *cp, *end; - register int c; + char *cp, *end; + int c; extern int interactive; + c = 0; cp = buf; end = buf + size - 1; /* save room for the '\0' */ while (cp < end && (c = getchar()) != EOF && c != '\n' && c != '\r') { diff --git a/gomoku/gomoku.6 b/gomoku/gomoku.6 index e99b25fa..b5adae99 100644 --- a/gomoku/gomoku.6 +++ b/gomoku/gomoku.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: gomoku.6,v 1.3 1997/01/03 01:35:26 cgd Exp $ +.\" $NetBSD: gomoku.6,v 1.4 1997/10/10 13:36:02 lukem Exp $ .\" .\" Copyright (c) 1994 .\" The Regents of the University of California. All rights reserved. @@ -43,17 +43,17 @@ .Nm gomoku .Nd game of 5 in a row .Sh SYNOPSIS -.Nm gomoku +.Nm .Op Fl bcdu .Op Fl D Ar debugfile .Op Ar inputfile .Sh DESCRIPTION -.Nm Gomoku +.Nm is a two player game were the object is to get 5 in a row horizontally, vertically or diagonally on a 19 by 19 grid. By convention, black always moves first. With no arguments, -.Nm gomoku +.Nm will display a playing board and prompt for moves from the user. Valid moves are a letter for the column and a number for the row of an empty board location. Entering ``quit" or ``resign" will end the game. @@ -69,13 +69,13 @@ The options are: This option sets background mode. Input moves are read from standard input, the computer picks a move, and prints it to standard output. The first input line should be either ``black" or ``white" to specify whether -.Nm gomoku +.Nm has the first move or not respectively. This option was intended for game tournaments where a referee program handles the board display and pits one program against another. .It Fl c Computer verses computer. -.Nm Gomoku +.Nm will play a game against itself. This is mostly used for testing. .It Fl d Print debugging information. Repeating this option more than diff --git a/gomoku/gomoku.h b/gomoku/gomoku.h index e40dd705..1f7a11fa 100644 --- a/gomoku/gomoku.h +++ b/gomoku/gomoku.h @@ -1,4 +1,4 @@ -/* $NetBSD: gomoku.h,v 1.3 1997/01/03 01:35:27 cgd Exp $ */ +/* $NetBSD: gomoku.h,v 1.4 1997/10/10 13:36:03 lukem Exp $ */ /* * Copyright (c) 1994 @@ -39,6 +39,7 @@ */ #include +#include /* board dimensions */ #define BSZ 19 @@ -261,8 +262,44 @@ extern int movelog[BSZ * BSZ]; /* history of moves */ extern int movenum; extern int debug; -extern char *copy(); -extern char *stoc(); -extern char *tail(); - #define ASSERT(x) + +void bdinit __P((struct spotstr *)); +void init_overlap __P((void)); +int getline __P((char *, int)); +void ask __P((char *)); +void dislog __P((char *)); +void bdump __P((FILE *)); +void bdisp __P((void)); +void bdisp_init __P((void)); +void cursfini __P((void)); +void cursinit __P((void)); +void bdwho __P((int)); +void panic __P((char *)); +void log __P((char *)); +void dlog __P((char *)); +void quit __P((void)); +void quitsig __P((int)); +void whatsup __P((int)); +int readinput __P((FILE *)); +char *stoc __P((int)); +int lton __P((int)); +int ctos __P((char *)); +void update_overlap __P((struct spotstr *)); +int makemove __P((int, int)); +int list_eq __P((struct combostr **, struct combostr **, int)); +void clearcombo __P((struct combostr *, int)); +void makeempty __P((struct combostr *)); +void appendcombo __P((struct combostr *, int)); +void updatecombo __P((struct combostr *, int)); +void markcombo __P((struct combostr *)); +void printcombo __P((struct combostr *, char *)); +void makecombo __P((struct combostr *, struct spotstr *, int, int)); +void makecombo2 __P((struct combostr *, struct spotstr *, int, int)); +int sortcombo __P((struct combostr **, struct combostr **, struct combostr *)); +int checkframes __P((struct combostr *, struct combostr *, struct spotstr *, +int, struct ovlp_info *)); +void addframes __P((int)); +void scanframes __P((int)); +int better __P((struct spotstr *, struct spotstr *, int)); +int pickmove __P((int)); diff --git a/gomoku/main.c b/gomoku/main.c index fc749944..9d56e26b 100644 --- a/gomoku/main.c +++ b/gomoku/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.3 1997/01/03 01:35:28 cgd Exp $ */ +/* $NetBSD: main.c,v 1.4 1997/10/10 13:36:04 lukem Exp $ */ /* * Copyright (c) 1994 @@ -36,24 +36,23 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1994\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1994\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$NetBSD: main.c,v 1.3 1997/01/03 01:35:28 cgd Exp $"; +__RCSID("$NetBSD: main.c,v 1.4 1997/10/10 13:36:04 lukem Exp $"); #endif #endif /* not lint */ #include #include #include -#include #include #include #include @@ -83,11 +82,9 @@ int movelog[BSZ * BSZ]; /* log of all the moves */ int movenum; /* current move number */ char *plyr[2]; /* who's who */ -extern void quit(); -#ifdef DEBUG -extern void whatsup(); -#endif +int main __P((int, char *[])); +int main(argc, argv) int argc; char **argv; @@ -100,13 +97,15 @@ main(argc, argv) "%3d %-6s" }; + color = curmove = 0; + prog = strrchr(argv[0], '/'); if (prog) prog++; else prog = argv[0]; - while ((ch = getopt(argc, argv, "bcdD:u")) != EOF) { + while ((ch = getopt(argc, argv, "bcdD:u")) != -1) { switch (ch) { case 'b': /* background */ interactive = 0; @@ -150,7 +149,7 @@ again: #ifdef DEBUG signal(SIGINT, whatsup); #else - signal(SIGINT, quit); + signal(SIGINT, quitsig); #endif if (inputfp == NULL && test == 0) { @@ -311,7 +310,7 @@ again: replay: ask("replay? "); if (getline(buf, sizeof(buf)) && - buf[0] == 'y' || buf[0] == 'Y') + (buf[0] == 'y' || buf[0] == 'Y')) goto again; if (strcmp(buf, "save") == 0) { FILE *fp; @@ -331,8 +330,11 @@ again: } } quit(); + /* NOTREACHED */ + return(0); } +int readinput(fp) FILE *fp; { @@ -492,6 +494,7 @@ syntax: /* * Display debug info. */ +void dlog(str) char *str; { @@ -504,6 +507,7 @@ dlog(str) fprintf(stderr, "%s\n", str); } +void log(str) char *str; { @@ -526,9 +530,17 @@ quit() exit(0); } +void +quitsig(dummy) + int dummy; +{ + quit(); +} + /* * Die gracefully. */ +void panic(str) char *str; { diff --git a/gomoku/makemove.c b/gomoku/makemove.c index c1be646e..ca270068 100644 --- a/gomoku/makemove.c +++ b/gomoku/makemove.c @@ -1,4 +1,4 @@ -/* $NetBSD: makemove.c,v 1.3 1997/01/03 01:35:29 cgd Exp $ */ +/* $NetBSD: makemove.c,v 1.4 1997/10/10 13:36:05 lukem Exp $ */ /* * Copyright (c) 1994 @@ -36,11 +36,12 @@ * SUCH DAMAGE. */ +#include #ifndef lint #if 0 static char sccsid[] = "@(#)makemove.c 8.2 (Berkeley) 5/3/95"; #else -static char rcsid[] = "$NetBSD: makemove.c,v 1.3 1997/01/03 01:35:29 cgd Exp $"; +__RCSID("$NetBSD: makemove.c,v 1.4 1997/10/10 13:36:05 lukem Exp $"); #endif #endif /* not lint */ @@ -61,15 +62,16 @@ int weight[5] = { 0, 1, 7, 22, 100 }; * WIN The the winning move was just played. * TIE The game is a tie. */ +int makemove(us, mv) int us, mv; { - register struct spotstr *sp, *fsp; - register union comboval *cp; + struct spotstr *sp, *fsp; + union comboval *cp; struct spotstr *osp; struct combostr *cbp, *cbp1; union comboval *cp1; - register int i, f, r, d, n; + int i, f, r, d, n; int space, val, bmask; /* check for end of game */ @@ -218,15 +220,17 @@ makemove(us, mv) /* * fix up the overlap array due to updating spot osp. */ +void update_overlap(osp) struct spotstr *osp; { - register struct spotstr *sp, *sp1, *sp2; - register int i, f, r, r1, d, d1, n; + struct spotstr *sp, *sp1, *sp2; + int i, f, r, r1, d, d1, n; int a, b, bmask, bmask1; struct spotstr *esp; char *str; + esp = NULL; for (r = 4; --r >= 0; ) { /* for each direction */ d = dd[r]; sp1 = osp; diff --git a/gomoku/pickmove.c b/gomoku/pickmove.c index 925e5ef2..4a762927 100644 --- a/gomoku/pickmove.c +++ b/gomoku/pickmove.c @@ -1,4 +1,4 @@ -/* $NetBSD: pickmove.c,v 1.4 1997/01/03 01:35:30 cgd Exp $ */ +/* $NetBSD: pickmove.c,v 1.5 1997/10/10 13:36:06 lukem Exp $ */ /* * Copyright (c) 1994 @@ -36,15 +36,15 @@ * SUCH DAMAGE. */ +#include #ifndef lint #if 0 static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95"; #else -static char rcsid[] = "$NetBSD: pickmove.c,v 1.4 1997/01/03 01:35:30 cgd Exp $"; +__RCSID("$NetBSD: pickmove.c,v 1.5 1997/10/10 13:36:06 lukem Exp $"); #endif #endif /* not lint */ -#include #include #include #include @@ -69,13 +69,13 @@ int forcemap[MAPSZ]; /* map for blocking <1,x> combos */ int tmpmap[MAPSZ]; /* map for blocking <1,x> combos */ int nforce; /* count of opponent <1,x> combos */ +int pickmove(us) int us; { - register struct spotstr *sp, *sp1, *sp2; - register union comboval *Ocp, *Tcp; - char *str; - int i, j, m; + struct spotstr *sp, *sp1, *sp2; + union comboval *Ocp, *Tcp; + int m; /* first move is easy */ if (movenum == 1) @@ -122,14 +122,14 @@ pickmove(us) } if (debug) { - sprintf(fmtbuf, "B %s %x/%d %d %x/%d %d %d %d", + sprintf(fmtbuf, "B %s %x/%d %d %x/%d %d %d", stoc(sp1 - board), sp1->s_combo[BLACK].s, sp1->s_level[BLACK], sp1->s_nforce[BLACK], sp1->s_combo[WHITE].s, sp1->s_level[WHITE], sp1->s_nforce[WHITE], sp1->s_wval); dlog(fmtbuf); - sprintf(fmtbuf, "W %s %x/%d %d %x/%d %d %d %d", + sprintf(fmtbuf, "W %s %x/%d %d %x/%d %d %d", stoc(sp2 - board), sp2->s_combo[WHITE].s, sp2->s_level[WHITE], sp2->s_nforce[WHITE], @@ -169,6 +169,7 @@ pickmove(us) /* * Return true if spot 'sp' is better than spot 'sp1' for color 'us'. */ +int better(sp, sp1, us) struct spotstr *sp; struct spotstr *sp1; @@ -229,14 +230,15 @@ int curlevel; /* implicit parameter to makecombo() */ * update the minimum combo values for each empty spot. * Also, try to combine frames to find more complex (chained) moves. */ +void scanframes(color) int color; { - register struct combostr *cbp, *ecbp; - register struct spotstr *sp; - register union comboval *cp; - register struct elist *ep, *nep; - register int i, r, d, n; + struct combostr *cbp, *ecbp; + struct spotstr *sp; + union comboval *cp; + struct elist *ep, *nep; + int i, r, d, n; union comboval cb; curcolor = color; @@ -413,15 +415,16 @@ scanframes(color) * Compute all level 2 combos of frames intersecting spot 'osp' * within the frame 'ocbp' and combo value 's'. */ +void makecombo2(ocbp, osp, off, s) struct combostr *ocbp; struct spotstr *osp; int off; int s; { - register struct spotstr *sp, *fsp; - register struct combostr *ncbp; - register int f, r, d, c; + struct spotstr *fsp; + struct combostr *ncbp; + int f, r, d, c; int baseB, fcnt, emask, bmask, n; union comboval ocb, fcb; struct combostr **scbpp, *fcbp; @@ -460,7 +463,7 @@ makecombo2(ocbp, osp, off, s) * If this is the end point of the frame, * use the closed ended value for the frame. */ - if (f == 0 && fcb.c.b || fcb.s == 0x101) { + if ((f == 0 && fcb.c.b) || fcb.s == 0x101) { fcb.c.a++; fcb.c.b = 0; } @@ -507,7 +510,7 @@ makecombo2(ocbp, osp, off, s) ((fcb.c.b ? 0x1E : 0x1F) & ~(1 << f)) : 0; combocnt++; - if (c == 1 && debug > 1 || debug > 3) { + if ((c == 1 && debug > 1) || debug > 3) { sprintf(fmtbuf, "%c c %d %d m %x %x o %d %d", "bw"[curcolor], ncbp->c_framecnt[0], ncbp->c_framecnt[1], @@ -544,13 +547,14 @@ makecombo2(ocbp, osp, off, s) * Scan the sorted list of frames and try to add a frame to * combinations of 'level' number of frames. */ +void addframes(level) int level; { - register struct combostr *cbp, *ecbp; - register struct spotstr *sp, *fsp; - register struct elist *ep, *nep; - register int i, r, d; + struct combostr *cbp, *ecbp; + struct spotstr *sp, *fsp; + struct elist *ep, *nep; + int i, r, d; struct combostr **cbpp, *pcbp; union comboval fcb, cb; @@ -644,20 +648,21 @@ addframes(level) * Compute all level N combos of frames intersecting spot 'osp' * within the frame 'ocbp' and combo value 's'. */ +void makecombo(ocbp, osp, off, s) struct combostr *ocbp; struct spotstr *osp; int off; int s; { - register struct combostr *cbp, *ncbp; - register struct spotstr *sp; - register struct elist *ep; - register int n, c; - struct elist *nep, **epp; + struct combostr *cbp, *ncbp; + struct spotstr *sp; + struct elist *ep; + int n, c; + struct elist *nep; struct combostr **scbpp; - int baseB, fcnt, emask, verts, d; - union comboval ocb, cb; + int baseB, fcnt, emask, verts; + union comboval ocb; struct ovlp_info vertices[1]; ocb.s = s; @@ -755,7 +760,7 @@ makecombo(ocbp, osp, off, s) ncbp->c_voff[0] = ep->e_off; } - if (c == 1 && debug > 1 || debug > 3) { + if ((c == 1 && debug > 1) || debug > 3) { sprintf(fmtbuf, "%c v%d i%d d%d c %d %d m %x %x o %d %d", "bw"[curcolor], verts, ncbp->c_frameindex, ncbp->c_dir, ncbp->c_framecnt[0], ncbp->c_framecnt[1], @@ -792,11 +797,12 @@ struct combostr *ecombo[MAXDEPTH]; /* separate from elist to save space */ * Add the combostr 'ocbp' to the empty spots list for each empty spot * in 'ocbp' that will complete the combo. */ +void makeempty(ocbp) struct combostr *ocbp; { struct combostr *cbp, *tcbp, **cbpp; - struct elist *ep, *nep, **epp; + struct elist *ep, *nep; struct spotstr *sp; int s, d, m, emask, i; int nframes; @@ -824,7 +830,8 @@ makeempty(ocbp) */ ep = &einfo[nframes]; cbpp = &ecombo[nframes]; - for (cbp = ocbp; tcbp = cbp->c_link[1]; cbp = cbp->c_link[0]) { + for (cbp = ocbp; (tcbp = cbp->c_link[1]) != NULL; + cbp = cbp->c_link[0]) { ep--; ep->e_combo = cbp; *--cbpp = cbp->c_link[1]; @@ -947,17 +954,18 @@ makeempty(ocbp) * We handle things differently depending on whether the next move * would be trying to "complete" the combo or trying to block it. */ +void updatecombo(cbp, color) struct combostr *cbp; int color; { - register struct framestr *fp; - register struct spotstr *sp; - register struct combostr *tcbp; - register int i, d; + struct spotstr *sp; + struct combostr *tcbp; + int i, d; int nframes, flg, s; union comboval cb; + flg = 0; /* save the top level value for the whole combo */ cb.c.a = cbp->c_combo.c.a; nframes = cbp->c_nframes; @@ -965,7 +973,7 @@ updatecombo(cbp, color) if (color != nextcolor) memset(tmpmap, 0, sizeof(tmpmap)); - for (; tcbp = cbp->c_link[1]; cbp = cbp->c_link[0]) { + for (; (tcbp = cbp->c_link[1]) != NULL; cbp = cbp->c_link[0]) { flg = cbp->c_flg; cb.c.b = cbp->c_combo.c.b; if (color == nextcolor) { @@ -1037,6 +1045,7 @@ updatecombo(cbp, color) /* * Add combo to the end of the list. */ +void appendcombo(cbp, color) struct combostr *cbp; int color; @@ -1067,6 +1076,7 @@ appendcombo(cbp, color) * Return -1 if 'fcbp' should not be combined with 'cbp'. * 's' is the combo value for frame 'fcpb'. */ +int checkframes(cbp, fcbp, osp, s, vertices) struct combostr *cbp; struct combostr *fcbp; @@ -1080,6 +1090,9 @@ checkframes(cbp, fcbp, osp, s, vertices) u_char *str; short *ip; + lcbp = NULL; + flg = 0; + cb.s = s; fcnt = cb.c.a - 2; verts = 0; @@ -1093,7 +1106,8 @@ checkframes(cbp, fcbp, osp, s, vertices) * an open or closed frame. */ i = cb.c.b ? 2 : 0; - for (; tcbp = cbp->c_link[1]; lcbp = cbp, cbp = cbp->c_link[0]) { + for (; (tcbp = cbp->c_link[1]) != NULL; + lcbp = cbp, cbp = cbp->c_link[0]) { if (tcbp == fcbp) return (-1); /* fcbp is already included */ @@ -1204,6 +1218,7 @@ checkframes(cbp, fcbp, osp, s, vertices) * Return true if this list of frames is already in the hash list. * Otherwise, add the new combo to the hash list. */ +int sortcombo(scbpp, cbpp, fcbp) struct combostr **scbpp; struct combostr **cbpp; @@ -1317,6 +1332,7 @@ inserted: /* * Print the combo into string 'str'. */ +void printcombo(cbp, str) struct combostr *cbp; char *str; @@ -1325,7 +1341,7 @@ printcombo(cbp, str) sprintf(str, "%x/%d", cbp->c_combo.s, cbp->c_nframes); str += strlen(str); - for (; tcbp = cbp->c_link[1]; cbp = cbp->c_link[0]) { + for (; (tcbp = cbp->c_link[1]) != NULL; cbp = cbp->c_link[0]) { sprintf(str, " %s%c%x", stoc(tcbp->c_vertex), pdir[tcbp->c_dir], cbp->c_flg); str += strlen(str); @@ -1334,6 +1350,7 @@ printcombo(cbp, str) } #ifdef DEBUG +void markcombo(ocbp) struct combostr *ocbp; { @@ -1448,11 +1465,12 @@ markcombo(ocbp) } } +void clearcombo(cbp, open) struct combostr *cbp; int open; { - register struct spotstr *sp; + struct spotstr *sp; struct combostr *tcbp; int d, n, mask; @@ -1468,6 +1486,7 @@ clearcombo(cbp, open) sp->s_flg &= mask; } +int list_eq(scbpp, cbpp, n) struct combostr **scbpp; struct combostr **cbpp; diff --git a/gomoku/stoc.c b/gomoku/stoc.c index 2177b91c..c5d62e94 100644 --- a/gomoku/stoc.c +++ b/gomoku/stoc.c @@ -1,4 +1,4 @@ -/* $NetBSD: stoc.c,v 1.3 1997/01/03 01:35:31 cgd Exp $ */ +/* $NetBSD: stoc.c,v 1.4 1997/10/10 13:36:07 lukem Exp $ */ /* * Copyright (c) 1994 @@ -36,16 +36,18 @@ * SUCH DAMAGE. */ +#include #ifndef lint #if 0 static char sccsid[] = "@(#)stoc.c 8.1 (Berkeley) 7/24/94"; #else -static char rcsid[] = "$NetBSD: stoc.c,v 1.3 1997/01/03 01:35:31 cgd Exp $"; +__RCSID("$NetBSD: stoc.c,v 1.4 1997/10/10 13:36:07 lukem Exp $"); #endif #endif /* not lint */ -#include "gomoku.h" #include +#include +#include "gomoku.h" char *letters = ""; @@ -54,10 +56,10 @@ struct mvstr { char *m_text; }; static struct mvstr mv[] = { - RESIGN, "resign", - RESIGN, "quit", - SAVE, "save", - -1, 0 + { RESIGN, "resign" }, + { RESIGN, "quit" }, + { SAVE, "save" }, + { -1, 0 } }; /* @@ -68,7 +70,7 @@ stoc(s) int s; { static char buf[32]; - register int i; + int i; for (i = 0; mv[i].m_code >= 0; i++) if (s == mv[i].m_code) @@ -80,10 +82,11 @@ stoc(s) /* * Turn the character form of a move into the spot number form. */ +int ctos(mp) char *mp; { - register int i; + int i; for (i = 0; mv[i].m_code >= 0; i++) if (strcmp(mp, mv[i].m_text) == 0) @@ -99,10 +102,11 @@ ctos(mp) /* * Turn a letter into a number. */ +int lton(c) int c; { - register int i; + int i; if (islower(c)) c = toupper(c); -- cgit v1.2.3-56-ge451