xref: /openbsd/games/hangman/hangman.h (revision 5122c280)
1 /*	$OpenBSD: hangman.h,v 1.11 2015/12/31 15:20:36 mestre Exp $	*/
2 /*	$NetBSD: hangman.h,v 1.5 1995/04/24 12:23:44 cgd Exp $	*/
3 
4 /*
5  * Copyright (c) 1983, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of the University nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  *	@(#)hangman.h	8.1 (Berkeley) 5/31/93
33  */
34 
35 #include <stdbool.h>
36 #include <stdio.h>
37 
38 #define	MAXBADWORDS	100
39 
40 #define	MINLEN	6
41 #define	MAXLEN	60
42 #define	MAXERRS	7
43 
44 #define	MESGY	12
45 #define	MESGX	0
46 #define	PROMPTY	11
47 #define	PROMPTX	0
48 #define	KNOWNY	10
49 #define	KNOWNX	1
50 #define	NUMBERY	4
51 #define	NUMBERX	(COLS - 11 - 26)
52 #define	AVGY	5
53 #define	AVGX	(COLS - 11 - 26)
54 #define	GUESSY	2
55 #define	GUESSX	(COLS - 11 - 26)
56 
57 
58 typedef struct {
59 	short	y, x;
60 	char	ch;
61 } ERR_POS;
62 
63 extern bool Guessed[];
64 
65 extern char Word[BUFSIZ], Known[BUFSIZ];
66 extern const char *const Noose_pict[];
67 
68 extern int Errors, Wordnum;
69 
70 extern double Average;
71 
72 extern const ERR_POS Err_pos[];
73 
74 extern const char *Dict_name;
75 
76 extern FILE *Dict;
77 
78 extern off_t Dict_size;
79 
80 extern int syms;
81 extern int symfd;
82 extern off_t symoffs, symsize;
83 
84 __dead void	die(int);
85 void	endgame(void);
86 void	getguess(void);
87 void	getword(void);
88 void	sym_getword(void);
89 int	sym_setup(void);
90 void	playgame(void);
91 void	prdata(void);
92 void	prman(void);
93 void	prword(void);
94 unsigned char	readch(void);
95 void	setup(void);
96