projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Without HAVE_SYS_TYPES_H or HAVE_SYS_WAIT_H, in connect_debugger we
[pspp]
/
src
/
output
/
ascii.c
diff --git
a/src/output/ascii.c
b/src/output/ascii.c
index a0dc1b0109191087288d635fd16891eb8c8c40e9..9252cd79bdb9dacfb034c359a44ea07d60e3659c 100644
(file)
--- a/
src/output/ascii.c
+++ b/
src/output/ascii.c
@@
-1,6
+1,5
@@
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@
-24,10
+23,10
@@
#include <limits.h>
#include <stdlib.h>
#include <limits.h>
#include <stdlib.h>
-#include <data/filename.h>
+#include <data/file
-
name.h>
#include <libpspp/alloc.h>
#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/compiler.h>
-#include <libpspp/message.h>
#include <libpspp/pool.h>
#include <libpspp/start-date.h>
#include <libpspp/version.h>
#include <libpspp/pool.h>
#include <libpspp/start-date.h>
#include <libpspp/version.h>
@@
-123,7
+122,7
@@
static bool handle_option (struct outp_driver *this, const char *key,
const struct string *val);
static bool
const struct string *val);
static bool
-ascii_open_driver (struct outp_driver *this,
const char *
options)
+ascii_open_driver (struct outp_driver *this,
struct substring
options)
{
struct ascii_driver_ext *x;
int i;
{
struct ascii_driver_ext *x;
int i;
@@
-247,7
+246,7
@@
enum
output_file_arg
};
output_file_arg
};
-static struct outp_option option_tab[] =
+static
const
struct outp_option option_tab[] =
{
{"headers", boolean_arg, 0},
{"paginate", boolean_arg, 1},
{
{"headers", boolean_arg, 0},
{"paginate", boolean_arg, 1},
@@
-275,7
+274,7
@@
handle_option (struct outp_driver *this, const char *key,
int subcat;
const char *value;
int subcat;
const char *value;
- value = ds_c
_
str (val);
+ value = ds_cstr (val);
if (!strncmp (key, "box[", 4))
{
char *tail;
if (!strncmp (key, "box[", 4))
{
char *tail;
@@
-324,7
+323,7
@@
handle_option (struct outp_driver *this, const char *key,
this->width = arg;
break;
default:
this->width = arg;
break;
default:
-
abort
();
+
NOT_REACHED
();
}
}
break;
}
}
break;
@@
-366,7
+365,7
@@
handle_option (struct outp_driver *this, const char *key,
x->tab_width = arg;
break;
default:
x->tab_width = arg;
break;
default:
-
abort
();
+
NOT_REACHED
();
}
}
break;
}
}
break;
@@
-396,12
+395,12
@@
handle_option (struct outp_driver *this, const char *key,
x->squeeze_blank_lines = setting;
break;
default:
x->squeeze_blank_lines = setting;
break;
default:
-
abort
();
+
NOT_REACHED
();
}
}
break;
default:
}
}
break;
default:
-
abort
();
+
NOT_REACHED
();
}
return true;
}
return true;
@@
-512,7
+511,7
@@
text_draw (struct outp_driver *this,
x += width - length;
break;
default:
x += width - length;
break;
default:
-
abort
();
+
NOT_REACHED
();
}
if (y >= this->length || x >= this->width)
}
if (y >= this->length || x >= this->width)
@@
-538,7
+537,7
@@
delineate (struct outp_driver *this, const struct outp_text *text, bool draw,
int max_width;
int height_left;
int max_width;
int height_left;
- const char *cp =
ls_c_str (&
text->string);
+ const char *cp =
ss_data (
text->string);
max_width = 0;
height_left = text->v;
max_width = 0;
height_left = text->v;
@@
-550,7
+549,7
@@
delineate (struct outp_driver *this, const struct outp_text *text, bool draw,
const char *end;
/* Initially the line is up to text->h characters long. */
const char *end;
/* Initially the line is up to text->h characters long. */
- chars_left =
ls_end (&
text->string) - cp;
+ chars_left =
ss_end (
text->string) - cp;
if (chars_left == 0)
break;
line_len = MIN (chars_left, text->h);
if (chars_left == 0)
break;
line_len = MIN (chars_left, text->h);
@@
-561,7
+560,7
@@
delineate (struct outp_driver *this, const struct outp_text *text, bool draw,
line_len = end - cp;
/* Don't cut off words if it can be avoided. */
line_len = end - cp;
/* Don't cut off words if it can be avoided. */
- if (cp + line_len <
ls_end (&
text->string))
+ if (cp + line_len <
ss_end (
text->string))
{
size_t space_len = line_len;
while (space_len > 0 && !isspace ((unsigned char) cp[space_len]))
{
size_t space_len = line_len;
while (space_len > 0 && !isspace ((unsigned char) cp[space_len]))
@@
-585,7
+584,7
@@
delineate (struct outp_driver *this, const struct outp_text *text, bool draw,
/* Next line. */
cp += line_len;
/* Next line. */
cp += line_len;
- if (cp <
ls_end (&
text->string) && isspace ((unsigned char) *cp))
+ if (cp <
ss_end (
text->string) && isspace ((unsigned char) *cp))
cp++;
}
cp++;
}
@@
-623,20
+622,20
@@
output_line (struct outp_driver *this, const struct line *line,
for (length = line->char_cnt; length-- > 0; s++)
if (*s & ATTR_BOX)
for (length = line->char_cnt; length-- > 0; s++)
if (*s & ATTR_BOX)
- ds_put
s
(out, ext->box[*s & 0xff]);
+ ds_put
_cstr
(out, ext->box[*s & 0xff]);
else
{
if (*s & ATTR_EMPHASIS)
{
if (ext->emphasis == EMPH_BOLD)
{
else
{
if (*s & ATTR_EMPHASIS)
{
if (ext->emphasis == EMPH_BOLD)
{
- ds_put
c
(out, *s);
- ds_put
c
(out, '\b');
+ ds_put
_char
(out, *s);
+ ds_put
_char
(out, '\b');
}
else if (ext->emphasis == EMPH_UNDERLINE)
}
else if (ext->emphasis == EMPH_UNDERLINE)
- ds_put
s
(out, "_\b");
+ ds_put
_cstr
(out, "_\b");
}
}
- ds_put
c
(out, *s);
+ ds_put
_char
(out, *s);
}
}
}
}
@@
-644,7
+643,7
@@
static void
append_lr_justified (struct string *out, int width,
const char *left, const char *right)
{
append_lr_justified (struct string *out, int width,
const char *left, const char *right)
{
- ds_put
c
_multiple (out, ' ', width);
+ ds_put
_char
_multiple (out, ' ', width);
if (left != NULL)
{
size_t length = MIN (strlen (left), width);
if (left != NULL)
{
size_t length = MIN (strlen (left), width);
@@
-655,7
+654,7
@@
append_lr_justified (struct string *out, int width,
size_t length = MIN (strlen (right), width);
memcpy (ds_end (out) - length, right, length);
}
size_t length = MIN (strlen (right), width);
memcpy (ds_end (out) - length, right, length);
}
- ds_put
c
(out, '\n');
+ ds_put
_char
(out, '\n');
}
static void
}
static void
@@
-673,9
+672,9
@@
ascii_close_page (struct outp_driver *this)
struct string out;
int line_num;
struct string out;
int line_num;
- ds_init
(&out, 128
);
+ ds_init
_empty (&out
);
- ds_put
c
_multiple (&out, '\n', x->top_margin);
+ ds_put
_char
_multiple (&out, '\n', x->top_margin);
if (x->headers)
{
char *r1, *r2;
if (x->headers)
{
char *r1, *r2;
@@
-685,7
+684,7
@@
ascii_close_page (struct outp_driver *this)
append_lr_justified (&out, this->width, outp_title, r1);
append_lr_justified (&out, this->width, outp_subtitle, r2);
append_lr_justified (&out, this->width, outp_title, r1);
append_lr_justified (&out, this->width, outp_subtitle, r2);
- ds_put
c
(&out, '\n');
+ ds_put
_char
(&out, '\n');
free (r1);
free (r2);
free (r1);
free (r2);
@@
-709,13
+708,13
@@
ascii_close_page (struct outp_driver *this)
if (line_num < x->line_cap)
output_line (this, &x->lines[line_num], &out);
if (line_num < x->line_cap)
output_line (this, &x->lines[line_num], &out);
- ds_put
c
(&out, '\n');
+ ds_put
_char
(&out, '\n');
dump_output (this, &out);
}
dump_output (this, &out);
}
- ds_put
c
_multiple (&out, '\n', x->bottom_margin);
+ ds_put
_char
_multiple (&out, '\n', x->bottom_margin);
if (x->paginate)
if (x->paginate)
- ds_put
c
(&out, '\f');
+ ds_put
_char
(&out, '\f');
dump_output (this, &out);
ds_destroy (&out);
dump_output (this, &out);
ds_destroy (&out);
@@
-734,7
+733,7
@@
ascii_chart_finalise (struct outp_driver *d UNUSED, struct chart *ch UNUSED)
}
}
-struct outp_class ascii_class =
+
const
struct outp_class ascii_class =
{
"ascii",
0,
{
"ascii",
0,