projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bogus type name.
[u/mdw/catacomb]
/
mptext.c
diff --git
a/mptext.c
b/mptext.c
index
c479d78
..
565322d
100644
(file)
--- a/
mptext.c
+++ b/
mptext.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: mptext.c,v 1.1
2 2002/01/13 19:51:18
mdw Exp $
+ * $Id: mptext.c,v 1.1
4 2002/10/09 00:33:44
mdw Exp $
*
* Textual representation of multiprecision numbers
*
*
* Textual representation of multiprecision numbers
*
@@
-30,6
+30,12
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mptext.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: mptext.c,v $
+ * Revision 1.14 2002/10/09 00:33:44 mdw
+ * Allow `0o' and `0b' prefixes for octal and binary (from Haskell)
+ *
+ * Revision 1.13 2002/10/09 00:21:06 mdw
+ * Allow user-specified `r_xx' bases to be up to 62.
+ *
* Revision 1.12 2002/01/13 19:51:18 mdw
* Extend the textual format to bases up to 62 by distinguishing case.
*
* Revision 1.12 2002/01/13 19:51:18 mdw
* Extend the textual format to bases up to 62 by distinguishing case.
*
@@
-207,12
+213,22
@@
mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p)
r = 0;
} else {
ch = ops->get(p);
r = 0;
} else {
ch = ops->get(p);
- if (ch == 'x') {
- ch = ops->get(p);
- rd = 16;
- } else {
- rd = 8;
- f |= f_ok;
+ switch (ch) {
+ case 'x':
+ rd = 16;
+ goto prefix;
+ case 'o':
+ rd = 8;
+ goto prefix;
+ case 'b':
+ rd = 2;
+ goto prefix;
+ prefix:
+ ch = ops->get(p);
+ break;
+ default:
+ rd = 8;
+ f |= f_ok;
}
r = -1;
}
}
r = -1;
}
@@
-339,7
+355,7
@@
restart:
/* --- An underscore indicates a numbered base --- */
/* --- An underscore indicates a numbered base --- */
- if (ch == '_' && r > 0 && r <=
36
) {
+ if (ch == '_' && r > 0 && r <=
62
) {
unsigned i;
/* --- Clear out the stacks --- */
unsigned i;
/* --- Clear out the stacks --- */