projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Track mLib change: symbols no longer need to include a terminating
[u/mdw/catacomb]
/
mptext.c
diff --git
a/mptext.c
b/mptext.c
index
891e414
..
a55f1c0
100644
(file)
--- a/
mptext.c
+++ b/
mptext.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: mptext.c,v 1.
6 2000/06/25 12:58:23
mdw Exp $
+ * $Id: mptext.c,v 1.
8 2000/12/06 20:32:42
mdw Exp $
*
* Textual representation of multiprecision numbers
*
*
* Textual representation of multiprecision numbers
*
@@
-30,6
+30,13
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mptext.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: mptext.c,v $
+ * Revision 1.8 2000/12/06 20:32:42 mdw
+ * Reduce binary bytes (to allow marker bits to be ignored). Fix error
+ * message string a bit. Allow leading `+' signs.
+ *
+ * Revision 1.7 2000/07/15 10:01:08 mdw
+ * Bug fix in binary input.
+ *
* Revision 1.6 2000/06/25 12:58:23 mdw
* Fix the derivation of `depth' commentary.
*
* Revision 1.6 2000/06/25 12:58:23 mdw
* Fix the derivation of `depth' commentary.
*
@@
-166,11
+173,10
@@
mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p)
/* --- Handle an initial sign --- */
/* --- Handle an initial sign --- */
- if (ch == '-') {
- f |= f_neg;
- ch = ops->get(p);
- while (isspace(ch))
- ch = ops->get(p);
+ if (radix >= 0 && (ch == '-' || ch == '+')) {
+ if (ch == '-')
+ f |= f_neg;
+ do ch = ops->get(p); while isspace(ch);
}
/* --- If the radix is zero, look for leading zeros --- */
}
/* --- If the radix is zero, look for leading zeros --- */
@@
-181,7
+187,7
@@
mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p)
r = -1;
} else if (radix < 0) {
rd = -radix;
r = -1;
} else if (radix < 0) {
rd = -radix;
- assert(((void)"binary radix must fit in a byte
", rd < UCHAR_MAX));
+ assert(((void)"binary radix must fit in a byte", rd < UCHAR_MAX));
r = -1;
} else if (ch != '0') {
rd = 10;
r = -1;
} else if (ch != '0') {
rd = 10;
@@
-203,6
+209,9
@@
mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p)
for (;; ch = ops->get(p)) {
int x;
for (;; ch = ops->get(p)) {
int x;
+ if (ch < 0)
+ break;
+
/* --- An underscore indicates a numbered base --- */
if (ch == '_' && r > 0 && r <= 36) {
/* --- An underscore indicates a numbered base --- */
if (ch == '_' && r > 0 && r <= 36) {
@@
-228,7
+237,7
@@
mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p)
/* --- Check that the character is a digit and in range --- */
if (radix < 0)
/* --- Check that the character is a digit and in range --- */
if (radix < 0)
- x = ch;
+ x = ch
% rd
;
else {
if (!isalnum(ch))
break;
else {
if (!isalnum(ch))
break;