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