plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

samterm.h (3882B)


      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 int	protodebug;
     60 
     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];
     90 extern int	exiting;
     91 extern int	autoindent;
     92 
     93 #define gettext sam_gettext	/* stupid gcc built-in functions */
     94 Rune	*gettext(Flayer*, long, ulong*);
     95 void	*alloc(ulong n);
     96 
     97 void	iconinit(void);
     98 void	getscreen(int, char**);
     99 void	initio(void);
    100 void	setlock(void);
    101 void	outcmd(void);
    102 void	rinit(Rasp*);
    103 void	startnewfile(int, Text*);
    104 void	getmouse(void);
    105 void	mouseunblock(void);
    106 void	kbdblock(void);
    107 void	extstart(void);
    108 void	hoststart(void);
    109 int	plumbstart(void);
    110 int	button(int but);
    111 int	load(char*, int);
    112 int	waitforio(void);
    113 int	rcvchar(void);
    114 int	getch(void);
    115 int	kbdchar(void);
    116 int	qpeekc(void);
    117 void	cut(Text*, int, int, int);
    118 void	paste(Text*, int);
    119 void	snarf(Text*, int);
    120 int	center(Flayer*, long);
    121 int	xmenuhit(int, Menu*);
    122 void	buttons(int);
    123 int	getr(Rectangle*);
    124 void	current(Flayer*);
    125 void	duplicate(Flayer*, Rectangle, Font*, int);
    126 void	startfile(Text*);
    127 void	panic(char*);
    128 void	panic1(Display*, char*);
    129 void	closeup(Flayer*);
    130 void	Strgrow(Rune**, long*, int);
    131 int	RESIZED(void);
    132 void	resize(void);
    133 void	rcv(void);
    134 void	type(Flayer*, int);
    135 void	menu2hit(void);
    136 void	menu3hit(void);
    137 void	scroll(Flayer*, int);
    138 void	hcheck(int);
    139 void	rclear(Rasp*);
    140 int	whichmenu(int);
    141 void	hcut(int, long, long);
    142 void	horigin(int, long);
    143 void	hgrow(int, long, long, int);
    144 int	hdata(int, long, uchar*, int);
    145 int	hdatarune(int, long, Rune*, int);
    146 Rune	*rload(Rasp*, ulong, ulong, ulong*);
    147 void	menuins(int, uchar*, Text*, int, int);
    148 void	menudel(int);
    149 Text	*sweeptext(int, int);
    150 void	setpat(char*);
    151 void	scrdraw(Flayer*, long tot);
    152 int	rcontig(Rasp*, ulong, ulong, int);
    153 int	rmissing(Rasp*, ulong, ulong);
    154 void	rresize(Rasp *, long, long, long);
    155 void	rdata(Rasp*, long, long, Rune*);
    156 void	rclean(Rasp*);
    157 void	scrorigin(Flayer*, int, long);
    158 long	scrtotal(Flayer*);
    159 void	flnewlyvisible(Flayer*);
    160 char	*rcvstring(void);
    161 void	Strcpy(Rune*, Rune*);
    162 void	Strncpy(Rune*, Rune*, long);
    163 void	flushtyping(int);
    164 void	dumperrmsg(int, int, int, int);
    165 int	screensize(int*,int*);
    166 void	getmouse(void);
    167 
    168 #include "mesg.h"
    169 
    170 void	outTs(Tmesg, int);
    171 void	outT0(Tmesg);
    172 void	outTl(Tmesg, long);
    173 void	outTslS(Tmesg, int, long, Rune*);
    174 void	outTsll(Tmesg, int, long, long);
    175 void	outTsl(Tmesg, int, long);
    176 void	outTsv(Tmesg, int, vlong);
    177 void	outTv(Tmesg, vlong);
    178 void	outstart(Tmesg);
    179 void	outcopy(int, uchar*);
    180 void	outshort(int);
    181 void	outlong(long);
    182 void	outvlong(vlong);
    183 void	outsend(void);