f7f27309 |
1 | #ifndef PUTTY_UNIX_H |
2 | #define PUTTY_UNIX_H |
3 | |
76d3a838 |
4 | #ifdef HAVE_CONFIG_H |
5 | # include "uxconfig.h" /* Space to hide it from mkfiles.pl */ |
6 | #endif |
7 | |
9a30e26b |
8 | #include <stdio.h> /* for FILENAME_MAX */ |
b3d375b2 |
9 | #include <stdint.h> /* C99 int types */ |
10 | #ifndef NO_LIBDL |
11 | #include <dlfcn.h> /* Dynamic library loading */ |
12 | #endif /* NO_LIBDL */ |
2dc6356a |
13 | #include "charset.h" |
14 | |
9a30e26b |
15 | struct Filename { |
962468d4 |
16 | char *path; |
9a30e26b |
17 | }; |
962468d4 |
18 | FILE *f_open(const struct Filename *, char const *, int); |
9a30e26b |
19 | |
20 | struct FontSpec { |
ae62eaeb |
21 | char *name; /* may be "" to indicate no selected font at all */ |
9a30e26b |
22 | }; |
ae62eaeb |
23 | struct FontSpec *fontspec_new(const char *name); |
9a30e26b |
24 | |
f7f27309 |
25 | typedef void *Context; /* FIXME: probably needs changing */ |
26 | |
f7f9fb5c |
27 | typedef int OSSocket; |
28 | #define OSSOCKET_DEFINED /* stop network.h using its default */ |
29 | |
1709795f |
30 | extern Backend pty_backend; |
31 | |
b3d375b2 |
32 | typedef uint32_t uint32; /* C99: uint32_t defined in stdint.h */ |
33 | #define PUTTY_UINT32_DEFINED |
34 | |
e6346999 |
35 | /* |
36 | * Under GTK, we send MA_CLICK _and_ MA_2CLK, or MA_CLICK _and_ |
37 | * MA_3CLK, when a button is pressed for the second or third time. |
38 | */ |
39 | #define MULTICLICK_ONLY_EVENT 0 |
40 | |
41 | /* |
d9b15094 |
42 | * Under GTK, there is no context help available. |
43 | */ |
44 | #define HELPCTX(x) P(NULL) |
45 | #define FILTER_KEY_FILES NULL /* FIXME */ |
1e00c92b |
46 | #define FILTER_DYNLIB_FILES NULL /* FIXME */ |
d9b15094 |
47 | |
48 | /* |
e6346999 |
49 | * Under X, selection data must not be NUL-terminated. |
50 | */ |
51 | #define SELECTION_NUL_TERMINATED 0 |
52 | |
0f351587 |
53 | /* |
54 | * Under X, copying to the clipboard terminates lines with just LF. |
55 | */ |
56 | #define SEL_NL { 10 } |
57 | |
f7f27309 |
58 | /* Simple wraparound timer function */ |
59 | unsigned long getticks(void); /* based on gettimeofday(2) */ |
60 | #define GETTICKCOUNT getticks |
39934deb |
61 | #define TICKSPERSEC 1000 /* we choose to use milliseconds */ |
62 | #define CURSORBLINK 450 /* no standard way to set this */ |
f7f27309 |
63 | |
64 | #define WCHAR wchar_t |
65 | #define BYTE unsigned char |
66 | |
f7397dc6 |
67 | /* |
68 | * Unix-specific global flag |
69 | * |
70 | * FLAG_STDERR_TTY indicates that standard error might be a terminal and |
71 | * might get its configuration munged, so anything trying to output plain |
72 | * text (i.e. with newlines in it) will need to put it back into cooked |
73 | * mode first. Applications setting this flag should also call |
74 | * stderr_tty_init() before messing with any terminal modes, and can call |
75 | * premsg() before outputting text to stderr and postmsg() afterwards. |
76 | */ |
77 | #define FLAG_STDERR_TTY 0x1000 |
78 | |
e9aef757 |
79 | /* Things pty.c needs from pterm.c */ |
a8327734 |
80 | char *get_x_display(void *frontend); |
81 | int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */ |
7af753e6 |
82 | long get_windowid(void *frontend); |
755a6d84 |
83 | |
5bf9955d |
84 | /* Things gtkdlg.c needs from pterm.c */ |
85 | void *get_window(void *frontend); /* void * to avoid depending on gtk.h */ |
86 | |
3f935d5b |
87 | /* Things pterm.c needs from gtkdlg.c */ |
4a693cfc |
88 | int do_config_box(const char *title, Conf *conf, |
f89c3294 |
89 | int midsession, int protcfginfo); |
3f935d5b |
90 | void fatal_message_box(void *window, char *msg); |
7718480a |
91 | void about_box(void *window); |
8eed910d |
92 | void *eventlogstuff_new(void); |
93 | void showeventlog(void *estuff, void *parentwin); |
cbe2d68f |
94 | void logevent_dlg(void *estuff, const char *string); |
abb6895f |
95 | int reallyclose(void *frontend); |
3f935d5b |
96 | |
10705014 |
97 | /* Things pterm.c needs from {ptermm,uxputty}.c */ |
98 | char *make_default_wintitle(char *hostname); |
4a693cfc |
99 | int process_nonoption_arg(char *arg, Conf *conf, int *allow_launch); |
10705014 |
100 | |
f5dd8adb |
101 | /* pterm.c needs this special function in xkeysym.c */ |
102 | int keysym_to_unicode(int keysym); |
103 | |
faec60ed |
104 | /* Things uxstore.c needs from pterm.c */ |
c85623f9 |
105 | char *x_get_default(const char *key); |
faec60ed |
106 | |
0ac15bdc |
107 | /* Things uxstore.c provides to pterm.c */ |
108 | void provide_xrm_string(char *string); |
109 | |
f7397dc6 |
110 | /* Things provided by uxcons.c */ |
111 | struct termios; |
112 | void stderr_tty_init(void); |
113 | void premsg(struct termios *); |
114 | void postmsg(struct termios *); |
115 | |
0ff9ea38 |
116 | /* The interface used by uxsel.c */ |
117 | void uxsel_init(void); |
118 | typedef int (*uxsel_callback_fn)(int fd, int event); |
119 | void uxsel_set(int fd, int rwx, uxsel_callback_fn callback); |
120 | void uxsel_del(int fd); |
c5e438ec |
121 | int select_result(int fd, int event); |
0ff9ea38 |
122 | int first_fd(int *state, int *rwx); |
123 | int next_fd(int *state, int *rwx); |
74aca06d |
124 | /* The following are expected to be provided _to_ uxsel.c by the frontend */ |
125 | int uxsel_input_add(int fd, int rwx); /* returns an id */ |
126 | void uxsel_input_remove(int id); |
c5e438ec |
127 | |
1d0d4a3b |
128 | /* uxcfg.c */ |
129 | struct controlbox; |
8a7f1392 |
130 | void unix_setup_config_box(struct controlbox *b, int midsession, int protocol); |
1d0d4a3b |
131 | |
8d68f26a |
132 | /* gtkcfg.c */ |
133 | void gtk_setup_config_box(struct controlbox *b, int midsession, void *window); |
134 | |
2dc6356a |
135 | /* |
136 | * In the Unix Unicode layer, DEFAULT_CODEPAGE is a special value |
137 | * which causes mb_to_wc and wc_to_mb to call _libc_ rather than |
138 | * libcharset. That way, we can interface the various charsets |
139 | * supported by libcharset with the one supported by mbstowcs and |
140 | * wcstombs (which will be the character set in which stuff read |
141 | * from the command line or config files is assumed to be encoded). |
142 | */ |
143 | #define DEFAULT_CODEPAGE 0xFFFF |
144 | #define CP_UTF8 CS_UTF8 /* from libcharset */ |
f7f27309 |
145 | |
68a49acb |
146 | #define strnicmp strncasecmp |
147 | #define stricmp strcasecmp |
148 | |
15b5d988 |
149 | /* BSD-semantics version of signal(), and another helpful function */ |
0f33f9d1 |
150 | void (*putty_signal(int sig, void (*func)(int)))(int); |
15b5d988 |
151 | void block_signal(int sig, int block_it); |
0f33f9d1 |
152 | |
db9b7dce |
153 | /* uxmisc.c */ |
154 | int cloexec(int); |
155 | |
facd762c |
156 | /* |
157 | * Exports from unicode.c. |
158 | */ |
21d2b241 |
159 | struct unicode_data; |
6ac7f054 |
160 | int init_ucs(struct unicode_data *ucsdata, char *line_codepage, |
161 | int utf8_override, int font_charset, int vtmode); |
facd762c |
162 | |
2f92b717 |
163 | /* |
164 | * Spare function exported directly from uxnet.c. |
165 | */ |
0a4022a1 |
166 | void *sk_getxdmdata(void *sock, int *lenp); |
2f92b717 |
167 | |
b51259f6 |
168 | /* |
43a1c4a4 |
169 | * Function provided by front ends, and called by uxnet.c to indicate |
170 | * that net_pending_errors() would like to be called back when the |
171 | * front end has a spare moment and isn't deep in any other recursion. |
172 | */ |
173 | void frontend_net_error_pending(void); |
174 | |
175 | /* |
b51259f6 |
176 | * General helpful Unix stuff: more helpful version of the FD_SET |
177 | * macro, which also handles maxfd. |
178 | */ |
179 | #define FD_SET_MAX(fd, max, set) do { \ |
180 | FD_SET(fd, &set); \ |
181 | if (max < fd + 1) max = fd + 1; \ |
182 | } while (0) |
183 | |
aef05b78 |
184 | /* |
185 | * Exports from winser.c. |
186 | */ |
187 | extern Backend serial_backend; |
188 | |
f7f27309 |
189 | #endif |