projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix XDATE.JDAY formula.
[pspp]
/
src
/
data-out.c
diff --git
a/src/data-out.c
b/src/data-out.c
index cc1292e5e262279b44cae19576d3f44e678849bc..e8d0fa3b45e3c4fd298de0bf3c07739170b74173 100644
(file)
--- a/
src/data-out.c
+++ b/
src/data-out.c
@@
-18,13
+18,12
@@
02111-1307, USA. */
#include <config.h>
02111-1307, USA. */
#include <config.h>
-#include
<assert.h>
+#include
"error.h"
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <stdlib.h>
#include <time.h>
-#include "approx.h"
#include "error.h"
#include "format.h"
#include "julcal/julcal.h"
#include "error.h"
#include "format.h"
#include "julcal/julcal.h"
@@
-104,9
+103,11
@@
data_out (char *s, const struct fmt_spec *fp, const union value *v)
case FMT_A:
assert (0);
case FMT_A:
assert (0);
+ abort ();
case FMT_AHEX:
assert (0);
case FMT_AHEX:
assert (0);
+ abort ();
case FMT_IB:
ok = convert_IB (s, fp, number);
case FMT_IB:
ok = convert_IB (s, fp, number);
@@
-160,6
+161,7
@@
data_out (char *s, const struct fmt_spec *fp, const union value *v)
default:
assert (0);
default:
assert (0);
+ abort ();
}
}
else
}
}
else
@@
-179,6
+181,7
@@
data_out (char *s, const struct fmt_spec *fp, const union value *v)
default:
assert (0);
default:
assert (0);
+ abort ();
}
}
}
}
@@
-414,8
+417,8
@@
convert_E (char *dst, const struct fmt_spec *fp, double number)
/* The C locale always uses a period `.' as a decimal point.
Translate to comma if necessary. */
/* The C locale always uses a period `.' as a decimal point.
Translate to comma if necessary. */
- if ((
set_decimal
== ',' && fp->type != FMT_DOT)
- || (
set_decimal
== '.' && fp->type == FMT_DOT))
+ if ((
get_decimal()
== ',' && fp->type != FMT_DOT)
+ || (
get_decimal()
== '.' && fp->type == FMT_DOT))
{
char *cp = strchr (buf, '.');
if (cp)
{
char *cp = strchr (buf, '.');
if (cp)
@@
-1027,7
+1030,7
@@
insert_commas (char *dst, const char *src, const struct fmt_spec *fp)
if (i % 3 == 0 && n_digits > i && n_items > n_reserved)
{
n_items--;
if (i % 3 == 0 && n_digits > i && n_items > n_reserved)
{
n_items--;
- *dst++ = fp->type == FMT_COMMA ?
set_grouping : set_decimal
;
+ *dst++ = fp->type == FMT_COMMA ?
get_grouping() : get_decimal()
;
}
*dst++ = *sp++;
}
}
*dst++ = *sp++;
}
@@
-1053,7
+1056,7
@@
year4 (int year)
static int
try_CCx (char *dst, const struct fmt_spec *fp, double number)
{
static int
try_CCx (char *dst, const struct fmt_spec *fp, double number)
{
-
struct set_cust_currency *cc = &set_cc[fp->type - FMT_CCA]
;
+
const struct set_cust_currency *cc = get_cc(fp->type - FMT_CCA)
;
struct fmt_spec f;
struct fmt_spec f;
@@
-1063,7
+1066,7
@@
try_CCx (char *dst, const struct fmt_spec *fp, double number)
/* Determine length available, decimal character for number
proper. */
/* Determine length available, decimal character for number
proper. */
- f.type = cc->decimal ==
set_decimal
? FMT_COMMA : FMT_DOT;
+ f.type = cc->decimal ==
get_decimal()
? FMT_COMMA : FMT_DOT;
f.w = fp->w - strlen (cc->prefix) - strlen (cc->suffix);
if (number < 0)
f.w -= strlen (cc->neg_prefix) + strlen (cc->neg_suffix) - 1;
f.w = fp->w - strlen (cc->prefix) - strlen (cc->suffix);
if (number < 0)
f.w -= strlen (cc->neg_prefix) + strlen (cc->neg_suffix) - 1;
@@
-1189,7
+1192,7
@@
try_F (char *dst, const struct fmt_spec *fp, double number)
n_int = 0;
/* Avoid printing `-.000'. 7/6/96. */
n_int = 0;
/* Avoid printing `-.000'. 7/6/96. */
- if (
approx_eq (number, 0.0)
)
+ if (
mag < EPSILON
)
number = 0.0;
}
else
number = 0.0;
}
else
@@
-1198,7
+1201,7
@@
try_F (char *dst, const struct fmt_spec *fp, double number)
digits in floor(number), including any sign. */
for (;;)
{
digits in floor(number), including any sign. */
for (;;)
{
- if (mag >= power10[n_int])
/* Should this be approx_ge()? */
+ if (mag >= power10[n_int])
{
assert (delta[j]);
n_int += delta[j++];
{
assert (delta[j]);
n_int += delta[j++];
@@
-1298,8
+1301,8
@@
try_F (char *dst, const struct fmt_spec *fp, double number)
if (n == n_int + n_dec)
{
/* Convert periods `.' to commas `,' for our foreign friends. */
if (n == n_int + n_dec)
{
/* Convert periods `.' to commas `,' for our foreign friends. */
- if ((
set_decimal
== ',' && fp->type != FMT_DOT)
- || (
set_decimal
== '.' && fp->type == FMT_DOT))
+ if ((
get_decimal()
== ',' && fp->type != FMT_DOT)
+ || (
get_decimal()
== '.' && fp->type == FMT_DOT))
{
cp = strchr (cp, '.');
if (cp)
{
cp = strchr (cp, '.');
if (cp)