Small tweaks
Lots of new code imported.
This commit is contained in:
parent
a770daa795
commit
2277c5d7bb
86 changed files with 12444 additions and 91 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -8,14 +8,49 @@
|
|||
#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)
|
||||
{
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue