mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Add platform-independent Unicode setup function.
Similarly to the one I just added for FontSpec: in a cross-platform main source file, you don't really want to mess about with per-platform ifdefs just to initialise a 'struct unicode_data' from a Conf. But until now, you had to, because init_ucs had a different prototype on Windows and Unix. I plan to use this in future test programs. But an immediate positive effect is that it removes the only platform-dependent call from fuzzterm.c. So now that could be built on Windows too, given only an appropriate cmake stanza. (Not that I have much idea if it's useful to fuzz the terminal separately on multiple platforms, but it's nice to know that it's possible if anyone does need to.)
This commit is contained in:
parent
4341ba6d5c
commit
edce3fb9da
5
putty.h
5
putty.h
@ -286,6 +286,11 @@ struct unicode_data {
|
||||
#define LGTYP_PACKETS 3 /* logmode: SSH data packets */
|
||||
#define LGTYP_SSHRAW 4 /* logmode: SSH raw data */
|
||||
|
||||
/* Platform-generic function to set up a struct unicode_data. This is
|
||||
* only likely to be useful to test programs; real clients will want
|
||||
* to use the more flexible per-platform setup functions. */
|
||||
void init_ucs_generic(Conf *conf, struct unicode_data *ucsdata);
|
||||
|
||||
/*
|
||||
* Enumeration of 'special commands' that can be sent during a
|
||||
* session, separately from the byte stream of ordinary session data.
|
||||
|
@ -21,9 +21,7 @@ int main(int argc, char **argv)
|
||||
|
||||
conf = conf_new();
|
||||
do_defaults(NULL, conf);
|
||||
init_ucs(&ucsdata, conf_get_str(conf, CONF_line_codepage),
|
||||
conf_get_bool(conf, CONF_utf8_override),
|
||||
CS_NONE, conf_get_int(conf, CONF_vtmode));
|
||||
init_ucs_generic(conf, &ucsdata);
|
||||
|
||||
term = term_init(conf, &ucsdata, &termwin);
|
||||
term_size(term, 24, 80, 10000);
|
||||
|
@ -243,6 +243,13 @@ bool init_ucs(struct unicode_data *ucsdata, char *linecharset,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void init_ucs_generic(Conf *conf, struct unicode_data *ucsdata)
|
||||
{
|
||||
init_ucs(ucsdata, conf_get_str(conf, CONF_line_codepage),
|
||||
conf_get_bool(conf, CONF_utf8_override),
|
||||
CS_NONE, conf_get_int(conf, CONF_vtmode));
|
||||
}
|
||||
|
||||
const char *cp_name(int codepage)
|
||||
{
|
||||
if (codepage == CS_NONE)
|
||||
|
@ -689,6 +689,11 @@ void init_ucs(Conf *conf, struct unicode_data *ucsdata)
|
||||
}
|
||||
}
|
||||
|
||||
void init_ucs_generic(Conf *conf, struct unicode_data *ucsdata)
|
||||
{
|
||||
init_ucs(conf, ucsdata);
|
||||
}
|
||||
|
||||
static void link_font(WCHAR *line_tbl, WCHAR *font_tbl, WCHAR attr)
|
||||
{
|
||||
int font_index, line_index, i;
|
||||
|
Loading…
Reference in New Issue
Block a user