diff options
Diffstat (limited to 'src/cmd/acme')
-rw-r--r-- | src/cmd/acme/acme.c | 9 | ||||
-rw-r--r-- | src/cmd/acme/dat.h | 2 | ||||
-rw-r--r-- | src/cmd/acme/elog.c | 2 | ||||
-rw-r--r-- | src/cmd/acme/exec.c | 1 | ||||
-rw-r--r-- | src/cmd/acme/fns.h | 1 | ||||
-rw-r--r-- | src/cmd/acme/look.c | 39 |
6 files changed, 46 insertions, 8 deletions
diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c index fbfb9f14..d4b4cad8 100644 --- a/src/cmd/acme/acme.c +++ b/src/cmd/acme/acme.c @@ -27,8 +27,6 @@ char wdir[512] = "."; Reffont *reffonts[2]; int snarffd = -1; int mainpid; -int plumbsendfd; -int plumbeditfd; enum{ NSnarf = 1000 /* less than 1024, I/O buffer size */ @@ -180,6 +178,8 @@ threadmain(int argc, char *argv[]) exits("keyboard"); } mainpid = getpid(); + startplumbing(); +/* plumbeditfd = plumbopen("edit", OREAD|OCEXEC); if(plumbeditfd < 0) fprint(2, "acme: can't initialize plumber: %r\n"); @@ -188,6 +188,7 @@ threadmain(int argc, char *argv[]) threadcreate(plumbproc, nil, STACK); } plumbsendfd = plumbopen("send", OWRITE|OCEXEC); +*/ fsysinit(); @@ -355,6 +356,7 @@ acmeerrorinit(void) threadcreate(acmeerrorproc, nil, STACK); } +/* void plumbproc(void *v) { @@ -369,6 +371,7 @@ plumbproc(void *v) sendp(cplumb, m); } } +*/ void keyboardthread(void *v) @@ -674,7 +677,7 @@ waitthread(void *v) textsetselect(t, 0, 0); } if(w->msg[0]) - warning(c->md, "%s: %s\n", c->name, w->msg); + warning(c->md, "%S: %s\n", c->name, w->msg); flushimage(display, 1); } qunlock(&row.lk); diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h index 9101ca34..94cfa383 100644 --- a/src/cmd/acme/dat.h +++ b/src/cmd/acme/dat.h @@ -524,8 +524,6 @@ char *home; char *fontnames[2]; Image *tagcols[NCOL]; Image *textcols[NCOL]; -int plumbsendfd; -int plumbeditfd; extern char wdir[]; /* must use extern because no dimension given */ int editing; int erroutfd; diff --git a/src/cmd/acme/elog.c b/src/cmd/acme/elog.c index e86af6ec..d7c9a9b0 100644 --- a/src/cmd/acme/elog.c +++ b/src/cmd/acme/elog.c @@ -170,7 +170,7 @@ eloginsert(File *f, int q0, Rune *r, int nr) elogflush(f); } /* try to merge with previous */ - if(f->elog.type==Insert && q0==f->elog.q0 && (q0+nr)-f->elog.q0<Maxstring){ + if(f->elog.type==Insert && q0==f->elog.q0 && f->elog.nr+nr<Maxstring){ runemove(f->elog.r+f->elog.nr, r, nr); f->elog.nr += nr; return; diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c index d81153ec..74f9f47c 100644 --- a/src/cmd/acme/exec.c +++ b/src/cmd/acme/exec.c @@ -1472,6 +1472,7 @@ Hard: } } threadexecl(cpid, sfd, "rc", "rc", "-c", t, nil); + warning(nil, "exec rc: %r\n"); Fail: /* threadexec hasn't happened, so send a zero */ diff --git a/src/cmd/acme/fns.h b/src/cmd/acme/fns.h index a73a7ec0..9fba7d7a 100644 --- a/src/cmd/acme/fns.h +++ b/src/cmd/acme/fns.h @@ -87,6 +87,7 @@ Rune* skipbl(Rune*, int, int*); Rune* findbl(Rune*, int, int*); char* edittext(Window*, int, Rune*, int); void flushwarnings(int); +void startplumbing(void); #define runemalloc(a) (Rune*)emalloc((a)*sizeof(Rune)) #define runerealloc(a, b) (Rune*)erealloc((a), (b)*sizeof(Rune)) diff --git a/src/cmd/acme/look.c b/src/cmd/acme/look.c index 6b259288..f6c4d4ee 100644 --- a/src/cmd/acme/look.c +++ b/src/cmd/acme/look.c @@ -8,15 +8,50 @@ #include <frame.h> #include <fcall.h> #include <regexp.h> +#define Fid FsFid +#include <fs.h> #include <plumb.h> +#undef Fid #include "dat.h" #include "fns.h" +FsFid *plumbsendfid; +FsFid *plumbeditfid; + Window* openfile(Text*, Expand*); int nuntitled; void +plumbproc(void *v) +{ + Plumbmsg *m; + + USED(v); + threadsetname("plumbproc"); + for(;;){ + m = plumbrecvfid(plumbeditfid); + if(m == nil) + threadexits(nil); + sendp(cplumb, m); + } +} + +void +startplumbing(void) +{ + plumbeditfid = plumbopenfid("edit", OREAD|OCEXEC); + if(plumbeditfid == nil) + fprint(2, "acme: can't initialize plumber: %r\n"); + else{ + cplumb = chancreate(sizeof(Plumbmsg*), 0); + threadcreate(plumbproc, nil, STACK); + } + plumbsendfid = plumbopenfid("send", OWRITE|OCEXEC); +} + + +void look3(Text *t, uint q0, uint q1, int external) { int n, c, f, expanded; @@ -79,7 +114,7 @@ look3(Text *t, uint q0, uint q1, int external) free(r); goto Return; } - if(plumbsendfd >= 0){ + if(plumbsendfid != nil){ /* send whitespace-delimited word to plumber */ m = emalloc(sizeof(Plumbmsg)); m->src = estrdup("acme"); @@ -121,7 +156,7 @@ look3(Text *t, uint q0, uint q1, int external) m->data = runetobyte(r, q1-q0); m->ndata = strlen(m->data); free(r); - if(m->ndata<messagesize-1024 && plumbsend(plumbsendfd, m) >= 0){ + if(m->ndata<messagesize-1024 && plumbsendtofid(plumbsendfid, m) >= 0){ plumbfree(m); goto Return; } |