Blob


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