samterm.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #define SAMTERM
  10. #define RUNESIZE sizeof(Rune)
  11. #define MAXFILES 256
  12. #define READBUFSIZE 8192
  13. #define NL 5
  14. enum{
  15. Up,
  16. Down
  17. };
  18. typedef struct Text Text;
  19. typedef struct Section Section;
  20. typedef struct Rasp Rasp;
  21. typedef struct Readbuf Readbuf;
  22. struct Section
  23. {
  24. long nrunes;
  25. Rune *text; /* if null, we haven't got it */
  26. Section *next;
  27. };
  28. struct Rasp
  29. {
  30. long nrunes;
  31. Section *sect;
  32. };
  33. #define Untagged ((ushort)65535)
  34. struct Text
  35. {
  36. Rasp rasp;
  37. short nwin;
  38. short front; /* input window */
  39. ushort tag;
  40. char lock;
  41. Flayer l[NL]; /* screen storage */
  42. };
  43. struct Readbuf
  44. {
  45. short n; /* # bytes in buf */
  46. uchar data[READBUFSIZE]; /* data bytes */
  47. };
  48. enum Resource
  49. {
  50. RHost,
  51. RKeyboard,
  52. RMouse,
  53. RPlumb,
  54. RResize,
  55. NRes,
  56. };
  57. extern Text **text;
  58. extern uchar **name;
  59. extern ushort *tag;
  60. extern int nname;
  61. extern int mname;
  62. extern Cursor bullseye;
  63. extern Cursor deadmouse;
  64. extern Cursor lockarrow;
  65. extern Cursor *cursor;
  66. extern Flayer *which;
  67. extern Flayer *work;
  68. extern Text cmd;
  69. extern Rune *scratch;
  70. extern long nscralloc;
  71. extern char hostlock;
  72. extern char hasunlocked;
  73. extern long snarflen;
  74. extern Mousectl* mousectl;
  75. extern Keyboardctl* keyboardctl;
  76. extern Mouse* mousep;
  77. extern long modified;
  78. extern int maxtab;
  79. extern Readbuf hostbuf[2]; /* double buffer; it's synchronous communication */
  80. extern Readbuf plumbbuf[2]; /* double buffer; it's synchronous communication */
  81. extern Channel *plumbc;
  82. extern Channel *hostc;
  83. extern int hversion;
  84. extern int plumbfd;
  85. extern int exiting;
  86. extern int autoindent;
  87. Rune *gettext(Flayer*, long, ulong*);
  88. void *alloc(ulong n);
  89. void iconinit(void);
  90. void getscreen(int, char**);
  91. void initio(void);
  92. void setlock(void);
  93. void outcmd(void);
  94. void rinit(Rasp*);
  95. void startnewfile(int, Text*);
  96. void getmouse(void);
  97. void mouseunblock(void);
  98. void kbdblock(void);
  99. void extstart(void);
  100. void hoststart(void);
  101. int plumbstart(void);
  102. int button(int but);
  103. int load(char*, int);
  104. int waitforio(void);
  105. int rcvchar(void);
  106. int getch(void);
  107. int kbdchar(void);
  108. int qpeekc(void);
  109. void cut(Text*, int, int, int);
  110. void paste(Text*, int);
  111. void snarf(Text*, int);
  112. int center(Flayer*, long);
  113. int xmenuhit(int, Menu*);
  114. void buttons(int);
  115. int getr(Rectangle*);
  116. void current(Flayer*);
  117. void duplicate(Flayer*, Rectangle, Font*, int);
  118. void startfile(Text*);
  119. void panic(char*);
  120. void panic1(Display*, char*);
  121. void closeup(Flayer*);
  122. void Strgrow(Rune**, long*, int);
  123. int RESIZED(void);
  124. void resize(void);
  125. void rcv(void);
  126. void type(Flayer*, int);
  127. void menu2hit(void);
  128. void menu3hit(void);
  129. void scroll(Flayer*, int);
  130. void hcheck(int);
  131. void rclear(Rasp*);
  132. int whichmenu(int);
  133. void hcut(int, long, long);
  134. void horigin(int, long);
  135. void hgrow(int, long, long, int);
  136. int hdata(int, long, uchar*, int);
  137. int hdatarune(int, long, Rune*, int);
  138. Rune *rload(Rasp*, ulong, ulong, ulong*);
  139. void menuins(int, uchar*, Text*, int, int);
  140. void menudel(int);
  141. Text *sweeptext(int, int);
  142. void setpat(char*);
  143. void scrdraw(Flayer*, long tot);
  144. int rcontig(Rasp*, ulong, ulong, int);
  145. int rmissing(Rasp*, ulong, ulong);
  146. void rresize(Rasp *, long, long, long);
  147. void rdata(Rasp*, long, long, Rune*);
  148. void rclean(Rasp*);
  149. void scrorigin(Flayer*, int, long);
  150. long scrtotal(Flayer*);
  151. void flnewlyvisible(Flayer*);
  152. char *rcvstring(void);
  153. void Strcpy(Rune*, Rune*);
  154. void Strncpy(Rune*, Rune*, long);
  155. void flushtyping(int);
  156. void dumperrmsg(int, int, int, int);
  157. int screensize(int*,int*);
  158. void getmouse(void);
  159. #include "mesg.h"
  160. void outTs(Tmesg, int);
  161. void outT0(Tmesg);
  162. void outTl(Tmesg, long);
  163. void outTslS(Tmesg, int, long, Rune*);
  164. void outTsll(Tmesg, int, long, long);
  165. void outTsl(Tmesg, int, long);
  166. void outTsv(Tmesg, int, vlong);
  167. void outTv(Tmesg, vlong);
  168. void outstart(Tmesg);
  169. void outcopy(int, uchar*);
  170. void outshort(int);
  171. void outlong(long);
  172. void outvlong(vlong);
  173. void outsend(void);