Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games Add use of `const' where appropriate to the games.
details: https://anonhg.NetBSD.org/src/rev/daf0f61a3e5d
branches: trunk
changeset: 476170:daf0f61a3e5d
user: jsm <jsm%NetBSD.org@localhost>
date: Wed Sep 08 21:17:44 1999 +0000
description:
Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).
Some such changes were previously covered in PRs bin/6041, bin/6146,
bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994,
bin/8039, bin/8057 and bin/8093.
diffstat:
games/boggle/boggle/bog.c | 30 ++++++++++-------
games/boggle/boggle/extern.h | 26 +++++++-------
games/boggle/boggle/mach.c | 29 ++++++++--------
games/boggle/boggle/prtable.c | 16 ++++----
games/boggle/boggle/word.c | 8 ++--
games/caesar/caesar.c | 8 ++--
games/canfield/canfield/canfield.c | 46 +++++++++++++-------------
games/canfield/cfscores/cfscores.c | 8 ++--
games/cribbage/cards.c | 7 ++-
games/cribbage/crib.c | 6 +-
games/cribbage/cribbage.h | 36 ++++++++++----------
games/cribbage/io.c | 24 +++++++-------
games/cribbage/score.c | 24 +++++++------
games/cribbage/support.c | 24 +++++++-------
games/factor/factor.c | 10 ++--
games/fish/fish.c | 24 +++++++-------
games/fortune/fortune/fortune.c | 64 ++++++++++++++++++++-----------------
games/fortune/strfile/strfile.c | 10 ++--
games/gomoku/bdisp.c | 12 ++----
games/gomoku/gomoku.h | 24 +++++++-------
games/gomoku/main.c | 16 ++++----
games/gomoku/makemove.c | 8 ++--
games/gomoku/pickmove.c | 8 ++--
games/gomoku/stoc.c | 14 ++++----
games/hangman/extern.c | 9 ++--
games/hangman/hangman.h | 7 ++-
games/hangman/setup.c | 6 +-
games/mille/comp.c | 8 ++--
games/mille/extern.c | 28 ++++++++--------
games/mille/mille.h | 24 +++++++------
games/mille/move.c | 8 ++--
games/mille/print.c | 6 +-
games/mille/save.c | 6 +-
games/monop/cards.c | 8 ++--
games/monop/execute.c | 6 +-
games/monop/getinp.c | 13 ++++---
games/monop/houses.c | 8 ++--
games/monop/initdeck.c | 8 ++--
games/monop/misc.c | 8 ++--
games/monop/monop.def | 12 +++---
games/monop/monop.ext | 6 +-
games/monop/monop.h | 18 +++++-----
games/monop/morg.c | 8 ++--
games/monop/print.c | 10 ++--
games/monop/spec.c | 6 +-
games/monop/trade.c | 6 +-
games/morse/morse.c | 16 ++++----
games/number/number.c | 21 +++++------
games/phantasia/gamesupport.c | 4 +-
games/phantasia/interplayer.c | 4 +-
games/phantasia/io.c | 4 +-
games/phantasia/main.c | 4 +-
games/phantasia/misc.c | 26 +++++++-------
games/phantasia/phantglobs.c | 22 ++++++------
games/phantasia/phantglobs.h | 36 ++++++++++----------
games/phantasia/phantstruct.h | 4 +-
games/phantasia/setup.c | 10 ++--
games/primes/pattern.c | 8 ++--
games/primes/pr_tbl.c | 8 ++--
games/primes/primes.c | 14 ++++----
games/quiz/quiz.c | 30 +++++++++--------
games/quiz/quiz.h | 6 +-
games/quiz/rxp.c | 22 ++++++------
games/robots/auto.c | 16 ++++----
games/robots/extern.c | 8 ++--
games/robots/init_field.c | 6 +-
games/robots/main.c | 8 ++--
games/robots/move.c | 6 +-
games/robots/query.c | 6 +-
games/robots/robots.h | 10 ++--
games/robots/score.c | 11 +++--
games/sail/assorted.c | 8 ++--
games/sail/dr_1.c | 16 +++++---
games/sail/dr_2.c | 12 +++---
games/sail/driver.h | 4 +-
games/sail/extern.h | 48 ++++++++++++++--------------
games/sail/globals.c | 36 ++++++++++----------
games/sail/lo_main.c | 6 +-
games/sail/pl_3.c | 6 +-
games/sail/pl_4.c | 6 +-
games/sail/pl_7.c | 24 +++++++-------
games/snake/snake/move.c | 16 ++++----
games/snake/snake/snake.c | 18 +++++-----
games/snake/snake/snake.h | 20 +++++------
games/snake/snscore/snscore.c | 6 +-
games/tetris/scores.c | 4 +-
games/tetris/screen.c | 6 +-
games/tetris/shapes.c | 8 ++--
games/tetris/tetris.c | 6 +-
games/tetris/tetris.h | 14 ++++----
games/trek/getpar.h | 6 +-
games/worm/worm.c | 8 ++--
92 files changed, 653 insertions(+), 636 deletions(-)
diffs (truncated from 4549 to 300 lines):
diff -r 2cceef9e92a0 -r daf0f61a3e5d games/boggle/boggle/bog.c
--- a/games/boggle/boggle/bog.c Wed Sep 08 20:43:48 1999 +0000
+++ b/games/boggle/boggle/bog.c Wed Sep 08 21:17:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bog.c,v 1.11 1999/07/21 04:02:29 hubertf Exp $ */
+/* $NetBSD: bog.c,v 1.12 1999/09/08 21:17:44 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: bog.c,v 1.11 1999/07/21 04:02:29 hubertf Exp $");
+__RCSID("$NetBSD: bog.c,v 1.12 1999/09/08 21:17:44 jsm Exp $");
#endif
#endif /* not lint */
@@ -101,10 +101,12 @@
int wordlen; /* Length of last word returned by nextword() */
int usedbits;
-char *pword[MAXPWORDS], pwords[MAXPSPACE], *pwordsp;
+const char *pword[MAXPWORDS];
+char pwords[MAXPSPACE], *pwordsp;
int npwords;
-char *mword[MAXMWORDS], mwords[MAXMSPACE], *mwordsp;
+const char *mword[MAXMWORDS];
+char mwords[MAXMSPACE], *mwordsp;
int nmwords;
int ngames = 0;
@@ -415,10 +417,11 @@
*/
int
checkword(word, prev, path)
- char *word;
+ const char *word;
int prev, *path;
{
- char *p, *q;
+ const char *p;
+ char *q;
int i, *lm;
if (debug) {
@@ -498,10 +501,10 @@
*/
int
validword(word)
- char *word;
+ const char *word;
{
int j;
- char *q, *w;
+ const char *q, *w;
j = word[0] - 'a';
if (dictseek(dictfp, dictindex[j].start, SEEK_SET) < 0) {
@@ -534,7 +537,8 @@
void
checkdict()
{
- char *p, **pw, *w;
+ char *p, *w;
+ const char **pw;
int i;
int prevch, previndex, *pi, *qi, st;
@@ -612,12 +616,12 @@
*/
void
newgame(b)
- char *b;
+ const char *b;
{
int i, p, q;
- char *tmp;
+ const char *tmp;
int *lm[26];
- static char *cubes[16] = {
+ static const char *cubes[16] = {
"ednosw", "aaciot", "acelrs", "ehinps",
"eefhiy", "elpstu", "acdemp", "gilruw",
"egkluy", "ahmors", "abilty", "adenvz",
@@ -684,7 +688,7 @@
compar(p, q)
const void *p, *q;
{
- return (strcmp(*(char **)p, *(char **)q));
+ return (strcmp(*(const char *const *)p, *(const char *const *)q));
}
void
diff -r 2cceef9e92a0 -r daf0f61a3e5d games/boggle/boggle/extern.h
--- a/games/boggle/boggle/extern.h Wed Sep 08 20:43:48 1999 +0000
+++ b/games/boggle/boggle/extern.h Wed Sep 08 21:17:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.4 1998/09/13 15:27:26 hubertf Exp $ */
+/* $NetBSD: extern.h,v 1.5 1999/09/08 21:17:44 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -35,11 +35,11 @@
* @(#)extern.h 8.1 (Berkeley) 6/11/93
*/
-void addword __P((char *));
+void addword __P((const char *));
void badword __P((void));
char *batchword __P((FILE *));
void checkdict __P((void));
-int checkword __P((char *, int, int *));
+int checkword __P((const char *, int, int *));
void cleanup __P((void));
void delay __P((int));
long dictseek __P((FILE *, long, int));
@@ -50,24 +50,24 @@
int help __P((void));
int inputch __P((void));
int loaddict __P((FILE *));
-int loadindex __P((char *));
-void newgame __P((char *));
+int loadindex __P((const char *));
+void newgame __P((const char *));
char *nextword __P((FILE *));
-FILE *opendict __P((char *));
+FILE *opendict __P((const char *));
void playgame __P((void));
-void prompt __P((char *));
-void prtable __P((char *[],
- int, int, int, void (*)(char *[], int), int (*)(char *[], int)));
-void putstr __P((char *));
+void prompt __P((const char *));
+void prtable __P((const char *const [],
+ int, int, int, void (*)(const char *const [], int), int (*)(const char *const [], int)));
+void putstr __P((const char *));
void redraw __P((void));
void results __P((void));
int setup __P((int, time_t));
-void showboard __P((char *));
-void showstr __P((char *, int));
+void showboard __P((const char *));
+void showstr __P((const char *, int));
void showword __P((int));
void starttime __P((void));
void startwords __P((void));
void stoptime __P((void));
int timerch __P((void));
void usage __P((void)) __attribute__((__noreturn__));
-int validword __P((char *));
+int validword __P((const char *));
diff -r 2cceef9e92a0 -r daf0f61a3e5d games/boggle/boggle/mach.c
--- a/games/boggle/boggle/mach.c Wed Sep 08 20:43:48 1999 +0000
+++ b/games/boggle/boggle/mach.c Wed Sep 08 21:17:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mach.c,v 1.8 1997/10/13 21:09:59 cjs Exp $ */
+/* $NetBSD: mach.c,v 1.9 1999/09/08 21:17:44 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93";
#else
-__RCSID("$NetBSD: mach.c,v 1.8 1997/10/13 21:09:59 cjs Exp $");
+__RCSID("$NetBSD: mach.c,v 1.9 1999/09/08 21:17:44 jsm Exp $");
#endif
#endif /* not lint */
@@ -70,16 +70,16 @@
static int lastline;
int ncols, nlines;
-extern char *pword[], *mword[];
+extern const char *pword[], *mword[];
extern int ngames, nmwords, npwords, tnmwords, tnpwords;
static void cont_catcher __P((int));
-static int prwidth __P((char *[], int));
-static void prword __P((char *[], int));
+static int prwidth __P((const char *const [], int));
+static void prword __P((const char *const [], int));
static void stop_catcher __P((int));
static void tty_cleanup __P((void));
static int tty_setup __P((void));
-static void tty_showboard __P((char *));
+static void tty_showboard __P((const char *));
static void winch_catcher __P((int));
/*
@@ -150,7 +150,7 @@
static void
prword(base, indx)
- char *base[];
+ const char *const base[];
int indx;
{
printw("%s", base[indx]);
@@ -158,7 +158,7 @@
static int
prwidth(base, indx)
- char *base[];
+ const char *const base[];
int indx;
{
return (strlen(base[indx]));
@@ -339,7 +339,7 @@
*/
void
addword(w)
- char *w;
+ const char *w;
{
int n;
@@ -410,7 +410,6 @@
char buf[MAXWORDLEN + 1];
extern char board[];
extern int usedbits, wordpath[];
- extern char *mword[], *pword[];
extern int nmwords, npwords;
getyx(stdscr, r, c);
@@ -480,7 +479,7 @@
*/
void
showstr(str, delaysecs)
- char *str;
+ const char *str;
int delaysecs;
{
addstr(str);
@@ -493,7 +492,7 @@
void
putstr(s)
- char *s;
+ const char *s;
{
addstr(s);
}
@@ -561,14 +560,14 @@
void
showboard(b)
- char *b;
+ const char *b;
{
tty_showboard(b);
}
void
prompt(mesg)
- char *mesg;
+ const char *mesg;
{
move(PROMPT_LINE, PROMPT_COL);
printw("%s", mesg);
@@ -660,7 +659,7 @@
static void
tty_showboard(b)
- char *b;
+ const char *b;
{
int i;
int line;
diff -r 2cceef9e92a0 -r daf0f61a3e5d games/boggle/boggle/prtable.c
--- a/games/boggle/boggle/prtable.c Wed Sep 08 20:43:48 1999 +0000
+++ b/games/boggle/boggle/prtable.c Wed Sep 08 21:17:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $ */
+/* $NetBSD: prtable.c,v 1.5 1999/09/08 21:17:45 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $");
+__RCSID("$NetBSD: prtable.c,v 1.5 1999/09/08 21:17:45 jsm Exp $");
#endif /* not lint */
#include <curses.h>
@@ -49,7 +49,7 @@
#define NCOLS 5
-static int get_maxlen __P((char *[], int, int (*)(char **, int)));
+static int get_maxlen __P((const char *const [], int, int (*)(const char *const *, int)));
/*
* Routine to print a table
@@ -68,10 +68,10 @@
*/
Home |
Main Index |
Thread Index |
Old Index