1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-17 19:11:00 -05:00

Post-release destabilisation! Completely remove the struct type

'Config' in putty.h, which stores all PuTTY's settings and includes an
arbitrary length limit on every single one of those settings which is
stored in string form. In place of it is 'Conf', an opaque data type
everywhere outside the new file conf.c, which stores a list of (key,
value) pairs in which every key contains an integer identifying a
configuration setting, and for some of those integers the key also
contains extra parts (so that, for instance, CONF_environmt is a
string-to-string mapping). Everywhere that a Config was previously
used, a Conf is now; everywhere there was a Config structure copy,
conf_copy() is called; every lookup, adjustment, load and save
operation on a Config has been rewritten; and there's a mechanism for
serialising a Conf into a binary blob and back for use with Duplicate
Session.

User-visible effects of this change _should_ be minimal, though I
don't doubt I've introduced one or two bugs here and there which will
eventually be found. The _intended_ visible effects of this change are
that all arbitrary limits on configuration strings and lists (e.g.
limit on number of port forwardings) should now disappear; that list
boxes in the configuration will now be displayed in a sorted order
rather than the arbitrary order in which they were added to the list
(since the underlying data structure is now a sorted tree234 rather
than an ad-hoc comma-separated string); and one more specific change,
which is that local and dynamic port forwardings on the same port
number are now mutually exclusive in the configuration (putting 'D' in
the key rather than the value was a mistake in the first place).

One other reorganisation as a result of this is that I've moved all
the dialog.c standard handlers (dlg_stdeditbox_handler and friends)
out into config.c, because I can't really justify calling them generic
any more. When they took a pointer to an arbitrary structure type and
the offset of a field within that structure, they were independent of
whether that structure was a Config or something completely different,
but now they really do expect to talk to a Conf, which can _only_ be
used for PuTTY configuration, so I've renamed them all things like
conf_editbox_handler and moved them out of the nominally independent
dialog-box management module into the PuTTY-specific config.c.

[originally from svn r9214]
This commit is contained in:
Simon Tatham
2011-07-14 18:52:21 +00:00
parent 7aba365ca9
commit a1f3b7a358
64 changed files with 4443 additions and 3303 deletions

View File

@ -162,7 +162,7 @@ union control {
*
* The `data' parameter points to the writable data being
* modified as a result of the configuration activity; for
* example, the PuTTY `Config' structure, although not
* example, the PuTTY `Conf' structure, although not
* necessarily.
*
* The `dlg' parameter is passed back to the platform-
@ -521,45 +521,6 @@ union control *ctrl_checkbox(struct controlset *, char *label, char shortcut,
handler_fn handler, intorptr context);
union control *ctrl_tabdelay(struct controlset *, union control *);
/*
* Standard handler routines to cover most of the common cases in
* the config box.
*/
/*
* The standard radio-button handler expects the main `context'
* field to contain the `offsetof' of an int field in the structure
* pointed to by `data', and expects each of the individual button
* data to give a value for that int field.
*/
void dlg_stdradiobutton_handler(union control *ctrl, void *dlg,
void *data, int event);
/*
* The standard checkbox handler expects the main `context' field
* to contain the `offsetof' an int field in the structure pointed
* to by `data', optionally ORed with CHECKBOX_INVERT to indicate
* that the sense of the datum is opposite to the sense of the
* checkbox.
*/
#define CHECKBOX_INVERT (1<<30)
void dlg_stdcheckbox_handler(union control *ctrl, void *dlg,
void *data, int event);
/*
* The standard edit-box handler expects the main `context' field
* to contain the `offsetof' a field in the structure pointed to by
* `data'. The secondary `context2' field indicates the type of
* this field:
*
* - if context2 > 0, the field is a char array and context2 gives
* its size.
* - if context2 == -1, the field is an int and the edit box is
* numeric.
* - if context2 < -1, the field is an int and the edit box is
* _floating_, and (-context2) gives the scale. (E.g. if
* context2 == -1000, then typing 1.2 into the box will set the
* field to 1200.)
*/
void dlg_stdeditbox_handler(union control *ctrl, void *dlg,
void *data, int event);
/*
* The standard file-selector handler expects the main `context'
* field to contain the `offsetof' a Filename field in the
@ -584,7 +545,7 @@ int dlg_radiobutton_get(union control *ctrl, void *dlg);
void dlg_checkbox_set(union control *ctrl, void *dlg, int checked);
int dlg_checkbox_get(union control *ctrl, void *dlg);
void dlg_editbox_set(union control *ctrl, void *dlg, char const *text);
void dlg_editbox_get(union control *ctrl, void *dlg, char *buffer, int length);
char *dlg_editbox_get(union control *ctrl, void *dlg); /* result must be freed by caller */
/* The `listbox' functions can also apply to combo boxes. */
void dlg_listbox_clear(union control *ctrl, void *dlg);
void dlg_listbox_del(union control *ctrl, void *dlg, int index);