simon-git: puzzles (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Tue Nov 13 22:15:02 GMT 2018
TL;DR:
0f77798 Add a #include of <stdbool.h>.
a76d269 Adopt C99 bool in the game backend API.
cd6cadb Adopt C99 bool in the midend API.
f6965b9 Adopt C99 bool in the printing API.
20b5678 Adopt C99 bool in the edsf API.
8fb4cd0 Adopt C99 bool in the findloop API.
836a5c4 Adopt C99 bool in misc.c functions.
33b55db Adopt C99 bool in the tree234 API.
0891594 Adopt C99 bool in the shared Latin-square API.
064da87 Adopt C99 bool in the grid.c API.
a550ea0 Replace TRUE/FALSE with C99 true/false throughout.
5f5b284 Use C99 bool within source modules.
53798c0 Add a missing const in unfinished/sokoban.c.
cdc0563 Add missing binary 'matching' to .gitignore.
47cec54 Unruly, Group: reference-count the 'immutable' array.
db3b531 Add missing 'static' to game-internal declarations.
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2018-11-13 22:15:02
commit 0f77798ae24d2152c5393f01e55e0168c564ee0d
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=0f77798ae24d2152c5393f01e55e0168c564ee0d;hp=b732fda2cf611b6f67c68e3a26077897afe41741
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:31:32 2018 +0000
Add a #include of <stdbool.h>.
This is the first commit in a series which will adopt C99 bool
throughout the code base where it makes sense to do so.
puzzles.h | 1 +
1 file changed, 1 insertion(+)
commit a76d269cf222ba81e717c7e9046db391f19036eb
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=a76d269cf222ba81e717c7e9046db391f19036eb;hp=0f77798ae24d2152c5393f01e55e0168c564ee0d
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:34:42 2018 +0000
Adopt C99 bool in the game backend API.
encode_params, validate_params and new_desc now take a bool parameter;
fetch_preset, can_format_as_text_now and timing_state all return bool;
and the data fields is_timed, wants_statusbar and can_* are all bool.
All of those were previously typed as int, but semantically boolean.
This commit changes the API declarations in puzzles.h, updates all the
games to match (including the unfinisheds), and updates the developer
docs as well.
blackbox.c | 12 +++----
bridges.c | 12 +++----
cube.c | 12 +++----
devel.but | 88 +++++++++++++++++++++++++--------------------------
dominosa.c | 12 +++----
fifteen.c | 12 +++----
filling.c | 12 +++----
flip.c | 12 +++----
flood.c | 12 +++----
galaxies.c | 12 +++----
guess.c | 12 +++----
inertia.c | 12 +++----
keen.c | 12 +++----
lightup.c | 12 +++----
loopy.c | 10 +++---
magnets.c | 12 +++----
map.c | 12 +++----
mines.c | 12 +++----
net.c | 12 +++----
netslide.c | 12 +++----
nullgame.c | 12 +++----
palisade.c | 12 +++----
pattern.c | 12 +++----
pearl.c | 12 +++----
pegs.c | 12 +++----
puzzles.h | 24 +++++++-------
range.c | 12 +++----
rect.c | 12 +++----
samegame.c | 12 +++----
signpost.c | 12 +++----
singles.c | 12 +++----
sixteen.c | 12 +++----
slant.c | 12 +++----
solo.c | 12 +++----
tents.c | 12 +++----
towers.c | 12 +++----
tracks.c | 12 +++----
twiddle.c | 12 +++----
undead.c | 12 +++----
unequal.c | 12 +++----
unfinished/group.c | 12 +++----
unfinished/separate.c | 12 +++----
unfinished/slide.c | 12 +++----
unfinished/sokoban.c | 12 +++----
unruly.c | 12 +++----
untangle.c | 12 +++----
46 files changed, 319 insertions(+), 319 deletions(-)
commit cd6cadbecf245b2916350939343db14e2978f782
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=cd6cadbecf245b2916350939343db14e2978f782;hp=a76d269cf222ba81e717c7e9046db391f19036eb
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:37:09 2018 +0000
Adopt C99 bool in the midend API.
This changes parameters of midend_size and midend_print_puzzle, the
return types of midend_process_key, midend_wants_statusbar,
midend_can_format_as_text_now and midend_can_{undo,redo}, the 'bval'
field in struct config_item, and finally the return type of the
function pointer passed to midend_deserialise and identify_game.
The last of those changes requires a corresponding fix in clients of
midend_deserialise and identify_game, so in this commit I've also
updated all the in-tree front ends to match. I expect downstream front
ends will need to do the same when they merge this change.
devel.but | 40 ++++++++++++++++++++--------------------
emcc.c | 2 +-
gtk.c | 2 +-
midend.c | 32 ++++++++++++++++----------------
osx.m | 2 +-
puzzles.h | 21 ++++++++++-----------
windows.c | 2 +-
7 files changed, 50 insertions(+), 51 deletions(-)
commit f6965b92e1915c9f49fafbadf603b4fd0da735bd
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=f6965b92e1915c9f49fafbadf603b4fd0da735bd;hp=cd6cadbecf245b2916350939343db14e2978f782
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:38:53 2018 +0000
Adopt C99 bool in the printing API.
Not many changes here: the 'dotted' flag passed to print_line_dotted
is bool, and so is the printing_in_colour flag passed to
print_get_colour. Also ps_init() takes a bool.
line_dotted is also a method in the drawing API structure, but it's
not actually filled in for any non-print-oriented implementation of
that API. So only front ends that do platform-specific _printing_
should need to make a corresponding change. In-tree, for example,
windows.c needed a fix because it prints via Windows GDI, but gtk.c
didn't have to do anything, because its CLI-based printing facility
just delegates to ps.c.
devel.but | 9 ++++-----
drawing.c | 4 ++--
nullfe.c | 2 +-
ps.c | 4 ++--
puzzles.h | 8 ++++----
windows.c | 2 +-
6 files changed, 14 insertions(+), 15 deletions(-)
commit 20b56788bc61de5b3d10c90a9fd588d373134aae
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=20b56788bc61de5b3d10c90a9fd588d373134aae;hp=f6965b92e1915c9f49fafbadf603b4fd0da735bd
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:39:45 2018 +0000
Adopt C99 bool in the edsf API.
Now the flag passed to edsf_merge to say whether two items are the
same or opposite is a bool, and so is the flag returned via a pointer
argument from edsf_canonify.
The latter requires client code to be updated to match (otherwise
you'll get a pointer type error), so I've done that update in Loopy,
which is edsf's only current in-tree client.
dsf.c | 11 ++++++-----
loopy.c | 21 ++++++++++++---------
puzzles.h | 6 +++---
3 files changed, 21 insertions(+), 17 deletions(-)
commit 8fb4cd031ae0bdcab133049c8683b41ac41d4000
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=8fb4cd031ae0bdcab133049c8683b41ac41d4000;hp=20b56788bc61de5b3d10c90a9fd588d373134aae
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:40:23 2018 +0000
Adopt C99 bool in the findloop API.
This shouldn't be a disruptive change at all: findloop_run and
findloop_is_loop_edge now return bool in place of int, but client code
should automatically adjust without needing any changes.
findloop.c | 6 +++---
puzzles.h | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
commit 836a5c4ea742cc2ab23537993e8c54b251ae803b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=836a5c4ea742cc2ab23537993e8c54b251ae803b;hp=8fb4cd031ae0bdcab133049c8683b41ac41d4000
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:40:49 2018 +0000
Adopt C99 bool in misc.c functions.
The 'decode' flag to obfuscate_bitmap and the 'wrap' flag to
move_cursor are the only ones affected here.
misc.c | 4 ++--
puzzles.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
commit 33b55db48e9573c6c825e3a222ff968f6a0bd4f4
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=33b55db48e9573c6c825e3a222ff968f6a0bd4f4;hp=836a5c4ea742cc2ab23537993e8c54b251ae803b
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:41:45 2018 +0000
Adopt C99 bool in the tree234 API.
The only affected function here is splitpos234, which I don't think
these puzzles are even using at the moment.
devel.but | 4 ++--
tree234.c | 2 +-
tree234.h | 4 +++-
3 files changed, 6 insertions(+), 4 deletions(-)
commit 08915945e64d2d3dfea7ec426228f814a6e65adf
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=08915945e64d2d3dfea7ec426228f814a6e65adf;hp=33b55db48e9573c6c825e3a222ff968f6a0bd4f4
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:42:28 2018 +0000
Adopt C99 bool in the shared Latin-square API.
latin_check now returns bool, and latin_solver_diff_set takes a bool
'extreme' flag. Should be non-disruptive.
latin.c | 12 ++++++------
latin.h | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
commit 064da876828ea3079d5d7be5849b693f4d55364b
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=064da876828ea3079d5d7be5849b693f4d55364b;hp=08915945e64d2d3dfea7ec426228f814a6e65adf
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:43:11 2018 +0000
Adopt C99 bool in the grid.c API.
More or less trivially: the only affected declaration is the
has_incentre flag in struct grid_face.
grid.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit a550ea0a47374705a37f36b0f05ffe9e4c8161fb
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=a550ea0a47374705a37f36b0f05ffe9e4c8161fb;hp=064da876828ea3079d5d7be5849b693f4d55364b
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:44:02 2018 +0000
Replace TRUE/FALSE with C99 true/false throughout.
This commit removes the old #defines of TRUE and FALSE from puzzles.h,
and does a mechanical search-and-replace throughout the code to
replace them with the C99 standard lowercase spellings.
blackbox.c | 42 +++----
bridges.c | 32 +++---
cube.c | 36 +++---
divvy.c | 6 +-
dominosa.c | 40 +++----
dsf.c | 2 +-
emcc.c | 24 ++--
fifteen.c | 50 ++++----
filling.c | 94 +++++++--------
findloop.c | 16 +--
flip.c | 46 ++++----
flood.c | 44 +++----
galaxies.c | 90 +++++++--------
grid.c | 32 +++---
gtk.c | 230 ++++++++++++++++++-------------------
guess.c | 46 ++++----
inertia.c | 72 ++++++------
keen.c | 90 +++++++--------
latin.c | 36 +++---
latin.h | 6 +-
lightup.c | 26 ++---
loopgen.c | 26 ++---
loopy.c | 128 ++++++++++-----------
magnets.c | 26 ++---
map.c | 94 +++++++--------
matching.c | 8 +-
midend.c | 80 ++++++-------
mines.c | 136 +++++++++++-----------
nestedvm.c | 16 +--
net.c | 130 ++++++++++-----------
netslide.c | 64 +++++------
nullgame.c | 18 +--
obfusc.c | 2 +-
palisade.c | 74 ++++++------
pattern.c | 90 +++++++--------
pearl.c | 106 ++++++++---------
pegs.c | 38 +++----
printing.c | 4 +-
ps.c | 8 +-
puzzles.h | 7 --
range.c | 64 +++++------
rect.c | 136 +++++++++++-----------
samegame.c | 52 ++++-----
signpost.c | 32 +++---
singles.c | 20 ++--
sixteen.c | 46 ++++----
slant.c | 104 ++++++++---------
solo.c | 248 ++++++++++++++++++++--------------------
tents.c | 84 +++++++-------
towers.c | 64 +++++------
tracks.c | 116 +++++++++----------
tree234.h | 4 +-
twiddle.c | 60 +++++-----
undead.c | 310 +++++++++++++++++++++++++-------------------------
unequal.c | 42 +++----
unfinished/group.c | 72 ++++++------
unfinished/numgame.c | 144 +++++++++++------------
unfinished/path.c | 32 +++---
unfinished/separate.c | 26 ++---
unfinished/slide.c | 78 ++++++-------
unfinished/sokoban.c | 38 +++----
unruly.c | 170 +++++++++++++--------------
untangle.c | 60 +++++-----
windows.c | 112 +++++++++---------
64 files changed, 2111 insertions(+), 2118 deletions(-)
commit 5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a;hp=a550ea0a47374705a37f36b0f05ffe9e4c8161fb
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:45:44 2018 +0000
Use C99 bool within source modules.
This is the main bulk of this boolification work, but although it's
making the largest actual change, it should also be the least
disruptive to anyone interacting with this code base downstream of me,
because it doesn't modify any interface between modules: all the
inter-module APIs were updated one by one in the previous commits.
This just cleans up the code within each individual source file to use
bool in place of int where I think that makes things clearer.
blackbox.c | 116 ++++++++++---------
bridges.c | 300 ++++++++++++++++++++++++++------------------------
cube.c | 22 ++--
divvy.c | 11 +-
dominosa.c | 28 ++---
dsf.c | 7 +-
emcc.c | 12 +-
fifteen.c | 24 ++--
filling.c | 95 +++++++++-------
findloop.c | 3 +-
flip.c | 26 +++--
flood.c | 12 +-
galaxies.c | 193 +++++++++++++++++---------------
grid.c | 19 ++--
gtk.c | 51 +++++----
guess.c | 108 +++++++++---------
inertia.c | 34 +++---
keen.c | 87 ++++++++-------
latin.c | 16 +--
lightup.c | 217 +++++++++++++++++++-----------------
loopgen.c | 12 +-
loopy.c | 149 +++++++++++++------------
magnets.c | 123 ++++++++++++---------
map.c | 100 +++++++++--------
matching.c | 4 +-
midend.c | 39 +++----
mines.c | 115 ++++++++++---------
nestedvm.c | 7 +-
net.c | 45 ++++----
netslide.c | 42 +++----
obfusc.c | 14 +--
osx.m | 30 ++---
palisade.c | 49 +++++----
pattern.c | 117 +++++++++++---------
pearl.c | 53 ++++-----
pegs.c | 41 ++++---
printing.c | 2 +-
ps.c | 4 +-
range.c | 33 +++---
rect.c | 44 ++++----
samegame.c | 56 +++++-----
signpost.c | 216 +++++++++++++++++++-----------------
singles.c | 131 ++++++++++++----------
sixteen.c | 45 ++++----
slant.c | 67 ++++++-----
solo.c | 208 +++++++++++++++++-----------------
tdq.c | 10 +-
tents.c | 61 +++++-----
towers.c | 84 +++++++-------
tracks.c | 85 +++++++-------
tree234.c | 10 +-
twiddle.c | 43 ++++----
undead.c | 254 ++++++++++++++++++++++++------------------
unequal.c | 257 +++++++++++++++++++++++-------------------
unfinished/group.c | 83 +++++++-------
unfinished/separate.c | 25 +++--
unfinished/slide.c | 88 ++++++++-------
unfinished/sokoban.c | 9 +-
unruly.c | 64 +++++------
untangle.c | 17 +--
windows.c | 53 ++++-----
61 files changed, 2297 insertions(+), 1973 deletions(-)
commit 53798c08d40efe9e0b1f0fca25f05fbdf660aca7
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=53798c08d40efe9e0b1f0fca25f05fbdf660aca7;hp=5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:51:49 2018 +0000
Add a missing const in unfinished/sokoban.c.
I noticed this when I temporarily enabled compilation of all the
unfinished puzzles while doing the bool trawl.
unfinished/sokoban.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit cdc0563123951822b2f5f514336f8890ee6df522
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=cdc0563123951822b2f5f514336f8890ee6df522;hp=53798c08d40efe9e0b1f0fca25f05fbdf660aca7
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:54:11 2018 +0000
Add missing binary 'matching' to .gitignore.
.gitignore | 1 +
1 file changed, 1 insertion(+)
commit 47cec547e59ac8c5012f6091394dcb4304d64fc3
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=47cec547e59ac8c5012f6091394dcb4304d64fc3;hp=cdc0563123951822b2f5f514336f8890ee6df522
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 21:58:14 2018 +0000
Unruly, Group: reference-count the 'immutable' array.
I noticed this during the bool trawl: both of these games have an
array of flags indicating which grid squares are immutable starting
clues, and copy it in every call to dup_game, which is completely
unnecessary because it doesn't change during play. So now each one
lives in a reference-counted structure, as per my usual practice in
similar cases elsewhere.
unfinished/group.c | 33 ++++++++++++++++++++++-----------
unruly.c | 31 +++++++++++++++++++++----------
2 files changed, 43 insertions(+), 21 deletions(-)
commit db3b531e2cab765a00475054d2e9046c9d0437d3
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=db3b531e2cab765a00475054d2e9046c9d0437d3;hp=47cec547e59ac8c5012f6091394dcb4304d64fc3
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Nov 13 22:06:19 2018 +0000
Add missing 'static' to game-internal declarations.
Another thing I spotted while trawling the whole source base was that
a couple of games had omitted 'static' on a lot of their internal
functions. Checking with nm, there turned out to be quite a few more
than I'd spotted by eye, so this should fix them all.
Also added one missing 'const', on the lookup table nbits[] in Tracks.
bridges.c | 2 +-
galaxies.c | 4 ++--
lightup.c | 2 +-
map.c | 4 ++--
pearl.c | 8 ++++----
solo.c | 6 +++---
tracks.c | 21 +++++++++++++--------
undead.c | 30 +++++++++++++++---------------
unequal.c | 2 +-
9 files changed, 42 insertions(+), 37 deletions(-)
More information about the tartarus-commits
mailing list