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