* [9fans] acme programming questions
@ 2009-06-18 5:09 Tim Newsham
2009-06-18 6:49 ` Russ Cox
2009-06-18 7:10 ` yy
0 siblings, 2 replies; 4+ messages in thread
From: Tim Newsham @ 2009-06-18 5:09 UTC (permalink / raw)
To: 9fans
I've been trying my hand at some very simple acme programming
tasks and have some questions. I'm interested in a utility
that translate dot into a filename:line-line range and a
utility that waits for an acme window to be closed. If I'm
reinventing these, I'd love to hear about existing programs
that do these.
I wrote a small tool to translate dot into filename:address
and in the process noticed that its relatively easy to
get the dot positions in terms of characters, but I couldn't
find a good way to translate those into line numbers without
manually processing the input file and counting newlines.
Is there a better way to do this? If I had a tool to do
the translation I could do the rest of the process in rc.
As it stands I ended up doing it all in C.
http://www.thenewsh.com/~newsham/x/9/aaddr
http://www.thenewsh.com/~newsham/x/9/acmeaddr.c
I wrote a small tool to wait for a window to be closed by
reading the event file and copying back all events that
had the ``1'' bit set in the flag. This allows many of the
events to occur, but none of the search features work. Can I
have acme's default search behavior by feeding back more
events to acme?
http://www.thenewsh.com/~newsham/x/9/acmewait.c
Tim Newsham
http://www.thenewsh.com/~newsham/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] acme programming questions
2009-06-18 5:09 [9fans] acme programming questions Tim Newsham
@ 2009-06-18 6:49 ` Russ Cox
2009-06-18 7:10 ` yy
1 sibling, 0 replies; 4+ messages in thread
From: Russ Cox @ 2009-06-18 6:49 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
In plan9port there is a libacme and <acme.h>
which makes some of this easier. It is basically
a wrapping of the routines from acme Mail.
Using libacme, your event waiter can do
something like this to send the events back:
while(winreadevent(w, e) > 0) {
switch(e->c1){
default:
Unknown:
print("unknown message %c%c\n", e->c1, e->c2);
break;
case 'E': /* write to body; can't affect us */
case 'F': /* generated by our actions; ignore */
case 'K': /* type away; we don't care */
break;
case 'M':
switch(e->c2){
case 'x':
case 'X':
case 'l':
case 'L':
/* send it back */
winwriteevent(w, e);
break;
case 'I': /* modify away; we don't care */
case 'D':
case 'd':
case 'i':
break;
default:
goto Unknown;
}
}
}
Russ
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] acme programming questions
2009-06-18 5:09 [9fans] acme programming questions Tim Newsham
2009-06-18 6:49 ` Russ Cox
@ 2009-06-18 7:10 ` yy
2009-06-18 15:39 ` Tim Newsham
1 sibling, 1 reply; 4+ messages in thread
From: yy @ 2009-06-18 7:10 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
2009/6/18 Tim Newsham <newsham@lava.net>:
> I've been trying my hand at some very simple acme programming
> tasks and have some questions. I'm interested in a utility
> that translate dot into a filename:line-line range
I think Edit = is what you want.
--
- yiyus || JGL .
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] acme programming questions
2009-06-18 7:10 ` yy
@ 2009-06-18 15:39 ` Tim Newsham
0 siblings, 0 replies; 4+ messages in thread
From: Tim Newsham @ 2009-06-18 15:39 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
[-- Attachment #1: Type: TEXT/PLAIN, Size: 588 bytes --]
> 2009/6/18 Tim Newsham <newsham@lava.net>:
>> I've been trying my hand at some very simple acme programming
>> tasks and have some questions. I'm interested in a utility
>> that translate dot into a filename:line-line range
>
> I think Edit = is what you want.
more or less, except I want a program that I can manipulate the
output of. If I make a program force an "Edit =" in a particular
window, the output will go to the error window (and possibly create
a new window)... am I overlooking something?
> - yiyus || JGL .
Tim Newsham
http://www.thenewsh.com/~newsham/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-18 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-18 5:09 [9fans] acme programming questions Tim Newsham
2009-06-18 6:49 ` Russ Cox
2009-06-18 7:10 ` yy
2009-06-18 15:39 ` Tim Newsham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).