shithub: libacme

ref: 521670692b07cbadbf6a88964839d76531ba9afd
dir: /acme.h/

View raw version
#pragma lib "libacme.a"

enum {
	AEventSz = 256 * UTFmax,
};

typedef struct AWin AWin;
typedef struct AEvent AEvent;

struct AWin {
	int id;
	
	int ctlfd;
	int addrfd;
	int datafd;
	
	Channel *eventc;
	
	void *aux;
	
	AWin *next;
};

struct AEvent {
	char origin;
	char type;
	
	int p;
	int q0, q1;
	int flags;
	
	int ntext;
	char text[AEventSz + 1];
};

int			awinfsopen(AWin *, char *, int);
Biobuf *	awinfsbopen(AWin *, char *, int);


AWin *	awincreate(void);
void	awinclose(AWin *);
void	awincloseall(void);

int		awinctl(AWin *, char *, ...);
void	awinclear(AWin *);
int		awincat(AWin *, int fd);
int		awinprint(AWin *, char *, ...);
int		awinerror(AWin *, char *, ...);
int		awinfatal(AWin *, char *, ...);
void	awinaddtag(AWin *, char *);
void	awinsettag(AWin *, char *);

Channel *	aeventlisten(AWin *);
void		aeventstop(AWin *);
int			aeventnext(Biobuf *bio, AEvent *);
void		aeventsend(AWin *, AEvent *);