Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

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