1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 11:02:48 -05:00

Line discipline module now uses dynamically allocated data. Also

fixed one or two other minor problems.

[originally from svn r2141]
This commit is contained in:
Simon Tatham
2002-10-26 10:16:19 +00:00
parent ba0468b983
commit 0b2523eeda
16 changed files with 326 additions and 204 deletions

View File

@ -53,13 +53,14 @@ struct gui_data {
char wintitle[sizeof(((Config *)0)->wintitle)];
char icontitle[sizeof(((Config *)0)->wintitle)];
int master_fd, master_func_id, exited;
void *ldisc;
};
static struct gui_data the_inst;
static struct gui_data *inst = &the_inst; /* so we always write `inst->' */
static int send_raw_mouse;
void ldisc_update(int echo, int edit)
void ldisc_update(void *frontend, int echo, int edit)
{
/*
* This is a stub in pterm. If I ever produce a Unix
@ -792,7 +793,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
printf("\n");
#endif
ldisc_send(output+start, end-start, 1);
ldisc_send(inst->ldisc, output+start, end-start, 1);
show_mouseptr(0);
term_seen_key_event(term);
term_out(term);
@ -924,8 +925,10 @@ void done_with_pty(struct gui_data *inst)
}
}
void frontend_keypress(void)
void frontend_keypress(void *handle)
{
struct gui_data *inst = (struct gui_data *)handle;
/*
* If our child process has exited but not closed, terminate on
* any keypress.
@ -1965,7 +1968,9 @@ int main(int argc, char **argv)
term_provide_resize_fn(term, back->size, backhandle);
term_size(term, cfg.height, cfg.width, cfg.savelines);
ldisc_send(NULL, 0, 0); /* cause ldisc to notice changes */
inst->ldisc = ldisc_create(term, back, backhandle, inst);
ldisc_send(inst->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
inst->master_fd = pty_master_fd;
inst->exited = FALSE;

View File

@ -589,6 +589,11 @@ static int pty_ldisc(void *handle, int option)
return 0; /* neither editing nor echoing */
}
static void pty_provide_ldisc(void *handle, void *ldisc)
{
/* This is a stub. */
}
static int pty_exitcode(void *handle)
{
if (!pty_child_dead)
@ -607,6 +612,7 @@ Backend pty_backend = {
pty_exitcode,
pty_sendok,
pty_ldisc,
pty_provide_ldisc,
pty_unthrottle,
1
};

View File

@ -14,12 +14,12 @@
* are ISO8859-1.
*/
void lpage_send(int codepage, char *buf, int len, int interactive)
void lpage_send(void *ldisc, int codepage, char *buf, int len, int interactive)
{
ldisc_send(buf, len, interactive);
ldisc_send(ldisc, buf, len, interactive);
}
void luni_send(wchar_t * widebuf, int len, int interactive)
void luni_send(void *ldisc, wchar_t * widebuf, int len, int interactive)
{
static char *linebuffer = 0;
static int linesize = 0;
@ -79,7 +79,7 @@ void luni_send(wchar_t * widebuf, int len, int interactive)
}
}
if (p > linebuffer)
ldisc_send(linebuffer, p - linebuffer, interactive);
ldisc_send(ldisc, linebuffer, p - linebuffer, interactive);
}
int is_dbcs_leadbyte(int codepage, char byte)