diff options
author | rsc <devnull@localhost> | 2005-01-30 16:34:12 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-01-30 16:34:12 +0000 |
commit | 9d01e221783e7706fd1d3dadfc8a7f678004929c (patch) | |
tree | ab3ca9688a6b41f27d40d65d431048edd65fd25d /src/cmd/acme | |
parent | 3fef2ed0565e831549b43153751c81e9ee2e7e86 (diff) | |
download | plan9port-9d01e221783e7706fd1d3dadfc8a7f678004929c.tar.gz plan9port-9d01e221783e7706fd1d3dadfc8a7f678004929c.tar.bz2 plan9port-9d01e221783e7706fd1d3dadfc8a7f678004929c.zip |
add errors file
Diffstat (limited to 'src/cmd/acme')
-rw-r--r-- | src/cmd/acme/dat.h | 1 | ||||
-rw-r--r-- | src/cmd/acme/fns.h | 1 | ||||
-rw-r--r-- | src/cmd/acme/fsys.c | 1 | ||||
-rw-r--r-- | src/cmd/acme/util.c | 43 | ||||
-rw-r--r-- | src/cmd/acme/xfid.c | 5 |
5 files changed, 51 insertions, 0 deletions
diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h index 4ac0d676..19229e7a 100644 --- a/src/cmd/acme/dat.h +++ b/src/cmd/acme/dat.h @@ -15,6 +15,7 @@ enum QWctl, QWdata, QWeditout, + QWerrors, QWevent, QWrdsel, QWwrsel, diff --git a/src/cmd/acme/fns.h b/src/cmd/acme/fns.h index c61f96ec..74a381e2 100644 --- a/src/cmd/acme/fns.h +++ b/src/cmd/acme/fns.h @@ -28,6 +28,7 @@ void allwindows(void(*)(Window*, void*), void*); uint loadfile(int, uint, int*, int(*)(void*, uint, Rune*, int), void*); Window* errorwin(Mntdir*, int); +Window* errorwinforwin(Window*); Runestr cleanrname(Runestr); void run(Window*, char*, Rune*, int, int, char*, char*, int); void fsysclose(void); diff --git a/src/cmd/acme/fsys.c b/src/cmd/acme/fsys.c index 536a3334..31236082 100644 --- a/src/cmd/acme/fsys.c +++ b/src/cmd/acme/fsys.c @@ -83,6 +83,7 @@ Dirtab dirtabw[]= { "ctl", QTFILE, QWctl, 0600 }, { "data", QTFILE, QWdata, 0600 }, { "editout", QTFILE, QWeditout, 0200 }, + { "errors", QTFILE, QWerrors, 0200 }, { "event", QTFILE, QWevent, 0600 }, { "rdsel", QTFILE, QWrdsel, 0400 }, { "wrsel", QTFILE, QWwrsel, 0200 }, diff --git a/src/cmd/acme/util.c b/src/cmd/acme/util.c index f9387df5..c224cce5 100644 --- a/src/cmd/acme/util.c +++ b/src/cmd/acme/util.c @@ -129,6 +129,49 @@ errorwin(Mntdir *md, int owner) return w; } +/* + * Incoming window should be locked. + * It will be unlocked and returned window + * will be locked in its place. + */ +Window* +errorwinforwin(Window *w) +{ + int i, n, nincl, owner; + Rune **incl; + Runestr dir; + Text *t; + + t = &w->body; + dir = dirname(t, nil, 0); + if(dir.nr==1 && dir.r[0]=='.'){ /* sigh */ + free(dir.r); + dir.r = nil; + dir.nr = 0; + } + incl = nil; + nincl = w->nincl; + if(nincl > 0){ + incl = emalloc(nincl*sizeof(Rune*)); + for(i=0; i<nincl; i++){ + n = runestrlen(w->incl[i]); + incl[i] = runemalloc(n+1); + runemove(incl[i], w->incl[i], n); + } + } + owner = w->owner; + winunlock(w); + for(;;){ + w = errorwin1(dir.r, dir.nr, incl, nincl); + winlock(w, owner); + if(w->col != nil) + break; + /* window deleted too fast */ + winunlock(w); + } + return w; +} + typedef struct Warning Warning; struct Warning{ diff --git a/src/cmd/acme/xfid.c b/src/cmd/acme/xfid.c index 579f1944..126a5fe9 100644 --- a/src/cmd/acme/xfid.c +++ b/src/cmd/acme/xfid.c @@ -444,6 +444,11 @@ xfidwrite(Xfid *x) respond(x, &fc, nil); break; + case QWerrors: + w = errorwinforwin(w); + t = &w->body; + goto BodyTag; + case QWbody: case QWwrsel: t = &w->body; |