summaryrefslogtreecommitdiff
path: root/sys/src/cmd/acid/builtin.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-02-09 22:43:09 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-02-09 22:43:09 +0100
commit16acf605e21e55e8f0520cf54016bfec5291802e (patch)
treeb63615e24216e3d054c052cf330372e1a45b4a23 /sys/src/cmd/acid/builtin.c
parent9bdf602ebbdcfcb4baaeb17499a1f1f6865ddc61 (diff)
acid: make 'a' and 'A' format to have the same size as mach->szaddr
to make it easier to write portable acid code, we introduce 'A' format in the same meaning as in db(1): A Print the value of dot in hexadecimal. Dot is unaffected. both 'a' (symbolic) and 'A' will both have 64 or 32 bit size depending on the mach, so pointer array indexing works the same.
Diffstat (limited to 'sys/src/cmd/acid/builtin.c')
-rw-r--r--sys/src/cmd/acid/builtin.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/src/cmd/acid/builtin.c b/sys/src/cmd/acid/builtin.c
index 0ebc11bbf..b8d904c7b 100644
--- a/sys/src/cmd/acid/builtin.c
+++ b/sys/src/cmd/acid/builtin.c
@@ -87,7 +87,7 @@ struct Btab
0
};
-char vfmt[] = "aBbcCdDfFgGiIoOqQrRsSuUVWxXYZ38";
+char vfmt[] = "aABbcCdDfFgGiIoOqQrRsSuUVWxXYZ38";
void
mkprint(Lsym *s)
@@ -365,7 +365,7 @@ follow(Node *r, Node *args)
for(i = 0; i < n; i++) {
l = al(TINT);
l->ival = f[i];
- l->fmt = 'X';
+ l->fmt = 'A';
*tail = l;
tail = &l->next;
}
@@ -390,11 +390,11 @@ funcbound(Node *r, Node *args)
r->l = al(TINT);
l = r->l;
l->ival = bounds[0];
- l->fmt = 'X';
+ l->fmt = 'A';
l->next = al(TINT);
l = l->next;
l->ival = bounds[1];
- l->fmt = 'X';
+ l->fmt = 'A';
}
}
@@ -970,10 +970,14 @@ void
patom(char type, Store *res)
{
int i;
+ char fmt;
char buf[512];
extern char *typenames[];
- switch(res->fmt) {
+ fmt = res->fmt;
+ if(fmt == 'A')
+ fmt = afmt;
+ switch(fmt) {
case 'c':
Bprint(bout, "%c", (int)res->ival);
break;
@@ -1065,7 +1069,6 @@ patom(char type, Store *res)
Bprint(bout, "%S", (Rune*)res->string->string);
break;
case 'a':
- case 'A':
symoff(buf, sizeof(buf), res->ival, CANY);
Bprint(bout, "%s", buf);
break;
@@ -1117,10 +1120,7 @@ comx(Node res)
Lsym *sl;
Node *n, xx;
- if(res.fmt != 'a' && res.fmt != 'A')
- return 0;
-
- if(res.comt == 0 || res.comt->base == 0)
+ if(res.fmt != 'a' || res.comt == 0 || res.comt->base == 0)
return 0;
sl = res.comt->base;