LEFT | RIGHT |
(no file at all) | |
1 // Derived from Inferno utils/5c/list.c | 1 // Derived from Inferno utils/5c/list.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/list.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/list.c |
3 // | 3 // |
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
6 // Portions Copyright © 1997-1999 Vita Nuova Limited | 6 // Portions Copyright © 1997-1999 Vita Nuova Limited |
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
8 // Portions Copyright © 2004,2006 Bruce Ellis | 8 // Portions Copyright © 2004,2006 Bruce Ellis |
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others | 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 int | 80 int |
81 Dconv(Fmt *fp) | 81 Dconv(Fmt *fp) |
82 { | 82 { |
83 char str[STRINGSZ]; | 83 char str[STRINGSZ]; |
84 char *op; | 84 char *op; |
85 Addr *a; | 85 Addr *a; |
86 int i; | 86 int i; |
87 int32 v; | 87 int32 v; |
88 | 88 |
89 a = va_arg(fp->args, Addr*); | 89 a = va_arg(fp->args, Addr*); |
| 90 if(a == A) { |
| 91 sprint(str, "<nil>"); |
| 92 goto conv; |
| 93 } |
90 i = a->type; | 94 i = a->type; |
91 switch(i) { | 95 switch(i) { |
92 | 96 |
93 default: | 97 default: |
94 sprint(str, "GOK-type(%d)", a->type); | 98 sprint(str, "GOK-type(%d)", a->type); |
95 break; | 99 break; |
96 | 100 |
97 case D_NONE: | 101 case D_NONE: |
98 str[0] = 0; | 102 str[0] = 0; |
99 if(a->name != D_NONE || a->reg != NREG || a->sym != S) | 103 if(a->name != D_NONE || a->reg != NREG || a->sym != S) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 180 |
177 // TODO(kaib): Add back | 181 // TODO(kaib): Add back |
178 // case D_ADDR: | 182 // case D_ADDR: |
179 // a->type = a->index; | 183 // a->type = a->index; |
180 // a->index = D_NONE; | 184 // a->index = D_NONE; |
181 // snprint(str, sizeof(str), "$%D", a); | 185 // snprint(str, sizeof(str), "$%D", a); |
182 // a->index = a->type; | 186 // a->index = a->type; |
183 // a->type = D_ADDR; | 187 // a->type = D_ADDR; |
184 // goto conv; | 188 // goto conv; |
185 } | 189 } |
186 //conv: | 190 conv: |
187 return fmtstrcpy(fp, str); | 191 return fmtstrcpy(fp, str); |
188 } | 192 } |
189 | 193 |
190 int | 194 int |
191 Aconv(Fmt *fp) | 195 Aconv(Fmt *fp) |
192 { | 196 { |
193 int i; | 197 int i; |
194 | 198 |
195 i = va_arg(fp->args, int); | 199 i = va_arg(fp->args, int); |
196 return fmtstrcpy(fp, anames[i]); | 200 return fmtstrcpy(fp, anames[i]); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 case D_AUTO: | 322 case D_AUTO: |
319 snprint(str, sizeof(str), "%S+%d(SP)", a->sym, a->offset); | 323 snprint(str, sizeof(str), "%S+%d(SP)", a->sym, a->offset); |
320 break; | 324 break; |
321 | 325 |
322 case D_PARAM: | 326 case D_PARAM: |
323 snprint(str, sizeof(str), "%S+%d(FP)", a->sym, a->offset); | 327 snprint(str, sizeof(str), "%S+%d(FP)", a->sym, a->offset); |
324 break; | 328 break; |
325 } | 329 } |
326 return fmtstrcpy(fp, str); | 330 return fmtstrcpy(fp, str); |
327 } | 331 } |
LEFT | RIGHT |