xref: /inferno-os/appl/acme/dat.m (revision 534d134e39305c47df7381629326a008baf1b335)
1Dat : module {
2	PATH : con "/dis/acme/dat.dis";
3
4	init : fn(mods : ref Mods);
5
6	Mods : adt {
7		sys : Sys;
8		bufio : Bufio;
9		draw : Draw;
10		styx : Styx;
11		styxaux : Styxaux;
12		acme : Acme;
13		gui : Gui;
14		graph : Graph;
15		dat : Dat;
16		framem : Framem;
17		utils : Utils;
18		regx : Regx;
19		scroll : Scroll;
20		textm : Textm;
21		filem : Filem;
22		windowm : Windowm;
23		rowm : Rowm;
24		columnm : Columnm;
25		bufferm : Bufferm;
26		diskm : Diskm;
27		exec : Exec;
28		look : Look;
29		timerm : Timerm;
30		fsys : Fsys;
31		xfidm : Xfidm;
32		plumbmsg : Plumbmsg;
33		edit: Edit;
34		editlog: Editlog;
35		editcmd: Editcmd;
36	};
37
38	SZSHORT : con 2;
39	SZINT : con 4;
40
41	FALSE, TRUE, XXX : con iota;
42
43	EM_NORMAL, EM_RAW, EM_MASK : con iota;
44
45	Qdir,Qacme,Qcons,Qconsctl,Qdraw,Qeditout,Qindex,Qlabel,Qnew,QWaddr,QWbody,QWconsctl,QWctl,QWdata,QWeditout,QWevent,QWrdsel,QWwrsel,QWtag,QMAX : con iota;
46
47	Blockincr : con 256;
48	Maxblock : con 8*1024;
49	NRange : con 10;
50	Infinity : con 16r7fffffff; 	# huge value for regexp address
51
52	# fbufalloc() guarantees room off end of BUFSIZE
53	MAXRPC : con 8192+Styx->IOHDRSZ;
54	BUFSIZE : con MAXRPC;
55	EVENTSIZE : con 256;
56	PLUMBSIZE : con 1024;
57	Scrollwid : con 12;	# width of scroll bar
58	Scrollgap : con 4;	# gap right of scroll bar
59	Margin : con 4;		# margin around text
60	Border : con 2;		#  line between rows, cols, windows
61	Maxtab : con 4;		# size of a tab, in units of the '0' character
62
63	Empty: con 0;
64	Null : con '-';
65	Delete : con 'd';
66	Insert : con 'i';
67	Replace: con 'r';
68	Filename : con 'f';
69
70	# editing
71	Inactive, Inserting, Collecting: con iota;
72
73	# alphabets
74	ALPHA_LATIN: con '\0';
75	ALPHA_GREEK: con '*';
76	ALPHA_CYRILLIC: con '@';
77
78	Kscrollup: con 16re050;
79	Kscrolldown: con 16re051;
80
81	Astring : adt {
82		s : string;
83	};
84
85	Lock : adt {
86		cnt : int;
87		chann : chan of int;
88
89		init : fn() : ref Lock;
90		lock : fn(l : self ref Lock);
91		unlock : fn(l : self ref Lock);
92		locked : fn(l : self ref Lock) : int;
93	};
94
95# 	Lockx : adt {
96#		sem : ref Lock->Semaphore;
97#
98#		init : fn() : ref Lockx;
99#		lock : fn(l : self ref Lockx);
100#		unlock : fn(l : self ref Lockx);
101#	};
102
103	Ref : adt {
104		l : ref Lock;
105		cnt : int;
106
107		init : fn() : ref Ref;
108		inc : fn(r : self ref Ref) : int;
109		dec : fn(r : self ref Ref) : int;
110		refx : fn(r : self ref Ref) : int;
111	};
112
113	Runestr : adt {
114		r: string;
115		nr: int;
116	};
117
118	Range : adt {
119		q0 : int;
120		q1 : int;
121	};
122
123	Block : adt {
124		addr : int;			# disk address in bytes
125		n : int;			# number of used runes in block
126		next : cyclic ref Block;	# pointer to next in free list
127	};
128
129	Timer : adt {
130		dt : int;
131		c : chan of int;
132		next : cyclic ref Timer;
133	};
134
135	Command : adt {
136		pid : int;
137		name : string;
138		text : string;
139		av : list of string;
140		iseditcmd: int;
141		md : ref Mntdir;
142		next : cyclic ref Command;
143	};
144
145	Dirtab : adt {
146		name : string;
147		qtype : int;
148		qid : int;
149		perm : int;
150	};
151
152	Mntdir : adt {
153		id : int;
154		refs : int;
155		dir : string;
156		ndir : int;
157		next : cyclic ref Mntdir;
158		nincl : int;
159		incl : array of string;
160	};
161
162	Fid : adt {
163		fid : int;
164		busy : int;
165		open : int;
166		qid : Sys->Qid;
167		w : cyclic ref Windowm->Window;
168		dir : array of Dirtab;
169		next : cyclic ref Fid;
170		mntdir : ref Mntdir;
171		nrpart : int;
172		rpart : array of byte;
173	};
174
175	Rangeset : type array of Range;
176
177	Expand : adt {
178		q0 : int;
179		q1 : int;
180		name : string;
181		bname : string;
182		jump : int;
183		at : ref Textm->Text;
184		ar : string;
185		a0 : int;
186		a1 : int;
187	};
188
189	Dirlist : adt {
190		r : string;
191		wid : int;
192	};
193
194	Reffont : adt {
195		r : ref Ref;
196		f : ref Draw->Font;
197
198		get : fn(p : int, q : int, r : int, b : string) : ref Reffont;
199		close : fn(r : self ref Reffont);
200	};
201
202	Cursor : adt {
203		hot : Draw->Point;
204		size : Draw->Point;
205		bits : array of byte;
206	};
207
208	Smsg0 : adt {
209		msize : int;
210		version : string;
211		iounit: int;
212		qid : Sys->Qid;
213		count : int;
214		data : array of byte;
215		stat : Sys->Dir;
216		qids: array of Sys->Qid;
217	};
218
219	# loadfile function ptr
220
221	BUFL, READL: con iota;
222
223	# allwindows pick type
224
225	Looper: adt{
226		cp: ref Edit->Cmd;
227		XY: int;
228		w: array of ref Windowm->Window;
229		nw: int;
230	};	# only one; X and Y can't nest
231
232	Tofile: adt {
233		f: ref Filem->File;
234		r: ref Edit->String;
235	};
236
237	Filecheck: adt{
238		f: ref Filem->File;
239		r: string;
240		nr: int;
241	};
242
243	Allwin: adt{
244		pick{
245			LP => lp: ref Looper;
246			FF => ff: ref Tofile;
247			FC => fc: ref Filecheck;
248		}
249	};
250
251	seq : int;
252	maxtab : int;
253	mouse : ref Draw->Pointer;
254	reffont : ref Reffont;
255	modbutton : ref Draw->Image;
256	colbutton : ref Draw->Image;
257	button : ref Draw->Image;
258	arrowcursor, boxcursor : ref Cursor;
259	row : ref Rowm->Row;
260	disk : ref Diskm->Disk;
261	seltext : ref Textm->Text;
262	argtext : ref Textm->Text;
263	mousetext : ref Textm->Text; 	# global because Text.close needs to clear it
264	typetext : ref Textm->Text;		# ditto
265	barttext : ref Textm->Text;		# shared between mousetask and keyboardtask
266	bartflag : int;
267	activewin : ref Windowm->Window;
268	activecol : ref Columnm->Column;
269	nullrect : Draw->Rect;
270	home : string;
271	plumbed : int;
272
273	ckeyboard : chan of int;
274	cmouse : chan of ref Draw->Pointer;
275	cwait : chan of string;
276	ccommand : chan of ref Command;
277	ckill : chan of string;
278	cxfidalloc : chan of ref Xfidm->Xfid;
279	cxfidfree : chan of ref Xfidm->Xfid;
280	cerr : chan of string;
281	cplumb : chan of ref Plumbmsg->Msg;
282	cedit: chan of int;
283};
284