simon-git: putty (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Fri Sep 22 15:07:08 BST 2023
TL;DR:
cfdff822 settings.c: missing 'const' in gppfont().
63717021 Expose conf_clear(), for test purposes.
954db6f7 Conditionalise FontSpec structure definition.
b567c9b2 New test program 'test_conf', mostly transitional.
72bbca9d Move the enum of Conf data types out into putty.h.
860bd0d5 Replace conf.c's type arrays with a new conf_key_info[].
8e952083 Begin moving saved-setting semantics into conf_key_info.
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2023-09-22 15:07:08
commit cfdff822c4e41895a866c0a77f43668737ab95f4
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=cfdff822c4e41895a866c0a77f43668737ab95f4;hp=bdbd5f429c79a67cc1d5fee7f121b9fe642466ad
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Sep 22 12:56:47 2023 +0100
settings.c: missing 'const' in gppfont().
settings.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 63717021457ce18645f736b0b8dc5bf49248b1ce
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=63717021457ce18645f736b0b8dc5bf49248b1ce;hp=cfdff822c4e41895a866c0a77f43668737ab95f4
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Sep 22 13:53:45 2023 +0100
Expose conf_clear(), for test purposes.
Normally you don't ever want to have a Conf structure that doesn't
have an entry for every primary key, because the code that uses Conf
to get real work done will fail assertions if lookups fail. But test
programs manipulating Conf in unusual ways are a special case.
(In particular, one thing you _can_ legally do with an empty Conf is
to call load_open_settings() to populate it. That has to be legal,
because it's how a Conf gets populated in the first place, after it's
initially created empty.)
putty.h | 1 +
utils/conf.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
commit 954db6f7fea40fc62214e19d8fedaee85c3dad81
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=954db6f7fea40fc62214e19d8fedaee85c3dad81;hp=63717021457ce18645f736b0b8dc5bf49248b1ce
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Sep 22 13:55:33 2023 +0100
Conditionalise FontSpec structure definition.
FontSpec is completely different per platform; not only is the
structure type different, not only are the behind-the-scenes
implementations of copy and free functions different, but even the API
of the constructor function is different. Cross-platform code can't
construct a FontSpec at all. This makes it hard to write a
cross-platform test program that works with them.
So, as a nasty bodge, I'll allow test programs to #define
SUPERSEDE_FONTSPEC_FOR_TESTING before including putty.h. Then they can
provide their own definition of FontSpec, and they also take
responsibility for superseding all the other functions that work with
one.
unix/platform.h | 2 ++
windows/platform.h | 2 ++
2 files changed, 4 insertions(+)
commit b567c9b2b5e159f6e552d1ca703d36610209d130
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=b567c9b2b5e159f6e552d1ca703d36610209d130;hp=954db6f7fea40fc62214e19d8fedaee85c3dad81
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Sep 22 13:57:50 2023 +0100
New test program 'test_conf', mostly transitional.
This aims to be a reasonably exhaustive test of what happens if you
set Conf values to various things, and then save your session, and
find out what ends up in the storage. Or vice versa.
Currently, the test program is written to match the existing
behaviour. The idea is that I can refactor the code that does the
loading and saving, and if this test still passes, I've probably done
it right.
However, in the long term, this test will be a liability: it's yet
another place you have to add every new config option. So my plan is
to get rid of it again once the refactorings I'm planning are
finished.
Or rather, I'll get rid of _that_ part of its functionality. I also
suspect I'll have added new kinds of consistency check by then, which
won't be a liability in the same way, and which I'll want to keep.
Buildscr | 1 +
CMakeLists.txt | 13 +
test/test_conf.c | 773 +++++++++++++++++++++++++++++++++++++++++++++++++
unix/CMakeLists.txt | 2 +
windows/CMakeLists.txt | 2 +
5 files changed, 791 insertions(+)
commit 72bbca9dddf747599878683950f39fff0d4ba35e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=72bbca9dddf747599878683950f39fff0d4ba35e;hp=b567c9b2b5e159f6e552d1ca703d36610209d130
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Sep 22 12:08:36 2023 +0100
Move the enum of Conf data types out into putty.h.
I'm about to start refactoring Conf in a way that will need it to be
more widely available.
putty.h | 13 ++++++
utils/conf.c | 137 ++++++++++++++++++++++++++++-------------------------------
2 files changed, 78 insertions(+), 72 deletions(-)
commit 860bd0d5b758c8503236c9394a0929355f5db1ad
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=860bd0d5b758c8503236c9394a0929355f5db1ad;hp=72bbca9dddf747599878683950f39fff0d4ba35e
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Sep 22 12:54:15 2023 +0100
Replace conf.c's type arrays with a new conf_key_info[].
This array is planned to be exposed more widely, and used for more
purposes than just checking the types of Conf options. In this commit
it just takes over from the two previous smaller arrays, and adds no
extra data.
conf.h | 731 +++++++++++++++++++++++++++++++++++++++++++++++++++
defs.h | 2 +
putty.h | 279 ++------------------
utils/CMakeLists.txt | 1 +
utils/conf.c | 97 ++++---
utils/conf_data.c | 9 +
6 files changed, 802 insertions(+), 317 deletions(-)
commit 8e9520837761ac3806690904aa3763960c63369e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=8e9520837761ac3806690904aa3763960c63369e;hp=860bd0d5b758c8503236c9394a0929355f5db1ad
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Sep 22 13:48:20 2023 +0100
Begin moving saved-setting semantics into conf_key_info.
The new ConfKeyInfo structure now includes some fields indicating how
to load and save each config option: what keyword it's stored under in
the saved settings file, and what its default value should be set to
when loading a session that doesn't mention it. (Including, of course,
loading the null session at program startup.)
So far, this only applies to the saved settings that are sufficiently
simple: a single integer, string or boolean value whose internal
format matches its storage format, or an integer value consisting of a
finite enumeration with a fixed mapping between its internal and
storage formats. Anything more difficult than that - mappings,
variable defaults, config options tied together, options that still
support a legacy save format alongside the up-to-date one, things
under #ifdef - hasn't yet been tampered with.
This allows a large amount of repetitive code in settings.c to be
deleted, and replaced by simple loops over the conf_key_info array
doing all the easy work. The remaining manual load/save code per
option is all there because it's difficult in some way.
The transitional test_conf program still passes after this upheaval.
conf-enums.h | 178 ++++++++++++++++++
conf.h | 540 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
defs.h | 2 +
putty.h | 21 +++
settings.c | 479 ++++++++++--------------------------------------
utils/conf_data.c | 41 +++++
6 files changed, 879 insertions(+), 382 deletions(-)
More information about the tartarus-commits
mailing list