edit.m 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. Edit: module {
  2. #pragma varargck argpos editerror 1
  3. PATH: con "/dis/acme/edit.dis";
  4. String: adt{
  5. n: int;
  6. r: string;
  7. };
  8. Addr: adt{
  9. typex: int; # # (char addr), l (line addr), / ? . $ + - , ;
  10. num: int;
  11. next: cyclic ref Addr; # or right side of , and ;
  12. re: ref String;
  13. left: cyclic ref Addr; # left side of , and ;
  14. };
  15. Address: adt{
  16. r: Dat->Range;
  17. f: ref Filem->File;
  18. };
  19. Cmd: adt{
  20. addr: ref Addr; # address (range of text)
  21. re: ref String; # regular expression for e.g. 'x'
  22. next: cyclic ref Cmd; # pointer to next element in {}
  23. num: int;
  24. flag: int; # whatever
  25. cmdc: int; # command character; 'x' etc.
  26. cmd: cyclic ref Cmd; # target of x, g, {, etc.
  27. text: ref String; # text of a, c, i; rhs of s
  28. mtaddr: ref Addr; # address for m, t
  29. };
  30. Cmdt: adt{
  31. cmdc: int; # command character
  32. text: int; # takes a textual argument?
  33. regexp: int; # takes a regular expression?
  34. addr: int; # takes an address (m or t)?
  35. defcmd: int; # default command; 0==>none
  36. defaddr: int; # default address
  37. count: int; # takes a count e.g. s2///
  38. token: string; # takes text terminated by one of these
  39. fnc: int; # function to call with parse tree
  40. };
  41. cmdtab: array of Cmdt;
  42. INCR: con 25; # delta when growing list
  43. List: adt{
  44. nalloc: int;
  45. nused: int;
  46. pick{
  47. C => cmdptr: array of ref Cmd;
  48. S => stringptr: array of ref String;
  49. A => addrptr: array of ref Addr;
  50. }
  51. };
  52. aNo, aDot, aAll: con iota; # default addresses
  53. ALLLOOPER, ALLTOFILE, ALLMATCHFILE, ALLFILECHECK, ALLELOGTERM, ALLEDITINIT, ALLUPDATE: con iota;
  54. C_nl, C_a, C_b, C_c, C_d, C_B, C_D, C_e, C_f, C_g, C_i, C_k, C_m, C_n, C_p, C_s, C_u, C_w, C_x, C_X, C_pipe, C_eq: con iota;
  55. editing: int;
  56. curtext: ref Textm->Text;
  57. init : fn(mods : ref Dat->Mods);
  58. allocstring: fn(a0: int): ref String;
  59. freestring: fn(a0: ref String);
  60. getregexp: fn(a0: int): ref String;
  61. newaddr: fn(): ref Addr;
  62. editcmd: fn(t: ref Textm->Text, r: string, n: int);
  63. editerror: fn(a0: string);
  64. cmdlookup: fn(a0: int): int;
  65. Straddc: fn(a0: ref String, a1: int);
  66. allelogterm: fn(w: ref Windowm->Window);
  67. alleditinit: fn(w: ref Windowm->Window);
  68. allupdate: fn(w: ref Windowm->Window);
  69. };