History

20100715-1712

forsyth committed 16 years ago

Commit 626a97a1 parent d416ec916 files · +135 −38Browse files

Unified · Split

16 files
  1. CHANGES +6 −0
  2. appl/wm/toolbar.b +26 −24
  3. dis/wm/toolbar.dis +0 −0
  4. emu/port/devsnarf.c +2 −1
  5. include/version.h +1 −1
  6. man/1/toolbar +30 −0
  7. utils/8a/a.y +7 −0
  8. utils/8c/list.c +3 −3
  9. utils/8c/peep.c +6 −2
  10. utils/8c/reg.c +2 −0
  11. utils/8l/l.h +1 −0
  12. utils/8l/span.c +2 −0
  13. utils/NOTICE +3 −2
  14. utils/cc/macbody +40 −6
  15. utils/kc/cgen.c +2 −0
  16. utils/kl/asm.c +5 −0
CHANGES+6−0
@@ -1,3 +1,9 @@
1+20100715
2+ appl/wm/toolbar.b changed not to create new /chan/snarf if one exists, unless -p (private) option given [toolbar(1)]
3+ utils/cc/macbody - add overlooked change to implement __VA_ARGS__
4+ other minor updates to the compilers to resync
5+20100714
6+ correctly initialise types in utils/cc/sub.c
17 20100504
28 change lib9/strtoull.c for MS
39 20100503
appl/wm/toolbar.b+26−24
@@ -82,12 +82,16 @@ init(ctxt: ref Draw->Context, argv: list of string) · 81 unmodified lines
8282 sys->bind("#s", "/chan", sys->MBEFORE);
8383
8484 arg->init(argv);
85− arg->setusage("toolbar [-s]");
85+ arg->setusage("toolbar [-s] [-p]");
8686 startmenu := 1;
87+# ownsnarf := (sys->open("/chan/snarf", Sys->ORDWR) == nil);
88+ ownsnarf := sys->stat("/chan/snarf").t0 < 0;
8789 while((c := arg->opt()) != 0){
8890 case c {
8991 's' =>
9092 startmenu = 0;
93+ 'p' =>
94+ ownsnarf = 1;
9195 * =>
9296 arg->usage();
9397 }
@@ -110,9 +114,13 @@ init(ctxt: ref Draw->Context, argv: list of string) · 16 unmodified lines
110114 shctxt := Context.new(ctxt);
111115 shctxt.addmodule("wm", myselfbuiltin);
112116
113− snarfIO := sys->file2chan("/chan", "snarf");
114− if(snarfIO == nil)
115− fatal(sys->sprint("cannot make /chan/snarf: %r"));
117+ snarfIO: ref Sys->FileIO;
118+ if(ownsnarf){
119+ snarfIO = sys->file2chan("/chan", "snarf");
120+ if(snarfIO == nil)
121+ fatal(sys->sprint("cannot make /chan/snarf: %r"));
122+ }else
123+ snarfIO = ref Sys->FileIO(chan of (int, int, int, Sys->Rread), chan of (int, array of byte, int, Sys->Rwrite));
116124 sync := chan of string;
117125 spawn consoleproc(ctxt, sync);
118126 if ((err := <-sync) != nil)
@@ -125,8 +133,8 @@ init(ctxt: ref Draw->Context, argv: list of string) · 6 unmodified lines
125133 snarf: array of byte;
126134 # write("/prog/"+string sys->pctl(0, nil)+"/ctl", "restricted"); # for testing
127135 for(;;) alt{
128− s := <-tbtop.ctxt.kbd =>
129− tk->keyboard(tbtop, c);
136+ k := <-tbtop.ctxt.kbd =>
137+ tk->keyboard(tbtop, k);
130138 m := <-tbtop.ctxt.ptr =>
131139 tk->pointer(tbtop, *m);
132140 s := <-tbtop.ctxt.ctl or
@@ -137,11 +145,13 @@ init(ctxt: ref Draw->Context, argv: list of string) · 4 unmodified lines
137145 if (donesetup){
138146 {
139147 shctxt.run(ref Listnode(nil, s) :: nil, 0);
140− } exception e {"fail:*" =>;}
148+ } exception {
149+ "fail:*" => ;
150+ }
141151 }
142152 detask := <-task =>
143153 deiconify(detask);
144− (off, data, fid, wc) := <-snarfIO.write =>
154+ (off, data, nil, wc) := <-snarfIO.write =>
145155 if(wc == nil)
146156 break;
147157 if (off == 0) # write at zero truncates
@@ -519,23 +529,15 @@ consoleproc(ctxt: ref Draw->Context, sync: chan of string) · 371 unmodified lines
519529 tk->keyboard(top, c);
520530 p := <-top.ctxt.ptr =>
521531 tk->pointer(top, *p);
522− (off, nbytes, fid, rc) := <-iostdout.read =>
523− if(rc == nil)
524− break;
525− alt{
526− rc <-= (nil, "inappropriate use of file") =>;
527− * =>;
528− }
529− (off, nbytes, fid, rc) := <-iostderr.read =>
530− if(rc == nil)
531− break;
532− alt{
533− rc <-= (nil, "inappropriate use of file") =>;
534− * =>;
535− }
536− (off, data, fid, wc) := <-iostdout.write =>
532+ (nil, nil, nil, rc) := <-iostdout.read =>
533+ if(rc != nil)
534+ rc <-= (nil, "inappropriate use of file");
535+ (nil, nil, nil, rc) := <-iostderr.read =>
536+ if(rc != nil)
537+ rc <-= (nil, "inappropriate use of file");
538+ (nil, data, nil, wc) := <-iostdout.write =>
537539 conout(top, data, wc);
538− (off, data, fid, wc) := <-iostderr.write =>
540+ (nil, data, nil, wc) := <-iostderr.write =>
539541 conout(top, data, wc);
540542 if(wc != nil)
541543 tkclient->wmctl(top, "untask");
dis/wm/toolbar.dis+0−0

Binary file not shown.

emu/port/devsnarf.c+2−1
@@ -63,7 +63,8 @@ snarfclose(Chan* c) · 62 unmodified lines
6363 /* this must be the last reference: no need to lock */
6464 if(c->mode == ORDWR || c->mode == OWRITE){
6565 if(!waserror()){
66− clipwrite(c->aux);
66+ if(c->aux != nil)
67+ clipwrite(c->aux);
6768 poperror();
6869 }
6970 }
include/version.h+1−1
@@ -1 +1 @@
1−#define VERSION "Fourth Edition (20100505)"
1+#define VERSION "Fourth Edition (20100715)"
man/1/toolbar+30−0
@@ -5,6 +5,8 @@ toolbar \- window manager toolbar · 4 unmodified lines
55 .B wm/toolbar
66 [
77 .B -s
8+] [
9+.B -p
810 ]
911 .SH DESCRIPTION
1012 .I Toolbar
@@ -55,6 +57,34 @@ The standard · 44 unmodified lines
5557 script executes the script
5658 .BI /usr/ username /lib/wmsetup ,
5759 enabling each user to have their own window manager configuration.
60+.PP
61+Normally
62+.I toolbar
63+packs a menu button referring to the start menu at the left hand side of the tool bar.
64+The
65+.B -s
66+option suppresses that.
67+.PP
68+.I Toolbar
69+serves the shared
70+.I "snarf buffer"
71+used by cut and paste in
72+.IR wm (1)
73+applications,
74+except in hosted Inferno where the host's standard clipboard system is used instead,
75+via
76+.IR snarf (3).
77+If
78+.I toolbar
79+cannot find
80+.B /chan/snarf
81+or the
82+.B -p
83+option is given,
84+.I toolbar
85+will create its own snarf buffer, private to the set of
86+applications running under the current instance of
87+.IR wm (1).
5888 .SH FILES
5989 .TP
6090 .B /lib/wmsetup
utils/8a/a.y+7−0
@@ -236,6 +236,7 @@ rom: · 235 unmodified lines
236236 }
237237 | reg
238238 | omem
239+| imm
239240
240241 rim:
241242 rem
@@ -386,6 +387,12 @@ omem: · 144 unmodified lines
386387 $$ = nullgen;
387388 $$.type = D_INDIR+D_SP;
388389 }
390+| con '(' LSREG ')'
391+ {
392+ $$ = nullgen;
393+ $$.type = D_INDIR+$3;
394+ $$.offset = $1;
395+ }
389396 | '(' LLREG '*' con ')'
390397 {
391398 $$ = nullgen;
utils/8c/list.c+3−3
@@ -70,7 +70,7 @@ Aconv(Fmt *fp) · 69 unmodified lines
7070 int
7171 Dconv(Fmt *fp)
7272 {
73− char str[40], s[20];
73+ char str[STRINGSZ], s[STRINGSZ];
7474 Adr *a;
7575 int i;
7676
@@ -224,7 +224,7 @@ char* regstr[] = · 147 unmodified lines
224224 int
225225 Rconv(Fmt *fp)
226226 {
227− char str[20];
227+ char str[STRINGSZ];
228228 int r;
229229
230230 r = va_arg(fp->args, int);
@@ -240,7 +240,7 @@ int · 9 unmodified lines
240240 Sconv(Fmt *fp)
241241 {
242242 int i, c;
243− char str[30], *p, *a;
243+ char str[STRINGSZ], *p, *a;
244244
245245 a = va_arg(fp->args, char*);
246246 p = str;
utils/8c/peep.c+6−2
@@ -639,10 +639,14 @@ copyu(Prog *p, Adr *v, Adr *s) · 638 unmodified lines
639639 return 2;
640640 goto caseread;
641641
642− case AMOVSL:
643642 case AREP:
644643 case AREPN:
645− if(v->type == D_CX || v->type == D_DI || v->type == D_SI)
644+ if(v->type == D_CX)
645+ return 2;
646+ goto caseread;
647+
648+ case AMOVSL:
649+ if(v->type == D_DI || v->type == D_SI)
646650 return 2;
647651 goto caseread;
648652
utils/8c/reg.c+2−0
@@ -224,7 +224,9 @@ regopt(Prog *p) · 223 unmodified lines
224224 */
225225 case AFMOVDP:
226226 case AFMOVFP:
227+ case AFMOVLP:
227228 case AFMOVVP:
229+ case AFMOVWP:
228230 case ACALL:
229231 for(z=0; z<BITS; z++)
230232 addrs.b[z] |= bit.b[z];
utils/8l/l.h+1−0
@@ -346,3 +346,4 @@ void zerosig(char*); · 345 unmodified lines
346346 #pragma varargck type "P" Prog*
347347 #pragma varargck type "R" int
348348 #pragma varargck type "A" int
349+#pragma varargck argpos diag 1
utils/8l/span.c+2−0
@@ -334,6 +334,8 @@ oclass(Adr *a) · 333 unmodified lines
334334 return Yax;
335335
336336 case D_CL:
337+ return Ycl;
338+
337339 case D_DL:
338340 case D_BL:
339341 case D_AH:
utils/NOTICE+3−2
@@ -9,10 +9,11 @@ file such as NOTICE, LICENCE or COPYING. · 8 unmodified lines
99 Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
1010 Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
1111 Portions Copyright © 1997-1999 Vita Nuova Limited
12− Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
12+ Portions Copyright © 2000-2008 Vita Nuova Holdings Limited (www.vitanuova.com)
1313 Portions Copyright © 2004,2006 Bruce Ellis
1414 Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
15− Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
15+ Revisions Copyright © 2000-2008 Lucent Technologies Inc. and others
16+ Portions Copyright © 2009 The Go Authors. All rights reserved.
1617
1718 Permission is hereby granted, free of charge, to any person obtaining a copy
1819 of this software and associated documentation files (the "Software"), to deal
utils/cc/macbody+40−6
@@ -1,3 +1,4 @@
1+#define VARMAC 0x80
12
23 long
34 getnsn(void)
@@ -43,6 +44,27 @@ getsym(void) · 39 unmodified lines
4344 return lookup();
4445 }
4546
47+Sym*
48+getsymdots(int *dots)
49+{
50+ int c;
51+ Sym *s;
52+
53+ s = getsym();
54+ if(s != S)
55+ return s;
56+
57+ c = getnsc();
58+ if(c != '.'){
59+ unget(c);
60+ return S;
61+ }
62+ if(getc() != '.' || getc() != '.')
63+ yyerror("bad dots in macro");
64+ *dots = 1;
65+ return slookup("__VA_ARGS__");
66+}
67+
4668 int
4769 getcom(void)
4870 {
@@ -172,7 +194,7 @@ macdef(void) · 123 unmodified lines
172194 {
173195 Sym *s, *a;
174196 char *args[NARG], *np, *base;
175− int n, i, c, len;
197+ int n, i, c, len, dots;
176198 int ischr;
177199
178200 s = getsym();
@@ -182,13 +204,14 @@ macdef(void) · 3 unmodified lines
182204 yyerror("macro redefined: %s", s->name);
183205 c = getc();
184206 n = -1;
207+ dots = 0;
185208 if(c == '(') {
186209 n++;
187210 c = getnsc();
188211 if(c != ')') {
189212 unget(c);
190213 for(;;) {
191− a = getsym();
214+ a = getsymdots(&dots);
192215 if(a == S)
193216 goto bad;
194217 if(n >= NARG) {
@@ -199,7 +222,7 @@ macdef(void) · 4 unmodified lines
199222 c = getnsc();
200223 if(c == ')')
201224 break;
202− if(c != ',')
225+ if(c != ',' || dots)
203226 goto bad;
204227 }
205228 }
@@ -325,6 +348,8 @@ macdef(void) · 119 unmodified lines
325348 } while(len & 3);
326349
327350 *base = n+1;
351+ if(dots)
352+ *base |= VARMAC;
328353 s->macro = base;
329354 if(debug['m'])
330355 print("#define %s %s\n", s->name, s->macro+1);
@@ -343,16 +368,19 @@ macexpand(Sym *s, char *b) · 12 unmodified lines
343368 {
344369 char buf[2000];
345370 int n, l, c, nargs;
346− char *arg[NARG], *cp, *ob, *ecp;
371+ char *arg[NARG], *cp, *ob, *ecp, dots;
347372
348373 ob = b;
349− nargs = *s->macro - 1;
350− if(nargs < 0) {
374+ if(*s->macro == 0) {
351375 strcpy(b, s->macro+1);
352376 if(debug['m'])
353377 print("#expand %s %s\n", s->name, ob);
354378 return;
355379 }
380+
381+ nargs = (char)(*s->macro & ~VARMAC) - 1;
382+ dots = *s->macro & VARMAC;
383+
356384 c = getnsc();
357385 if(c != '(')
358386 goto bad;
@@ -425,6 +453,10 @@ macexpand(Sym *s, char *b) · 66 unmodified lines
425453 }
426454 if(l == 0) {
427455 if(c == ',') {
456+ if(n == nargs && dots) {
457+ *cp++ = ',';
458+ continue;
459+ }
428460 *cp++ = 0;
429461 arg[n++] = cp;
430462 if(n > nargs)
@@ -452,6 +484,8 @@ macexpand(Sym *s, char *b) · 21 unmodified lines
452484 cp = s->macro+1;
453485 for(;;) {
454486 c = *cp++;
487+ if(c == '\n')
488+ c = ' ';
455489 if(c != '#') {
456490 *b++ = c;
457491 if(c == 0)
utils/kc/cgen.c+2−0
@@ -493,6 +493,8 @@ cgen(Node *n, Node *nn) · 492 unmodified lines
493493 } else
494494 gopcode(OADD, nodconst(v), Z, &nod);
495495 gopcode(OAS, &nod, Z, &nod2);
496+ if(nn && l->op == ONAME) /* in x=++i, emit USED(i) */
497+ gins(ANOP, l, Z);
496498
497499 regfree(&nod);
498500 if(l->addable < INDEXED)
utils/kl/asm.c+5−0
@@ -1001,6 +1001,11 @@ asmout(Prog *p, Optab *o, int aflag) · 1000 unmodified lines
10011001 }
10021002 }
10031003 break;
1004+
1005+ case 57: /* op r1,r2 with reserved rs1 */
1006+ r = 0;
1007+ o1 = OP_RRR(opcode(p->as), p->from.reg, r, p->to.reg);
1008+ break;
10041009 }
10051010 if(aflag)
10061011 return o1;