1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-13 17:17:37 -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

@ -233,13 +233,13 @@ struct terminal_tag {
struct unicode_data *ucsdata;
/*
* We maintain a full _copy_ of a Config structure here, not
* merely a pointer to it. That way, when we're passed a new
* one for reconfiguration, we can check the differences and
* adjust the _current_ setting of (e.g.) auto wrap mode rather
* than only the default.
* We maintain a full copy of a Conf here, not merely a pointer
* to it. That way, when we're passed a new one for
* reconfiguration, we can check the differences and adjust the
* _current_ setting of (e.g.) auto wrap mode rather than only
* the default.
*/
Config cfg;
Conf *conf;
/*
* from_backend calls term_out, but it can also be called from
@ -273,6 +273,52 @@ struct terminal_tag {
int wcFromTo_size;
struct bidi_cache_entry *pre_bidi_cache, *post_bidi_cache;
int bidi_cache_size;
/*
* We copy a bunch of stuff out of the Conf structure into local
* fields in the Terminal structure, to avoid the repeated
* tree234 lookups which would be involved in fetching them from
* the former every time.
*/
int ansi_colour;
char *answerback;
int answerbacklen;
int arabicshaping;
int beep;
int bellovl;
int bellovl_n;
int bellovl_s;
int bellovl_t;
int bidi;
int bksp_is_delete;
int blink_cur;
int blinktext;
int cjk_ambig_wide;
int conf_height;
int conf_width;
int crhaslf;
int erase_to_scrollback;
int funky_type;
int lfhascr;
int logflush;
int logtype;
int mouse_override;
int nethack_keypad;
int no_alt_screen;
int no_applic_c;
int no_applic_k;
int no_dbackspace;
int no_mouse_rep;
int no_remote_charset;
int no_remote_resize;
int no_remote_wintitle;
int rawcnp;
int rect_select;
int remote_qtitle_action;
int rxvt_homeend;
int scroll_on_disp;
int scroll_on_key;
int xterm_256_colour;
};
#define in_utf(term) ((term)->utf || (term)->ucsdata->line_codepage==CP_UTF8)