Reorganised the Unicode layer somewhat: moved luni_send and
[u/mdw/putty] / putty.h
diff --git a/putty.h b/putty.h
index 3594ceb..ba99aae 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -23,17 +23,6 @@ typedef struct terminal_tag Terminal;
 #include "puttyps.h"
 #include "network.h"
 
-/*
- * Global variables. Most modules declare these `extern', but
- * window.c will do `#define PUTTY_DO_GLOBALS' before including this
- * module, and so will get them properly defined.
- */
-#ifdef PUTTY_DO_GLOBALS
-#define GLOBAL
-#else
-#define GLOBAL extern
-#endif
-
 /* Three attribute types: 
  * The ATTRs (normal attributes) are stored with the characters in the main
  * display arrays
@@ -104,9 +93,6 @@ GLOBAL int alt_pressed;
 
 GLOBAL int session_closed;
 
-GLOBAL char *help_path;
-GLOBAL int help_has_contents;
-
 GLOBAL int nsessions;
 GLOBAL char **sessions;
 
@@ -188,28 +174,27 @@ enum {
 };
 
 struct backend_tag {
-    char *(*init) (void *frontend_handle,
+    char *(*init) (void *frontend_handle, void **backend_handle,
                   char *host, int port, char **realhost, int nodelay);
     /* back->send() returns the current amount of buffered data. */
-    int (*send) (char *buf, int len);
+    int (*send) (void *handle, char *buf, int len);
     /* back->sendbuffer() does the same thing but without attempting a send */
-    int (*sendbuffer) (void);
-    void (*size) (int width, int height);
-    void (*special) (Telnet_Special code);
-    Socket(*socket) (void);
-    int (*exitcode) (void);
-    int (*sendok) (void);
-    int (*ldisc) (int);
+    int (*sendbuffer) (void *handle);
+    void (*size) (void *handle, int width, int height);
+    void (*special) (void *handle, Telnet_Special code);
+    Socket(*socket) (void *handle);
+    int (*exitcode) (void *handle);
+    int (*sendok) (void *handle);
+    int (*ldisc) (void *handle, int);
+    void (*provide_ldisc) (void *handle, void *ldisc);
     /*
      * back->unthrottle() tells the back end that the front end
      * buffer is clearing.
      */
-    void (*unthrottle) (int);
+    void (*unthrottle) (void *handle, int);
     int default_port;
 };
 
-GLOBAL Backend *back;
-
 extern struct backend_list {
     int protocol;
     char *name;
@@ -398,8 +383,6 @@ GLOBAL Config cfg;
 GLOBAL int default_protocol;
 GLOBAL int default_port;
 
-GLOBAL Terminal *term;                /* temporary while changes are made */
-
 struct RSAKey;                        /* be a little careful of scope */
 
 /*
@@ -429,7 +412,8 @@ void beep(int);
 void begin_session(void);
 void sys_cursor(int x, int y);
 void request_paste(void);
-void frontend_keypress(void);
+void frontend_keypress(void *frontend);
+void ldisc_update(void *frontend, int echo, int edit);
 #define OPTIMISE_IS_SCROLL 1
 
 void set_iconic(int iconic);
@@ -488,6 +472,9 @@ void term_copyall(Terminal *);
 void term_reconfig(Terminal *);
 void term_seen_key_event(Terminal *); 
 int from_backend(void *, int is_stderr, char *data, int len);
+void term_provide_resize_fn(Terminal *term,
+                           void (*resize_fn)(void *, int, int),
+                           void *resize_ctx);
 
 /*
  * Exports from logging.c.
@@ -531,8 +518,14 @@ extern Backend ssh_backend;
 /*
  * Exports from ldisc.c.
  */
+void *ldisc_create(Terminal *, Backend *, void *, void *);
+void ldisc_send(void *handle, char *buf, int len, int interactive);
 
-extern void ldisc_send(char *buf, int len, int interactive);
+/*
+ * Exports from ldiscucs.c.
+ */
+void lpage_send(void *, int codepage, char *buf, int len, int interactive);
+void luni_send(void *, wchar_t * widebuf, int len, int interactive);
 
 /*
  * Exports from sshrand.c.
@@ -561,9 +554,12 @@ extern char ver[];
 #ifndef CP_UTF8
 #define CP_UTF8 65001
 #endif
-void init_ucs_tables(void);
-void lpage_send(int codepage, char *buf, int len, int interactive);
-void luni_send(wchar_t * widebuf, int len, int interactive);
+void init_ucs(void);
+int is_dbcs_leadbyte(int codepage, char byte);
+int mb_to_wc(int codepage, int flags, char *mbstr, int mblen,
+            wchar_t *wcstr, int wclen);
+int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
+            char *mbstr, int mblen, char *defchr, int *defused);
 wchar_t xlat_uskbd2cyrllic(int ch);
 int check_compose(int first, int second);
 int decode_codepage(char *cp_name);