mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Add ability to specify custom load and save separately.
This allows a couple more settings to be treated automatically on
save, which are more complicated on load because they still honour
older alternative save keywords.
In particular, CONF_proxy_type and CONF_remote_qtitle_action now have
explicit enum mappings. These were needed for the automated save code,
but also, I've rewritten the custom load code to use them too. This
decouples the storage format of those settings from the order of
values in the internal enum, which is generally an advantage of
specifying storage enums explicitly.
Those two settings weren't already tested by test_conf, because I
wasn't changing them in previous commits. Now I've added extra code
that does test them, and verified it works when backported to commit
b567c9b2b5
where I introduced test_conf before beginning the main
refactoring.
A setting can also be specified explicitly as not loaded and saved at
all. There were quite a few commented that way, but now there's a
machine-readable indication of it.
test_conf will now check that all these settings make sense together -
things shouldn't have a save keyword unless they use it, and should
have one if they don't, and shouldn't specify combinations of options
that conflict.
(For that reason, test_conf is now also running the consistency check
before the main test, so that a missing keyword will cause an error
message _before_ it causes a segfault, saving some debugging!)
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
#include "putty.h"
|
||||
|
||||
#define CONF_ENUM(name, ...) \
|
||||
static const ConfSaveEnumValue enum_values_##name[] = { \
|
||||
__VA_ARGS__ \
|
||||
}; static const ConfSaveEnumType enum_##name = { \
|
||||
.values = enum_values_##name, \
|
||||
.nvalues = lenof(enum_values_##name), \
|
||||
#define CONF_ENUM(name, ...) \
|
||||
static const ConfSaveEnumValue conf_enum_values_##name[] = { \
|
||||
__VA_ARGS__ \
|
||||
}; const ConfSaveEnumType conf_enum_##name = { \
|
||||
.values = conf_enum_values_##name, \
|
||||
.nvalues = lenof(conf_enum_values_##name), \
|
||||
};
|
||||
|
||||
#define VALUE(eval, sval) { eval, sval, false }
|
||||
@ -43,7 +43,10 @@ bool conf_enum_map_from_storage(const ConfSaveEnumType *etype,
|
||||
#define DEFAULT_STR(x) .default_value.sval = x
|
||||
#define DEFAULT_BOOL(x) .default_value.bval = x
|
||||
#define SAVE_KEYWORD(x) .save_keyword = x
|
||||
#define STORAGE_ENUM(x) .storage_enum = &enum_ ## x
|
||||
#define STORAGE_ENUM(x) .storage_enum = &conf_enum_ ## x
|
||||
#define SAVE_CUSTOM .save_custom = true
|
||||
#define LOAD_CUSTOM .load_custom = true
|
||||
#define NOT_SAVED .not_saved = true
|
||||
|
||||
const ConfKeyInfo conf_key_info[] = {
|
||||
#include "conf.h"
|
||||
|
Reference in New Issue
Block a user