acme 9.4 KB

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