Unified · Split
| @@ -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 | |
| 1 | 7 | 20100504 |
| 2 | 8 | change lib9/strtoull.c for MS |
| 3 | 9 | 20100503 |
| @@ -82,12 +82,16 @@ init(ctxt: ref Draw->Context, argv: list of string) · 81 unmodified lines | ||
| 82 | 82 | sys->bind("#s", "/chan", sys->MBEFORE); |
| 83 | 83 | |
| 84 | 84 | arg->init(argv); |
| 85 | − arg->setusage("toolbar [-s]"); | |
| 85 | + arg->setusage("toolbar [-s] [-p]"); | |
| 86 | 86 | startmenu := 1; |
| 87 | +# ownsnarf := (sys->open("/chan/snarf", Sys->ORDWR) == nil); | |
| 88 | + ownsnarf := sys->stat("/chan/snarf").t0 < 0; | |
| 87 | 89 | while((c := arg->opt()) != 0){ |
| 88 | 90 | case c { |
| 89 | 91 | 's' => |
| 90 | 92 | startmenu = 0; |
| 93 | + 'p' => | |
| 94 | + ownsnarf = 1; | |
| 91 | 95 | * => |
| 92 | 96 | arg->usage(); |
| 93 | 97 | } |
| @@ -110,9 +114,13 @@ init(ctxt: ref Draw->Context, argv: list of string) · 16 unmodified lines | ||
| 110 | 114 | shctxt := Context.new(ctxt); |
| 111 | 115 | shctxt.addmodule("wm", myselfbuiltin); |
| 112 | 116 | |
| 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)); | |
| 116 | 124 | sync := chan of string; |
| 117 | 125 | spawn consoleproc(ctxt, sync); |
| 118 | 126 | if ((err := <-sync) != nil) |
| @@ -125,8 +133,8 @@ init(ctxt: ref Draw->Context, argv: list of string) · 6 unmodified lines | ||
| 125 | 133 | snarf: array of byte; |
| 126 | 134 | # write("/prog/"+string sys->pctl(0, nil)+"/ctl", "restricted"); # for testing |
| 127 | 135 | for(;;) alt{ |
| 128 | − s := <-tbtop.ctxt.kbd => | |
| 129 | − tk->keyboard(tbtop, c); | |
| 136 | + k := <-tbtop.ctxt.kbd => | |
| 137 | + tk->keyboard(tbtop, k); | |
| 130 | 138 | m := <-tbtop.ctxt.ptr => |
| 131 | 139 | tk->pointer(tbtop, *m); |
| 132 | 140 | s := <-tbtop.ctxt.ctl or |
| @@ -137,11 +145,13 @@ init(ctxt: ref Draw->Context, argv: list of string) · 4 unmodified lines | ||
| 137 | 145 | if (donesetup){ |
| 138 | 146 | { |
| 139 | 147 | shctxt.run(ref Listnode(nil, s) :: nil, 0); |
| 140 | − } exception e {"fail:*" =>;} | |
| 148 | + } exception { | |
| 149 | + "fail:*" => ; | |
| 150 | + } | |
| 141 | 151 | } |
| 142 | 152 | detask := <-task => |
| 143 | 153 | deiconify(detask); |
| 144 | − (off, data, fid, wc) := <-snarfIO.write => | |
| 154 | + (off, data, nil, wc) := <-snarfIO.write => | |
| 145 | 155 | if(wc == nil) |
| 146 | 156 | break; |
| 147 | 157 | if (off == 0) # write at zero truncates |
| @@ -519,23 +529,15 @@ consoleproc(ctxt: ref Draw->Context, sync: chan of string) · 371 unmodified lines | ||
| 519 | 529 | tk->keyboard(top, c); |
| 520 | 530 | p := <-top.ctxt.ptr => |
| 521 | 531 | 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 => | |
| 537 | 539 | conout(top, data, wc); |
| 538 | − (off, data, fid, wc) := <-iostderr.write => | |
| 540 | + (nil, data, nil, wc) := <-iostderr.write => | |
| 539 | 541 | conout(top, data, wc); |
| 540 | 542 | if(wc != nil) |
| 541 | 543 | tkclient->wmctl(top, "untask"); |
Binary file not shown.
| @@ -63,7 +63,8 @@ snarfclose(Chan* c) · 62 unmodified lines | ||
| 63 | 63 | /* this must be the last reference: no need to lock */ |
| 64 | 64 | if(c->mode == ORDWR || c->mode == OWRITE){ |
| 65 | 65 | if(!waserror()){ |
| 66 | − clipwrite(c->aux); | |
| 66 | + if(c->aux != nil) | |
| 67 | + clipwrite(c->aux); | |
| 67 | 68 | poperror(); |
| 68 | 69 | } |
| 69 | 70 | } |
| @@ -1 +1 @@ | ||
| 1 | −#define VERSION "Fourth Edition (20100505)" | |
| 1 | +#define VERSION "Fourth Edition (20100715)" | |
| @@ -5,6 +5,8 @@ toolbar \- window manager toolbar · 4 unmodified lines | ||
| 5 | 5 | .B wm/toolbar |
| 6 | 6 | [ |
| 7 | 7 | .B -s |
| 8 | +] [ | |
| 9 | +.B -p | |
| 8 | 10 | ] |
| 9 | 11 | .SH DESCRIPTION |
| 10 | 12 | .I Toolbar |
| @@ -55,6 +57,34 @@ The standard · 44 unmodified lines | ||
| 55 | 57 | script executes the script |
| 56 | 58 | .BI /usr/ username /lib/wmsetup , |
| 57 | 59 | 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). | |
| 58 | 88 | .SH FILES |
| 59 | 89 | .TP |
| 60 | 90 | .B /lib/wmsetup |
| @@ -236,6 +236,7 @@ rom: · 235 unmodified lines | ||
| 236 | 236 | } |
| 237 | 237 | | reg |
| 238 | 238 | | omem |
| 239 | +| imm | |
| 239 | 240 | |
| 240 | 241 | rim: |
| 241 | 242 | rem |
| @@ -386,6 +387,12 @@ omem: · 144 unmodified lines | ||
| 386 | 387 | $$ = nullgen; |
| 387 | 388 | $$.type = D_INDIR+D_SP; |
| 388 | 389 | } |
| 390 | +| con '(' LSREG ')' | |
| 391 | + { | |
| 392 | + $$ = nullgen; | |
| 393 | + $$.type = D_INDIR+$3; | |
| 394 | + $$.offset = $1; | |
| 395 | + } | |
| 389 | 396 | | '(' LLREG '*' con ')' |
| 390 | 397 | { |
| 391 | 398 | $$ = nullgen; |
| @@ -70,7 +70,7 @@ Aconv(Fmt *fp) · 69 unmodified lines | ||
| 70 | 70 | int |
| 71 | 71 | Dconv(Fmt *fp) |
| 72 | 72 | { |
| 73 | − char str[40], s[20]; | |
| 73 | + char str[STRINGSZ], s[STRINGSZ]; | |
| 74 | 74 | Adr *a; |
| 75 | 75 | int i; |
| 76 | 76 | |
| @@ -224,7 +224,7 @@ char* regstr[] = · 147 unmodified lines | ||
| 224 | 224 | int |
| 225 | 225 | Rconv(Fmt *fp) |
| 226 | 226 | { |
| 227 | − char str[20]; | |
| 227 | + char str[STRINGSZ]; | |
| 228 | 228 | int r; |
| 229 | 229 | |
| 230 | 230 | r = va_arg(fp->args, int); |
| @@ -240,7 +240,7 @@ int · 9 unmodified lines | ||
| 240 | 240 | Sconv(Fmt *fp) |
| 241 | 241 | { |
| 242 | 242 | int i, c; |
| 243 | − char str[30], *p, *a; | |
| 243 | + char str[STRINGSZ], *p, *a; | |
| 244 | 244 | |
| 245 | 245 | a = va_arg(fp->args, char*); |
| 246 | 246 | p = str; |
| @@ -639,10 +639,14 @@ copyu(Prog *p, Adr *v, Adr *s) · 638 unmodified lines | ||
| 639 | 639 | return 2; |
| 640 | 640 | goto caseread; |
| 641 | 641 | |
| 642 | − case AMOVSL: | |
| 643 | 642 | case AREP: |
| 644 | 643 | 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) | |
| 646 | 650 | return 2; |
| 647 | 651 | goto caseread; |
| 648 | 652 | |
| @@ -224,7 +224,9 @@ regopt(Prog *p) · 223 unmodified lines | ||
| 224 | 224 | */ |
| 225 | 225 | case AFMOVDP: |
| 226 | 226 | case AFMOVFP: |
| 227 | + case AFMOVLP: | |
| 227 | 228 | case AFMOVVP: |
| 229 | + case AFMOVWP: | |
| 228 | 230 | case ACALL: |
| 229 | 231 | for(z=0; z<BITS; z++) |
| 230 | 232 | addrs.b[z] |= bit.b[z]; |
| @@ -346,3 +346,4 @@ void zerosig(char*); · 345 unmodified lines | ||
| 346 | 346 | #pragma varargck type "P" Prog* |
| 347 | 347 | #pragma varargck type "R" int |
| 348 | 348 | #pragma varargck type "A" int |
| 349 | +#pragma varargck argpos diag 1 | |
| @@ -334,6 +334,8 @@ oclass(Adr *a) · 333 unmodified lines | ||
| 334 | 334 | return Yax; |
| 335 | 335 | |
| 336 | 336 | case D_CL: |
| 337 | + return Ycl; | |
| 338 | + | |
| 337 | 339 | case D_DL: |
| 338 | 340 | case D_BL: |
| 339 | 341 | case D_AH: |
| @@ -9,10 +9,11 @@ file such as NOTICE, LICENCE or COPYING. · 8 unmodified lines | ||
| 9 | 9 | Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
| 10 | 10 | Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
| 11 | 11 | 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) | |
| 13 | 13 | Portions Copyright © 2004,2006 Bruce Ellis |
| 14 | 14 | 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. | |
| 16 | 17 | |
| 17 | 18 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 18 | 19 | of this software and associated documentation files (the "Software"), to deal |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#define VARMAC 0x80 | |
| 1 | 2 | |
| 2 | 3 | long |
| 3 | 4 | getnsn(void) |
| @@ -43,6 +44,27 @@ getsym(void) · 39 unmodified lines | ||
| 43 | 44 | return lookup(); |
| 44 | 45 | } |
| 45 | 46 | |
| 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 | + | |
| 46 | 68 | int |
| 47 | 69 | getcom(void) |
| 48 | 70 | { |
| @@ -172,7 +194,7 @@ macdef(void) · 123 unmodified lines | ||
| 172 | 194 | { |
| 173 | 195 | Sym *s, *a; |
| 174 | 196 | char *args[NARG], *np, *base; |
| 175 | − int n, i, c, len; | |
| 197 | + int n, i, c, len, dots; | |
| 176 | 198 | int ischr; |
| 177 | 199 | |
| 178 | 200 | s = getsym(); |
| @@ -182,13 +204,14 @@ macdef(void) · 3 unmodified lines | ||
| 182 | 204 | yyerror("macro redefined: %s", s->name); |
| 183 | 205 | c = getc(); |
| 184 | 206 | n = -1; |
| 207 | + dots = 0; | |
| 185 | 208 | if(c == '(') { |
| 186 | 209 | n++; |
| 187 | 210 | c = getnsc(); |
| 188 | 211 | if(c != ')') { |
| 189 | 212 | unget(c); |
| 190 | 213 | for(;;) { |
| 191 | − a = getsym(); | |
| 214 | + a = getsymdots(&dots); | |
| 192 | 215 | if(a == S) |
| 193 | 216 | goto bad; |
| 194 | 217 | if(n >= NARG) { |
| @@ -199,7 +222,7 @@ macdef(void) · 4 unmodified lines | ||
| 199 | 222 | c = getnsc(); |
| 200 | 223 | if(c == ')') |
| 201 | 224 | break; |
| 202 | − if(c != ',') | |
| 225 | + if(c != ',' || dots) | |
| 203 | 226 | goto bad; |
| 204 | 227 | } |
| 205 | 228 | } |
| @@ -325,6 +348,8 @@ macdef(void) · 119 unmodified lines | ||
| 325 | 348 | } while(len & 3); |
| 326 | 349 | |
| 327 | 350 | *base = n+1; |
| 351 | + if(dots) | |
| 352 | + *base |= VARMAC; | |
| 328 | 353 | s->macro = base; |
| 329 | 354 | if(debug['m']) |
| 330 | 355 | print("#define %s %s\n", s->name, s->macro+1); |
| @@ -343,16 +368,19 @@ macexpand(Sym *s, char *b) · 12 unmodified lines | ||
| 343 | 368 | { |
| 344 | 369 | char buf[2000]; |
| 345 | 370 | int n, l, c, nargs; |
| 346 | − char *arg[NARG], *cp, *ob, *ecp; | |
| 371 | + char *arg[NARG], *cp, *ob, *ecp, dots; | |
| 347 | 372 | |
| 348 | 373 | ob = b; |
| 349 | − nargs = *s->macro - 1; | |
| 350 | − if(nargs < 0) { | |
| 374 | + if(*s->macro == 0) { | |
| 351 | 375 | strcpy(b, s->macro+1); |
| 352 | 376 | if(debug['m']) |
| 353 | 377 | print("#expand %s %s\n", s->name, ob); |
| 354 | 378 | return; |
| 355 | 379 | } |
| 380 | + | |
| 381 | + nargs = (char)(*s->macro & ~VARMAC) - 1; | |
| 382 | + dots = *s->macro & VARMAC; | |
| 383 | + | |
| 356 | 384 | c = getnsc(); |
| 357 | 385 | if(c != '(') |
| 358 | 386 | goto bad; |
| @@ -425,6 +453,10 @@ macexpand(Sym *s, char *b) · 66 unmodified lines | ||
| 425 | 453 | } |
| 426 | 454 | if(l == 0) { |
| 427 | 455 | if(c == ',') { |
| 456 | + if(n == nargs && dots) { | |
| 457 | + *cp++ = ','; | |
| 458 | + continue; | |
| 459 | + } | |
| 428 | 460 | *cp++ = 0; |
| 429 | 461 | arg[n++] = cp; |
| 430 | 462 | if(n > nargs) |
| @@ -452,6 +484,8 @@ macexpand(Sym *s, char *b) · 21 unmodified lines | ||
| 452 | 484 | cp = s->macro+1; |
| 453 | 485 | for(;;) { |
| 454 | 486 | c = *cp++; |
| 487 | + if(c == '\n') | |
| 488 | + c = ' '; | |
| 455 | 489 | if(c != '#') { |
| 456 | 490 | *b++ = c; |
| 457 | 491 | if(c == 0) |
| @@ -493,6 +493,8 @@ cgen(Node *n, Node *nn) · 492 unmodified lines | ||
| 493 | 493 | } else |
| 494 | 494 | gopcode(OADD, nodconst(v), Z, &nod); |
| 495 | 495 | gopcode(OAS, &nod, Z, &nod2); |
| 496 | + if(nn && l->op == ONAME) /* in x=++i, emit USED(i) */ | |
| 497 | + gins(ANOP, l, Z); | |
| 496 | 498 | |
| 497 | 499 | regfree(&nod); |
| 498 | 500 | if(l->addable < INDEXED) |
| @@ -1001,6 +1001,11 @@ asmout(Prog *p, Optab *o, int aflag) · 1000 unmodified lines | ||
| 1001 | 1001 | } |
| 1002 | 1002 | } |
| 1003 | 1003 | 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; | |
| 1004 | 1009 | } |
| 1005 | 1010 | if(aflag) |
| 1006 | 1011 | return o1; |