ref: 34b70a9de77eb764e83ba184ce59071d53c333d5
parent: dfe87a2482a58d297233aacea4b3b60562e40f6d
author: james palmer <foura@biobuf.link>
date: Sun Jun 6 18:41:36 EDT 2021
names are hard
--- a/acme.h
+++ b/acme.h
@@ -1,11 +1,11 @@
#pragma lib "libacme.a"
enum {
- Eventsz = 256 * UTFmax,
+ AEventSz = 256 * UTFmax,
};
-typedef struct Win Win;
-struct Win {
+typedef struct AWin AWin;
+struct AWin {
int id;
int ctl;
int event;
@@ -14,19 +14,19 @@
void *aux;
};
-Win * wincreate(void);
-void winclose(Win *);
-int winopen(Win *, char *, int);
-void wintitle(Win *, char *, ...);
-void winctl(Win *, char *, ...);
-void winclear(Win *);
-void winappend(Win *, char *, ...);
-void winerror(Win *, char *, ...);
-void winaddtag(Win *, char *);
-void winsettag(Win *, char *);
+AWin * awincreate(void);
+void awinclose(AWin *);
+int awinopen(AWin *, char *, int);
+void awintitle(AWin *, char *, ...);
+void awinctl(AWin *, char *, ...);
+void awinclear(AWin *);
+void awinappend(AWin *, char *, ...);
+void awinerror(AWin *, char *, ...);
+void awinaddtag(AWin *, char *);
+void awinsettag(AWin *, char *);
-typedef struct Event Event;
-struct Event {
+typedef struct AEvent AEvent;
+struct AEvent {
char origin; /* mouse, keyboard, etc. */
char type; /* delete, exec, etc. */
int p; /* click point */
@@ -33,8 +33,8 @@
int q0, q1; /* expanded text */
int flags;
int ntext;
- char text[Eventsz + 1];
+ char text[AEventSz + 1];
};
-int eventnext(Win *, Event *);
-void eventsend(Win *, Event *);
+int aeventnext(AWin *, AEvent *);
+void aeventsend(AWin *, AEvent *);
--- a/window.c
+++ b/window.c
@@ -4,7 +4,7 @@
#include "acme.h"
int
-winopen(Win *w, char *f, int mode)
+awinopen(AWin *w, char *f, int mode)
{
char buf[128];
int fd;
@@ -15,29 +15,29 @@
return fd;
}
-Win *
-wincreate(void)
+AWin *
+awincreate(void)
{
- Win *w;
+ AWin *w;
char buf[12];
- w = mallocz(sizeof(Win), 1);
+ w = mallocz(sizeof(AWin), 1);
w->ctl = open("/mnt/wsys/new/ctl", ORDWR|OCEXEC);
if(w->ctl < 0)
- sysfatal("winopen: %r");
+ sysfatal("open ctl: %r");
if(read(w->ctl, buf, sizeof(buf)) != sizeof(buf))
sysfatal("read ctl: %r");
w->id = atoi(buf);
- w->event = winopen(w, "event", ORDWR);
- w->addr = winopen(w, "addr", ORDWR);
- w->data = winopen(w, "data", ORDWR);
+ w->event = awinopen(w, "event", ORDWR);
+ w->addr = awinopen(w, "addr", ORDWR);
+ w->data = awinopen(w, "data", ORDWR);
return w;
}
void
-winclose(Win *w)
+awinclose(AWin *w)
{
fprint(w->ctl, "delete");
@@ -49,7 +49,7 @@
}
void
-wintitle(Win *w, char *fmt, ...)
+awintitle(AWin *w, char *fmt, ...)
{
char *title;
va_list args;
@@ -58,12 +58,12 @@
title = vsmprint(fmt, args);
va_end(args);
- winctl(w, "name %s\n", title);
+ awinctl(w, "name %s\n", title);
free(title);
}
void
-winctl(Win *w, char *fmt, ...)
+awinctl(AWin *w, char *fmt, ...)
{
va_list args;
@@ -73,7 +73,7 @@
}
void
-winclear(Win *w)
+awinclear(AWin *w)
{
fprint(w->addr, ",");
fprint(w->data, "");
@@ -80,12 +80,12 @@
}
void
-winappend(Win *w, char *fmt, ...)
+awinappend(AWin *w, char *fmt, ...)
{
int fd;
va_list args;
- fd = winopen(w, "body", OWRITE);
+ fd = awinopen(w, "body", OWRITE);
va_start(args, fmt);
vfprint(fd, fmt, args);
@@ -95,12 +95,12 @@
}
void
-winerror(Win *w, char *fmt, ...)
+awinerror(AWin *w, char *fmt, ...)
{
int errorfd;
va_list args;
- errorfd = winopen(w, "errors", OWRITE);
+ errorfd = awinopen(w, "errors", OWRITE);
va_start(args, fmt);
vfprint(errorfd, fmt, args);
@@ -110,22 +110,22 @@
}
void
-winaddtag(Win *w, char *tag)
+awinaddtag(AWin *w, char *tag)
{
int tagfd;
- tagfd = winopen(w, "tag", OWRITE);
+ tagfd = awinopen(w, "tag", OWRITE);
fprint(tagfd, "%s ", tag);
close(tagfd);
}
void
-winsettag(Win *w, char *tag)
+awinsettag(AWin *w, char *tag)
{
int tagfd;
- winctl(w, "cleartag");
- tagfd = winopen(w, "tag", OWRITE);
+ awinctl(w, "cleartag");
+ tagfd = awinopen(w, "tag", OWRITE);
fprint(tagfd, "%s", tag);
close(tagfd);
}