Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[9fans] 9p write event to Acme?

181 views
Skip to first unread message

James A. Robinson

unread,
Aug 29, 2013, 2:47:46 AM8/29/13
to
[argh, I posted this to the google group though I know that it won't show up...]

Folks,

I'm interested in writing some Acme commands to simulate
execution of certain built-in commands.  For example, I would
like to be able to simulate the user 2-1 chording on an Edit
command in the tag.

Is my understanding correct if I am thinking that this would
consist of a single event

c0: M
c1: x
flag ^= 8
nb: 4
nr: 4
text: Edit
arg: ...

where ... represents the argument passed to Edit?
Or would this consist of two events, with text set
to Edit and then to the command to pass in?

It's not clear to me if I also have muck with q0, q1,
oq0, oq1 or loc.  I was guessing that only people
reading an event would be interested in those.

I looked around to see if I could find examples of
programs sending events to acme via 9p, but I haven't
managed to find them.  I see several examples of
scripts calling something named winwriteevent, and
the man page for that sounds promising, but I don't
see it as part of plan9port, and I was guessing that
people might use 9p write to acme/$winid/event
instead, or write Go/C program using the acme api
libraries that Russ provided?

Jim

James A. Robinson

unread,
Aug 30, 2013, 8:41:01 AM8/30/13
to
So I see that it actually isn't possible to do what
I want, that the write operations to an event file
are limited to just positional information.  That's
unfortunate, I had really hoped it was possible to
simulate events via an external program.


.../src/libacme/acme.c:

int
winwriteevent(Win *w, Event *e)
{
char buf[100];

snprint(buf, sizeof buf, "%c%c%d %d \n", e->c1, e->c2, e->q0, e->q1);
return fswrite(wfid(w, "event"), buf, strlen(buf));
}
0 new messages