diff options
| author | rsc <devnull@localhost> | 2005-02-11 00:01:49 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2005-02-11 00:01:49 +0000 |
| commit | 281c90a5be6b1ab2280ffa23885fe41e7af80bce (patch) | |
| tree | c26a67c58f869a3a6821f1a0ae980af03d4eb430 /src/cmd/acid/builtin.c | |
| parent | ce2a378d46c0bcd00ec08b9bc4ad861c8aa28a2f (diff) | |
| download | plan9port-281c90a5be6b1ab2280ffa23885fe41e7af80bce.tar.gz plan9port-281c90a5be6b1ab2280ffa23885fe41e7af80bce.zip | |
more pthread
Diffstat (limited to 'src/cmd/acid/builtin.c')
| -rw-r--r-- | src/cmd/acid/builtin.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/cmd/acid/builtin.c b/src/cmd/acid/builtin.c index 316c4921..8dbc1765 100644 --- a/src/cmd/acid/builtin.c +++ b/src/cmd/acid/builtin.c @@ -325,22 +325,33 @@ xkill(Node *r, Node *args) void xregister(Node *r, Node *args) { + int tid; Regdesc *rp; - Node res; + Node res, resid; + Node *av[Maxarg]; - if(args == 0) - error("register(string): arg count"); - expr(args, &res); - if(res.type != TSTRING) - error("register(string): arg type"); + na = 0; + flatten(av, args); + if(na != 1 && na != 2) + error("register(name[, threadid]): arg count"); + expr(av[0], &res); + if(res.type != TSTRING) + error("register(name[, threadid]): arg type: name should be string"); + tid = 0; + if(na == 2){ + expr(av[1], &resid); + if(resid.type != TINT) + error("register(name[, threadid]): arg type: threadid should be int"); + tid = resid.store.u.ival; + } if((rp = regdesc(res.store.u.string->string)) == nil) error("no such register"); - r->op = OCONST; r->type = TREG; r->store.fmt = rp->format; - r->store.u.reg = rp->name; + r->store.u.reg.name = rp->name; + r->store.u.reg.thread = tid; } void @@ -1127,7 +1138,10 @@ patom(char type, Store *res) switch(type){ case TREG: - Bprint(bout, "register(\"%s\")", res->u.reg); + if(res->u.reg.thread) + Bprint(bout, "register(\"%s\", 0x%ux)", res->u.reg.name, res->u.reg.thread); + else + Bprint(bout, "register(\"%s\")", res->u.reg.name); return; case TCON: Bprint(bout, "refconst("); |
