dat.m 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. Dat : module {
  2. PATH : con "/dis/acme/dat.dis";
  3. init : fn(mods : ref Mods);
  4. Mods : adt {
  5. sys : Sys;
  6. bufio : Bufio;
  7. draw : Draw;
  8. styx : Styx;
  9. styxaux : Styxaux;
  10. acme : Acme;
  11. gui : Gui;
  12. graph : Graph;
  13. dat : Dat;
  14. framem : Framem;
  15. utils : Utils;
  16. regx : Regx;
  17. scroll : Scroll;
  18. textm : Textm;
  19. filem : Filem;
  20. windowm : Windowm;
  21. rowm : Rowm;
  22. columnm : Columnm;
  23. bufferm : Bufferm;
  24. diskm : Diskm;
  25. exec : Exec;
  26. look : Look;
  27. timerm : Timerm;
  28. fsys : Fsys;
  29. xfidm : Xfidm;
  30. plumbmsg : Plumbmsg;
  31. edit: Edit;
  32. editlog: Editlog;
  33. editcmd: Editcmd;
  34. };
  35. SZSHORT : con 2;
  36. SZINT : con 4;
  37. FALSE, TRUE, XXX : con iota;
  38. EM_NORMAL, EM_RAW, EM_MASK : con iota;
  39. Qdir,Qacme,Qcons,Qconsctl,Qdraw,Qeditout,Qindex,Qlabel,Qnew,QWaddr,QWbody,QWconsctl,QWctl,QWdata,QWeditout,QWevent,QWrdsel,QWwrsel,QWtag,QMAX : con iota;
  40. Blockincr : con 256;
  41. Maxblock : con 8*1024;
  42. NRange : con 10;
  43. Infinity : con 16r7fffffff; # huge value for regexp address
  44. # fbufalloc() guarantees room off end of BUFSIZE
  45. MAXRPC : con 8192+Styx->IOHDRSZ;
  46. BUFSIZE : con MAXRPC;
  47. EVENTSIZE : con 256;
  48. PLUMBSIZE : con 1024;
  49. Scrollwid : con 12; # width of scroll bar
  50. Scrollgap : con 4; # gap right of scroll bar
  51. Margin : con 4; # margin around text
  52. Border : con 2; # line between rows, cols, windows
  53. Maxtab : con 4; # size of a tab, in units of the '0' character
  54. Empty: con 0;
  55. Null : con '-';
  56. Delete : con 'd';
  57. Insert : con 'i';
  58. Replace: con 'r';
  59. Filename : con 'f';
  60. # editing
  61. Inactive, Inserting, Collecting: con iota;
  62. # alphabets
  63. ALPHA_LATIN: con '\0';
  64. ALPHA_GREEK: con '*';
  65. ALPHA_CYRILLIC: con '@';
  66. Kscrollup: con 16re050;
  67. Kscrolldown: con 16re051;
  68. Astring : adt {
  69. s : string;
  70. };
  71. Lock : adt {
  72. cnt : int;
  73. chann : chan of int;
  74. init : fn() : ref Lock;
  75. lock : fn(l : self ref Lock);
  76. unlock : fn(l : self ref Lock);
  77. locked : fn(l : self ref Lock) : int;
  78. };
  79. # Lockx : adt {
  80. # sem : ref Lock->Semaphore;
  81. #
  82. # init : fn() : ref Lockx;
  83. # lock : fn(l : self ref Lockx);
  84. # unlock : fn(l : self ref Lockx);
  85. # };
  86. Ref : adt {
  87. l : ref Lock;
  88. cnt : int;
  89. init : fn() : ref Ref;
  90. inc : fn(r : self ref Ref) : int;
  91. dec : fn(r : self ref Ref) : int;
  92. refx : fn(r : self ref Ref) : int;
  93. };
  94. Runestr : adt {
  95. r: string;
  96. nr: int;
  97. };
  98. Range : adt {
  99. q0 : int;
  100. q1 : int;
  101. };
  102. Block : adt {
  103. addr : int; # disk address in bytes
  104. n : int; # number of used runes in block
  105. next : cyclic ref Block; # pointer to next in free list
  106. };
  107. Timer : adt {
  108. dt : int;
  109. c : chan of int;
  110. next : cyclic ref Timer;
  111. };
  112. Command : adt {
  113. pid : int;
  114. name : string;
  115. text : string;
  116. av : list of string;
  117. iseditcmd: int;
  118. md : ref Mntdir;
  119. next : cyclic ref Command;
  120. };
  121. Dirtab : adt {
  122. name : string;
  123. qtype : int;
  124. qid : int;
  125. perm : int;
  126. };
  127. Mntdir : adt {
  128. id : int;
  129. refs : int;
  130. dir : string;
  131. ndir : int;
  132. next : cyclic ref Mntdir;
  133. nincl : int;
  134. incl : array of string;
  135. };
  136. Fid : adt {
  137. fid : int;
  138. busy : int;
  139. open : int;
  140. qid : Sys->Qid;
  141. w : cyclic ref Windowm->Window;
  142. dir : array of Dirtab;
  143. next : cyclic ref Fid;
  144. mntdir : ref Mntdir;
  145. nrpart : int;
  146. rpart : array of byte;
  147. };
  148. Rangeset : type array of Range;
  149. Expand : adt {
  150. q0 : int;
  151. q1 : int;
  152. name : string;
  153. bname : string;
  154. jump : int;
  155. at : ref Textm->Text;
  156. ar : string;
  157. a0 : int;
  158. a1 : int;
  159. };
  160. Dirlist : adt {
  161. r : string;
  162. wid : int;
  163. };
  164. Reffont : adt {
  165. r : ref Ref;
  166. f : ref Draw->Font;
  167. get : fn(p : int, q : int, r : int, b : string) : ref Reffont;
  168. close : fn(r : self ref Reffont);
  169. };
  170. Cursor : adt {
  171. hot : Draw->Point;
  172. size : Draw->Point;
  173. bits : array of byte;
  174. };
  175. Smsg0 : adt {
  176. msize : int;
  177. version : string;
  178. iounit: int;
  179. qid : Sys->Qid;
  180. count : int;
  181. data : array of byte;
  182. stat : Sys->Dir;
  183. qids: array of Sys->Qid;
  184. };
  185. # loadfile function ptr
  186. BUFL, READL: con iota;
  187. # allwindows pick type
  188. Looper: adt{
  189. cp: ref Edit->Cmd;
  190. XY: int;
  191. w: array of ref Windowm->Window;
  192. nw: int;
  193. }; # only one; X and Y can't nest
  194. Tofile: adt {
  195. f: ref Filem->File;
  196. r: ref Edit->String;
  197. };
  198. Filecheck: adt{
  199. f: ref Filem->File;
  200. r: string;
  201. nr: int;
  202. };
  203. Allwin: adt{
  204. pick{
  205. LP => lp: ref Looper;
  206. FF => ff: ref Tofile;
  207. FC => fc: ref Filecheck;
  208. }
  209. };
  210. seq : int;
  211. maxtab : int;
  212. mouse : ref Draw->Pointer;
  213. reffont : ref Reffont;
  214. modbutton : ref Draw->Image;
  215. colbutton : ref Draw->Image;
  216. button : ref Draw->Image;
  217. arrowcursor, boxcursor : ref Cursor;
  218. row : ref Rowm->Row;
  219. disk : ref Diskm->Disk;
  220. seltext : ref Textm->Text;
  221. argtext : ref Textm->Text;
  222. mousetext : ref Textm->Text; # global because Text.close needs to clear it
  223. typetext : ref Textm->Text; # ditto
  224. barttext : ref Textm->Text; # shared between mousetask and keyboardtask
  225. bartflag : int;
  226. activewin : ref Windowm->Window;
  227. activecol : ref Columnm->Column;
  228. nullrect : Draw->Rect;
  229. home : string;
  230. plumbed : int;
  231. ckeyboard : chan of int;
  232. cmouse : chan of ref Draw->Pointer;
  233. cwait : chan of string;
  234. ccommand : chan of ref Command;
  235. ckill : chan of string;
  236. cxfidalloc : chan of ref Xfidm->Xfid;
  237. cxfidfree : chan of ref Xfidm->Xfid;
  238. cerr : chan of string;
  239. cplumb : chan of ref Plumbmsg->Msg;
  240. cedit: chan of int;
  241. };