-
Notifications
You must be signed in to change notification settings - Fork 1
/
cpx.h
314 lines (267 loc) · 7.81 KB
/
cpx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/*
* COPS (c) 1995 - 2003 Sven & Wilfried Behne
* 2004 F.Naumann & O.Skancke
*
* A XCONTROL compatible CPX manager.
*
* This file is part of COPS.
*
* COPS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* COPS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XaAES; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _cpx_h
#define _cpx_h
#include <setjmp.h>
#include <gemx.h>
#include "global.h"
#define PH_MAGIC 0x601a /* Magic des Programmheaders */
struct program_header
{
short ph_branch;
long ph_tlen;
long ph_dlen;
long ph_blen;
long ph_slen;
long ph_res1;
long ph_prgflags;
short ph_absflag;
};
struct foobar
{
short dummy;
short *image;
};
struct cl_segm
{
void *text_seg;
long len_text;
void *data_seg;
long len_data;
void *bss_seg;
long len_bss;
};
struct cpxhead
{
unsigned short magic;
unsigned short flags;
#define CPX_SETONLY 0x0001 /* Set Only CPX Flag */
#define CPX_BOOTINIT 0x0002 /* Boot Initialization Flag */
#define CPX_RESIDENT 0x0004 /* RAM Resident Flag */
#define CPX_WAS_RESIDENT 0x8000 /* used internally by config.cpx */
long cpx_id;
unsigned short cpx_version;
char i_text[14];
unsigned short icon[48];
struct
{
unsigned i_color: 4;
unsigned reserved: 4;
unsigned i_char: 8;
} i_info;
char title_txt[18];
struct
{
unsigned c_board: 4;
unsigned c_text: 4;
unsigned pattern: 4;
unsigned c_back: 4;
} t_info;
char buffer[64];
char reserved[306];
};
/* Mausparameter */
typedef struct
{
_WORD x;
_WORD y;
_WORD buttons;
_WORD kstate;
} MRETS;
/* Struktur zur Verwaltung von CPX-Modulen */
struct cpxlist
{
char f_name[14];
short head_ok;
short segm_ok;
struct cl_segm *segm;
struct cpxlist *next;
struct cpxhead header;
};
/*
* exported functions to cpx (xcontrol parameter block)
*
* 32bit clean
*/
/* helper structs for 16bit argument alignment */
struct rsh_fix_args
{
short num_objs; short num_frstr; short num_frimg; short num_tree;
OBJECT *rs_object; TEDINFO *rs_tedinfo; char **rs_strings; ICONBLK *rs_iconblk;
BITBLK *rs_bitblk; long *rs_frstr; long *rs_frimg; long *rs_trindex; struct foobar *rs_imdope;
};
struct rsh_obfix_args
{
OBJECT *tree; short ob;
};
struct Popup_args
{
char **items; short no_items; short slct; short font; GRECT *up; GRECT *world;
};
struct Sl_size_args
{
OBJECT *tree; short base; short slider;
short num_items; short visible; short direction; short min_size;
};
struct Sl_xy_args
{
OBJECT *tree; _WORD base; _WORD slider; _WORD value;
_WORD min; _WORD max; void _cdecl (*userdef)(void);
};
struct Sl_arrow_args
{
OBJECT *tree; _WORD base; _WORD slider; _WORD obj; _WORD inc;
_WORD min; _WORD max; _WORD *value; _WORD direction; void _cdecl (*userdef)(void);
};
struct Sl_dragxy_args
{
OBJECT *tree; _WORD base; short slider;
_WORD min; _WORD max; _WORD *value; void _cdecl (*userdef)(void);
};
struct Xform_do_args
{
OBJECT *tree; _WORD edit_obj; _WORD *msg;
};
struct Set_Evnt_Mask_args
{
_WORD mask; MOBLK *m1; MOBLK *m2; long evtime;
};
struct XGen_Alert_args
{
_WORD alert_id;
};
struct MFsave_args
{
_WORD flag; MFORM *mf;
};
struct xcpb
{
short handle;
short booting;
short reserved;
short SkipRshFix;
struct cpxlist *_cdecl (*get_cpx_list)(void);
short _cdecl (*save_header)(struct cpxlist *header);
void _cdecl (*rsh_fix)(struct rsh_fix_args);
void _cdecl (*rsh_obfix)(struct rsh_obfix_args);
short _cdecl (*Popup)(struct Popup_args);
void _cdecl (*Sl_size)(struct Sl_size_args);
void _cdecl (*Sl_x)(struct Sl_xy_args);
void _cdecl (*Sl_y)(struct Sl_xy_args);
void _cdecl (*Sl_arrow)(struct Sl_arrow_args);
void _cdecl (*Sl_dragx)(struct Sl_dragxy_args);
void _cdecl (*Sl_dragy)(struct Sl_dragxy_args);
short _cdecl (*Xform_do)(struct Xform_do_args);
GRECT * _cdecl (*GetFirstRect)(GRECT *prect);
GRECT * _cdecl (*GetNextRect)(void);
void _cdecl (*Set_Evnt_Mask)(struct Set_Evnt_Mask_args);
short _cdecl (*XGen_Alert)(struct XGen_Alert_args);
short _cdecl (*CPX_Save)(void *ptr, long bytes);
void * _cdecl (*Get_Buffer)(void);
short _cdecl (*getcookie)(long cookie, long *p_value);
short Country_Code;
void _cdecl (*MFsave)(struct MFsave_args);
};
/*
* CPX interface entry points
*
* 32bit clean
*/
typedef struct
{
short _cdecl (*cpx_call)(GRECT *rect, DIALOG * /* COPS extension */);
void _cdecl (*cpx_draw)(GRECT *clip);
void _cdecl (*cpx_wmove)(GRECT *work);
void _cdecl (*cpx_timer)(short *quit);
void _cdecl (*cpx_key)(short kstate, short key, short *quit);
void _cdecl (*cpx_button)(MRETS *mrets, short nclicks, short *quit);
void _cdecl (*cpx_m1)(MRETS *mrets, short *quit);
void _cdecl (*cpx_m2)(MRETS *mrets, short *quit);
short _cdecl (*cpx_hook)(_WORD event, _WORD *msg, MRETS *mrets, _WORD *key, _WORD *nclicks);
void _cdecl (*cpx_close)(short flag);
} CPXINFO;
/* Documented alert message numbers for XGen_Alert */
#define XAL_SAVE_DEFAULTS 0
#define XAL_MEM_ERR 1
#define XAL_FILE_ERR 2
#define XAL_FILE_NOT_FOUND 3
/* Undocumented alert message numbers for XGen_Alert */
#define XAL_NO_NODES_ERR 4
#define XAL_RELOAD_CPXS 5
#define XAL_UNLOAD_CPX 6
#define XAL_NO_RELOAD 7
#define XAL_SAVE_HEADER 8
#define XAL_FILE_NOT_CPX 9
#define XAL_NO_SOUND_DMA 10 /* used by sound.cpx/fsound.cpx */
#define XAL_SHUTDOWN 11
#define MFSAVE 1
#define MFRESTORE 0
#ifndef CT_KEY
#define CT_KEY 53
#endif
#define CPXD_INVALID 0x8000 /* signalisiert ungueltigen CPX_DESC-Eintrag */
#define CPXD_AUTOSTART 0x0002
#define CPXD_INACTIVE 0x0001
typedef struct cpx_desc
{
struct cpx_desc *next; /* Zeiger auf die naechste CPX-Beschreibung oder 0L */
void *start_of_cpx; /* Startadresse des CPX im Speicher */
void *end_of_cpx; /* Endadresse des CPX im Speicher */
jmp_buf jb; /* longjmp buffer for interrupted Xform_do */
char *stack; /* temporary malloced() stack */
CPXINFO *info; /* Zeiger auf CPXINFO-Struktur die bei cpx_call() zurueckgeliefert wird */
DIALOG *dialog; /* Zeiger auf die Dialogbeschreibung oder 0L, wenn das CPX nicht offen ist */
OBJECT *tree; /* ist bei Form-CPX 0L, bis cpx_form_do() aufgerufen wird */
_WORD whdl; /* Handle des Dialogfensters */
_WORD window_x; /* Position des Dialogfensters */
_WORD window_y;
short is_evnt_cpx; /* 0: Form-CPX 1: Event-CPX */
_WORD button; /* wird von handle_form_cpx() zurueckgeliefert */
_WORD *msg; /* Zeiger auf den bei Xform_do() uebergebenen Messagebuffer */
_WORD edit_obj;
_WORD cursor_idx;
BOOLEAN cursor;
short obfix_cnt;
_WORD box_width;
_WORD box_height;
GRECT size; /* Dialogausmasse und -position */
OBJECT empty_tree[2]; /* IBOX fuer leeren Objektbaum am Anfang,
wegen WDIALOG-Fehler aus 2 Objekten bestehend */
struct cl_segm segm;
_WORD icon_x; /* Iconposition innerhalb des Hauptfensters */
_WORD icon_y;
int selected;
short flags;
/* cpx read/write accessible data */
GRECT redraw_area; /* Bereich den ein CPX nach WM_REDRAW neuzeichnen soll */
GRECT dirty_area; /* Bereich eines neuzuzeichnenden Rechtecks */
short mask; /* zusaetzliche Ereignismaske fuer evnt_multi() */
MOBLK m1; /* Mausrechteck fuer evnt_multi() */
MOBLK m2; /* Mausrechteck fuer evnt_multi() */
long time; /* Timerintervall fuer evnt_multi() */
struct cpxlist old; /* Beschreibung fuer get_cpx_list */
struct xcpb xctrl_pb; /* Parameterblock fuer das CPX */
/* cpx name */
char file_name[0];
} CPX_DESC;
#endif /* _cpx_h */