|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 40696 (0x9ef8) Types: TextFile Names: »patches01«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Scrabble/patches01«
*** /dev/null Wed Jul 12 10:00:03 1989 --- README2 Wed Jul 12 10:03:52 1989 *************** *** 0 **** --- 1,19 ---- + I took the original scrabble posting and the two sets of patches + that were posted to the net (diffs for MSDOS and diffs for non-ANSI + C compiler) and merged them into a common set of sources. The + Makefiles are set up to define things for the specific environment. + + In the Makefile and Makefile.gcc, comment out the -DBSD define if + you are on System V. I haven't tried this on a System V machine, + so I don't what else is required over what has already been done. + + Thanks to: + Erik Talvola <talvola@pasteur.Berkeley.EDU> + for the MSDOS patches + Scott Boyd <scott@futures.UUCP> + for the patches for non-ANSI C compilers + -------------------------- + + -Bill Randle + billr@saab.CNA.TEK.COM + July 12, 1989 *** /dev/null Wed Jul 12 09:45:01 1989 --- README.PC Wed Jul 12 07:15:41 1989 *************** *** 0 **** --- 1,58 ---- + FILES: + + README.PC This file + Makefile.tcc A make file for Turbo-C and Opus Make + + patch1 A file for patch(1) to patch various files in + the distribution Scrabble. + + util.c Replacement for original util.c + + + + This is an initial attempt to get Wayne Christopher's Scrabble program + running under MS-DOS. I initially attempted to use Microsoft C v5.1, but + soon ran into some strange bugs, which prompted me to switch over to Turbo-C. + After a little while, I was able to get the whole thing compiled and running + fine. + + To compile, you will need Turbo-C, and Bjorn Larsson's PC-Curses package. + Bjorn's address is: + + ...mcvax!enea!infovax!bl + + from the notes in the PC-Curses source files. I used version v1.3 of the + code - earlier (or later) versions may also work. + + I have included a Makefile which seems to work fairly well. I cheated in + creating the compilation command for scrabble.exe though - I use *.obj in + the command line, which will bomb if, for example, plural.obj is lying + around. Before you do a make, just delete any spurious obj's like this. + I used OpusMake from Opus Software, an excellent program - other make programs + may or may not work. + + Note that refresh.c from the original distribution is not needed on the + PC. All the diff files should be applied to the original distributed + sources. There is a new util.c file needed for MS-DOS, as the diffs to + the original Unix file were larger than the file itself. + + The only problem so far is that I can only get the program to read in a + dictionary of about 88K or so, which may be sufficient, but I don't have a + good dictionary for DOS. In testing, I just skipped about 3 out of every 4 + words from the one I played with on Unix, and it loaded, but a lot of good + words were obviously deleted by using this random deletion. Also, the Unix + dictionary has things like roman numerals, words such as "qs" (more than one + q), which aren't good Scrabble words. If anyone gets a good DOS dictionary, + tell me. Also, if you can up the limit that the program can read in, please + let me know as well. I don't have much experience with far pointers, and may + have used them incorrectly. + + Anyway, I hope people can get some use out of this program. It seems pretty + robust, and plays a decent game of Scrabble (even with the mutant wordlist). + Please let me know if anyone makes any improvements to the MS-DOS port. + + + Erik Talvola + + talvola@cory.berkeley.edu + ...!ucbvax!cory!talvola *** orig/Makefile.orig Sat Apr 1 09:32:37 1989 --- Makefile Wed Jul 12 09:26:05 1989 *************** *** 15,21 **** #---- Tool specific stuff ---- ! DICT_DEF = -DDICT_FILE=\"dictionary\" PROGRAM = scrabble --- 15,22 ---- #---- Tool specific stuff ---- ! DICT_DEF = -DDICT_FILE=\"/usr/dict/words\" ! SYS_DEF = -DUNIX -DBSD PROGRAM = scrabble *************** *** 61,67 **** SPEC_INCLUDE = -I. -I../include ! SPEC_DEFINES = $(DICT_DEF) MAN_SECTION = 1 --- 62,68 ---- SPEC_INCLUDE = -I. -I../include ! SPEC_DEFINES = $(DICT_DEF) $(SYS_DEF) MAN_SECTION = 1 *************** *** 69,75 **** MISC = ! CC = gcc -W -fwritable-strings OPT_LIBS = $(SPEC_OPT_LIBS) --- 70,76 ---- MISC = ! #CC = gcc -W -fwritable-strings OPT_LIBS = $(SPEC_OPT_LIBS) *************** *** 77,93 **** PROF_LIBS = $(SPEC_PROF_LIBS) ! OPT_LDFLAGS = -lcurses -ltermlib -lX -lm -O ! DEBUG_LDFLAGS = -lcurses -ltermlib -lX -lm -g ! PROF_LDFLAGS = -lcurses -ltermlib -lX_p -lm_p -pg MAN_PAGE = $(PROGRAM).$(MAN_SECTION) #---- State ---- ! CFLAGS=-O -g LIBS=$(OPT_LIBS) LDFLAGS=$(OPT_LDFLAGS) --- 78,97 ---- PROF_LIBS = $(SPEC_PROF_LIBS) ! #OPT_LDFLAGS = -O -lcurses -ltermlib -lX -lm ! OPT_LDFLAGS = -O -lcurses -ltermlib -lm ! DEBUG_LDFLAGS = -g -lcurses -ltermlib -lX -lm ! PROF_LDFLAGS = -pg -lcurses -ltermlib -lX_p -lm_p + MAN_PAGE = $(PROGRAM).$(MAN_SECTION) #---- State ---- ! #CFLAGS=-O -g ! CFLAGS=-g LIBS=$(OPT_LIBS) LDFLAGS=$(OPT_LDFLAGS) *** orig/board.c.orig Sat Apr 1 09:32:39 1989 --- board.c Wed Jul 12 07:16:29 1989 *************** *** 8,13 **** --- 8,17 ---- * */ + #ifdef MSDOS + typedef char bool; + #include <stdlib.h> + #endif #include "scrabble.h" static char *bonus_map[] = { *************** *** 63,69 **** --- 67,77 ---- } for (i = POOL_SIZE - 1; i >= 0; i--) { + #ifdef MSDOS + j = rand() % (i + 1); + #else j = random() % (i + 1); + #endif for (k = 0; j >= 0; j -= distrib[k++]) ; k--; *************** *** 80,87 **** --- 88,102 ---- return (board); } + #ifdef _STDC_ void boardmove(board_t *board, move_t *move) + #else + void + boardmove(board, move) + board_t *board; + move_t *move; + #endif { int i; *************** *** 101,108 **** --- 116,129 ---- return; } + #ifdef _STDC_ char pickletter(board_t *board) + #else + char + pickletter(board) + board_t *board; + #endif { if (board->numleft) return (board->pool[--board->numleft]); *************** *** 115,122 **** --- 136,150 ---- static char lbchar[] = " `\"(<"; static char rbchar[] = " '\")>"; + #ifdef _STDC_ void printboard(board_t *board, FILE *fp) + #else + void + printboard(board,fp) + board_t *board; + FILE *fp; + #endif { int i, j; char c; *** orig/date.h.orig Thu Apr 6 12:36:52 1989 --- date.h Wed Jul 12 09:26:10 1989 *************** *** 1,3 **** ! #define DATE "Thu Apr 6 12:36:51 PDT 1989" #define HOST "saab" #define USER "billr" --- 1,3 ---- ! #define DATE "Wed Jul 12 09:26:09 PDT 1989" #define HOST "saab" #define USER "billr" *** orig/dict.c.orig Sat Apr 1 09:32:39 1989 --- dict.c Wed Jul 12 07:23:53 1989 *************** *** 8,23 **** --- 8,41 ---- * */ + #ifdef MSDOS + typedef char bool; + #endif #include "scrabble.h" + #ifdef _STDC_ static int dicthash(char *word, int tabsize); static void getem(word_t **wordp, char *lbuf, int place, char *opt, int numopt, int len); + #else + static int dicthash(); + static void getem(); + #endif + #ifdef MSDOS + static dict_t far *dictionary; + #else static dict_t *dictionary; + #endif + #ifdef _STDC_ void readdict(char *file) + #else + void + readdict(file) + char *file; + #endif { FILE *fp; char buf[BSIZE], *e; *************** *** 31,37 **** --- 49,59 ---- fprintf(stderr, "Reading \"%s\" ", file); fflush(stderr); + #ifdef MSDOS + dictionary = (dict_t far *) util_farmalloc(sizeof (dict_t)); + #else dictionary = (dict_t *) util_malloc(sizeof (dict_t)); + #endif for (i = 0; i < MAX_LENGTH; i++) for (j = 0; j < HASH_SIZE; j++) dictionary->buckets[i][j] = NULL; *************** *** 88,95 **** --- 110,123 ---- return; } + #ifdef _STDC_ void writedict(char *file) + #else + void + writedict(file) + char *file; + #endif { int i, j, k = 0; word_t *word; *************** *** 117,124 **** --- 145,158 ---- return; } + #ifdef _STDC_ void addword(char *word) + #else + void + addword(word) + char *word; + #endif { int key = dicthash(word, HASH_SIZE); int len = strlen(word); *************** *** 144,151 **** --- 178,191 ---- return; } + #ifdef _STDC_ void remword(char *word) + #else + void + remword(word) + char *word; + #endif { int key = dicthash(word, HASH_SIZE); int len = strlen(word); *************** *** 169,176 **** --- 209,222 ---- return; } + #ifdef _STDC_ bool isaword(char *poss) + #else + bool + isaword(poss) + char *poss; + #endif { word_t *word; int len = strlen(poss); *************** *** 192,199 **** --- 238,255 ---- * up the length. */ + #ifdef _STDC_ word_t * getpossibles(char *opt, int numopt, char *req, int numreq, int len) + #else + word_t * + getpossibles(opt, numopt, req, numreq, len) + char *opt; + int numopt; + char *req; + int numreq; + int len; + #endif { char lbuf[SIZE]; int i; *************** *** 232,239 **** --- 288,306 ---- return (word); } + #ifdef _STDC_ static void getem(word_t **wordp, char *lbuf, int place, char *opt, int numopt, int len) + #else + static void + getem(wordp, lbuf, place, opt, numopt, len) + word_t **wordp; + char *lbuf; + int place; + char *opt; + int numopt; + int len; + #endif { int key; word_t *set, *ww; *************** *** 277,284 **** --- 344,358 ---- /* A return value of -1 denotes that this is a bad word. */ + #ifdef _STDC_ static int dicthash(char *word, int tabsize) + #else + static int + dicthash(word, tabsize) + char *word; + int tabsize; + #endif { int i; unsigned long result = 0; *** orig/move.c.orig Sat Apr 1 09:32:40 1989 --- move.c Wed Jul 12 07:16:31 1989 *************** *** 8,15 **** --- 8,19 ---- * */ + #ifdef MSDOS + typedef char bool; + #endif #include "scrabble.h" + #ifdef _STDC_ static void dopos(board_t *board, player_t *player, int x, int y, bool horiz, move_t *best); static int wordpoints(board_t *board, int x, int y, bool horiz, int len, *************** *** 18,26 **** --- 22,44 ---- static bool validword(board_t *board, int x, int y, int len, char subc, bool horiz, bool machine, bool check); static bool validlocation(board_t *board, int x, int y, bool horiz, int len); + #else + static void dopos(); + static int wordpoints(); + static bool validword(); + static bool validlocation(); + #endif + #ifdef _STDC_ void bestmove(board_t *board, player_t *player, move_t *best) + #else + void + bestmove(board, player, best) + board_t *board; + player_t *player; + move_t *best; + #endif { int x, y; move_t try; *************** *** 42,49 **** --- 60,75 ---- #ifdef notdef + #ifdef sun386 void printmove(int which, move_t *move, FILE *fp) + #else + void + printmove(which, move, fp) + int which; + move_t *move; + FILE *fp; + #endif { fprintf(fp, "Player %d: \"%s\", %s at (%d, %d) for %d points.\n", which, move->word, move->horiz ? "horiz" : "vert", *************** *** 54,61 **** --- 80,98 ---- #endif + #ifdef _STDC_ static void dopos(board_t *board, player_t *player, int x, int y, bool horiz, move_t *best) + #else + static void + dopos(board, player, x, y, horiz, best) + board_t *board; + player_t *player; + int x; + int y; + bool horiz; + move_t *best; + #endif { char opt[SIZE]; char req[SIZE]; *************** *** 132,139 **** --- 169,186 ---- return; } + #ifdef _STDC_ static bool validlocation(board_t *board, int x, int y, bool horiz, int len) + #else + static bool + validlocation(board, x, y, horiz, len) + board_t *board; + int x; + int y; + bool horiz; + int len; + #endif { int i; *************** *** 171,178 **** --- 218,234 ---- * be invalid. */ + #ifdef _STDC_ void trymove(move_t *move, board_t *board, player_t *player, bool check) + #else + void + trymove(move, board, player, check) + move_t *move; + board_t *board; + player_t *player; + bool check; + #endif { bool used[WORK_SIZE]; int numused = 0; *************** *** 319,327 **** --- 375,396 ---- return; } + #ifdef _STDC_ static bool validword(board_t *board, int x, int y, int len, char subc, bool horiz, bool machine, bool check) + #else + static bool + validword(board, x, y, len, subc, horiz, machine, check) + board_t *board; + int x; + int y; + int len; + char subc; + bool horiz; + bool machine; + bool check; + #endif { char buf[BSIZE], qbuf[BSIZE], c; int i; *************** *** 364,372 **** --- 433,453 ---- } } + #ifdef _STDC_ static int wordpoints(board_t *board, int x, int y, bool horiz, int len, char *word, char subc, int wx, int wy, bool allbonuses, bool *wilds) + #else + static int + wordpoints(board, x, y, horiz, len, word, subc, wx, wy, allbonuses, wilds) + board_t *board; + int x,y; + bool horiz; + int len; + char *word, subc; + int wx,wy; + bool allbonuses, *wilds; + #endif { int value = 0; int mult = 1; *** orig/player.c.orig Sat Apr 1 09:32:41 1989 --- player.c Wed Jul 12 07:16:31 1989 *************** *** 8,17 **** --- 8,27 ---- * */ + #ifdef MSDOS + typedef char bool; + #endif #include "scrabble.h" + #ifdef _STDC_ player_t * makeplayer(board_t *board, int num) + #else + player_t * + makeplayer(board, num) + board_t *board; + int num; + #endif { player_t *player = (player_t *) util_malloc(sizeof (player_t)); int i; *************** *** 51,58 **** --- 61,76 ---- /* Note that this must be called before boardmove. */ + #ifdef _STDC_ void playermove(board_t *board, player_t *player, move_t *move) + #else + void + playermove(board, player, move) + board_t *board; + player_t *player; + move_t *move; + #endif { int i, j, k; char c; *************** *** 121,128 **** --- 139,154 ---- #ifdef notdef + #ifdef _STDC_ void printplayer(player_t *player, int num, FILE *fp) + #else + void + printplayer(player, num, fp) + player_t *player; + int num; + FILE *fp; + #endif { int i; *** orig/plural.c.orig Sat Apr 1 09:32:41 1989 --- plural.c Wed Jul 12 07:16:32 1989 *************** *** 26,33 **** --- 26,39 ---- { "", "s" } } ; + #ifdef _STDC_ void pluralize(char *word) + #else + void + pluralize(word) + char *word; + #endif { int i, wl, sl; char *s, *t; *** orig/savegame.c.orig Sat Apr 1 09:32:42 1989 --- savegame.c Wed Jul 12 07:16:32 1989 *************** *** 8,35 **** --- 8,68 ---- * */ + #ifdef MSDOS + typedef char bool; + #endif #include "scrabble.h" + #ifdef _STDC_ board_t * restoregame(FILE *fp, int *nump, int *whosup, int *turn) + #else + board_t * + restoregame(fp, nump, whosup, turn) + FILE *fp; + int *nump; + int *whosup; + int *turn; + #endif { return (NULL); } + #ifdef _STDC_ player_t * restoreplayer(FILE *fp) + #else + player_t * + restoreplayer(fp) + FILE *fp; + #endif { return (NULL); } + #ifdef _STDC_ void savegame(FILE *fp, int nump, int whosup, int turn) + #else + void + savegame(fp, nump, whosup, turn) + FILE *fp; + int nump; + int whosup; + int turn; + #endif { return; } + #ifdef _STDC_ void saveplayer(FILE *fp) + #else + void + saveplayer(fp) + FILE *fp; + #endif { return; } *** orig/scrabble.c.orig Sat Apr 1 09:32:43 1989 --- scrabble.c Wed Jul 12 07:22:12 1989 *************** *** 8,13 **** --- 8,17 ---- * */ + #ifdef MSDOS + typedef char bool; + #include <stdlib.h> + #endif #include "scrabble.h" #include "date.h" #include <signal.h> *************** *** 16,28 **** --- 20,47 ---- bool userpick = false; bool confirm = false; + #ifdef _STDC_ static bool domove(board_t *board, player_t **players, int which); + #else + static bool domove(); + #endif static void sighandler(); + #ifdef MSDOS + static char *dictfile = "dictionary"; + #else static char *dictfile = DICT_FILE; + #endif + #ifdef _STDC_ int main(int ac, char **av) + #else + int + main(ac, av) + int ac; + char **av; + #endif { board_t *board; player_t *players[MAX_PLAYERS]; *************** *** 40,46 **** --- 59,69 ---- printf("Compiled %s by %s@%s\n\n", DATE, USER, HOST); */ + #ifdef MSDOS + srand((unsigned int) time(0)); + #else srandom(time(0)); + #endif for (i = 0; i < MAX_PLAYERS; i++) machine[i] = false; *************** *** 115,121 **** --- 138,146 ---- user_init(DEV_TTY, board, players, numplayers); + #ifndef MSDOS signal(SIGINT, sighandler); + #endif /* Now take turns. */ for (;;) { *************** *** 179,186 **** --- 204,219 ---- exit(1); } + #ifdef _STDC_ static bool domove(board_t *board, player_t **players, int which) + #else + static bool + domove(board, players, which) + board_t *board; + player_t **players; + int which; + #endif { move_t move; char buf[BSIZE]; *** orig/scrabble.h.orig Sat Apr 1 09:32:38 1989 --- scrabble.h Wed Jul 12 07:16:36 1989 *************** *** 25,31 **** --- 25,35 ---- #define DICT_FILE "/usr/dict/words" #endif + #ifdef MSDOS + #define HASH_SIZE 1003 + #else #define HASH_SIZE 5003 + #endif #define MAX_LENGTH 15 #define WILD '*' #define ZIP ' ' *************** *** 120,126 **** --- 124,134 ---- /* scrabble.c */ + #ifdef _STDC_ extern int main(int ac, char **av); + #else + extern int main(); + #endif extern dict_t *dictionaries; extern bool debug; extern bool userpick; *************** *** 128,135 **** --- 136,148 ---- /* board.c */ extern board_t *makeboard(); + #ifdef _STDC_ extern void boardmove(board_t *board, move_t *move); extern char pickletter(board_t *board); + #else + extern void boardmove(); + extern char pickletter(); + #endif extern int letterpoint_values[]; /* extern void printboard(board_t *board, FILE *fp); */ *************** *** 136,148 **** --- 149,167 ---- /* move.c */ + #ifdef _STDC_ extern void bestmove(board_t *board, player_t *player, move_t *best); extern void trymove(move_t *move, board_t *board, player_t *player, bool check); + #else + extern void bestmove(); + extern void trymove(); + #endif /* extern void printmove(int which, move_t *move, FILE *fp); */ /* dict.c */ + #ifdef _STDC_ extern void readdict(char *file); extern word_t *getpossibles(char *req, int numreq, char *opt, int numopt, int len); *************** *** 150,172 **** --- 169,212 ---- extern void addword(char *word); extern void remword(char *word); extern void writedict(char *file); + #else + extern void readdict(); + extern word_t *getpossibles(); + extern bool isaword(); + extern void addword(); + extern void remword(); + extern void writedict(); + #endif /* player.c */ + #ifdef _STDC_ extern player_t *makeplayer(board_t *board, int num); extern void playermove(board_t *board, player_t *player, move_t *move); + #else + extern player_t *makeplayer(); + extern void playermove(); + #endif /* extern void printplayer(player_t *player, int num, FILE *fp); */ /* savegame.c */ + #ifdef _STDC_ extern board_t *restoregame(FILE *fp, int *nump, int *whosup, int *turn); extern player_t *restoreplayer(FILE *fp); extern void savegame(FILE *fp, int nump, int whosup, int turn); extern void saveplayer(FILE *fp); + #else + extern board_t *restoregame(); + extern player_t *restoreplayer(); + extern void savegame(); + extern void saveplayer(); + #endif /* user.c */ + #ifdef _STDC_ extern void user_init(devtype_t type, board_t *board, player_t *players[], int numplayers); extern void user_message(char *message); *************** *** 176,181 **** --- 216,231 ---- extern void user_drawplayer(player_t *player, int pos, bool up); extern void user_drawsummary(board_t *board, int turn); extern void user_drawmove(board_t *board, move_t *move, player_t *player); + #else + extern void user_init(); + extern void user_message(); + extern char *user_question(); + extern bool user_confirm(); + extern command_t user_command(); + extern void user_drawplayer(); + extern void user_drawsummary(); + extern void user_drawmove(); + #endif extern void user_givehelp(); extern void user_update(); extern void user_cleanup(); *************** *** 184,189 **** --- 234,240 ---- /* tty.c */ + #ifdef _STDC_ extern void tty_init(board_t *board, player_t *players[], int numplayers); extern void tty_message(char *message); extern char *tty_question(char *message); *************** *** 192,197 **** --- 243,258 ---- extern void tty_drawplayer(player_t *player, int pos, bool up); extern void tty_drawsummary(board_t *board, int turn); extern void tty_drawmove(board_t *board, move_t *mv, player_t *player); + #else + extern void tty_init(); + extern void tty_message(); + extern char *tty_question(); + extern bool tty_confirm(); + extern command_t tty_command(); + extern void tty_drawplayer(); + extern void tty_drawsummary(); + extern void tty_drawmove(); + #endif extern void tty_givehelp(); extern void tty_update(); extern void tty_cleanup(); *** orig/tty.c.orig Sat Apr 1 09:32:44 1989 --- tty.c Wed Jul 12 07:25:45 1989 *************** *** 8,16 **** --- 8,21 ---- * */ + #ifdef MSDOS + #include <curses.h> #include "scrabble.h" + #else + #include "scrabble.h" #include <curses.h> #undef bool + #endif static WINDOW *boardwin, *scores, *summary, *dialog; #ifdef notdef *************** *** 50,57 **** --- 55,70 ---- " ? : Print this help message. " } ; + #ifdef _STDC_ void tty_init(board_t *board, player_t *players[], int numplayers) + #else + void + tty_init(board, players, numplayers) + board_t *board; + player_t *players[]; + int numplayers; + #endif { int i, j; int x, y; *************** *** 93,103 **** for (j = 0; j < 15; j++) { bpos(x, y, i, j); wmove(boardwin, y, x - 1); ! waddch(boardwin, lbchar[board->bonus[j][i]]); wmove(boardwin, y, x); waddch(boardwin, '.'); wmove(boardwin, y, x + 1); ! waddch(boardwin, rbchar[board->bonus[j][i]]); } /* Draw the scores display... */ --- 106,116 ---- for (j = 0; j < 15; j++) { bpos(x, y, i, j); wmove(boardwin, y, x - 1); ! waddch(boardwin, lbchar[(int)board->bonus[j][i]]); wmove(boardwin, y, x); waddch(boardwin, '.'); wmove(boardwin, y, x + 1); ! waddch(boardwin, rbchar[(int)board->bonus[j][i]]); } /* Draw the scores display... */ *************** *** 121,137 **** return; } void tty_message(char *message) { /* Print the message and clear the line below it. */ messline = (messline + 1) % MESS_SIZE; if (messline < MESS_SIZE - 1) { wmove(dialog, messline + 1, 0); ! wclrtoeol(dialog); } wmove(dialog, messline, 0); ! wclrtoeol(dialog); wprintw(dialog, "%s", message); wrefresh(dialog); --- 134,156 ---- return; } + #ifdef _STDC_ void tty_message(char *message) + #else + void + tty_message(message) + char *message; + #endif { /* Print the message and clear the line below it. */ messline = (messline + 1) % MESS_SIZE; if (messline < MESS_SIZE - 1) { wmove(dialog, messline + 1, 0); ! wclrtoeol(dialog); } wmove(dialog, messline, 0); ! wclrtoeol(dialog); wprintw(dialog, "%s", message); wrefresh(dialog); *************** *** 139,146 **** --- 158,171 ---- return; } + #ifdef _STDC_ char * tty_question(char *message) + #else + char * + tty_question(message) + char *message; + #endif { static char buf[BSIZE]; *************** *** 156,163 **** --- 181,194 ---- return (buf); } + #ifdef _STDC_ bool tty_confirm(char *message) + #else + bool + tty_confirm(message) + char *message; + #endif { char c; *************** *** 176,183 **** --- 207,222 ---- * a word. Other commands are 'T', 'S', 'R', 'Q', and '?'. */ + #ifdef _STDC_ command_t tty_command(board_t *board, player_t *player, move_t *mv) + #else + command_t + tty_command(board, player, mv) + board_t *board; + player_t *player; + move_t *mv; + #endif { int x = 7, y = 7; int px, py; *************** *** 300,307 **** --- 339,354 ---- return (MOVE); } + #ifdef _STDC_ void tty_drawplayer(player_t *player, int pos, bool up) + #else + void + tty_drawplayer(player, pos, up) + player_t *player; + int pos; + bool up; + #endif { int i; *************** *** 310,316 **** player->score); for (i = 0; i < player->numworking; i++) wprintw(scores, " %c", player->working[i]); ! wclrtoeol(scores); wmove(scores, pos + 5, 0); wrefresh(scores); --- 357,363 ---- player->score); for (i = 0; i < player->numworking; i++) wprintw(scores, " %c", player->working[i]); ! wclrtoeol(scores); wmove(scores, pos + 5, 0); wrefresh(scores); *************** *** 317,324 **** --- 364,378 ---- return; } + #ifdef _STDC_ void tty_drawsummary(board_t *board, int turn) + #else + void + tty_drawsummary(board, turn) + board_t *board; + int turn; + #endif { wmove(summary, 0, 0); wprintw(summary, " Game turn: %d ", turn); *************** *** 329,336 **** --- 383,398 ---- return; } + #ifdef _STDC_ void tty_drawmove(board_t *board, move_t *mv, player_t *player) + #else + void + tty_drawmove(board, mv, player) + board_t *board; + move_t *mv; + player_t *player; + #endif { int i, x, y; char c; *** orig/user.c.orig Sat Apr 1 09:32:44 1989 --- user.c Wed Jul 12 07:16:34 1989 *************** *** 10,18 **** --- 10,22 ---- * added to this file. */ + #ifdef MSDOS + typedef char bool; + #endif #include "scrabble.h" struct device { + #ifdef _STDC_ void (*init)(board_t *board, player_t *players[], int numplayers); void (*message)(char *message); char *(*question)(char *message); *************** *** 21,26 **** --- 25,40 ---- void (*drawplayer)(player_t *player, int pos, bool up); void (*drawsummary)(board_t *board, int turn); void (*drawmove)(board_t *board, move_t *move, player_t *player); + #else + void (*init)(); + void (*message)(); + char *(*question)(); + bool (*confirm)(); + command_t (*command)(); + void (*drawplayer)(); + void (*drawsummary)(); + void (*drawmove)(); + #endif void (*givehelp)(); void (*update)(); void (*cleanup)(); *************** *** 42,49 **** --- 56,72 ---- static struct device *dev; + #ifdef _STDC_ void user_init(devtype_t type, board_t *board, player_t *players[], int numplayers) + #else + void + user_init(type, board, players, numplayers) + devtype_t type; + board_t *board; + player_t *players[]; + int numplayers; + #endif { switch (type) { case DEV_TTY: dev = &tty_device; break; *************** *** 54,100 **** --- 77,172 ---- return; } + #ifdef _STDC_ void user_message(char *message) + #else + void + user_message(message) + char *message; + #endif { (dev->message)(message); return; } + #ifdef _STDC_ char * user_question(char *message) + #else + char * + user_question(message) + char *message; + #endif { return ((dev->question)(message)); } + #ifdef _STDC_ bool user_confirm(char *message) + #else + bool + user_confirm(message) + char *message; + #endif { return ((dev->confirm)(message)); } + #ifdef _STDC_ command_t user_command(board_t *board, player_t *player, move_t *move) + #else + command_t + user_command(board, player, move) + board_t *board; + player_t *player; + move_t *move; + #endif { return ((dev->command)(board, player, move)); } + #ifdef _STDC_ void user_drawplayer(player_t *player, int pos, bool up) + #else + void + user_drawplayer(player, pos, up) + player_t *player; + int pos; + bool up; + #endif { (dev->drawplayer)(player, pos, up); return; } + #ifdef _STDC_ void user_drawsummary(board_t *board, int turn) + #else + void + user_drawsummary(board, turn) + board_t *board; + int turn; + #endif { (dev->drawsummary)(board, turn); return; } + #ifdef _STDC_ void user_drawmove(board_t *board, move_t *move, player_t *player) + #else + void + user_drawmove(board, move, player) + board_t *board; + move_t *move; + player_t *player; + #endif { (dev->drawmove)(board, move, player); return; *************** *** 123,130 **** --- 195,210 ---- #ifdef notdef + #ifdef _STDC_ bool readmove(board_t *board, player_t *player, move_t *move) + #else + bool + readmove(board, player, move) + board_t *board; + player_t *player; + move_t *move; + #endif { char buf[BSIZE]; int x, y, i; *** orig/util.c.orig Sat Apr 1 09:32:45 1989 --- util.c Wed Jul 12 09:41:38 1989 *************** *** 9,22 **** --- 9,35 ---- */ #include "util.h" + #ifdef UNIX #include <pwd.h> #include <sys/types.h> + #ifdef BSD #include <sys/time.h> #include <sys/resource.h> + #else /* BSD */ + #include <time.h> + #endif /* BSD */ extern char *malloc(); extern char *realloc(); + #endif /* UNIX */ + #ifdef MSDOS + #include <string.h> + #include <stdlib.h> + #include <time.h> + #include <alloc.h> + #endif /* MSDOS */ + char * strsav(str) char *str; *************** *** 51,73 **** char * util_datestring() { - register char *tzn; struct tm *tp; static char tbuf[40]; char *ap; struct timeval tv; struct timezone tz; ! char *timezone(), *asctime(); ! int i; ! struct tm *localtime(); (void) gettimeofday(&tv, &tz); tp = localtime((time_t *) &tv.tv_sec); - ap = asctime(tp); tzn = timezone(tz.tz_minuteswest, tp->tm_isdst); sprintf(tbuf, "%.20s", ap); if (tzn) strcat(tbuf, tzn); strcat(tbuf, ap + 19); i = strlen(tbuf); tbuf[i - 1] = '\0'; --- 64,96 ---- char * util_datestring() { struct tm *tp; static char tbuf[40]; char *ap; + int i; + #ifdef BSD + register char *tzn; struct timeval tv; struct timezone tz; ! extern char *timezone(); /* missing from time.h */ ! #else ! time_t t; ! #endif + #ifdef BSD (void) gettimeofday(&tv, &tz); tp = localtime((time_t *) &tv.tv_sec); tzn = timezone(tz.tz_minuteswest, tp->tm_isdst); + #else + t = time((time_t *) NULL); + tp = localtime(&t); + #endif + ap = asctime(tp); sprintf(tbuf, "%.20s", ap); + #ifdef BSD if (tzn) strcat(tbuf, tzn); + #endif strcat(tbuf, ap + 19); i = strlen(tbuf); tbuf[i - 1] = '\0'; *************** *** 74,79 **** --- 97,103 ---- return (tbuf); } + #ifdef BSD int util_seconds() { *************** *** 82,88 **** --- 106,114 ---- getrusage(RUSAGE_SELF, &ruse); return (ruse.ru_utime.tv_sec); } + #endif + #ifdef UNIX char * util_tildexpand(s) char *s; *************** *** 111,116 **** --- 137,143 ---- strcat(n, s); return (n); } + #endif char * util_malloc(num) *************** *** 123,129 **** --- 150,160 ---- fprintf(stderr, "malloc: can't allocate %d bytes", num); exit(1); } + #ifdef BSD bzero(s, num); + #else + (void) memset(s, 0, num); + #endif return (s); } *************** *** 142,144 **** --- 173,194 ---- return (s); } + #ifdef MSDOS + char far * + util_farmalloc(num) + unsigned long num; + { + char far *s; + char far *t; + + s = (char far *) farmalloc(num); + if (!s) { + fprintf(stderr, "malloc: can't allocate %d bytes", num); + exit(1); + } + for (t = s; t < s + num; t++) { + *t = 0; + } + return (s); + } + #endif *** orig/util.h.orig Sat Apr 1 09:32:38 1989 --- util.h Wed Jul 12 07:38:55 1989 *************** *** 6,13 **** * Standard definitions. */ ! #define UNIX ! #define BSD /* vcc has problems with math.h */ --- 6,18 ---- * Standard definitions. */ ! /* ! * One or more of the following should be defined in the Makefile. ! * You can alternately define them here. ! */ ! /* #define UNIX */ ! /* #define MSDOS */ ! /* #define BSD */ /* vcc has problems with math.h */ *************** *** 40,46 **** --- 45,53 ---- abort();\ }} + #ifdef UNIX typedef int bool; + #endif #define false 0 #define true 1 *************** *** 71,79 **** --- 78,91 ---- extern char *strstr(); extern char *util_datestring(); extern char *util_malloc(); + #ifdef MSDOS + extern char far *util_farmalloc(); + #endif extern char *util_realloc(); extern int util_seconds(); + #ifdef UNIX extern char *util_tildexpand(); + #endif /* Externs from libc */ *************** *** 82,93 **** --- 94,109 ---- extern int errno; extern char *sys_errlist[]; extern double atof(); + #ifdef UNIX extern long random(); extern void srandom(); + #endif extern long time(); extern void exit(); extern void bcopy(); + #ifdef UNIX extern char *sbrk(); + #endif extern char *getlogin(); extern void free(); extern void perror(); *** /dev/null Wed Jul 12 09:45:01 1989 --- patchlevel.h Wed Jul 12 07:29:39 1989 *************** *** 0 **** --- 1 ---- + #define PATCHLEVEL 1 *** /dev/null Wed Jul 12 09:45:01 1989 --- Makefile.gcc Wed Jul 12 07:42:15 1989 *************** *** 0 **** --- 1,229 ---- + + # RCS Info: $Revision: 1.2 $ on $Date: 89/03/15 11:16:17 $ + # $Source: /yew3/faustus/src/scrabble/RCS/Makefile,v $ + # Copyright (c) 1987 Wayne A. Christopher, U. C. Berkeley CAD Group + # + # Program Makefile + # + # This makefile has the standard options "clean", "require", and "install". + # Also available are "lint", "depend", "tags", "opt", "debug", and "prof". + # "opt" causes the program to be compiled optimized, "debug" with -g, and + # "prof" with -pg. As an added bonus, the Makefile remembers the last of + # these options given. + + what: all + + #---- Tool specific stuff ---- + + DICT_DEF = -DDICT_FILE=\"/usr/dict/words\" + SYS_DEF = -DUNIX -DBSD + + PROGRAM = scrabble + + SRC = \ + board.c \ + dict.c \ + move.c \ + player.c \ + savegame.c \ + scrabble.c \ + tty.c \ + user.c \ + util.c refresh.c + + OBJ = \ + board.o \ + dict.o \ + move.o \ + player.o \ + savegame.o \ + scrabble.o \ + tty.o \ + user.o \ + util.o refresh.o + + HDR = \ + scrabble.h \ + util.h + + SUPPORT = plural + + SABER_HDR = scrabble.h + + REQUIRE = + + SPEC_OPT_LIBS = + + SPEC_DEBUG_LIBS = + + SPEC_PROF_LIBS = + + SPEC_LINT_LIBS = + + SPEC_INCLUDE = -I. -I../include + + SPEC_DEFINES = $(DICT_DEF) $(SYS_DEF) + + MAN_SECTION = 1 + + DOC = + + MISC = + + CC = gcc -W -fwritable-strings + + OPT_LIBS = $(SPEC_OPT_LIBS) + + DEBUG_LIBS = $(SPEC_DEBUG_LIBS) + + PROF_LIBS = $(SPEC_PROF_LIBS) + + #OPT_LDFLAGS = -lcurses -ltermlib -lX -lm -O + OPT_LDFLAGS = -lcurses -ltermlib -lm -O + + DEBUG_LDFLAGS = -lcurses -ltermlib -lX -lm -g + + PROF_LDFLAGS = -lcurses -ltermlib -lX_p -lm_p -pg + + MAN_PAGE = $(PROGRAM).$(MAN_SECTION) + + #---- State ---- + + #CFLAGS=-O -g + CFLAGS=-g + LIBS=$(OPT_LIBS) + LDFLAGS=$(OPT_LDFLAGS) + + #---- Generic stuff ---- + + # EXTDEFINES are things that come from a higher-level Makefile + + EXTDEFINES = + + DEFINES = $(EXT_DEFINES) $(SPEC_DEFINES) + + INCLUDE = $(SPEC_INCLUDE) + + LINT_LIBS = $(SPEC_LINT_LIB) + + LINT_FLAGS = -DLINT -u -z -lc + + .c.o: $*.c + $(CC) $(DEFINES) $(INCLUDE) $(CFLAGS) -c $*.c + + all: date.h $(PROGRAM) $(SUPPORT) .saberinit + @echo "All done." + + $(PROGRAM): $(OBJ) $(LIBS) + rm -f $(PROGRAM) + $(CC) -o $(PROGRAM) $(OBJ) $(LIBS) $(LDFLAGS) + + $(SUPPORT): $(SUPPORT).o + rm -f $(SUPPORT) + $(CC) -o $(SUPPORT) $(SUPPORT).o $(LIBS) $(LDFLAGS) + + date.h: /tmp + @echo \#define DATE \"`date`\" > date.h + @echo \#define HOST \"`hostname`\" >> date.h + @echo \#define USER \"`whoami`\" >> date.h + + #---- Stuff that changes our state ---- + + opt: + @-if egrep -s '^CFLAGS=-O' Makefile ; then \ + echo already -O ... ; \ + else echo converting from $(CFLAGS) to -O ; \ + sed -e 's/^CFLAGS=.*$$/CFLAGS=-O/' \ + -e 's/^LIBS=.*$$/LIBS=\$$\(OPT_LIBS\)/' \ + -e 's/^LDFLAGS=.*$$/LDFLAGS=\$$\(OPT_LDFLAGS\)/' \ + < Makefile > mktemp ; \ + mv mktemp Makefile ; \ + rm *.o ; \ + fi + @make $(MFLAGS) + + debug: + @-if egrep -s '^CFLAGS=-g' Makefile ; then \ + echo already -g ... ; \ + else echo converting from $(CFLAGS) to -g ; \ + sed -e 's/^CFLAGS=.*$$/CFLAGS=-g/' \ + -e 's/^LIBS=.*$$/LIBS=\$$\(DEBUG_LIBS\)/' \ + -e 's/^LDFLAGS=.*$$/LDFLAGS=\$$\(DEBUG_LDFLAGS\)/' \ + < Makefile > mktemp ; \ + mv mktemp Makefile ; \ + rm *.o ; \ + fi + @make $(MFLAGS) + + prof: + @-if egrep -s '^CFLAGS=-pg' Makefile ; then \ + echo already -pg -O ... ; \ + else echo converting from $(CFLAGS) to -pg -O ; \ + sed -e 's/^CFLAGS=.*$$/CFLAGS=-pg -O/' \ + -e 's/^LIBS=.*$$/LIBS=\$$\(PROF_LIBS\)/' \ + -e 's/^LDFLAGS=.*$$/LDFLAGS=\$$\(PROF_LDFLAGS\)/' \ + < Makefile > mktemp ; \ + mv mktemp Makefile ; \ + rm *.o ; \ + fi + @make $(MFLAGS) + + checkin: + ci $(SRC) $(HDR) $(MAN_PAGE) Makefile $(DOC) $(MISC) </dev/null + rcs -U $(SRC) $(HDR) $(MAN_PAGE) Makefile $(DOC) $(MISC) + + checkout: + co $(SRC) $(HDR) $(MAN_PAGE) $(DOC) $(MISC) </dev/null + + #---- Stuff for lint ---- + + lint: $(SRC) $(HDR) + lint $(LINT_FLAGS) $(DEFINES) $(INCLUDE) $(SRC) $(LINT_LIBS) + + #---- Stuff for "make install" ---- + + #install: $(INSTALLED) $(MAN_INSTALLED) + # + #$(INSTALLED): $(TARGET) + # cp $(TARGET) $(INSTALLED) + # strip $(TARGET) $(INSTALLED) + # + #$(MAN_INSTALLED): $(MAN_PAGE) + # cp $(MAN_PAGE) $(MAN_INSTALLED) + + #---- Misc junk ---- + + dist: + rdist -Rich $(SRC) $(SUPPSRC) $(HDR) $(MAN_PAGE) $(DOC) \ + $(MISC) Makefile $(DIST) + + print: + psgrind -2r -Plps $(HDR) $(SRC) $(SUPPSRC) + + require: + @echo $(REQUIRE) + + clean: + rm -f $(TARGET) $(SUPPORT) $(OBJ) $(SUPPOBJ) tags *.out foo tmp + + tags: $(SRC) $(HDR) $(SUPPSRC) + ctags -w -t $(SRC) $(HDR) $(SUPPSRC) > /dev/null 2>&1 + + depend: $(SRC) $(SUPPSRC) + cc -M $(DEFINES) $(INCLUDE) $(CFLAGS) $(SRC) $(SUPPSRC) > makedep + echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep + echo '$$r makedep' >>eddep + echo 'w' >>eddep + ed - Makefile < eddep + rm eddep makedep + echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile + echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile + echo '# see make depend above' >> Makefile + + .saberinit: Makefile + @echo load $(SRC) $(LIBS) $(LDFLAGS) > .saberinit + + #----------------------------------------------------------------- + # DO NOT DELETE THIS LINE -- make depend uses it + # DEPENDENCIES MUST END AT END OF FILE + *** /dev/null Wed Jul 12 09:45:01 1989 --- Makefile.tcc Wed Jul 12 07:15:42 1989 *************** *** 0 **** --- 1,72 ---- + + # RCS Info: $Revision: 1.2 $ on $Date: 89/03/15 11:16:17 $ + # $Source: /yew3/faustus/src/scrabble/RCS/Makefile,v $ + # Copyright (c) 1987 Wayne A. Christopher, U. C. Berkeley CAD Group + # + # Program Makefile + # + # This makefile has the standard options "clean", "require", and "install". + # Also available are "lint", "depend", "tags", "opt", "debug", and "prof". + # "opt" causes the program to be compiled optimized, "debug" with -g, and + # "prof" with -pg. As an added bonus, the Makefile remembers the last of + # these options given. + # + # Heavily mutated to work with OpusMake, Turbo-C v1.5 (at least), and + # Bjorn Larsson's (...mcvax!enea!infovax!bl) PC-Curses package. + # + # Erik Talvola + # talvola@cory.berkeley.edu + # ...!ucbvax!cory!talvola + + what: all + + #---- Tool specific stuff ---- + + PROGRAM = scrabble.exe + + SRC = \ + board.c \ + dict.c \ + move.c \ + player.c \ + savegame.c \ + scrabble.c \ + tty.c \ + user.c \ + util.c + + OBJ = board.obj dict.obj move.obj player.obj savegame.obj \ + scrabble.obj tty.obj user.obj util.obj + + HDR = \ + scrabble.h \ + util.h + + SUPPORT = plural + + CC = tcc + MODEL = c + CFLAGS = -m$(MODEL) -I\turboc\include -G -O -Z -DMSDOS + LIBDIR = \turboc\lib + + LIBS = $(LIBDIR)\$(MODEL)curses.lib + LDFLAGS = -L$(LIBDIR) -m$(MODEL) + + #---- Generic stuff ---- + + # EXTDEFINES are things that come from a higher-level Makefile + + all: date.h $(PROGRAM) $(SUPPORT).exe + @echo "All done." + + # the next rule isn't very good - before making scrabble.exe, delete + # plural.obj (and any others) if they exist. I didn't bother writing + # a file to give to LINK, and the command line is too long to handle all + # the obj's directly. + + $(PROGRAM): $(OBJ) + $(CC) -e$(PROGRAM) $(LDFLAGS) *.obj $(LIBS) + + $(SUPPORT).exe: $(SUPPORT).obj + $(CC) -e$(SUPPORT) $(LDFLAGS) $(SUPPORT).obj $(LIBS) +