acme 10 KB

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