xref: /inferno-os/appl/acme/edit.m (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1Edit: module {
2	#pragma	varargck	argpos	editerror	1
3
4	PATH: con "/dis/acme/edit.dis";
5
6	String: adt{
7		n: int;
8		r: string;
9	};
10
11	Addr: adt{
12		typex: int;		# # (char addr), l (line addr), / ? . $ + - , ;
13		num: int;
14		next: cyclic ref Addr;		# or right side of , and ;
15		re: ref String;
16		left: cyclic ref Addr;		# left side of , and ;
17	};
18
19	Address: adt{
20		r: Dat->Range;
21		f: ref Filem->File;
22	};
23
24	Cmd: adt{
25		addr: ref Addr;			# address (range of text)
26		re: ref String;			# regular expression for e.g. 'x'
27		next: cyclic ref Cmd;		# pointer to next element in {}
28		num: int;
29		flag: int;				# whatever
30		cmdc: int;				# command character; 'x' etc.
31		cmd: cyclic ref Cmd;			# target of x, g, {, etc.
32		text: ref String;			# text of a, c, i; rhs of s
33		mtaddr: ref Addr;		# address for m, t
34	};
35
36	Cmdt: adt{
37		cmdc: int;			# command character
38		text: int;			# takes a textual argument?
39		regexp: int;		# takes a regular expression?
40		addr: int;		# takes an address (m or t)?
41		defcmd: int;		# default command; 0==>none
42		defaddr: int;		# default address
43		count: int;		# takes a count e.g. s2///
44		token: string;		# takes text terminated by one of these
45		fnc: int;			# function to call with parse tree
46	};
47
48	cmdtab: array of Cmdt;
49
50	INCR: con 25;	# delta when growing list
51
52	List: adt{
53		nalloc: int;
54		nused: int;
55		pick{
56			C => cmdptr: array of ref Cmd;
57			S => stringptr: array of ref String;
58			A => addrptr: array of ref Addr;
59		}
60	};
61
62	aNo, aDot, aAll: con iota;	# default addresses
63
64	ALLLOOPER, ALLTOFILE, ALLMATCHFILE, ALLFILECHECK, ALLELOGTERM, ALLEDITINIT, ALLUPDATE: con iota;
65
66	C_nl, C_a, C_b, C_c, C_d, C_B, C_D, C_e, C_f, C_g, C_i, C_k, C_m, C_n, C_p, C_s, C_u, C_w, C_x, C_X, C_pipe, C_eq: con iota;
67
68	editing: int;
69	curtext: ref Textm->Text;
70
71	init : fn(mods : ref Dat->Mods);
72
73	allocstring: fn(a0: int): ref String;
74	freestring: fn(a0: ref String);
75	getregexp: fn(a0: int): ref String;
76	newaddr: fn(): ref Addr;
77	editcmd: fn(t: ref Textm->Text, r: string, n: int);
78	editerror: fn(a0: string);
79	cmdlookup: fn(a0: int): int;
80	Straddc: fn(a0: ref String, a1: int);
81
82	allelogterm: fn(w: ref Windowm->Window);
83	alleditinit: fn(w: ref Windowm->Window);
84	allupdate: fn(w: ref Windowm->Window);
85};
86