Support octal #fmt conversions

This commit is contained in:
Brian Anderson 2011-04-26 20:13:23 -04:00
parent 66b59e4b05
commit 2e12fbfc06
3 changed files with 25 additions and 0 deletions

View file

@ -46,6 +46,7 @@ mod CT {
ty_int(signedness);
ty_bits;
ty_hex(caseness);
ty_octal;
// FIXME: More types
}
@ -289,6 +290,8 @@ mod CT {
t = ty_hex(case_upper);
} else if (_str.eq(tstr, "t")) {
t = ty_bits;
} else if (_str.eq(tstr, "o")) {
t = ty_octal;
} else {
log_err "unknown type in conversion";
fail;
@ -326,6 +329,7 @@ mod RT {
ty_bits;
ty_hex_upper;
ty_hex_lower;
ty_octal;
}
// FIXME: May not want to use a vector here for flags;
@ -365,6 +369,9 @@ mod RT {
case (ty_bits) {
res = uint_to_str_prec(u, 2u, prec);
}
case (ty_octal) {
res = uint_to_str_prec(u, 8u, prec);
}
}
ret pad(cv, res, pad_unsigned);
}