shithub: libacme

ref: ce79e1fe0355e8e6aff4de3278c5b343f8b31538
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 eventfd;
	int addrfd;
	int datafd;
	int bodyfd;
	
	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);

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

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

Channel *	aeventlisten(AWin *);
void		aeventstop(AWin *);
void		aeventsend(AWin *, AEvent *);