Colin's const-fixing Patch Of Death. Seems to build fine on Windows
[u/mdw/putty] / unix / unix.h
CommitLineData
f7f27309 1#ifndef PUTTY_UNIX_H
2#define PUTTY_UNIX_H
3
9a30e26b 4#include <stdio.h> /* for FILENAME_MAX */
2dc6356a 5#include "charset.h"
6
9a30e26b 7struct Filename {
8 char path[FILENAME_MAX];
9};
10#define f_open(filename, mode) ( fopen((filename).path, (mode)) )
11
12struct FontSpec {
13 char name[256];
14};
15
f7f27309 16typedef void *Context; /* FIXME: probably needs changing */
17
1709795f 18extern Backend pty_backend;
19
e6346999 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/*
d9b15094 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/*
e6346999 33 * Under X, selection data must not be NUL-terminated.
34 */
35#define SELECTION_NUL_TERMINATED 0
36
0f351587 37/*
38 * Under X, copying to the clipboard terminates lines with just LF.
39 */
40#define SEL_NL { 10 }
41
f7f27309 42/* Simple wraparound timer function */
43unsigned long getticks(void); /* based on gettimeofday(2) */
44#define GETTICKCOUNT getticks
45#define TICKSPERSEC 1000000 /* gettimeofday returns microseconds */
215a9fd9 46#define CURSORBLINK 450000 /* no standard way to set this */
f7f27309 47
48#define WCHAR wchar_t
49#define BYTE unsigned char
50
a0e5ed33 51GLOBAL void *logctx;
52
e9aef757 53/* Things pty.c needs from pterm.c */
a8327734 54char *get_x_display(void *frontend);
55int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
7af753e6 56long get_windowid(void *frontend);
755a6d84 57
5bf9955d 58/* Things gtkdlg.c needs from pterm.c */
59void *get_window(void *frontend); /* void * to avoid depending on gtk.h */
60
3f935d5b 61/* Things pterm.c needs from gtkdlg.c */
56b9b9a7 62int do_config_box(const char *title, Config *cfg, int midsession);
3f935d5b 63void fatal_message_box(void *window, char *msg);
7718480a 64void about_box(void *window);
8eed910d 65void *eventlogstuff_new(void);
66void showeventlog(void *estuff, void *parentwin);
cbe2d68f 67void logevent_dlg(void *estuff, const char *string);
abb6895f 68int reallyclose(void *frontend);
3f935d5b 69
10705014 70/* Things pterm.c needs from {ptermm,uxputty}.c */
71char *make_default_wintitle(char *hostname);
46a3419b 72int process_nonoption_arg(char *arg, Config *cfg);
10705014 73
f5dd8adb 74/* pterm.c needs this special function in xkeysym.c */
75int keysym_to_unicode(int keysym);
76
faec60ed 77/* Things uxstore.c needs from pterm.c */
c85623f9 78char *x_get_default(const char *key);
faec60ed 79
0ac15bdc 80/* Things uxstore.c provides to pterm.c */
81void provide_xrm_string(char *string);
82
0ff9ea38 83/* The interface used by uxsel.c */
84void uxsel_init(void);
85typedef int (*uxsel_callback_fn)(int fd, int event);
86void uxsel_set(int fd, int rwx, uxsel_callback_fn callback);
87void uxsel_del(int fd);
c5e438ec 88int select_result(int fd, int event);
0ff9ea38 89int first_fd(int *state, int *rwx);
90int next_fd(int *state, int *rwx);
74aca06d 91/* The following are expected to be provided _to_ uxsel.c by the frontend */
92int uxsel_input_add(int fd, int rwx); /* returns an id */
93void uxsel_input_remove(int id);
c5e438ec 94
1d0d4a3b 95/* uxcfg.c */
96struct controlbox;
7718480a 97void unix_setup_config_box(struct controlbox *b, int midsession, void *window);
1d0d4a3b 98
2dc6356a 99/*
100 * In the Unix Unicode layer, DEFAULT_CODEPAGE is a special value
101 * which causes mb_to_wc and wc_to_mb to call _libc_ rather than
102 * libcharset. That way, we can interface the various charsets
103 * supported by libcharset with the one supported by mbstowcs and
104 * wcstombs (which will be the character set in which stuff read
105 * from the command line or config files is assumed to be encoded).
106 */
107#define DEFAULT_CODEPAGE 0xFFFF
108#define CP_UTF8 CS_UTF8 /* from libcharset */
f7f27309 109
68a49acb 110#define strnicmp strncasecmp
111#define stricmp strcasecmp
112
0f33f9d1 113/* BSD-semantics version of signal() */
114void (*putty_signal(int sig, void (*func)(int)))(int);
115
facd762c 116/*
117 * Exports from unicode.c.
118 */
21d2b241 119struct unicode_data;
120int init_ucs(struct unicode_data *ucsdata,
3900c2d6 121 char *line_codepage, int font_charset, int vtmode);
facd762c 122
2f92b717 123/*
124 * Spare function exported directly from uxnet.c.
125 */
126int sk_getxdmdata(void *sock, unsigned long *ip, int *port);
127
f7f27309 128#endif