samterm.h 3.7 KB

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