]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - unix/unix.h
Event Log for Unix PuTTY. Doesn't yet allow X selection of its
[PuTTY.git] / unix / unix.h
1 #ifndef PUTTY_UNIX_H
2 #define PUTTY_UNIX_H
3
4 #include <stdio.h>                     /* for FILENAME_MAX */
5 #include "charset.h"
6
7 struct Filename {
8     char path[FILENAME_MAX];
9 };
10 #define f_open(filename, mode) ( fopen((filename).path, (mode)) )
11
12 struct FontSpec {
13     char name[256];
14 };
15
16 typedef void *Context;                 /* FIXME: probably needs changing */
17
18 extern Backend pty_backend;
19
20 /*
21  * Under GTK, we send MA_CLICK _and_ MA_2CLK, or MA_CLICK _and_
22  * MA_3CLK, when a button is pressed for the second or third time.
23  */
24 #define MULTICLICK_ONLY_EVENT 0
25
26 /*
27  * Under GTK, there is no context help available.
28  */
29 #define HELPCTX(x) P(NULL)
30 #define FILTER_KEY_FILES NULL          /* FIXME */
31
32 /*
33  * Under X, selection data must not be NUL-terminated.
34  */
35 #define SELECTION_NUL_TERMINATED 0
36
37 /*
38  * Under X, copying to the clipboard terminates lines with just LF.
39  */
40 #define SEL_NL { 10 }
41
42 /* Simple wraparound timer function */
43 unsigned long getticks(void);          /* based on gettimeofday(2) */
44 #define GETTICKCOUNT getticks
45 #define TICKSPERSEC 1000000            /* gettimeofday returns microseconds */
46 #define CURSORBLINK  450000            /* no standard way to set this */
47
48 #define WCHAR wchar_t
49 #define BYTE unsigned char
50
51 GLOBAL void *logctx;
52
53 /* Things pty.c needs from pterm.c */
54 char *get_x_display(void *frontend);
55 int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
56 long get_windowid(void *frontend);
57
58 /* Things gtkdlg.c needs from pterm.c */
59 void *get_window(void *frontend);      /* void * to avoid depending on gtk.h */
60
61 /* Things pterm.c needs from gtkdlg.c */
62 void fatal_message_box(void *window, char *msg);
63 void about_box(void);
64 void *eventlogstuff_new(void);
65 void showeventlog(void *estuff, void *parentwin);
66 void logevent_dlg(void *estuff, char *string);
67
68 /* Things pterm.c needs from {ptermm,uxputty}.c */
69 char *make_default_wintitle(char *hostname);
70 int process_nonoption_arg(char *arg, Config *cfg);
71
72 /* Things uxstore.c needs from pterm.c */
73 char *x_get_default(const char *key);
74
75 /* Things uxstore.c provides to pterm.c */
76 void provide_xrm_string(char *string);
77
78 /* The interface used by uxsel.c */
79 void uxsel_init(void);
80 typedef int (*uxsel_callback_fn)(int fd, int event);
81 void uxsel_set(int fd, int rwx, uxsel_callback_fn callback);
82 void uxsel_del(int fd);
83 int select_result(int fd, int event);
84 int first_fd(int *state, int *rwx);
85 int next_fd(int *state, int *rwx);
86 /* The following are expected to be provided _to_ uxsel.c by the frontend */
87 int uxsel_input_add(int fd, int rwx);  /* returns an id */
88 void uxsel_input_remove(int id);
89
90 /* uxcfg.c */
91 struct controlbox;
92 void unix_setup_config_box(struct controlbox *b, int midsession);
93
94 /*
95  * In the Unix Unicode layer, DEFAULT_CODEPAGE is a special value
96  * which causes mb_to_wc and wc_to_mb to call _libc_ rather than
97  * libcharset. That way, we can interface the various charsets
98  * supported by libcharset with the one supported by mbstowcs and
99  * wcstombs (which will be the character set in which stuff read
100  * from the command line or config files is assumed to be encoded).
101  */
102 #define DEFAULT_CODEPAGE 0xFFFF
103 #define CP_UTF8 CS_UTF8                /* from libcharset */
104
105 #define strnicmp strncasecmp
106 #define stricmp strcasecmp
107
108 /* BSD-semantics version of signal() */
109 void (*putty_signal(int sig, void (*func)(int)))(int);
110
111 /*
112  * Exports from unicode.c.
113  */
114 struct unicode_data;
115 int init_ucs(struct unicode_data *ucsdata,
116              char *line_codepage, int font_charset);
117
118 /*
119  * Spare function exported directly from uxnet.c.
120  */
121 int sk_getxdmdata(void *sock, unsigned long *ip, int *port);
122
123 #endif