summaryrefslogtreecommitdiff
path: root/appl/acme/dat.m
blob: 66a0f59299dceee393a63fd4f20ff5801d33183a (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
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
Dat : module {
	PATH : con "/dis/acme/dat.dis";

	init : fn(mods : ref Mods);

	Mods : adt {
		sys : Sys;
		bufio : Bufio;
		draw : Draw;
		styx : Styx;
		styxaux : Styxaux;
		acme : Acme;
		gui : Gui;
		graph : Graph;
		dat : Dat;
		framem : Framem;
		utils : Utils;
		regx : Regx;
		scroll : Scroll;
		textm : Textm;
		filem : Filem;
		windowm : Windowm;
		rowm : Rowm;
		columnm : Columnm;
		bufferm : Bufferm;
		diskm : Diskm;
		exec : Exec;
		look : Look;
		timerm : Timerm;
		fsys : Fsys;
		xfidm : Xfidm;
		plumbmsg : Plumbmsg;
		edit: Edit;
		editlog: Editlog;
		editcmd: Editcmd;
	};

	SZSHORT : con 2;
	SZINT : con 4;

	FALSE, TRUE, XXX : con iota;

	EM_NORMAL, EM_RAW, EM_MASK : con iota;

	Qdir,Qacme,Qcons,Qconsctl,Qdraw,Qeditout,Qindex,Qlabel,Qnew,QWaddr,QWbody,QWconsctl,QWctl,QWdata,QWeditout,QWevent,QWrdsel,QWwrsel,QWtag,QMAX : con iota;

	Blockincr : con 256;
	Maxblock : con 8*1024;
	NRange : con 10;
	Infinity : con 16r7fffffff; 	# huge value for regexp address

	# fbufalloc() guarantees room off end of BUFSIZE
	MAXRPC : con 8192+Styx->IOHDRSZ;
	BUFSIZE : con MAXRPC;
	EVENTSIZE : con 256;
	PLUMBSIZE : con 1024;
	Scrollwid : con 12;	# width of scroll bar
	Scrollgap : con 4;	# gap right of scroll bar
	Margin : con 4;		# margin around text
	Border : con 2;		#  line between rows, cols, windows
	Maxtab : con 4;		# size of a tab, in units of the '0' character
	
	Empty: con 0;
	Null : con '-';
	Delete : con 'd';
	Insert : con 'i';
	Replace: con 'r';
	Filename : con 'f';

	# editing
	Inactive, Inserting, Collecting: con iota;

	# alphabets
	ALPHA_LATIN: con '\0';
	ALPHA_GREEK: con '*';
	ALPHA_CYRILLIC: con '@';

	Astring : adt {
		s : string;
	};

	Lock : adt {
		cnt : int;
		chann : chan of int;

		init : fn() : ref Lock;
		lock : fn(l : self ref Lock);
		unlock : fn(l : self ref Lock);
		locked : fn(l : self ref Lock) : int;
	};

# 	Lockx : adt {
#		sem : ref Lock->Semaphore;
#
#		init : fn() : ref Lockx;
#		lock : fn(l : self ref Lockx);
#		unlock : fn(l : self ref Lockx);
#	};

	Ref : adt {
		l : ref Lock;
		cnt : int;

		init : fn() : ref Ref;
		inc : fn(r : self ref Ref) : int;
		dec : fn(r : self ref Ref) : int;
		refx : fn(r : self ref Ref) : int;
	};

	Runestr : adt {
		r: string;
		nr: int;
	};

	Range : adt {
		q0 : int;
		q1 : int;
	};

	Block : adt {
		addr : int;			# disk address in bytes
		n : int;			# number of used runes in block
		next : cyclic ref Block;	# pointer to next in free list
	};

	Timer : adt {
		dt : int;
		c : chan of int;
		next : cyclic ref Timer;
	};

	Command : adt {
		pid : int;
		name : string;
		text : string;
		av : list of string;
		iseditcmd: int;
		md : ref Mntdir;
		next : cyclic ref Command;
	};

	Dirtab : adt {
		name : string;
		qtype : int;
		qid : int;
		perm : int;
	};

	Mntdir : adt {
		id : int;
		refs : int;
		dir : string;
		ndir : int;
		next : cyclic ref Mntdir;
		nincl : int;
		incl : array of string;
	};

	Fid : adt {
		fid : int;
		busy : int;
		open : int;
		qid : Sys->Qid;
		w : cyclic ref Windowm->Window;
		dir : array of Dirtab;
		next : cyclic ref Fid;
		mntdir : ref Mntdir;
		nrpart : int;
		rpart : array of byte;
	};

	Rangeset : type array of Range;

	Expand : adt {
		q0 : int;
		q1 : int;
		name : string;
		bname : string;
		jump : int;
		at : ref Textm->Text;
		ar : string;
		a0 : int;
		a1 : int;
	};

	Dirlist : adt {
		r : string;
		wid : int;
	};

	Reffont : adt {
		r : ref Ref;
		f : ref Draw->Font;

		get : fn(p : int, q : int, r : int, b : string) : ref Reffont;
		close : fn(r : self ref Reffont);
	};

	Cursor : adt {
		hot : Draw->Point;
		size : Draw->Point;
		bits : array of byte;
	};

	Smsg0 : adt {
		msize : int;
		version : string;
		iounit: int;
		qid : Sys->Qid;
		count : int;
		data : array of byte;
		stat : Sys->Dir;
		qids: array of Sys->Qid;
	};

	# loadfile function ptr

	BUFL, READL: con iota;

	# allwindows pick type

	Looper: adt{
		cp: ref Edit->Cmd;
		XY: int;
		w: array of ref Windowm->Window;
		nw: int;
	};	# only one; X and Y can't nest

	Tofile: adt {
		f: ref Filem->File;
		r: ref Edit->String;
	};

	Filecheck: adt{
		f: ref Filem->File;
		r: string;
		nr: int;
	};

	Allwin: adt{
		pick{
			LP => lp: ref Looper;
			FF => ff: ref Tofile;
			FC => fc: ref Filecheck;
		}
	};

	seq : int;
	maxtab : int;
	mouse : ref Draw->Pointer;
	reffont : ref Reffont;
	modbutton : ref Draw->Image;
	colbutton : ref Draw->Image;
	button : ref Draw->Image;
	arrowcursor, boxcursor : ref Cursor;
	row : ref Rowm->Row;
	disk : ref Diskm->Disk;
	seltext : ref Textm->Text;
	argtext : ref Textm->Text;
	mousetext : ref Textm->Text; 	# global because Text.close needs to clear it
	typetext : ref Textm->Text;		# ditto
	barttext : ref Textm->Text;		# shared between mousetask and keyboardtask
	bartflag : int;
	activewin : ref Windowm->Window;
	activecol : ref Columnm->Column;
	nullrect : Draw->Rect;
	home : string;
	plumbed : int;

	ckeyboard : chan of int;
	cmouse : chan of ref Draw->Pointer;
	cwait : chan of string;
	ccommand : chan of ref Command;
	ckill : chan of string;
	cxfidalloc : chan of ref Xfidm->Xfid;
	cxfidfree : chan of ref Xfidm->Xfid;
	cerr : chan of string;
	cplumb : chan of ref Plumbmsg->Msg;
	cedit: chan of int;
};