]> asedeno.scripts.mit.edu Git - pssh.git/blob - arm/vt100/putty.h
My 2007-03-13 release:
[pssh.git] / arm / vt100 / putty.h
1 /*
2 PuTTY is copyright 1997-2004 Simon Tatham.
3
4 Portions copyright Robert de Bath, Joris van Rantwijk, Delian
5 Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,
6 Justin Bradford, Ben Harris, and CORE SDI S.A.
7
8 Permission is hereby granted, free of charge, to any person
9 obtaining a copy of this software and associated documentation files
10 (the "Software"), to deal in the Software without restriction,
11 including without limitation the rights to use, copy, modify, merge,
12 publish, distribute, sublicense, and/or sell copies of the Software,
13 and to permit persons to whom the Software is furnished to do so,
14 subject to the following conditions:
15
16 The above copyright notice and this permission notice shall be
17 included in all copies or substantial portions of the Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 NONINFRINGEMENT.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
23 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 */
27 /**********
28  * Portions Copyright (c) 2004 Greg Parker.  All rights reserved.
29  *
30  * Redistribution and use in source and binary forms, with or without
31  * modification, are permitted provided that the following conditions
32  * are met:
33  * 1. Redistributions of source code must retain the above copyright
34  *    notice, this list of conditions and the following disclaimer.
35  * 2. Redistributions in binary form must reproduce the above copyright
36  *    notice, this list of conditions and the following disclaimer in the
37  *    documentation and/or other materials provided with the distribution.
38  *
39  * THIS SOFTWARE IS PROVIDED BY GREG PARKER ``AS IS'' AND ANY EXPRESS OR
40  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
41  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
43  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
46  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
48  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49  **********/
50
51 #ifndef PUTTY_PUTTY_H
52 #define PUTTY_PUTTY_H
53
54 #include "includes.h"
55
56 /*
57  * Global variables. Most modules declare these `extern', but
58  * window.c will do `#define PUTTY_DO_GLOBALS' before including this
59  * module, and so will get them properly defined.
60  */
61 #ifndef GLOBAL
62 #ifdef PUTTY_DO_GLOBALS
63 #define GLOBAL
64 #else
65 #define GLOBAL extern
66 #endif
67 #endif
68
69 #ifndef DONE_TYPEDEFS
70 #define DONE_TYPEDEFS
71 typedef struct config_tag Config;
72 typedef struct backend_tag Backend;
73 typedef struct terminal_tag Terminal;
74 #endif
75
76 #include "puttyps.h"
77 #include "misc.h"
78
79 /* Three attribute types: 
80  * The ATTRs (normal attributes) are stored with the characters in
81  * the main display arrays
82  *
83  * The TATTRs (temporary attributes) are generated on the fly, they
84  * can overlap with characters but not with normal attributes.
85  *
86  * The LATTRs (line attributes) are an entirely disjoint space of
87  * flags.
88  *
89  * ATTR_INVALID is an illegal colour combination.
90  */
91
92 struct attr_tag {
93     unsigned long attr;  /* Character and basic attributes */
94     unsigned long color; /* Color information */
95 };
96
97 /* Combines char/charset/attr and color attributes into the struct */
98 #define ATTR_COMBINE(x,y) ((struct attr_tag){ x, y })
99 #define ATTR_WRAP(x) ((struct attr_tag){ x, 0 })
100
101 /* Stores line count and line attributes in attr_tag */
102 /* Yes, this is a hack */
103 #define LINE_COLS(x)  (((x)[0]).color)
104 #define LINE_ATTRS(x) (((x)[0]).attr)
105
106 #define TATTR_ACTCURS       0x4UL      /* active cursor (block) */
107 #define TATTR_PASCURS       0x2UL      /* passive cursor (box) */
108 #define TATTR_RIGHTCURS     0x1UL      /* cursor-on-RHS */
109
110 #define LATTR_NORM     0x00000000UL
111 #define LATTR_WIDE     0x01000000UL
112 #define LATTR_TOP      0x02000000UL
113 #define LATTR_BOT      0x03000000UL
114 #define LATTR_MODE     0x03000000UL
115 #define LATTR_WRAPPED  0x10000000UL
116 #define LATTR_WRAPPED2 0x20000000UL
117
118 /* Like Linux use the F000 page for direct to font. */
119 #define ATTR_OEMCP   0x0000F000UL      /* OEM Codepage DTF */
120 #define ATTR_ACP     0x0000F100UL      /* Ansi Codepage DTF */
121
122 /* These are internal use overlapping with the UTF-16 surrogates */
123 #define ATTR_ASCII   0x0000D800UL      /* normal ASCII charset ESC ( B */
124 #define ATTR_LINEDRW 0x0000D900UL      /* line drawing charset ESC ( 0 */
125 #define ATTR_SCOACS  0x0000DA00UL      /* SCO Alternate charset */
126 #define ATTR_GBCHR   0x0000DB00UL      /* UK variant   charset ESC ( A */
127 #define CSET_MASK    0x0000FF00UL      /* Character set mask; MUST be 0xFF00 */
128
129 #define DIRECT_CHAR(c) ((c&0xFC00)==0xD800)
130 #define DIRECT_FONT(c) ((c&0xFE00)==0xF000)
131
132 #define UCSERR       (ATTR_LINEDRW|'a') /* UCS Format error character. */
133 /*
134  * UCSWIDE is a special value used in the terminal data to signify
135  * the character cell containing the right-hand half of a CJK wide
136  * character. We use 0xDFFF because it's part of the surrogate
137  * range and hence won't be used for anything else (it's impossible
138  * to input it via UTF-8 because our UTF-8 decoder correctly
139  * rejects surrogates).
140  */
141 #define UCSWIDE      0xDFFF
142
143 #define ATTR_NARROW  0x80000000UL
144 #define ATTR_WIDE    0x40000000UL
145 #define ATTR_BOLD    0x04000000UL
146 #define ATTR_UNDER   0x08000000UL
147 #define ATTR_REVERSE 0x10000000UL
148 #define ATTR_BLINK   0x20000000UL
149 #define ATTR_CLEAR   0x00000000UL
150
151 #define ATTR_FGMASK  0x000001FFUL
152 #define ATTR_BGMASK  0x0003FE00UL
153 #define ATTR_COLOURS 0x0003FFFFUL
154 #define ATTR_FGSHIFT 0
155 #define ATTR_BGSHIFT 9
156
157 #define ATTR_DEFFG   (256 << ATTR_FGSHIFT)
158 #define ATTR_DEFBG   (258 << ATTR_BGSHIFT)
159 #define ATTR_DEFCOLORS (ATTR_DEFFG | ATTR_DEFBG)
160
161 #define ATTR_INVALID ATTR_COMBINE( ATTR_CLEAR, ATTR_COLOURS )
162 #define ATTR_INVALIDATE(x) ((x).color |= ATTR_COLOURS )
163 #define ATTR_DEFAULT ATTR_COMBINE( ATTR_CLEAR, ATTR_DEFCOLORS )
164
165 #define ERASE_CHAR   ATTR_COMBINE( ATTR_CLEAR | ATTR_ASCII | ' ', ATTR_DEFCOLORS )
166 #define ATTR_MASK    0xFC00FF00UL
167 #define CHAR_MASK    0x000000FFUL
168
169 #define ATTR_CUR_AND (~(ATTR_BOLD|ATTR_REVERSE|ATTR_BLINK|ATTR_COLOURS))
170 #define ATTR_CUR_XOR 0x016A0000UL
171
172 #define ATTR_CHAR(x) ATTR_COMBINE((x).attr & CHAR_MASK, 0)
173 #define ATTR_CHARALL(x) ATTR_COMBINE((x).attr & (CHAR_MASK | CSET_MASK), 0)
174 #define ATTR_ATTRS(x) ATTR_COMBINE((x).attr & ATTR_MASK, (x).color)
175
176 #define ATTR_AND(x,y) ATTR_COMBINE((x).attr & (y).attr, (x).color & (y).color)
177 #define ATTR_OR(x,y)  ATTR_COMBINE((x).attr | (y).attr, (x).color | (y).color)
178 #define ATTR_XOR(x,y) ATTR_COMBINE((x).attr ^ (y).attr, (x).color ^ (y).color)
179
180 #define ATTR_ZERO(x) (!((x).attr | (x).color))
181 #define ATTR_EQUAL(x,y) ATTR_ZERO(ATTR_XOR(x,y))
182
183 #define ATTR_ON(x,y)  (ATTR_COMBINE((x).attr |  (y), (x).color))
184 #define ATTR_OFF(x,y) (ATTR_COMBINE((x).attr & ~(y), (x).color))
185 #define ATTR_STATE(x,y) ((x).attr & (y))
186
187 struct sesslist {
188     int nsessions;
189     char **sessions;
190     char *buffer;                      /* so memory can be freed later */
191 };
192
193 struct unicode_data {
194     char **uni_tbl;
195     int dbcs_screenfont;
196     int font_codepage;
197     int line_codepage;
198     wchar_t unitab_scoacs[256];
199     wchar_t unitab_line[256];
200     wchar_t unitab_font[256];
201     wchar_t unitab_xterm[256];
202     wchar_t unitab_oemcp[256];
203     unsigned char unitab_ctrl[256];
204 };
205
206 #define LGXF_OVR  1                    /* existing logfile overwrite */
207 #define LGXF_APN  0                    /* existing logfile append */
208 #define LGXF_ASK -1                    /* existing logfile ask */
209 #define LGTYP_NONE  0                  /* logmode: no logging */
210 #define LGTYP_ASCII 1                  /* logmode: pure ascii */
211 #define LGTYP_DEBUG 2                  /* logmode: all chars of traffic */
212 #define LGTYP_PACKETS 3                /* logmode: SSH data packets */
213
214 typedef enum {
215     TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT,
216     TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF, TS_LECHO, TS_RECHO, TS_PING,
217     TS_EOL
218 } Telnet_Special;
219
220 struct telnet_special {
221     const char *name;                  /* NULL==end, ""==separator */
222     int code;
223 };
224
225 typedef enum {
226     MBT_NOTHING,
227     MBT_LEFT, MBT_MIDDLE, MBT_RIGHT,   /* `raw' button designations */
228     MBT_SELECT, MBT_EXTEND, MBT_PASTE, /* `cooked' button designations */
229     MBT_WHEEL_UP, MBT_WHEEL_DOWN       /* mouse wheel */
230 } Mouse_Button;
231
232 typedef enum {
233     MA_NOTHING, MA_CLICK, MA_2CLK, MA_3CLK, MA_DRAG, MA_RELEASE
234 } Mouse_Action;
235
236 /* Keyboard modifiers -- keys the user is actually holding down */
237
238 #define PKM_SHIFT       0x01
239 #define PKM_CONTROL     0x02
240 #define PKM_META        0x04
241 #define PKM_ALT         0x08
242
243 /* Keyboard flags that aren't really modifiers */
244 #define PKF_CAPSLOCK    0x10
245 #define PKF_NUMLOCK     0x20
246 #define PKF_REPEAT      0x40
247
248 /* Stand-alone keysyms for function keys */
249
250 typedef enum {
251     PK_NULL,            /* No symbol for this key */
252     /* Main keypad keys */
253     PK_ESCAPE, PK_TAB, PK_BACKSPACE, PK_RETURN, PK_COMPOSE,
254     /* Editing keys */
255     PK_HOME, PK_INSERT, PK_DELETE, PK_END, PK_PAGEUP, PK_PAGEDOWN,
256     /* Cursor keys */
257     PK_UP, PK_DOWN, PK_RIGHT, PK_LEFT, PK_REST,
258     /* Numeric keypad */                        /* Real one looks like: */
259     PK_PF1, PK_PF2, PK_PF3, PK_PF4,             /* PF1 PF2 PF3 PF4 */
260     PK_KPCOMMA, PK_KPMINUS, PK_KPDECIMAL,       /*  7   8   9   -  */
261     PK_KP0, PK_KP1, PK_KP2, PK_KP3, PK_KP4,     /*  4   5   6   ,  */
262     PK_KP5, PK_KP6, PK_KP7, PK_KP8, PK_KP9,     /*  1   2   3  en- */
263     PK_KPBIGPLUS, PK_KPENTER,                   /*    0     .  ter */
264     /* Top row */
265     PK_F1,  PK_F2,  PK_F3,  PK_F4,  PK_F5,
266     PK_F6,  PK_F7,  PK_F8,  PK_F9,  PK_F10,
267     PK_F11, PK_F12, PK_F13, PK_F14, PK_F15,
268     PK_F16, PK_F17, PK_F18, PK_F19, PK_F20,
269     PK_PAUSE
270 } Key_Sym;
271
272 #define PK_ISEDITING(k) ((k) >= PK_HOME && (k) <= PK_PAGEDOWN)
273 #define PK_ISCURSOR(k)  ((k) >= PK_UP && (k) <= PK_REST)
274 #define PK_ISKEYPAD(k)  ((k) >= PK_PF1 && (k) <= PK_KPENTER)
275 #define PK_ISFKEY(k)    ((k) >= PK_F1 && (k) <= PK_F20)
276
277 enum {
278     VT_XWINDOWS, VT_OEMANSI, VT_OEMONLY, VT_POORMAN, VT_UNICODE
279 };
280
281 enum {
282     /*
283      * SSH ciphers (both SSH1 and SSH2)
284      */
285     CIPHER_WARN,                       /* pseudo 'cipher' */
286     CIPHER_3DES,
287     CIPHER_BLOWFISH,
288     CIPHER_AES,                        /* (SSH 2 only) */
289     CIPHER_DES,
290     CIPHER_MAX                         /* no. ciphers (inc warn) */
291 };
292
293 enum {
294     /*
295      * Several different bits of the PuTTY configuration seem to be
296      * three-way settings whose values are `always yes', `always
297      * no', and `decide by some more complex automated means'. This
298      * is true of line discipline options (local echo and line
299      * editing), proxy DNS, Close On Exit, and SSH server bug
300      * workarounds. Accordingly I supply a single enum here to deal
301      * with them all.
302      */
303     FORCE_ON, FORCE_OFF, AUTO
304 };
305
306 enum {
307     /*
308      * Proxy types.
309      */
310     PROXY_NONE, PROXY_SOCKS4, PROXY_SOCKS5,
311     PROXY_HTTP, PROXY_TELNET, PROXY_CMD
312 };
313
314 enum {
315     /*
316      * Line discipline options which the backend might try to control.
317      */
318     LD_EDIT,                           /* local line editing */
319     LD_ECHO                            /* local echo */
320 };
321
322 enum {
323     /* Protocol back ends. (cfg.protocol) */
324     PROT_RAW, PROT_TELNET, PROT_RLOGIN, PROT_SSH
325 };
326
327 enum {
328     /* Bell settings (cfg.beep) */
329     // GrP allow audible and visible to be set simultaneously
330     BELL_AUDIBLE = 1<<0,
331     BELL_VISIBLE = 1<<1
332 };
333
334 enum {
335     /* Taskbar flashing indication on bell (cfg.beep_ind) */
336     B_IND_DISABLED, B_IND_FLASH, B_IND_STEADY
337 };
338
339 enum {
340     /* Resize actions (cfg.resize_action) */
341     RESIZE_TERM, RESIZE_DISABLED, RESIZE_FONT, RESIZE_EITHER
342 };
343
344 enum {
345     /* Function key types (cfg.funky_type) */
346     FUNKY_TILDE,
347     FUNKY_LINUX,
348     FUNKY_XTERM,
349     FUNKY_VT400,
350     FUNKY_VT100P,
351     FUNKY_SCO
352 };
353
354 struct backend_tag {
355     const char *(*init) (void *frontend_handle, void **backend_handle,
356                          Config *cfg,
357                          char *host, int port, char **realhost, int nodelay);
358     void (*free) (void *handle);
359     /* back->reconfig() passes in a replacement configuration. */
360     void (*reconfig) (void *handle, Config *cfg);
361     /* back->send() returns the current amount of buffered data. */
362     int (*send_buf) (void *handle, char *buf, int len);
363     /* back->sendbuffer() does the same thing but without attempting a send */
364     int (*sendbuffer) (void *handle);
365     void (*size) (void *handle, int width, int height);
366     void (*special) (void *handle, Telnet_Special code);
367     const struct telnet_special *(*get_specials) (void *handle);
368     // Socket(*socket) (void *handle);
369     int (*exitcode) (void *handle);
370     int (*sendok) (void *handle);
371     int (*ldisc) (void *handle, int);
372     void (*provide_ldisc) (void *handle, void *ldisc);
373     void (*provide_logctx) (void *handle, void *logctx);
374     /*                                                                          
375      * back->unthrottle() tells the back end that the front end                 
376      * buffer is clearing.                                                      
377      */
378     void (*unthrottle) (void *handle, int);
379     int default_port;
380 };
381
382 extern struct backend_list {
383     int protocol;
384     char *name;
385     Backend *backend;
386 } backends[];
387
388 /*
389  * IMPORTANT POLICY POINT: everything in this structure which wants
390  * to be treated like an integer must be an actual, honest-to-
391  * goodness `int'. No enum-typed variables. This is because parts
392  * of the code will want to pass around `int *' pointers to them
393  * and we can't run the risk of porting to some system on which the
394  * enum comes out as a different size from int.
395  */
396 struct config_tag {
397     /* Basic options */
398     char host[512];
399     int port;
400     int protocol;
401     int close_on_exit;
402     int warn_on_close;
403     int ping_interval;                 /* in seconds */
404     int tcp_nodelay;
405     /* Proxy options */
406     char proxy_exclude_list[512];
407     int proxy_dns;
408     int even_proxy_localhost;
409     int proxy_type;
410     char proxy_host[512];
411     int proxy_port;
412     char proxy_username[32];
413     char proxy_password[32];
414     char proxy_telnet_command[512];
415     /* SSH options */
416     char remote_cmd[512];
417     char remote_cmd2[512];             /* fallback if the first fails
418                                         * (used internally for scp) */
419     char *remote_cmd_ptr;              /* might point to a larger command
420                                         * but never for loading/saving */
421     char *remote_cmd_ptr2;             /* might point to a larger command 
422                                         * but never for loading/saving */
423     int nopty;
424     int compression;
425     int agentfwd;
426     int change_username;               /* allow username switching in SSH2 */
427     int ssh_cipherlist[CIPHER_MAX];
428     // Filename keyfile;
429     int sshprot;                       /* use v1 or v2 when both available */
430     int ssh2_des_cbc;                  /* "des-cbc" nonstandard SSH2 cipher */
431     int try_tis_auth;
432     int try_ki_auth;
433     int ssh_subsys;                    /* run a subsystem rather than a command */
434     int ssh_subsys2;                   /* fallback to go with remote_cmd2 */
435     /* Telnet options */
436     char *termtype;
437     char termspeed[32];
438     char environmt[1024];              /* VAR\tvalue\0VAR\tvalue\0\0 */
439     char username[100];
440     char localusername[100];
441     int rfc_environ;
442     int passive_telnet;
443     /* Keyboard options */
444     int bksp_is_delete;
445     int rxvt_homeend;
446     int funky_type;
447     int no_applic_c;                   /* totally disable app cursor keys */
448     int no_applic_k;                   /* totally disable app keypad */
449     int no_mouse_rep;                  /* totally disable mouse reporting */
450     int no_remote_resize;              /* disable remote resizing */
451     int no_alt_screen;                 /* disable alternate screen */
452     int no_remote_wintitle;            /* disable remote retitling */
453     int no_dbackspace;                 /* disable destructive backspace */
454     int no_remote_charset;             /* disable remote charset config */
455     int no_remote_qtitle;              /* disable remote win title query */
456     int app_cursor;
457     int app_keypad;
458     int nethack_keypad;
459     int telnet_keyboard;
460     int telnet_newline;
461     int alt_f4;                        /* is it special? */
462     int alt_space;                     /* is it special? */
463     int alt_only;                      /* is it special? */
464     int localecho;
465     int localedit;
466     int alwaysontop;
467     int fullscreenonaltenter;
468     int scroll_on_key;
469     int scroll_on_disp;
470     int erase_to_scrollback;
471     int compose_key;
472     int ctrlaltkeys;
473     char wintitle[256];                /* initial window title */
474     /* Terminal options */
475     int savelines;
476     int dec_om;
477     int wrap_mode;
478     int lfhascr;
479     int cursor_type;                   /* 0=block 1=underline 2=vertical */
480     int blink_cur;
481     int beep;
482     int beep_ind;
483     int bellovl;                       /* bell overload protection active? */
484     int bellovl_n;                     /* number of bells to cause overload */
485     int bellovl_t;                     /* time interval for overload (seconds) */
486     int bellovl_s;                     /* period of silence to re-enable bell (s) */
487     int scrollbar;
488     int scrollbar_in_fullscreen;
489     int resize_action;
490     int bce;
491     int blinktext;
492     int win_name_always;
493     int width, height;
494     FontSpec font;
495     int logtype;
496     int logxfovr;
497     int hide_mouseptr;
498     int sunken_edge;
499     int window_border;
500     char answerback[256];
501     char printer[128];
502     /* Colour options */
503     int system_colour;
504     int try_palette;
505     int bold_colour;
506     unsigned char colours[22][3];
507     /* Selection options */
508     int mouse_is_xterm;
509     int rect_select;
510     int rawcnp;
511     int rtf_paste;
512     int mouse_override;
513     short *wordness;
514     /* translations */
515     int vtmode;
516     char line_codepage[128];
517     int xlat_capslockcyr;
518     /* Options for pterm. Should split out into platform-dependent part. */
519     int stamp_utmp;
520     int login_shell;
521     int scrollbar_on_left;
522     int shadowbold;
523     FontSpec boldfont;
524     FontSpec widefont;
525     FontSpec wideboldfont;
526     int shadowboldoffset;
527 };
528
529 /*
530  * Exports from window.c.
531  */
532 void request_resize(void *frontend, int, int);
533 void do_text(Context, int, int, char *, int, struct attr_tag, unsigned long);
534 void do_cursor(Context, int, int, char *, int, struct attr_tag, unsigned long);
535 int char_width(Context ctx, unsigned int uc);
536 #ifdef OPTIMISE_SCROLL
537 void do_scroll(Context, int, int, int);
538 #endif
539 void set_title(void *frontend, char *);
540 void set_icon(void *frontend, char *);
541 void set_sbar(void *frontend, int, int, int);
542 Context get_ctx(void *frontend);
543 void free_ctx(Context);
544 void palette_set(void *frontend, int, int, int, int);
545 void palette_reset(void *frontend);
546 void write_aclip(void *frontend, char *, int, int);
547 void write_clip(void *frontend, char *, size_t, int);
548 void get_clip(void *frontend, wchar_t **, size_t *);
549 void optimised_move(void *frontend, int, int, int);
550 void set_raw_mouse_mode(void *frontend, int);
551 void connection_fatal(void *frontend, char *, ...);
552 void fatalbox(char *, ...);
553 void modalfatalbox(char *, ...);
554 #ifdef macintosh
555 #pragma noreturn(fatalbox)
556 #pragma noreturn(modalfatalbox)
557 #endif
558 void beep(void *frontend, int);
559 void begin_session(void *frontend);
560 void sys_cursor(void *frontend, int x, int y);
561 void request_paste(void *frontend);
562 void frontend_keypress(void *frontend);
563 void ldisc_update(void *frontend, int echo, int edit);
564 void update_specials_menu(void *frontend);
565 int from_backend(void *frontend, int is_stderr, const char *data, size_t len);
566 #define OPTIMISE_IS_SCROLL 1
567
568 void set_iconic(void *frontend, int iconic);
569 void move_window(void *frontend, int x, int y);
570 void set_zorder(void *frontend, int top);
571 void refresh_window(void *frontend);
572 void set_zoomed(void *frontend, int zoomed);
573 int is_iconic(void *frontend);
574 void get_window_pos(void *frontend, int *x, int *y);
575 void get_window_pixels(void *frontend, int *x, int *y);
576 char *get_window_title(void *frontend, int icon);
577
578 void cleanup_exit(int);
579
580
581 /*
582  * Exports from settings.c.
583  */
584 char *save_settings(char *section, int do_host, Config * cfg);
585 void save_open_settings(void *sesskey, int do_host, Config *cfg);
586 void load_settings(char *section, int do_host, Config * cfg);
587 void load_open_settings(void *sesskey, int do_host, Config *cfg);
588 void get_sesslist(struct sesslist *, int allocate);
589 void do_defaults(char *, Config *);
590 void registry_cleanup(void);
591
592 /*
593  * Functions used by settings.c to provide platform-specific
594  * default settings.
595  * 
596  * (The integer one is expected to return `def' if it has no clear
597  * opinion of its own. This is because there's no integer value
598  * which I can reliably set aside to indicate `nil'. The string
599  * function is perfectly all right returning NULL, of course. The
600  * Filename and FontSpec functions are _not allowed_ to fail to
601  * return, since these defaults _must_ be per-platform.)
602  */
603 char *platform_default_s(const char *name);
604 int platform_default_i(const char *name, int def);
605 Filename platform_default_filename(const char *name);
606 FontSpec platform_default_fontspec(const char *name);
607
608 /*
609  * Exports from terminal.c.
610  */
611
612 Terminal *term_init(Config *, struct unicode_data *, void *);
613 void term_free(Terminal *);
614 void term_size(Terminal *, int, int, int);
615 void term_out(Terminal *);
616 void term_paint(Terminal *, Context, int, int, int, int, int);
617 void term_scroll(Terminal *, int, int);
618 void term_pwron(Terminal *);
619 void term_clrsb(Terminal *);
620 void term_mouse(Terminal *, Mouse_Button, Mouse_Button, Mouse_Action,
621                 int,int,int,int,int);
622 void term_key(Terminal *, Key_Sym, wchar_t *, size_t, unsigned int,
623               unsigned int);
624 void term_deselect(Terminal *);
625 void term_update(Terminal *);
626 void term_invalidate(Terminal *);
627 int term_blink(Terminal *, int set_cursor);
628 void term_do_paste(Terminal *);
629 int term_paste_pending(Terminal *);
630 void term_paste(Terminal *);
631 void term_nopaste(Terminal *);
632 int term_ldisc(Terminal *, int option);
633 void term_copyall(Terminal *);
634 void term_reconfig(Terminal *, Config *);
635 void term_seen_key_event(Terminal *); 
636 size_t term_data(Terminal *, int is_stderr, const char *data, size_t len);
637 void term_provide_resize_fn(Terminal *term,
638                             void (*resize_fn)(void *, int, int),
639                             void *resize_ctx);
640 void term_provide_logctx(Terminal *term, void *logctx);
641 void term_copy(Terminal *term);
642 int term_selection_exists(Terminal *term);
643 int term_app_cursor_keys(Terminal *term); // fixme suck
644 void term_task(Terminal *);
645
646 /*
647  * Exports from ssh.c. (NB the getline variables have to be GLOBAL
648  * so that PuTTYtel will still compile - otherwise it would depend
649  * on ssh.c.)
650  */
651
652 GLOBAL int (*ssh_get_line) (const char *prompt, char *str, int maxlen,
653                             int is_pw);
654 GLOBAL int ssh_getline_pw_only;
655 extern Backend ssh_backend;
656
657 /*
658  * Exports from ldisc.c.
659  */
660 void *ldisc_create(Config *, Terminal *, Backend *, void *, void *);
661 void ldisc_free(void *);
662 void ldisc_send(void *handle, char *buf, ssize_t len, int interactive);
663
664 /*
665  * Exports from ldiscucs.c.
666  */
667 void lpage_send(void *, int codepage, char *buf, size_t len, int interactive);
668 void luni_send(void *, wchar_t * widebuf, size_t len, int interactive);
669
670 /*
671  * Exports from unicode.c.
672  */
673 #ifndef CP_UTF8
674 #define CP_UTF8 65001
675 #endif
676 /* void init_ucs(void); -- this is now in platform-specific headers */
677 int is_dbcs_leadbyte(int codepage, char byte);
678 size_t mb_to_wc(int codepage, int flags, char *mbstr, size_t mblen,
679                 wchar_t *wcstr, size_t wclen);
680 size_t wc_to_mb(int codepage, int flags, wchar_t *wcstr, size_t wclen,
681                 char *mbstr, size_t mblen, char *defchr, int *defused,
682                 struct unicode_data *ucsdata);
683 wchar_t xlat_uskbd2cyrllic(int ch);
684 int check_compose(int first, int second);
685 int decode_codepage(char *cp_name);
686 const char *cp_enumerate (int index);
687 const char *cp_name(int codepage);
688 void get_unitab(int codepage, wchar_t * unitab, int ftype);
689
690 /*
691  * Exports from wcwidth.c
692  */
693 int wcwidth(wchar_t ucs);
694 int wcswidth(const wchar_t *pwcs, size_t n);
695
696 /*
697  * Exports from printing.c.
698  */
699 typedef struct printer_enum_tag printer_enum;
700 typedef struct printer_job_tag printer_job;
701 printer_enum *printer_start_enum(int *nprinters);
702 char *printer_get_name(printer_enum *, int);
703 void printer_finish_enum(printer_enum *);
704 printer_job *printer_start_job(char *printer);
705 void printer_job_data(printer_job *, void *, size_t);
706 void printer_finish_job(printer_job *);
707
708 /*
709  * Exports from config.c.
710  */
711 struct controlbox;
712 void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
713                       int midsession, int protocol);
714
715 /*
716  * Miscellaneous exports from the platform-specific code.
717  */
718 char *get_username(void);              /* return value needs freeing */
719 char *get_random_data(int bytes);      /* used in cmdgen.c */
720
721 #endif