NetSurf
misc.h
Go to the documentation of this file.
1/*
2 * Copyright 2010 Ole Loots <ole@monochrom.net>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef NS_ATARI_MISC_H
20#define NS_ATARI_MISC_H
21
22
23#define SBUF8_TO_LBUF8(sbuf,lbuf)\
24 lbuf[0] = (long)sbuf[0];\
25 lbuf[1] = (long)sbuf[1];\
26 lbuf[2] = (long)sbuf[2];\
27 lbuf[3] = (long)sbuf[3];\
28 lbuf[4] = (long)sbuf[4];\
29 lbuf[5] = (long)sbuf[5];\
30 lbuf[6] = (long)sbuf[6];\
31 lbuf[7] = (long)sbuf[7];
32
33#define RECT_TO_GRECT(r,g) \
34 do { \
35 (g)->g_x = (r->x0 < r->x1) ? r->x0 : r->x1 ; \
36 (g)->g_y = (r->y0 < r->y1) ? r->y0 : r->y1 ; \
37 (g)->g_w = (r->x0 < r->x1) ? r->x1 - r->x0 : r->x0 - r->x1 ; \
38 (g)->g_h = (r->y0 < r->y1) ? r->y1 - r->y0 : r->y0 - r->y1 ; \
39 } while(0)
40
41
42
43/* Modes for find_gui_window: */
44#define BY_WINDOM_HANDLE 0x0
45#define BY_GEM_HANDLE 0x1
46
47/**
48 */
49typedef int (*scan_process_callback)(int pid, void *data);
50
51/**
52 */
53struct gui_window * find_guiwin_by_aes_handle(short handle);
54
55/**
56 */
57bool is_process_running(const char * name);
58
59/**
60 */
62
63/**
64 */
65void dbg_grect(const char * str, GRECT * r);
66
67/**
68 */
69void dbg_pxy(const char * str, short * pxy);
70
71/**
72 */
73void dbg_rect(const char * str, int * pxy);
74
75/**
76 */
77const char * file_select(const char * title, const char * name);
78
79/**
80 * Convert NKC to netsurf input key code and/or to ucs4 (depends on keycode).
81 *
82 * \param[in] nkc atari normalized key code
83 * \param[out] ucs4_out The ucs4 converted keycode
84 * \return The netsurf input keycode or 0 and ucs4_out updated with
85 * the NKC converted to UC4 encoding.
86 */
87long nkc_to_input_key(short nkc, long * ucs4_out);
88
89/**
90 * Cause an abnormal program termination.
91 *
92 * \note This never returns and is intended to terminate without any cleanup.
93 *
94 * \param error The message to display to the user.
95 */
96void die(const char * const error) __attribute__ ((noreturn));
97
98/**
99 * Warn the user of an event.
100 *
101 * \param[in] warning A warning looked up in the message translation table
102 * \param[in] detail Additional text to be displayed or NULL.
103 * \return NSERROR_OK on success or error code if there was a
104 * faliure displaying the message to the user.
105 */
106nserror atari_warn_user(const char *warning, const char *detail);
107
108#endif
static const __attribute__((used))
Definition: gui.c:358
nserror
Enumeration of error codes.
Definition: errors.h:29
void dbg_pxy(const char *str, short *pxy)
Definition: misc.c:394
void dbg_grect(const char *str, GRECT *r)
Definition: misc.c:388
const char * file_select(const char *title, const char *name)
Show default file selector.
Definition: misc.c:363
bool is_process_running(const char *name)
Definition: misc.c:186
void gem_set_cursor(MFORM_EX *cursor)
Definition: misc.c:196
void die(const char *const error) __attribute__((noreturn))
Cause an abnormal program termination.
Definition: misc.c:69
nserror atari_warn_user(const char *warning, const char *detail)
Warn the user of an event.
Definition: misc.c:56
void dbg_rect(const char *str, int *pxy)
Definition: misc.c:400
int(* scan_process_callback)(int pid, void *data)
Definition: misc.h:49
long nkc_to_input_key(short nkc, long *ucs4_out)
Convert NKC to netsurf input key code and/or to ucs4 (depends on keycode).
Definition: misc.c:213
struct gui_window * find_guiwin_by_aes_handle(short handle)
Definition: misc.c:77
first entry in window list
Definition: gui.c:296
MFORM_EX * cursor
Definition: gui.h:150
char * title
Definition: gui.h:153
Definition: gui.h:54