summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorforsyth <forsyth@vitanuova.com>2010-07-15 17:13:02 +0100
committerforsyth <forsyth@vitanuova.com>2010-07-15 17:13:02 +0100
commit4d1cf5269ce9db7a55c9be8fb51fda675c5d8223 (patch)
tree7f3d5e5c801b38cd38116259247dba984a01553d
parent287839a46d8cf9bfe7ae06f655a4a74f8ba54793 (diff)
20100715-1712
-rw-r--r--CHANGES6
-rw-r--r--appl/wm/toolbar.b50
-rw-r--r--dis/wm/toolbar.disbin10616 -> 10598 bytes
-rw-r--r--emu/port/devsnarf.c3
-rw-r--r--include/version.h2
-rw-r--r--man/1/toolbar30
-rw-r--r--utils/8a/a.y7
-rw-r--r--utils/8c/list.c6
-rw-r--r--utils/8c/peep.c8
-rw-r--r--utils/8c/reg.c2
-rw-r--r--utils/8l/l.h1
-rw-r--r--utils/8l/span.c2
-rw-r--r--utils/NOTICE5
-rw-r--r--utils/cc/macbody46
-rw-r--r--utils/kc/cgen.c2
-rw-r--r--utils/kl/asm.c5
16 files changed, 136 insertions, 39 deletions
diff --git a/CHANGES b/CHANGES
index d548a05f..d4c0f72e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+20100715
+ appl/wm/toolbar.b changed not to create new /chan/snarf if one exists, unless -p (private) option given [toolbar(1)]
+ utils/cc/macbody - add overlooked change to implement __VA_ARGS__
+ other minor updates to the compilers to resync
+20100714
+ correctly initialise types in utils/cc/sub.c
20100504
change lib9/strtoull.c for MS
20100503
diff --git a/appl/wm/toolbar.b b/appl/wm/toolbar.b
index a96f5ba4..cd99f927 100644
--- a/appl/wm/toolbar.b
+++ b/appl/wm/toolbar.b
@@ -82,12 +82,16 @@ init(ctxt: ref Draw->Context, argv: list of string)
sys->bind("#s", "/chan", sys->MBEFORE);
arg->init(argv);
- arg->setusage("toolbar [-s]");
+ arg->setusage("toolbar [-s] [-p]");
startmenu := 1;
+# ownsnarf := (sys->open("/chan/snarf", Sys->ORDWR) == nil);
+ ownsnarf := sys->stat("/chan/snarf").t0 < 0;
while((c := arg->opt()) != 0){
case c {
's' =>
startmenu = 0;
+ 'p' =>
+ ownsnarf = 1;
* =>
arg->usage();
}
@@ -110,9 +114,13 @@ init(ctxt: ref Draw->Context, argv: list of string)
shctxt := Context.new(ctxt);
shctxt.addmodule("wm", myselfbuiltin);
- snarfIO := sys->file2chan("/chan", "snarf");
- if(snarfIO == nil)
- fatal(sys->sprint("cannot make /chan/snarf: %r"));
+ snarfIO: ref Sys->FileIO;
+ if(ownsnarf){
+ snarfIO = sys->file2chan("/chan", "snarf");
+ if(snarfIO == nil)
+ fatal(sys->sprint("cannot make /chan/snarf: %r"));
+ }else
+ snarfIO = ref Sys->FileIO(chan of (int, int, int, Sys->Rread), chan of (int, array of byte, int, Sys->Rwrite));
sync := chan of string;
spawn consoleproc(ctxt, sync);
if ((err := <-sync) != nil)
@@ -125,8 +133,8 @@ init(ctxt: ref Draw->Context, argv: list of string)
snarf: array of byte;
# write("/prog/"+string sys->pctl(0, nil)+"/ctl", "restricted"); # for testing
for(;;) alt{
- s := <-tbtop.ctxt.kbd =>
- tk->keyboard(tbtop, c);
+ k := <-tbtop.ctxt.kbd =>
+ tk->keyboard(tbtop, k);
m := <-tbtop.ctxt.ptr =>
tk->pointer(tbtop, *m);
s := <-tbtop.ctxt.ctl or
@@ -137,11 +145,13 @@ init(ctxt: ref Draw->Context, argv: list of string)
if (donesetup){
{
shctxt.run(ref Listnode(nil, s) :: nil, 0);
- } exception e {"fail:*" =>;}
+ } exception {
+ "fail:*" => ;
+ }
}
detask := <-task =>
deiconify(detask);
- (off, data, fid, wc) := <-snarfIO.write =>
+ (off, data, nil, wc) := <-snarfIO.write =>
if(wc == nil)
break;
if (off == 0) # write at zero truncates
@@ -519,23 +529,15 @@ consoleproc(ctxt: ref Draw->Context, sync: chan of string)
tk->keyboard(top, c);
p := <-top.ctxt.ptr =>
tk->pointer(top, *p);
- (off, nbytes, fid, rc) := <-iostdout.read =>
- if(rc == nil)
- break;
- alt{
- rc <-= (nil, "inappropriate use of file") =>;
- * =>;
- }
- (off, nbytes, fid, rc) := <-iostderr.read =>
- if(rc == nil)
- break;
- alt{
- rc <-= (nil, "inappropriate use of file") =>;
- * =>;
- }
- (off, data, fid, wc) := <-iostdout.write =>
+ (nil, nil, nil, rc) := <-iostdout.read =>
+ if(rc != nil)
+ rc <-= (nil, "inappropriate use of file");
+ (nil, nil, nil, rc) := <-iostderr.read =>
+ if(rc != nil)
+ rc <-= (nil, "inappropriate use of file");
+ (nil, data, nil, wc) := <-iostdout.write =>
conout(top, data, wc);
- (off, data, fid, wc) := <-iostderr.write =>
+ (nil, data, nil, wc) := <-iostderr.write =>
conout(top, data, wc);
if(wc != nil)
tkclient->wmctl(top, "untask");
diff --git a/dis/wm/toolbar.dis b/dis/wm/toolbar.dis
index ccbddd07..32c5300c 100644
--- a/dis/wm/toolbar.dis
+++ b/dis/wm/toolbar.dis
Binary files differ
diff --git a/emu/port/devsnarf.c b/emu/port/devsnarf.c
index 4778c130..dda5fe31 100644
--- a/emu/port/devsnarf.c
+++ b/emu/port/devsnarf.c
@@ -63,7 +63,8 @@ snarfclose(Chan* c)
/* this must be the last reference: no need to lock */
if(c->mode == ORDWR || c->mode == OWRITE){
if(!waserror()){
- clipwrite(c->aux);
+ if(c->aux != nil)
+ clipwrite(c->aux);
poperror();
}
}
diff --git a/include/version.h b/include/version.h
index 22ae5377..4f7c0d9f 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20100505)"
+#define VERSION "Fourth Edition (20100715)"
diff --git a/man/1/toolbar b/man/1/toolbar
index 674b4c31..2b934a9f 100644
--- a/man/1/toolbar
+++ b/man/1/toolbar
@@ -5,6 +5,8 @@ toolbar \- window manager toolbar
.B wm/toolbar
[
.B -s
+] [
+.B -p
]
.SH DESCRIPTION
.I Toolbar
@@ -55,6 +57,34 @@ The standard
script executes the script
.BI /usr/ username /lib/wmsetup ,
enabling each user to have their own window manager configuration.
+.PP
+Normally
+.I toolbar
+packs a menu button referring to the start menu at the left hand side of the tool bar.
+The
+.B -s
+option suppresses that.
+.PP
+.I Toolbar
+serves the shared
+.I "snarf buffer"
+used by cut and paste in
+.IR wm (1)
+applications,
+except in hosted Inferno where the host's standard clipboard system is used instead,
+via
+.IR snarf (3).
+If
+.I toolbar
+cannot find
+.B /chan/snarf
+or the
+.B -p
+option is given,
+.I toolbar
+will create its own snarf buffer, private to the set of
+applications running under the current instance of
+.IR wm (1).
.SH FILES
.TP
.B /lib/wmsetup
diff --git a/utils/8a/a.y b/utils/8a/a.y
index 167234b4..631344d3 100644
--- a/utils/8a/a.y
+++ b/utils/8a/a.y
@@ -236,6 +236,7 @@ rom:
}
| reg
| omem
+| imm
rim:
rem
@@ -386,6 +387,12 @@ omem:
$$ = nullgen;
$$.type = D_INDIR+D_SP;
}
+| con '(' LSREG ')'
+ {
+ $$ = nullgen;
+ $$.type = D_INDIR+$3;
+ $$.offset = $1;
+ }
| '(' LLREG '*' con ')'
{
$$ = nullgen;
diff --git a/utils/8c/list.c b/utils/8c/list.c
index 8ee83383..84466942 100644
--- a/utils/8c/list.c
+++ b/utils/8c/list.c
@@ -70,7 +70,7 @@ Aconv(Fmt *fp)
int
Dconv(Fmt *fp)
{
- char str[40], s[20];
+ char str[STRINGSZ], s[STRINGSZ];
Adr *a;
int i;
@@ -224,7 +224,7 @@ char* regstr[] =
int
Rconv(Fmt *fp)
{
- char str[20];
+ char str[STRINGSZ];
int r;
r = va_arg(fp->args, int);
@@ -240,7 +240,7 @@ int
Sconv(Fmt *fp)
{
int i, c;
- char str[30], *p, *a;
+ char str[STRINGSZ], *p, *a;
a = va_arg(fp->args, char*);
p = str;
diff --git a/utils/8c/peep.c b/utils/8c/peep.c
index ed3e6b78..3d98b771 100644
--- a/utils/8c/peep.c
+++ b/utils/8c/peep.c
@@ -639,10 +639,14 @@ copyu(Prog *p, Adr *v, Adr *s)
return 2;
goto caseread;
- case AMOVSL:
case AREP:
case AREPN:
- if(v->type == D_CX || v->type == D_DI || v->type == D_SI)
+ if(v->type == D_CX)
+ return 2;
+ goto caseread;
+
+ case AMOVSL:
+ if(v->type == D_DI || v->type == D_SI)
return 2;
goto caseread;
diff --git a/utils/8c/reg.c b/utils/8c/reg.c
index 12ad50ab..fe84f573 100644
--- a/utils/8c/reg.c
+++ b/utils/8c/reg.c
@@ -224,7 +224,9 @@ regopt(Prog *p)
*/
case AFMOVDP:
case AFMOVFP:
+ case AFMOVLP:
case AFMOVVP:
+ case AFMOVWP:
case ACALL:
for(z=0; z<BITS; z++)
addrs.b[z] |= bit.b[z];
diff --git a/utils/8l/l.h b/utils/8l/l.h
index 3affb6ae..e3be6b17 100644
--- a/utils/8l/l.h
+++ b/utils/8l/l.h
@@ -346,3 +346,4 @@ void zerosig(char*);
#pragma varargck type "P" Prog*
#pragma varargck type "R" int
#pragma varargck type "A" int
+#pragma varargck argpos diag 1
diff --git a/utils/8l/span.c b/utils/8l/span.c
index 0adecbb7..67ec929b 100644
--- a/utils/8l/span.c
+++ b/utils/8l/span.c
@@ -334,6 +334,8 @@ oclass(Adr *a)
return Yax;
case D_CL:
+ return Ycl;
+
case D_DL:
case D_BL:
case D_AH:
diff --git a/utils/NOTICE b/utils/NOTICE
index 7ffa9708..b36c8093 100644
--- a/utils/NOTICE
+++ b/utils/NOTICE
@@ -9,10 +9,11 @@ file such as NOTICE, LICENCE or COPYING.
Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
Portions Copyright © 1997-1999 Vita Nuova Limited
- Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
+ Portions Copyright © 2000-2008 Vita Nuova Holdings Limited (www.vitanuova.com)
Portions Copyright © 2004,2006 Bruce Ellis
Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
- Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
+ Revisions Copyright © 2000-2008 Lucent Technologies Inc. and others
+ Portions Copyright © 2009 The Go Authors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/utils/cc/macbody b/utils/cc/macbody
index 91181875..e26dc427 100644
--- a/utils/cc/macbody
+++ b/utils/cc/macbody
@@ -1,3 +1,4 @@
+#define VARMAC 0x80
long
getnsn(void)
@@ -43,6 +44,27 @@ getsym(void)
return lookup();
}
+Sym*
+getsymdots(int *dots)
+{
+ int c;
+ Sym *s;
+
+ s = getsym();
+ if(s != S)
+ return s;
+
+ c = getnsc();
+ if(c != '.'){
+ unget(c);
+ return S;
+ }
+ if(getc() != '.' || getc() != '.')
+ yyerror("bad dots in macro");
+ *dots = 1;
+ return slookup("__VA_ARGS__");
+}
+
int
getcom(void)
{
@@ -172,7 +194,7 @@ macdef(void)
{
Sym *s, *a;
char *args[NARG], *np, *base;
- int n, i, c, len;
+ int n, i, c, len, dots;
int ischr;
s = getsym();
@@ -182,13 +204,14 @@ macdef(void)
yyerror("macro redefined: %s", s->name);
c = getc();
n = -1;
+ dots = 0;
if(c == '(') {
n++;
c = getnsc();
if(c != ')') {
unget(c);
for(;;) {
- a = getsym();
+ a = getsymdots(&dots);
if(a == S)
goto bad;
if(n >= NARG) {
@@ -199,7 +222,7 @@ macdef(void)
c = getnsc();
if(c == ')')
break;
- if(c != ',')
+ if(c != ',' || dots)
goto bad;
}
}
@@ -325,6 +348,8 @@ macdef(void)
} while(len & 3);
*base = n+1;
+ if(dots)
+ *base |= VARMAC;
s->macro = base;
if(debug['m'])
print("#define %s %s\n", s->name, s->macro+1);
@@ -343,16 +368,19 @@ macexpand(Sym *s, char *b)
{
char buf[2000];
int n, l, c, nargs;
- char *arg[NARG], *cp, *ob, *ecp;
+ char *arg[NARG], *cp, *ob, *ecp, dots;
ob = b;
- nargs = *s->macro - 1;
- if(nargs < 0) {
+ if(*s->macro == 0) {
strcpy(b, s->macro+1);
if(debug['m'])
print("#expand %s %s\n", s->name, ob);
return;
}
+
+ nargs = (char)(*s->macro & ~VARMAC) - 1;
+ dots = *s->macro & VARMAC;
+
c = getnsc();
if(c != '(')
goto bad;
@@ -425,6 +453,10 @@ macexpand(Sym *s, char *b)
}
if(l == 0) {
if(c == ',') {
+ if(n == nargs && dots) {
+ *cp++ = ',';
+ continue;
+ }
*cp++ = 0;
arg[n++] = cp;
if(n > nargs)
@@ -452,6 +484,8 @@ macexpand(Sym *s, char *b)
cp = s->macro+1;
for(;;) {
c = *cp++;
+ if(c == '\n')
+ c = ' ';
if(c != '#') {
*b++ = c;
if(c == 0)
diff --git a/utils/kc/cgen.c b/utils/kc/cgen.c
index e4e54d48..a6b5771c 100644
--- a/utils/kc/cgen.c
+++ b/utils/kc/cgen.c
@@ -493,6 +493,8 @@ cgen(Node *n, Node *nn)
} else
gopcode(OADD, nodconst(v), Z, &nod);
gopcode(OAS, &nod, Z, &nod2);
+ if(nn && l->op == ONAME) /* in x=++i, emit USED(i) */
+ gins(ANOP, l, Z);
regfree(&nod);
if(l->addable < INDEXED)
diff --git a/utils/kl/asm.c b/utils/kl/asm.c
index dde73d6d..62fe60b7 100644
--- a/utils/kl/asm.c
+++ b/utils/kl/asm.c
@@ -1001,6 +1001,11 @@ asmout(Prog *p, Optab *o, int aflag)
}
}
break;
+
+ case 57: /* op r1,r2 with reserved rs1 */
+ r = 0;
+ o1 = OP_RRR(opcode(p->as), p->from.reg, r, p->to.reg);
+ break;
}
if(aflag)
return o1;