projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make the expression code a little nicer and fix bugs found
[pspp]
/
src
/
output.c
diff --git
a/src/output.c
b/src/output.c
index f3e0da7ea392f28a7bec0cdb3b0cc5d3d0b87c76..c0c4e0b022339f4e1f1a978b611dca96d00925ad 100644
(file)
--- a/
src/output.c
+++ b/
src/output.c
@@
-19,15
+19,16
@@
#include <config.h>
#include "output.h"
#include <config.h>
#include "output.h"
-#include
<assert.h>
+#include
"error.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include "alloc.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include "alloc.h"
-#include "
approx
.h"
+#include "
devind
.h"
#include "error.h"
#include "filename.h"
#include "error.h"
#include "filename.h"
+#include "htmlP.h"
#include "lexer.h"
#include "misc.h"
#include "settings.h"
#include "lexer.h"
#include "misc.h"
#include "settings.h"
@@
-73,7
+74,7
@@
char *outp_subtitle;
/* A set of OUTP_DEV_* bits indicating the devices that are
disabled. */
/* A set of OUTP_DEV_* bits indicating the devices that are
disabled. */
-int disabled_devices;
+
static
int disabled_devices;
static void destroy_driver (struct outp_driver *);
static void configure_driver (char *);
static void destroy_driver (struct outp_driver *);
static void configure_driver (char *);
@@
-205,12
+206,12
@@
find_defn_value (const char *key)
return d->value;
if (!strcmp (key, "viewwidth"))
{
return d->value;
if (!strcmp (key, "viewwidth"))
{
- sprintf (buf, "%d",
set_viewwidth
);
+ sprintf (buf, "%d",
get_viewwidth()
);
return buf;
}
else if (!strcmp (key, "viewlength"))
{
return buf;
}
else if (!strcmp (key, "viewlength"))
{
- sprintf (buf, "%d",
set_viewlength
);
+ sprintf (buf, "%d",
get_viewlength()
);
return buf;
}
else
return buf;
}
else
@@
-226,9
+227,8
@@
outp_init (void)
extern struct outp_class postscript_class;
extern struct outp_class epsf_class;
#endif
extern struct outp_class postscript_class;
extern struct outp_class epsf_class;
#endif
-#if !NO_HTML
extern struct outp_class html_class;
extern struct outp_class html_class;
-#endif
+ extern struct outp_class devind_class;
char def[] = "default";
char def[] = "default";
@@
-239,6
+239,7
@@
outp_init (void)
add_class (&epsf_class);
add_class (&postscript_class);
#endif
add_class (&epsf_class);
add_class (&postscript_class);
#endif
+ add_class (&devind_class);
add_class (&ascii_class);
add_name (def, &def[strlen (def)], OUTP_S_INIT_FILE);
add_class (&ascii_class);
add_name (def, &def[strlen (def)], OUTP_S_INIT_FILE);
@@
-454,7
+455,7
@@
outp_done (void)
void
outp_list_classes (void)
{
void
outp_list_classes (void)
{
- int width =
set_viewwidth
;
+ int width =
get_viewwidth()
;
struct outp_driver_class_list *c;
printf (_("Driver classes:\n\t"));
struct outp_driver_class_list *c;
printf (_("Driver classes:\n\t"));
@@
-464,7
+465,7
@@
outp_list_classes (void)
if ((int) strlen (c->class->name) + 1 > width)
{
printf ("\n\t");
if ((int) strlen (c->class->name) + 1 > width)
{
printf ("\n\t");
- width =
set_viewwidth
- 8;
+ width =
get_viewwidth()
- 8;
}
else
putc (' ', stdout);
}
else
putc (' ', stdout);
@@
-587,6
+588,7
@@
tokener (void)
break;
default:
msg (IS, _("Syntax error in string constant."));
break;
default:
msg (IS, _("Syntax error in string constant."));
+ continue;
}
ds_putchar (&op_tokstr, (unsigned char) c);
}
}
ds_putchar (&op_tokstr, (unsigned char) c);
}
@@
-957,7
+959,7
@@
outp_evaluate_dimension (char *dimen, char **tail)
if (c <= 0.0 || ptail == s)
goto lossage;
s = ptail;
if (c <= 0.0 || ptail == s)
goto lossage;
s = ptail;
- if (
approx_eq (c, 0.0)
)
+ if (
c == 0.0
)
goto lossage;
if (value > 0)
value += b / c;
goto lossage;
if (value > 0)
value += b / c;
@@
-969,7
+971,7
@@
outp_evaluate_dimension (char *dimen, char **tail)
double b;
s = &ptail[1];
b = strtod (s, &ptail);
double b;
s = &ptail[1];
b = strtod (s, &ptail);
- if (
approx_le (b, 0.0)
|| ptail == s)
+ if (
b <= 0.0
|| ptail == s)
goto lossage;
s = ptail;
value /= b;
goto lossage;
s = ptail;
value /= b;
@@
-1028,7
+1030,7
@@
outp_evaluate_dimension (char *dimen, char **tail)
ptail += 2;
value *= factor;
}
ptail += 2;
value *= factor;
}
- if (
approx_lt (value, 0.0)
)
+ if (
value <= 0.0
)
goto lossage;
if (tail)
*tail = ptail;
goto lossage;
if (tail)
*tail = ptail;