[goffice] fix SI and no-mantissa interaction
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] fix SI and no-mantissa interaction
- Date: Thu, 1 Sep 2011 09:16:11 +0000 (UTC)
commit 26178870867d742cafc0043eb1d3ee42c5f5072a
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Sep 1 03:15:29 2011 -0600
fix SI and no-mantissa interaction
2011-09-01 Andreas J. Guelzow <aguelzow pyrshep ca>
* goffice/utils/go-format.c (go_format_parse_number_E):
use OP_NUM_SIMPLIFY_MANTISSA_SI instead of OP_NUM_SIMPLIFY_MANTISSA
if appropriate
(go_format_execute): handle OP_NUM_SIMPLIFY_MANTISSA_SI
(go_format_dump_program): ditto
ChangeLog | 8 ++++++++
goffice/utils/go-format.c | 22 ++++++++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 131b5b0..55b0ea4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-09-01 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * goffice/utils/go-format.c (go_format_parse_number_E):
+ use OP_NUM_SIMPLIFY_MANTISSA_SI instead of OP_NUM_SIMPLIFY_MANTISSA
+ if appropriate
+ (go_format_execute): handle OP_NUM_SIMPLIFY_MANTISSA_SI
+ (go_format_dump_program): ditto
+
+2011-09-01 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* goffice/utils/go-format.c (go_format_parse_number_new_1): mark
the end of the number
(go_format_dump_program): support new op
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 89f4e03..d845ecb 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -186,6 +186,7 @@ typedef enum {
OP_MARKUP_SUPERSCRIPT_END,
#endif
#ifdef ALLOW_SI_APPEND
+ OP_NUM_SIMPLIFY_MANTISSA_SI,
OP_NUM_REDUCE_EXPONENT_SI,
OP_NUM_SIMPLIFY_EXPONENT_SI,
OP_NUM_SI_EXPONENT,
@@ -1869,8 +1870,12 @@ go_format_parse_number_E (GOFormatParseState *pstate)
#ifdef ALLOW_EE_MARKUP
if (use_markup) {
ADD_OPuc (OP_CHAR, UNICODE_TIMES);
- if (simplify_mantissa)
- ADD_OP (OP_NUM_SIMPLIFY_MANTISSA);
+ if (simplify_mantissa) {
+ if (append_SI)
+ ADD_OP (OP_NUM_SIMPLIFY_MANTISSA_SI);
+ else
+ ADD_OP (OP_NUM_SIMPLIFY_MANTISSA);
+ }
ADD_OP2 (OP_CHAR, '1');
ADD_OP2 (OP_CHAR, '0');
ADD_OP (OP_MARKUP_SUPERSCRIPT_START);
@@ -2456,6 +2461,7 @@ go_format_dump_program (const guchar *prg)
REGULAR(OP_MARKUP_SUPERSCRIPT_END);
#endif
#ifdef ALLOW_SI_APPEND
+ REGULAR(OP_NUM_SIMPLIFY_MANTISSA_SI);
REGULAR(OP_NUM_REDUCE_EXPONENT_SI);
REGULAR(OP_NUM_SIMPLIFY_EXPONENT_SI);
REGULAR(OP_NUM_SI_EXPONENT);
@@ -2803,7 +2809,7 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
int exponent = 0;
#ifdef ALLOW_SI_APPEND
char const *si_str = NULL;
- int si_pos = 0;
+ int si_pos = -1;
#endif
struct {
DOUBLE w, n, d, val;
@@ -3449,6 +3455,14 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
break;
#endif
#ifdef ALLOW_SI_APPEND
+ case OP_NUM_SIMPLIFY_MANTISSA_SI:
+ if (exponent != 0 && special_mantissa != INT_MAX) {
+ g_string_truncate (dst, mantissa_start);
+ si_pos = mantissa_start;
+ }
+
+ break;
+
case OP_NUM_REDUCE_EXPONENT_SI:
exponent -= si_reduction (exponent, &si_str);
si_pos = dst->len;
@@ -3471,7 +3485,7 @@ SUFFIX(go_format_execute) (PangoLayout *layout, GString *dst,
g_string_insert (dst, numpos_end, si_str);
numpos_end += strlen (si_str);
}
- si_pos = 0;
+ si_pos = -1;
break;
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]