summaryrefslogtreecommitdiff
path: root/emu/Nt/ieplugin.h
blob: bb8db90c3e9121441e4804fdeb96806bc2a68e09 (plain)
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
typedef struct Pop Pop;
typedef struct Iop Iop;
typedef struct IPoint IPoint;
typedef struct IRectangle IRectangle;
typedef struct Plugin Plugin;

enum {
	// messages from Plugin to Inferno
	Pgfxkey,
	Pmouse,

	// message from Inferno to Plugin
	Iattachscr,
	Iflushscr,
	Isetcur,
	Idrawcur,
	Iquit,
};

struct Pop {
	int	op;
	union {
		int key;			// Pgfxkey
		struct {
			int	x;
			int	y;
			int	b;
			int	modify;
		} m;				// Pmouse
	} u;
};

struct IPoint
{
	LONG	x;
	LONG	y;
};

struct IRectangle
{
	IPoint	min;
	IPoint	max;
};

struct Iop {
	int	op;
	int	val;
	union {
		IRectangle	r;		// Iflushscr
		// need additional support for Isetcur & Idrawcur
	} u;
};
#define PI_NCLOSE	2

struct Plugin {
	LONG sz;				// size of this data struct (including screen mem)
	HANDLE	conin;		// console input (from plugin) - never NULL
	HANDLE	conout;		// console output (to plugin) - can be NULL
	HANDLE	datain;		// #C data file for initialisation (HACK!)
	HANDLE	dopop;		// new Pop available
	HANDLE	popdone;		// acknowledgement of Pop
	HANDLE	doiop;		// new Iop available
	HANDLE	iopdone;		// acknowledgement of Iop
	HANDLE	closehandles[PI_NCLOSE];
	Pop pop;
	Iop iop;
	int Xsize;				// screen dimensions
	int Ysize;
	ULONG cdesc;			// display chans descriptor
	int cflag;
	ULONG screen[1];
};

#define IOP	(plugin->iop)
#define POP	(plugin->pop)