1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00
Files
winscp/source/putty/utils/conf_data.c
Martin Prikryl 25df2381f1 Updating code to PuTTY 0.82
Source commit: ddf59fef3b75f5efff8bf82fecdd61ef49970fd2
2024-12-05 16:51:39 +01:00

47 lines
1.6 KiB
C

#include "putty.h"
#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 }
#define VALUE_OBSOLETE(eval, sval) { eval, sval, true }
#include "conf-enums.h"
bool conf_enum_map_to_storage(const ConfSaveEnumType *etype,
int confval, int *storageval_out)
{
size_t i; // WINSCP
for (i = 0; i < etype->nvalues; i++)
if (!etype->values[i].obsolete &&
etype->values[i].confval == confval) {
*storageval_out = etype->values[i].storageval;
return true;
}
return false;
}
bool conf_enum_map_from_storage(const ConfSaveEnumType *etype,
int storageval, int *confval_out)
{
size_t i; // WINSCP
for (i = 0; i < etype->nvalues; i++)
if (etype->values[i].storageval == storageval) {
*confval_out = etype->values[i].confval;
return true;
}
return false;
}
#define CONF_OPTION(id, subkey_type, value_type, ...) \
{ CONF_TYPE_ ## subkey_type, CONF_TYPE_ ## value_type, __VA_ARGS__ },
const ConfKeyInfo conf_key_info[] = {
#include "conf.winscp.h"
};