Blob


1 .TH ACME 4
2 .SH NAME
3 acme \- control files for text windows
4 .SH SYNOPSIS
5 .B acme
6 [
7 .B -f
8 .I varfont
9 ] [
10 .B -F
11 .I fixfont
12 ]
13 [
14 .I file
15 \&... ]
16 .SH DESCRIPTION
17 The text window system
18 .IR acme (1)
19 serves a variety of files for reading, writing, and controlling
20 windows.
21 Some of them are virtual versions of system files for dealing
22 with the virtual console; others control operations
23 of
24 .I acme
25 itself.
26 When a command is run under
27 .IR acme ,
28 a directory holding these files is mounted on
29 .B /mnt/acme
30 (also bound to
31 .BR /mnt/wsys )
32 and also
33 .BR /dev ;
34 the files mentioned here
35 appear in both those directories.
36 .PP
37 Some of these files supply virtual versions of services available from the underlying
38 environment, in particular the character terminal files in Plan 9's
39 \fIcons\fR(3).
40 (Unlike in Plan 9's \fIrio\fR(1),
41 each command under
42 .I acme
43 sees the same set of files; there is not a distinct
44 .B /dev/cons
45 for each window.)
46 Other files are unique to
47 .IR acme .
48 .TP
49 .B acme
50 is a subdirectory used by
51 .B win
52 (see
53 .IR acme (1))
54 as a mount point for the
55 .I acme
56 files associated with the window in which
57 .B win
58 is running.
59 It has no specific function under
60 .I acme
61 itself.
62 .TP
63 .B cons
64 is the standard and diagnostic output file for all commands
65 run under
66 .IR acme .
67 (Input for commands is redirected to
68 .BR /dev/null .)
69 Text written to
70 .B cons
71 appears in a window labeled
72 .IB dir /+Errors\f1,
73 where
74 .I dir
75 is the directory in which the command
76 was run.
77 The window is created if necessary, but not until text is actually written.
78 .TP
79 .B consctl
80 Is an empty unwritable file present only for compatibility; there is no way
81 to turn off `echo', for example, under
82 .IR acme .
83 .TP
84 .B index
85 holds a sequence of lines of text, one per window. Each line has 5 decimal numbers,
86 each formatted in 11 characters plus a blank\(emthe window ID;
87 number of characters (runes) in the tag;
88 number of characters in the body;
89 a 1 if the window is a directory, 0 otherwise;
90 and a 1 if the window is modified, 0
91 otherwise\(emfollowed by the tag up to a newline if present.
92 Thus at character position 5×12 starts the name of the window.
93 If a file has multiple zeroxed windows open,
94 only the most recently used will appear in the
95 .B index
96 file.
97 .TP
98 .B label
99 is an empty file, writable without effect, present only for compatibility with
100 .BR rio .
101 .TP
102 .B new
103 A directory analogous to the numbered directories
104 .RI ( q.v. ).
105 Accessing any
106 file in
107 .B new
108 creates a new window. Thus to cause text to appear in a new window,
109 write it to
110 .BR /dev/new/body .
111 For more control, open
112 .BR /dev/new/ctl
113 and use the interface described below.
114 .LP
115 .PP
116 Each
117 .I acme
118 window has associated a directory numbered by its ID.
119 Window IDs are chosen sequentially and may be discovered by the
120 .B ID
121 command, by
122 reading the
123 .B ctl
124 file, or
125 indirectly through the
126 .B index
127 file. The files in the numbered directories are as follows.
128 .TP
129 .B addr
130 may be written with any textual address (line number, regular expression, etc.),
131 in the format understood by button 3 but without the initial colon, including compound addresses,
132 to set the address for text accessed through the
133 .B data
134 file.
135 When read, it returns the value of the address that would next be read
136 or written through the
137 .B data
138 file, in the format
139 .BI # m ,# n
140 where
141 .I m
142 and
143 .I n
144 are character (not byte) offsets. If
145 .I m
146 and
147 .I n
148 are identical, the format is just
149 .BI # m\f1.
150 Thus a regular expression may be evaluated by writing it to
151 .B addr
152 and reading it back.
153 The
154 .B addr
155 address has no effect on the user's selection of text.
156 .TP
157 .B body
158 holds contents of the window body. It may be read at any byte offset.
159 Text written to
160 .B body
161 is always appended; the file offset is ignored.
162 .TP
163 .B ctl
164 may be read to recover the five numbers as held in the
165 .B index
166 file, described above, plus two more fields: the width of the
167 window in pixels and the name of the font used in the window.
168 Text messages may be written to
169 .B ctl
170 to affect the window.
171 Each message is terminated by a newline and multiple
172 messages may be sent in a single write.
173 .RS .5i
174 .TF limit=addr
175 .TP
176 .B addr=dot
177 Set the
178 .B addr
179 address to that of the user's selected text in the window.
180 .TP
181 .B clean
182 Mark the window clean as though it has just been written.
183 .TP
184 .B dirty
185 Mark the window dirty, the opposite of clean.
186 .TP
187 .B cleartag
188 Remove all text in the tag after the vertical bar.
189 .TP
190 .B del
191 Equivalent to the
192 .B Del
193 interactive command.
194 .TP
195 .B delete
196 Equivalent to the
197 .B Delete
198 interactive command.
199 .TP
200 .B dot=addr
201 Set the user's selected text in the window to the text addressed by the
202 .B addr
203 address.
204 .TP
205 .BI dump " command
206 Set the command string to recreate the window from a dump file.
207 .TP
208 .BI dumpdir " directory
209 Set the directory in which to run the command to recreate the window from a dump file.
210 .TP
211 .B get
212 Equivalent to the
213 .B Get
214 interactive command with no arguments; accepts no arguments.
215 .TP
216 .B limit=addr
217 When the
218 .B ctl
219 file is first opened, regular expression context searches in
220 .B addr
221 addresses examine the whole file; this message restricts subsequent
222 searches to the current
223 .B addr
224 address.
225 .TP
226 .B mark
227 Cancel
228 .BR nomark ,
229 returning the window to the usual state wherein each modification to the
230 body must be undone individually.
231 .TP
232 .BI name " name
233 Set the name of the window to
234 .IR name .
235 .TP
236 .B nomark
237 Turn off automatic `marking' of changes, so a set of related changes
238 may be undone in a single
239 .B Undo
240 interactive command.
241 .TP
242 .B noscroll
243 Turn off automatic `scrolling' of the window to show text written to the body.
244 .TP
245 .B put
246 Equivalent to the
247 .B Put
248 interactive command with no arguments; accepts no arguments.
249 .TP
250 .B scroll
251 Cancel a
252 .B noscroll
253 message, returning the window to the default state wherein each write
254 to the
255 .B body
256 file causes the window to `scroll' to display the new text.
257 .TP
258 .B show
259 Guarantee at least some of the selected text is visible on the display.
260 .RE
261 .PD
262 .TP
263 .B data
264 is used in conjunction with
265 .B addr
266 for random access to the contents of the body.
267 The file offset is ignored when writing the
268 .B data
269 file; instead the location of the data to be read or written is determined by the state of the
270 .B addr
271 file.
272 Text, which must contain only whole characters (no `partial runes'),
273 written to
274 .B data
275 replaces the characters addressed by the
276 .B addr
277 file and sets the address to the null string at the end of the written text.
278 A read from
279 .B data
280 returns as many whole characters as the read count will permit starting
281 at the beginning of the
282 .B addr
283 address (the end of the address has no effect)
284 and sets the address to the null string at the end of the returned
285 characters.
286 .TP
287 .B event
288 When a window's
289 .B event
290 file is open, changes to the window occur as always but the
291 actions are also reported as
292 messages to the reader of the file. Also, user actions with buttons 2 and 3
293 (other than chorded
294 .B Cut
295 and
296 .BR Paste ,
297 which behave normally) have no immediate effect on the window;
298 it is expected that the program reading the
299 .B event
300 file will interpret them.
301 The messages have a fixed format:
302 a character indicating the origin or cause of the action,
303 a character indicating the type of the action,
304 four free-format blank-terminated decimal numbers,
305 optional text, and a newline.
306 The first and second numbers are the character addresses of the action,
307 the third is a flag,
308 and the final is a count of the characters in the optional text, which
309 may itself contain newlines.
310 The origin characters are
311 .B E
312 for writes to the
313 .B body
314 or
315 .B tag
316 file,
317 .B F
318 for actions through the window's other files,
319 .B K
320 for the keyboard, and
321 .B M
322 for the mouse.
323 The type characters are
324 .B D
325 for text deleted from the body,
326 .B d
327 for text deleted from the tag,
328 .B I
329 for text inserted to the body,
330 .B i
331 for text inserted to the tag,
332 .B L
333 for a button 3 action in the body,
334 .B l
335 for a button 3 action in the tag,
336 .B X
337 for a button 2 action in the body, and
338 .B x
339 for a button 2 action in the tag.
340 .IP
341 If the relevant text has less than 256 characters, it is included in the message;
342 otherwise it is elided, the fourth number is 0, and the program must read
343 it from the
344 .B data
345 file if needed. No text is sent on a
346 .B D
347 or
348 .B d
349 message.
350 .IP
351 For
352 .BR D ,
353 .BR d ,
354 .BR I ,
355 and
356 .BR i
357 the flag is always zero.
358 For
359 .BR X
360 and
361 .BR x ,
362 the flag is a bitwise OR (reported decimally) of the following:
363 1 if the text indicated is recognized as an
364 .I acme
365 built-in command;
366 2 if the text indicated is a null string that has a non-null expansion;
367 if so, another complete message will follow describing the expansion
368 exactly as if it had been indicated explicitly (its flag will always be 0);
369 8 if the command has an extra (chorded) argument; if so,
370 two more complete messages will follow reporting the argument (with
371 all numbers 0 except the character count) and where it originated, in the form of
372 a fully-qualified button 3 style address.
373 .IP
374 For
375 .B L
376 and
377 .BR l ,
378 the flag is the bitwise OR of the following:
379 1 if
380 .I acme
381 can interpret the action without loading a new file;
382 2 if a second (post-expansion) message follows, analogous to that with
383 .B X
384 messages;
385 4 if the text is a file or window name (perhaps with address) rather than
386 plain literal text.
387 .IP
388 For messages with the 1 bit on in the flag,
389 writing the message back to the
390 .B event
391 file, but with the flag, count, and text omitted,
392 will cause the action to be applied to the file exactly as it would
393 have been if the
394 .B event
395 file had not been open.
396 .TP
397 .B tag
398 holds contents of the window tag. It may be read at any byte offset.
399 Text written to
400 .B tag
401 is always appended; the file offset is ignored.
402 .SH SOURCE
403 .B /usr/local/plan9/src/cmd/acme
404 .SH SEE ALSO
405 .IR rio (1),
406 .IR acme (1)