Cleanups and memory leak fixes from James H.
[sgt/puzzles] / list.c
CommitLineData
19ef4855 1/*
2 * list.c: List of puzzles.
3 */
4
5#include "puzzles.h"
6
7/*
8 * The available games can be most easily enumerated by searching
9 * for the line in each game source file saying "#define thegame
10 * <gamename>". Hence, the following piece of shell/Perl should
11 * regenerate this list automatically:
12
13perl -ne '/^#define thegame (\S+)/ and $1 ne "nullgame" and print "extern const game $1;\n"' *.c
14echo -e '\nconst game *gamelist[] = {'
15perl -ne '/^#define thegame (\S+)/ and $1 ne "nullgame" and print " &$1,\n"' *.c
16echo -e '};\n\nconst int gamecount = lenof(gamelist);'
17
18 */
19
20extern const game cube;
6c04c334 21extern const game dominosa;
19ef4855 22extern const game fifteen;
f4afe206 23extern const game flip;
74476385 24extern const game guess;
7959b517 25extern const game mines;
19ef4855 26extern const game net;
27extern const game netslide;
28extern const game pattern;
32ee875d 29extern const game pegs;
19ef4855 30extern const game rect;
e839f206 31extern const game samegame;
19ef4855 32extern const game sixteen;
1d8e8ad8 33extern const game solo;
9038fd11 34extern const game twiddle;
9d6c3859 35extern const game untangle;
19ef4855 36
37const game *gamelist[] = {
38 &cube,
6c04c334 39 &dominosa,
19ef4855 40 &fifteen,
f4afe206 41 &flip,
74476385 42 &guess,
7959b517 43 &mines,
19ef4855 44 &net,
45 &netslide,
46 &pattern,
32ee875d 47 &pegs,
19ef4855 48 &rect,
e839f206 49 &samegame,
19ef4855 50 &sixteen,
1d8e8ad8 51 &solo,
9038fd11 52 &twiddle,
9d6c3859 53 &untangle,
19ef4855 54};
55
56const int gamecount = lenof(gamelist);