acme 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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, in the format
  151. .BI # m ,# n
  152. where
  153. .I m
  154. and
  155. .I n
  156. are character (not byte) offsets. If
  157. .I m
  158. and
  159. .I n
  160. are identical, the format is just
  161. .BI # m\f1.
  162. Thus a regular expression may be evaluated by writing it to
  163. .B addr
  164. and reading it back.
  165. The
  166. .B addr
  167. address has no effect on the user's selection of text.
  168. .TP
  169. .B body
  170. holds contents of the window body. It may be read at any byte offset.
  171. Text written to
  172. .B body
  173. is always appended; the file offset is ignored.
  174. .TP
  175. .B ctl
  176. may be read to recover the five numbers as held in the
  177. .B index
  178. file, described above, plus two more fields: the width of the
  179. window in pixels and the name of the font used in the window.
  180. Text messages may be written to
  181. .B ctl
  182. to affect the window.
  183. Each message is terminated by a newline and multiple
  184. messages may be sent in a single write.
  185. .RS .5i
  186. .TF limit=addr
  187. .TP
  188. .B addr=dot
  189. Set the
  190. .B addr
  191. address to that of the user's selected text in the window.
  192. .TP
  193. .B clean
  194. Mark the window clean as though it has just been written.
  195. .TP
  196. .B dirty
  197. Mark the window dirty, the opposite of clean.
  198. .TP
  199. .B cleartag
  200. Remove all text in the tag after the vertical bar.
  201. .TP
  202. .B del
  203. Equivalent to the
  204. .B Del
  205. interactive command.
  206. .TP
  207. .B delete
  208. Equivalent to the
  209. .B Delete
  210. interactive command.
  211. .TP
  212. .B dot=addr
  213. Set the user's selected text in the window to the text addressed by the
  214. .B addr
  215. address.
  216. .TP
  217. .BI dump " command
  218. Set the command string to recreate the window from a dump file.
  219. .TP
  220. .BI dumpdir " directory
  221. Set the directory in which to run the command to recreate the window from a dump file.
  222. .TP
  223. .B get
  224. Equivalent to the
  225. .B Get
  226. interactive command with no arguments; accepts no arguments.
  227. .TP
  228. .B limit=addr
  229. When the
  230. .B ctl
  231. file is first opened, regular expression context searches in
  232. .B addr
  233. addresses examine the whole file; this message restricts subsequent
  234. searches to the current
  235. .B addr
  236. address.
  237. .TP
  238. .B mark
  239. Cancel
  240. .BR nomark ,
  241. returning the window to the usual state wherein each modification to the
  242. body must be undone individually.
  243. .TP
  244. .B menu
  245. Maintain
  246. .BR Undo ,
  247. .BR Redo ,
  248. and
  249. .B Put
  250. in the left half of the tag.
  251. (This is the default for file windows.)
  252. .TP
  253. .BI name " name
  254. Set the name of the window to
  255. .IR name .
  256. .TP
  257. .B nomark
  258. Turn off automatic `marking' of changes, so a set of related changes
  259. may be undone in a single
  260. .B Undo
  261. interactive command.
  262. .TP
  263. .B nomenu
  264. Do not maintain
  265. .BR Undo ,
  266. .BR Redo ,
  267. and
  268. .B Put
  269. in the left half of the tag.
  270. (This is the default for directory and error windows.)
  271. .TP
  272. .B noscroll
  273. Turn off automatic `scrolling' of the window to show text written to the body.
  274. .TP
  275. .B put
  276. Equivalent to the
  277. .B Put
  278. interactive command with no arguments; accepts no arguments.
  279. .TP
  280. .B scroll
  281. Cancel a
  282. .B noscroll
  283. message, returning the window to the default state wherein each write
  284. to the
  285. .B body
  286. file causes the window to `scroll' to display the new text.
  287. .TP
  288. .B show
  289. Guarantee at least some of the selected text is visible on the display.
  290. .RE
  291. .PD
  292. .TP
  293. .B data
  294. is used in conjunction with
  295. .B addr
  296. for random access to the contents of the body.
  297. The file offset is ignored when writing the
  298. .B data
  299. file; instead the location of the data to be read or written is determined by the state of the
  300. .B addr
  301. file.
  302. Text, which must contain only whole characters (no `partial runes'),
  303. written to
  304. .B data
  305. replaces the characters addressed by the
  306. .B addr
  307. file and sets the address to the null string at the end of the written text.
  308. A read from
  309. .B data
  310. returns as many whole characters as the read count will permit starting
  311. at the beginning of the
  312. .B addr
  313. address (the end of the address has no effect)
  314. and sets the address to the null string at the end of the returned
  315. characters.
  316. .TP
  317. .B errors
  318. Writing to the
  319. .B errors
  320. file appends to the body of the
  321. .IB dir /+Errors
  322. window, where
  323. .I dir
  324. is the directory currently named in the tag.
  325. The window is created if necessary,
  326. but not until text is actually written.
  327. .TP
  328. .B event
  329. When a window's
  330. .B event
  331. file is open, changes to the window occur as always but the
  332. actions are also reported as
  333. messages to the reader of the file. Also, user actions with buttons 2 and 3
  334. (other than chorded
  335. .B Cut
  336. and
  337. .BR Paste ,
  338. which behave normally) have no immediate effect on the window;
  339. it is expected that the program reading the
  340. .B event
  341. file will interpret them.
  342. The messages have a fixed format:
  343. a character indicating the origin or cause of the action,
  344. a character indicating the type of the action,
  345. four free-format blank-terminated decimal numbers,
  346. optional text, and a newline.
  347. The first and second numbers are the character addresses of the action,
  348. the third is a flag,
  349. and the final is a count of the characters in the optional text, which
  350. may itself contain newlines.
  351. The origin characters are
  352. .B E
  353. for writes to the
  354. .B body
  355. or
  356. .B tag
  357. file,
  358. .B F
  359. for actions through the window's other files,
  360. .B K
  361. for the keyboard, and
  362. .B M
  363. for the mouse.
  364. The type characters are
  365. .B D
  366. for text deleted from the body,
  367. .B d
  368. for text deleted from the tag,
  369. .B I
  370. for text inserted to the body,
  371. .B i
  372. for text inserted to the tag,
  373. .B L
  374. for a button 3 action in the body,
  375. .B l
  376. for a button 3 action in the tag,
  377. .B X
  378. for a button 2 action in the body, and
  379. .B x
  380. for a button 2 action in the tag.
  381. .IP
  382. If the relevant text has less than 256 characters, it is included in the message;
  383. otherwise it is elided, the fourth number is 0, and the program must read
  384. it from the
  385. .B data
  386. file if needed. No text is sent on a
  387. .B D
  388. or
  389. .B d
  390. message.
  391. .IP
  392. For
  393. .BR D ,
  394. .BR d ,
  395. .BR I ,
  396. and
  397. .BR i
  398. the flag is always zero.
  399. For
  400. .BR X
  401. and
  402. .BR x ,
  403. the flag is a bitwise OR (reported decimally) of the following:
  404. 1 if the text indicated is recognized as an
  405. .I acme
  406. built-in command;
  407. 2 if the text indicated is a null string that has a non-null expansion;
  408. if so, another complete message will follow describing the expansion
  409. exactly as if it had been indicated explicitly (its flag will always be 0);
  410. 8 if the command has an extra (chorded) argument; if so,
  411. two more complete messages will follow reporting the argument (with
  412. all numbers 0 except the character count) and where it originated, in the form of
  413. a fully-qualified button 3 style address.
  414. .IP
  415. For
  416. .B L
  417. and
  418. .BR l ,
  419. the flag is the bitwise OR of the following:
  420. 1 if
  421. .I acme
  422. can interpret the action without loading a new file;
  423. 2 if a second (post-expansion) message follows, analogous to that with
  424. .B X
  425. messages;
  426. 4 if the text is a file or window name (perhaps with address) rather than
  427. plain literal text.
  428. .IP
  429. For messages with the 1 bit on in the flag,
  430. writing the message back to the
  431. .B event
  432. file, but with the flag, count, and text omitted,
  433. will cause the action to be applied to the file exactly as it would
  434. have been if the
  435. .B event
  436. file had not been open.
  437. .TP
  438. .B tag
  439. holds contents of the window tag. It may be read at any byte offset.
  440. Text written to
  441. .B tag
  442. is always appended; the file offset is ignored.
  443. .TP
  444. .B xdata
  445. The
  446. .B xdata
  447. file like
  448. .B data
  449. except that reads stop at the end address.
  450. .SH SOURCE
  451. .B /sys/src/cmd/acme
  452. .SH SEE ALSO
  453. .IR rio (1),
  454. .IR acme (1),
  455. .IR cons (3).