+Wed Feb 11 23:54:15 2004 Ben Pfaff <blp@gnu.org>
+
+ * pref.h.orig: Don't meddle with __WIN32__, __MSDOS, __DJGPP__,
+ __CYGWIN32__, __unix__, or unix anymore, and deal with some of the
+ consequences. Declare ATTRIBUTE instead of meddling withe
+ __attribute__. Declare UNUSED instead of unused. Add macros
+ NO_RETURN, PRINTF_FORMAT, SCANF_FORMAT. Reformat gettext, N_, _
+ macros. Move alloca()-related stuff to src/alloc.h and simplify.
+ Get rid of PAGED_STACK entirely. Remove mkdir macro definition.
+ Get rid of obsolete "procedure-specific options".
+
2004-01-23 gettextize <bug-gnu-gettext@gnu.org>
* Makefile.am (SUBDIRS): Remove intl.
\f
/* Compilers. */
-/* Fix Windows lossage. */
-#ifdef __WIN32__
-#undef __WIN32__
-#define __WIN32__ 1
-#undef __MSDOS__
-#define __MSDOS__ 1
-#endif
-
-/* Fix DJGPP lossage. */
-#if __DJGPP__
-#undef unix
-#undef __unix__
-#endif
-
-/* Fix Cygnus Windows lossage. */
-#if defined (__CYGWIN32__)
-#define unix 1
-#endif
-
-/* Ensure that unix and __unix__ are equivalent. */
-#if defined (unix) || defined (__unix__) || defined (__unix)
-#undef unix
-#define unix 1
-
-#undef __unix__
-#define __unix__ 1
-
-#undef __unix
-#define __unix 1
-#endif
-
/* Make sure to use the proper keywords. */
#if __GNUC__ > 1 && !defined (inline)
#define inline __inline__
printf-like arguments, never return, etc. Conditionalize these
declarations on whether gcc is in use. */
#if __GNUC__ > 1
-#define __attribute__(X) __attribute__ (X)
+#define ATTRIBUTE(X) __attribute__ (X)
#else
-#define __attribute__(X)
+#define ATTRIBUTE(X)
#endif
-/* GNU C allows unused variables and parameters to be declared as
- such. */
-#if __GNUC__ >= 2
-#define unused __attribute__ ((__unused__))
-#else
-#define unused
-#endif
+#define UNUSED ATTRIBUTE ((unused))
+#define NO_RETURN ATTRIBUTE ((noreturn))
+#define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (printf, FMT, FIRST)))
+#define SCANF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (scanf, FMT, FIRST)))
\f
/* CPUs. */
which causes gcc not to do its checking on printf() format
types. */
#undef gettext
-#define gettext(STRING) \
- STRING
+#define gettext(STRING) STRING
#endif
-#define _(STRING) \
- gettext(STRING)
-
-#define N_(STRING) \
- STRING
-
-/* Even C emulation of alloca counts as an alloca implementation. */
-#if C_ALLOCA
-#define HAVE_ALLOCA 1
-#endif
-
-/* Define PAGED_STACK if alloca() is supported and the stack can
- expand arbitrarily. (Under some broken OSes like DOS and
- Windows the stack is small and fixed in size.) This will prevent
- big alloca() requests (like 1MB). */
-#if HAVE_ALLOCA && unix
-#define PAGED_STACK 1
-#endif
-
-/* Saves on #if's. */
-#if HAVE_ALLOCA && !__CHECKER__
-#define local_alloc(X) \
- alloca(X)
-
-#define local_free(P) \
- do \
- { \
- } \
- while (0)
-#elif !__CHECKER__
-#define local_alloc(X) \
- xmalloc (X)
-
-#define local_free(P) \
- free (P)
-#else /* __CHECKER__ */
-/* Why define these this way? Because if you do it this way then if
- you try to free a block returned by local_alloc() with the free()
- function, you get an error message. */
-#define local_alloc(X) \
- ((void *) (((char *) (xmalloc (X+16))) + 16))
-
-#define local_free(P) \
- free (((char *) P) - 16)
-#endif /* __CHECKER__ */
+#define _(STRING) gettext(STRING)
+#define N_(STRING) STRING
\f
/* Filesystems. */
/* Directory separator character for this OS, if applicable. */
-#if !__MSDOS__
+#ifndef __MSDOS__
#define DIR_SEPARATOR '/'
#elif
#define DIR_SEPARATOR '\\'
#endif
/* Path delimiter character. */
-#if !__MSDOS__
+#ifndef __MSDOS__
#define PATH_DELIMITER ':'
#else
#define PATH_DELIMITER ';'
#endif
-
-/* MSDOS mkdir() takes only one argument. */
-#if __MSDOS__ && !__DJGPP__
-#define mkdir(path, mode) \
- mkdir (path)
-#endif
\f
/* Options. */
/* Define to exclude the PostScript and Encapsulated PostScript
driver. */
/* #define NO_POSTSCRIPT 1 */
-\f
-/* Procedure-specific options. */
-
-/* CROSSTABS: Maximum number of tables to process in one pass. */
-#define MAX_CROSSTAB_TABLES 32
-
-/* FREQUENCIES: Define to allow bars greater than 1/2" wide. */
-/* #define ALLOW_HUGE_BARS 1 */
-
-/* FREQUENCIES: Minimum, maximum number of bars in a histogram. The
- number is based on the number of unique values of the variable,
- unless overridden. */
-#define MIN_HIST_BARS 3
-#define MAX_HIST_BARS 20
-
-/* FREQUENCIES: Density of polyline used to approximate the normal
- curve. The value is the number of samples taken per chart. Higher
- values give smoother curves. */
-#define POLYLINE_DENSITY (MAX_HIST_BARS*4)
+Wed Feb 11 23:56:51 2004 Ben Pfaff <blp@gnu.org>
+
+ Miscellaneous cleanups.
+
+ * Change unused to UNUSED in many source files to reflect modified
+ pref.h. Change use of __WIN32__, __MSDOS, __DJGPP__,
+ __CYGWIN32__, __unix__, and unix not to assume that they're
+ defined to a nonzero value. Change use of __attribute__ to use
+ NO_RETURN or PRINTF_FORMAT instead.
+
+ * alloc.h: Move definitions for local_alloc(), local_free() here
+ from ../pref.h.orig and simplify.
+
+ * expr-evl.c: Instead of working differently based on PAGED_STACK,
+ use a pool allocator unconditionally.
+ (CHECK_STRING_SPACE) Removed.
+ (ALLOC_STRING_SPACE) Removed.
+ (expr_evaluate) Use e->pool instead of CHECK_STRING_SPACE and
+ ALLOC_STRING_SPACE.
+
+ * expr-opt.c: (dump_expression) Allocate string pool.
+
+ * expr-prs.c: (expr_free) Free string pool.
+
+ * pool.c: (pool_destroy) This pool must be removed from its
+ parent's list of gizmos, not from its own. Use free_all_gizmos().
+ (pool_clear) New function.
+ (free_all_gizmos) New function.
+ (pool_alloc) Use space in empty block after this one if any.
+ (pool_release) Only empty out blocks, don't actually free() them.
+
+ * print.c: Get rid of PAGED_STACK special case by always
+ dynamically allocating line buffers.
+ (struct print_trns) Always include the `line' member.
+ (internal_cmd_print) Always initialize the `line' member.
+ (alloc_line) Always allocate memory for `line'.
+ (print_trns_proc) Always initialize buf from `line' member.
+ (print_trns_free) Always free `line' memory.
+
+ * sort.c: (allocate_file_handles) Special-case MS-DOS for mkdir()
+ call.
+
Wed Feb 11 20:33:18 2004 Ben Pfaff <blp@gnu.org>
* flip.c: Fixed crash from FLIP when a numeric variable is
/* Aggregate each case as it comes through. Cases which aren't needed
are dropped. */
static int
-agr_00x_trns_proc (struct trns_header *h unused, struct ccase *c)
+agr_00x_trns_proc (struct trns_header *h UNUSED, struct ccase *c)
{
int code = aggregate_single_case (c, compaction_case);
debug_printf (("%d ", code));
/* Aggregate the current case and output it if we passed a
breakpoint. */
static int
-agr_10x_trns_proc (struct trns_header *h unused, struct ccase *c)
+agr_10x_trns_proc (struct trns_header *h UNUSED, struct ccase *c)
{
int code = aggregate_single_case (c, buf_1xx);
/* Close the system file now that we're done with it. */
static void
-agr_10x_trns_free (struct trns_header *h unused)
+agr_10x_trns_free (struct trns_header *h UNUSED)
{
fh_close_handle (outfile);
}
\f
/* A algo_random_func that uses random.h. */
unsigned
-algo_default_random (unsigned max, void *aux unused)
+algo_default_random (unsigned max, void *aux UNUSED)
{
return rng_get_unsigned (pspp_rng ()) % max;
}
#include <stddef.h>
-/* Functions. */
+/* malloc() wrapper functions. */
void *xmalloc (size_t size);
void *xcalloc (size_t size);
void *xrealloc (void *ptr, size_t size);
char *xstrdup (const char *s);
+\f
+/* alloca() wrapper functions. */
+#if defined (HAVE_ALLOCA) || defined (C_ALLOCA)
+#include <alloca.h>
+#define local_alloc(X) alloca (X)
+#define local_free(P) ((void) 0)
+#else
+#define local_alloc(X) xmalloc (X)
+#define local_free(P) free (P)
+#endif
#endif /* alloc.h */
static int preclose (struct file_ext *);
static int
-ascii_open_global (struct outp_class *this unused)
+ascii_open_global (struct outp_class *this UNUSED)
{
ascii_pool = pool_create ();
return 1;
}
static int
-ascii_close_global (struct outp_class *this unused)
+ascii_close_global (struct outp_class *this UNUSED)
{
pool_destroy (ascii_pool);
return 1;
}
static int *
-ascii_font_sizes (struct outp_class *this unused, int *n_valid_sizes)
+ascii_font_sizes (struct outp_class *this UNUSED, int *n_valid_sizes)
{
static int valid_sizes[] = {12, 12, 0, 0};
static void
ascii_line_horz (struct outp_driver *this, const struct rect *r,
- const struct color *c unused, int style)
+ const struct color *c UNUSED, int style)
{
struct ascii_driver_ext *ext = this->ext;
int x1 = r->x1 / this->horiz;
static void
ascii_line_vert (struct outp_driver *this, const struct rect *r,
- const struct color *c unused, int style)
+ const struct color *c UNUSED, int style)
{
struct ascii_driver_ext *ext = this->ext;
int x1 = r->x1 / this->horiz;
static void
ascii_line_intersection (struct outp_driver *this, const struct rect *r,
- const struct color *c unused,
+ const struct color *c UNUSED,
const struct outp_styles *style)
{
struct ascii_driver_ext *ext = this->ext;
/* FIXME: Later we could set this up so that for certain devices it
performs shading? */
static void
-ascii_box (struct outp_driver *this unused, const struct rect *r unused,
- const struct color *bord unused, const struct color *fill unused)
+ascii_box (struct outp_driver *this UNUSED, const struct rect *r UNUSED,
+ const struct color *bord UNUSED, const struct color *fill UNUSED)
{
assert (this->driver_open && this->page_open);
}
/* Polylines not supported. */
static void
-ascii_polyline_begin (struct outp_driver *this unused, const struct color *c unused)
+ascii_polyline_begin (struct outp_driver *this UNUSED, const struct color *c UNUSED)
{
assert (this->driver_open && this->page_open);
}
static void
-ascii_polyline_point (struct outp_driver *this unused, int x unused, int y unused)
+ascii_polyline_point (struct outp_driver *this UNUSED, int x UNUSED, int y UNUSED)
{
assert (this->driver_open && this->page_open);
}
static void
-ascii_polyline_end (struct outp_driver *this unused)
+ascii_polyline_end (struct outp_driver *this UNUSED)
{
assert (this->driver_open && this->page_open);
}
}
static void
-ascii_text_set_font_by_family (struct outp_driver *this unused, const char *s unused)
+ascii_text_set_font_by_family (struct outp_driver *this UNUSED, const char *s UNUSED)
{
assert (this->driver_open && this->page_open);
}
}
static const char *
-ascii_text_get_font_family (struct outp_driver *this unused)
+ascii_text_get_font_family (struct outp_driver *this UNUSED)
{
assert (this->driver_open && this->page_open);
return "";
}
static int
-compare_numeric_value (const void *a_, const void *b_, void *foo unused)
+compare_numeric_value (const void *a_, const void *b_, void *foo UNUSED)
{
const union value *a = a_;
const union value *b = b_;
}
static unsigned
-hash_numeric_value (const void *a_, void *foo unused)
+hash_numeric_value (const void *a_, void *foo UNUSED)
{
const union value *a = a_;
return CMD_SUCCESS;
}
-#if unix
+#ifdef unix
/* Spawn a shell process. */
static int
shell (void)
lex_match_id ("HOST");
-#if unix
+#ifdef unix
/* Figure out whether to invoke an interactive shell or to execute a
single shell command. */
if (lex_look_ahead () == '.')
}
static int
-cor_custom_variables (struct cmd_correlations *cmd unused)
+cor_custom_variables (struct cmd_correlations *cmd UNUSED)
{
struct variable **v1, **v2;
int nv1, nv2;
}
static int
-cor_custom_matrix (struct cmd_correlations *cmd unused)
+cor_custom_matrix (struct cmd_correlations *cmd UNUSED)
{
if (!lex_force_match ('('))
return 0;
/* Parses the TABLES subcommand. */
static int
-crs_custom_tables (struct cmd_crosstabs *cmd unused)
+crs_custom_tables (struct cmd_crosstabs *cmd UNUSED)
{
struct var_set *var_set;
int n_by;
/* Parses the VARIABLES subcommand. */
static int
-crs_custom_variables (struct cmd_crosstabs *cmd unused)
+crs_custom_variables (struct cmd_crosstabs *cmd UNUSED)
{
if (nxtab)
{
/* Compare the table_entry's at A and B and return a strcmp()-type
result. */
static int
-compare_table_entry (const void *a_, const void *b_, void *foo unused)
+compare_table_entry (const void *a_, const void *b_, void *foo UNUSED)
{
const struct table_entry *a = a_;
const struct table_entry *b = b_;
/* Calculate a hash value from table_entry PA. */
static unsigned
-hash_table_entry (const void *pa, void *foo unused)
+hash_table_entry (const void *pa, void *foo UNUSED)
{
const struct table_entry *a = pa;
unsigned long hash = a->table;
/* Specialized error routine. */
static void dls_error (const struct data_in *, const char *format, ...)
- __attribute__ ((format (printf, 2, 3)));
+ PRINTF_FORMAT (2, 3);
static void
dls_error (const struct data_in *i, const char *format, ...)
/* Note that since this is exclusively an input program, C is
guaranteed to be temp_case. */
static int
-read_one_case (struct trns_header *t, struct ccase *c unused)
+read_one_case (struct trns_header *t, struct ccase *c UNUSED)
{
dlsp = (struct data_list_pgm *) t;
return do_reading (1);
/* Parses the VARIABLES subcommand. */
static int
-dsc_custom_variables (struct cmd_descriptives *cmd unused)
+dsc_custom_variables (struct cmd_descriptives *cmd UNUSED)
{
if (!lex_match_id ("VARIABLES")
&& (token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
};
static int
-devind_open_global (struct outp_class *this unused)
+devind_open_global (struct outp_class *this UNUSED)
{
return 1;
}
static int
-devind_close_global (struct outp_class *this unused)
+devind_close_global (struct outp_class *this UNUSED)
{
return 1;
}
}
static int
-compare_variable_dblptrs (const void *a_, const void *b_, void *aux unused)
+compare_variable_dblptrs (const void *a_, const void *b_, void *aux UNUSED)
{
struct variable *const *a = a_;
struct variable *const *b = b_;
/* Executes a goto transformation. */
static int
-goto_trns_proc (struct trns_header * t, struct ccase * c unused)
+goto_trns_proc (struct trns_header * t, struct ccase * c UNUSED)
{
return ((struct goto_trns *) t)->dest;
}
/* Functions. */
void msg (int class, const char *format, ...)
- __attribute__ ((format (printf, 2, 3)));
+ PRINTF_FORMAT (2, 3);
void tmsg (int class, const char *title, const char *format, ...)
- __attribute__ ((format (printf, 3, 4)));
+ PRINTF_FORMAT (3, 4);
void err_failure (void);
void err_cond_fail (void);
/* Obscure functions. */
void err_break (void);
void err_check_count (void);
-void err_hcf (int exit_code) __attribute__ ((noreturn));
+void err_hcf (int exit_code) NO_RETURN;
void err_vmsg (const struct error *);
#endif /* error.h */
#include "error.h"
#include "julcal/julcal.h"
#include "magic.h"
+#include "pool.h"
#include "random.h"
#include "stats.h"
#include "str.h"
efficient if I hand-coded it in assembly for a dozen processors,
but I'm not going to do that either. */
-/* These macros are defined differently depending on the way that
- the stack is managed. (i.e., I have to adapt the code to inferior
- environments.)
-
- void CHECK_STRING_SPACE(int x): Assure that at least X+1 bytes of
- space are available in the string evaluation stack.
-
- unsigned char *ALLOC_STRING_SPACE(int x): Return a pointer to X+1
- bytes of space. CHECK_STRING_SPACE must have previously been
- called with an argument of at least X. */
-
-#if PAGED_STACK
-#define CHECK_STRING_SPACE(X) /* nothing to do! */
-#define ALLOC_STRING_SPACE(X) \
- alloca((X) + 1)
-#else /* !PAGED_STACK */
-#define CHECK_STRING_SPACE(X) \
- do \
- { \
- if (str_stk + X >= str_end) \
- { \
- e->str_size += 1024; \
- e->str_stk = xrealloc (e->str_stk, e->str_size); \
- str_end = e->str_stk + e->str_size - 1; \
- } \
- } \
- while (0)
-
-#define ALLOC_STRING_SPACE(X) \
- (str_stk += X + 1, str_stk - X - 1)
-#endif /* !PAGED_STACK */
-
double
expr_evaluate (struct expression *e, struct ccase *c, union value *v)
{
unsigned char *op = e->op;
double *dbl = e->num;
unsigned char *str = e->str;
-#if !PAGED_STACK
- unsigned char *str_stk = e->str_stk;
- unsigned char *str_end = e->str_stk + e->str_size - 1;
-#endif
struct variable **vars = e->var;
int i, j;
/* Stack pointer. */
union value *sp = e->stack;
+ pool_clear (e->pool);
+
for (;;)
{
switch (*op++)
int n_args = *op++;
unsigned char *dest;
- CHECK_STRING_SPACE (255);
- dest = ALLOC_STRING_SPACE (255);
+ dest = pool_alloc (e->pool, 256);
dest[0] = 0;
sp -= n_args - 1;
{
unsigned char *dest;
- CHECK_STRING_SPACE (len);
- dest = ALLOC_STRING_SPACE (len);
+ dest = pool_alloc (e->pool, len + 1);
dest[0] = len;
memset (&dest[1], ' ', len - sp->c[0]);
memcpy (&dest[len - sp->c[0] + 1], &sp->c[1], sp->c[0]);
{
unsigned char *dest;
- CHECK_STRING_SPACE (len);
- dest = ALLOC_STRING_SPACE (len);
+ dest = pool_alloc (e->pool, len + 1);
dest[0] = len;
memset (&dest[1], sp[2].c[1], len - sp->c[0]);
memcpy (&dest[len - sp->c[0] + 1], &sp->c[1], sp->c[0]);
{
unsigned char *dest;
- CHECK_STRING_SPACE (len);
- dest = ALLOC_STRING_SPACE (len);
+ dest = pool_alloc (e->pool, len + 1);
dest[0] = len;
memcpy (&dest[1], &sp->c[1], sp->c[0]);
memset (&dest[sp->c[0] + 1], ' ', len - sp->c[0]);
{
unsigned char *dest;
- CHECK_STRING_SPACE (len);
- dest = ALLOC_STRING_SPACE (len);
+ dest = pool_alloc (e->pool, len + 1);
dest[0] = len;
memcpy (&dest[1], &sp->c[1], sp->c[0]);
memset (&dest[sp->c[0] + 1], sp[2].c[1], len - sp->c[0]);
f.w = *op++;
f.d = *op++;
- CHECK_STRING_SPACE (f.w);
- dest = ALLOC_STRING_SPACE (f.w);
+ dest = pool_alloc (e->pool, f.w + 1);
dest[0] = f.w;
data_out (&dest[1], &f, sp);
msg (SE, _("%g is not a valid index value for vector %s. "
"The result will be set to the empty string."),
sp[0].f, vect->name);
- CHECK_STRING_SPACE (0);
- sp->c = ALLOC_STRING_SPACE (0);
+ sp->c = pool_alloc (e->pool, 1);
sp->c[0] = 0;
break;
}
v = vect->var[rindx - 1];
- CHECK_STRING_SPACE (v->width);
- sp->c = ALLOC_STRING_SPACE (v->width);
+ sp->c = pool_alloc (e->pool, v->width + 1);
sp->c[0] = v->width;
memcpy (&sp->c[1], c->data[v->fv].s, v->width);
}
break;
case OP_STR_CON:
sp++;
- CHECK_STRING_SPACE (*str);
- sp->c = ALLOC_STRING_SPACE (*str);
+ sp->c = pool_alloc (e->pool, *str + 1);
memcpy (sp->c, str, *str + 1);
str += *str + 1;
break;
int width = (*vars)->width;
sp++;
- CHECK_STRING_SPACE (width);
- sp->c = ALLOC_STRING_SPACE (width);
+ sp->c = pool_alloc (e->pool, width + 1);
sp->c[0] = width;
memcpy (&sp->c[1], &c->data[(*vars)->fv], width);
vars++;
int width = (*vars)->width;
sp++;
- CHECK_STRING_SPACE (width);
- sp->c = ALLOC_STRING_SPACE (width);
+ sp->c = pool_alloc (e->pool, width + 1);
sp->c[0] = width;
if (c == NULL)
{
assert (v);
-#if PAGED_STACK
- memcpy (e->str_stack, sp->c, sp->c[0] + 1);
- v->c = e->str_stack;
-#else
v->c = sp->c;
-#endif
return 0.0;
}
#include "error.h"
#include "julcal/julcal.h"
#include "misc.h"
+#include "pool.h"
#include "stats.h"
#include "str.h"
#include "var.h"
e->stack = xmalloc (max_height * sizeof *e->stack);
-#if PAGED_STACK
- e->str_stack = e->type == EX_STRING ? xmalloc (256) : NULL;
-#else
- e->str_stack = xmalloc (256);
- e->str_size = 256;
-#endif
+ e->pool = pool_create ();
}
static void
free (e->num);
free (e->str);
free (e->stack);
- free (e->str_stack);
+ pool_destroy (e->pool);
free (e);
}
static int get_num_args (struct function *, int, union any_node **);
static int
-unary_func (struct function * f, int x unused, union any_node ** n)
+unary_func (struct function * f, int x UNUSED, union any_node ** n)
{
double divisor;
struct nonterm_node *c;
}
static int
-binary_func (struct function * f, int x unused, union any_node ** n)
+binary_func (struct function * f, int x UNUSED, union any_node ** n)
{
if (!get_num_args (f, 2, n))
return EX_ERROR;
}
static int
-ternary_func (struct function * f, int x unused, union any_node ** n)
+ternary_func (struct function * f, int x UNUSED, union any_node ** n)
{
if (!get_num_args (f, 3, n))
return EX_ERROR;
}
static int
-MISSING_func (struct function * f, int x unused, union any_node ** n)
+MISSING_func (struct function * f, int x UNUSED, union any_node ** n)
{
if (token == T_ID
&& dict_lookup_var (default_dict, tokid) != NULL
}
static int
-SYSMIS_func (struct function * f unused, int x unused, union any_node ** n)
+SYSMIS_func (struct function * f UNUSED, int x UNUSED, union any_node ** n)
{
int t;
}
static int
-VALUE_func (struct function *f unused, int x unused, union any_node **n)
+VALUE_func (struct function *f UNUSED, int x UNUSED, union any_node **n)
{
struct variable *v = parse_variable ();
}
static int
-LAG_func (struct function *f unused, int x unused, union any_node **n)
+LAG_func (struct function *f UNUSED, int x UNUSED, union any_node **n)
{
struct variable *v = parse_variable ();
int nlag = 1;
}
static int
-CONCAT_func (struct function * f unused, int x unused, union any_node ** n)
+CONCAT_func (struct function * f UNUSED, int x UNUSED, union any_node ** n)
{
int m = 0;
arg; and `f', format spec (this must be the last arg). If the
optional args are included, the type becomes f->t+1. */
static int
-generic_str_func (struct function *f, int x unused, union any_node ** n)
+generic_str_func (struct function *f, int x UNUSED, union any_node ** n)
{
int max_args = 0;
int type;
/* An algo_compare_func that compares functions A and B based on
their names. */
static int
-compare_functions (const void *a_, const void *b_, void *aux unused)
+compare_functions (const void *a_, const void *b_, void *aux UNUSED)
{
const struct function *a = a_;
const struct function *b = b_;
double *num; /* Numeric operands. */
unsigned char *str; /* String operands. */
union value *stack; /* Evaluation stack. */
- unsigned char *str_stack; /* String evaluation stack. */
-#if !PAGED_STACK
- size_t str_size; /* Size of string eval stack. */
-#endif
+ struct pool *pool; /* Pool for evaluation temporaries. */
};
struct nonterm_node *optimize_expression (struct nonterm_node *);
/* Hashes the name of file handle H. */
static unsigned
-hash_file_handle (const void *handle_, void *param unused)
+hash_file_handle (const void *handle_, void *param UNUSED)
{
const struct file_handle *handle = handle_;
/* Compares names of file handles A and B. */
static int
-cmp_file_handle (const void *a_, const void *b_, void *foo unused)
+cmp_file_handle (const void *a_, const void *b_, void *foo UNUSED)
{
const struct file_handle *a = a_;
const struct file_handle *b = b_;
/* PORTME: Everything in this file is system dependent. */
-#if unix
+#ifdef unix
#include <pwd.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#include "stat.h"
#endif
-#if __WIN32__
+#ifdef __WIN32__
#define NOGDI
#define NOUSER
#define NONLS
}
}
-#if unix
+#ifdef unix
/* Expands csh tilde notation from the path INPUT into a malloc()'d
returned string. */
char *
If PREPEND is non-NULL, then it is prepended to each filename;
i.e., it looks like PREPEND/PATH_COMPONENT/NAME. This is not done
with absolute directories in the path. */
-#if unix || __MSDOS__ || __WIN32__
+#if defined (unix) || defined (__MSDOS__) || defined (__WIN32__)
char *
fn_search_path (const char *basename, const char *path, const char *prepend)
{
existing file. Returns a malloc()'d copy of the canonical name.
This function must always succeed; if it needs to bail out then it
should return xstrdup(FN1). */
-#if unix
+#ifdef unix
char *
fn_normalize (const char *filename)
{
}
}
}
-#elif __WIN32__
+#elif defined (__WIN32__)
char *
fn_normalize (const char *fn1)
{
int
fn_absolute_p (const char *name)
{
-#if unix
+#ifdef unix
if (name[0] == '/'
|| !strncmp (name, "./", 2)
|| !strncmp (name, "../", 3)
|| name[0] == '~')
return 1;
-#elif __MSDOS__
+#elif defined (__MSDOS__)
if (name[0] == '\\'
|| !strncmp (name, ".\\", 2)
|| !strncmp (name, "..\\", 3)
{
if (!strcmp (filename, "-") || !strcmp (filename, "stdin")
|| !strcmp (filename, "stdout") || !strcmp (filename, "stderr")
-#if unix
+#ifdef unix
|| filename[0] == '|'
|| (*filename && filename[strlen (filename) - 1] == '|')
#endif
int
fn_exists_p (const char *name)
{
-#if unix
+#ifdef unix
struct stat temp;
return stat (name, &temp) == 0;
#endif
}
-#if unix
+#ifdef unix
/* Stolen from libc.info but heavily modified, this is a wrapper
around readlink() that allows for arbitrary filename length. */
char *
else if (mode[0] == 'w' && !strcmp (fn, "stderr"))
return stderr;
-#if unix
+#ifdef unix
if (fn[0] == '|')
{
if (set_safer)
{
if (!strcmp (fn, "-"))
return 0;
-#if unix
+#ifdef unix
else if (fn[0] == '|' || (*fn && fn[strlen (fn) - 1] == '|'))
{
pclose (f);
/* Parses the VARIABLES subcommand, adding to
{n_variables,v_variables}. */
static int
-frq_custom_variables (struct cmd_frequencies *cmd unused)
+frq_custom_variables (struct cmd_frequencies *cmd UNUSED)
{
int mode;
int min, max;
/* Parses the GROUPED subcommand, setting the frq.{n_grouped,grouped}
fields of specified variables. */
static int
-frq_custom_grouped (struct cmd_frequencies *cmd unused)
+frq_custom_grouped (struct cmd_frequencies *cmd UNUSED)
{
lex_match ('=');
if ((token == T_ID && dict_lookup_var (default_dict, tokid) != NULL)
/* Parses the PERCENTILES subcommand, adding user-specified
percentiles to the list. */
static int
-frq_custom_percentiles (struct cmd_frequencies *cmd unused)
+frq_custom_percentiles (struct cmd_frequencies *cmd UNUSED)
{
lex_match ('=');
if (token != T_NUM)
/* Parses the NTILES subcommand, adding the percentiles that
correspond to the specified evenly-distributed ntiles. */
static int
-frq_custom_ntiles (struct cmd_frequencies *cmd unused)
+frq_custom_ntiles (struct cmd_frequencies *cmd UNUSED)
{
int i;
/* Hash of numeric values. */
static unsigned
-hash_value_numeric (const void *value_, void *foo unused)
+hash_value_numeric (const void *value_, void *foo UNUSED)
{
const struct freq *value = value_;
return hsh_hash_double (value->v.f);
/* Ascending numeric compare of values. */
static int
-compare_value_numeric_a (const void *a_, const void *b_, void *foo unused)
+compare_value_numeric_a (const void *a_, const void *b_, void *foo UNUSED)
{
const struct freq *a = a_;
const struct freq *b = b_;
/* Descending numeric compare of values. */
static int
-compare_value_numeric_d (const void *a, const void *b, void *foo unused)
+compare_value_numeric_d (const void *a, const void *b, void *foo UNUSED)
{
return -compare_value_numeric_a (a, b, foo);
}
/* Ascending numeric compare of frequency;
secondary key on ascending numeric value. */
static int
-compare_freq_numeric_a (const void *a_, const void *b_, void *foo unused)
+compare_freq_numeric_a (const void *a_, const void *b_, void *foo UNUSED)
{
const struct freq *a = a_;
const struct freq *b = b_;
/* Descending numeric compare of frequency;
secondary key on ascending numeric value. */
static int
-compare_freq_numeric_d (const void *a_, const void *b_, void *foo unused)
+compare_freq_numeric_d (const void *a_, const void *b_, void *foo UNUSED)
{
const struct freq *a = a_;
const struct freq *b = b_;
}
static int
-save_trns_proc (struct trns_header * t unused, struct ccase * c)
+save_trns_proc (struct trns_header * t UNUSED, struct ccase * c)
{
flt64 *p = trns->case_buf;
int i;
/* Perform one iteration of steps 3...7 above. */
static int
-mtf_processing (struct ccase *c unused)
+mtf_processing (struct ccase *c UNUSED)
{
/* List of files with minimum BY values. */
struct mtf_file *min_head, *min_tail;
void
getl_uninitialize (void)
{
-#if HAVE_LIBHISTORY && unix
+#if HAVE_LIBHISTORY && defined (unix)
if (history_file)
write_history (history_file);
#endif
#if HAVE_LIBHISTORY
if (!history_file)
{
-#if unix
+#ifdef unix
history_file = tilde_expand (HISTORY_FILE);
#endif
using_history ();
#if __DJGPP__
#include <conio.h>
-#elif __WIN32__ && __BORLANDC__
+#elif defined (__WIN32__) && defined (__BORLANDC__)
#undef gettext
#include <conio.h>
#define gettext(STRING) \
#endif
void
-init_glob (int argc unused, char **argv)
+init_glob (int argc UNUSED, char **argv)
{
/* FIXME: Allow i18n of other locale items (besides LC_MESSAGES). */
#if ENABLE_NLS
#if !INCLUDED_GLOB_H
#define INCLUDED_GLOB_H 1
-void init_glob (int argc unused, char **argv);
+void init_glob (int argc UNUSED, char **argv);
#endif /* glob.h */
int space_index;
static int font_msg (int, const char *,...)
- __attribute__ ((format (printf, 2, 3)));
+ PRINTF_FORMAT (2, 3);
static void scan_badchars (char *, int);
static void dup_char_metric (struct font_desc * font, int dest, int src);
static void add_char_metric (struct font_desc * font, struct char_metrics *metrics,
/* Current location in file, used for error reporting. */
struct file_locator where;
-#if unix
+#ifdef unix
fn = fn_tilde_expand (fn);
#endif
goto file_lossage;
}
free (line);
-#if unix
+#ifdef unix
free ((char *) fn);
#endif
if (f != NULL)
fclose (f);
pool_destroy (font_pool);
-#if unix
+#ifdef unix
free ((char *) fn);
#endif
err_pop_file_locator (&where);
/* A "algo_predicate_func" that returns nonzero if DATA points
to a non-null void. */
static int
-not_null (const void *data_, void *aux unused)
+not_null (const void *data_, void *aux UNUSED)
{
void *const *data = data_;
static int preclose (struct file_ext *);
static int
-html_open_global (struct outp_class *this unused)
+html_open_global (struct outp_class *this UNUSED)
{
return 1;
}
static int
-html_close_global (struct outp_class *this unused)
+html_close_global (struct outp_class *this UNUSED)
{
return 1;
}
}
int
-end_case_trns_proc (struct trns_header *t unused, struct ccase * c unused)
+end_case_trns_proc (struct trns_header *t UNUSED, struct ccase * c UNUSED)
{
#if DEBUGGING
printf ("END CASE\n");
}
static int
-end_file_trns_proc (struct trns_header * t unused, struct ccase * c unused)
+end_file_trns_proc (struct trns_header * t UNUSED, struct ccase * c UNUSED)
{
#if DEBUGGING
printf ("END FILE\n");
}
static int
-break_trns_proc (struct trns_header * trns, struct ccase * c unused)
+break_trns_proc (struct trns_header * trns, struct ccase * c UNUSED)
{
return ((struct break_trns *) trns)->loop_term;
}
#include "debug-print.h"
-static void parse_script (void) __attribute__ ((noreturn));
+static void parse_script (void) NO_RETURN;
static void handle_error (int code);
static int execute_command (void);
/* Compares doubles A and B, treating SYSMIS as greatest. */
static int
-compare_doubles (const void *a_, const void *b_, void *aux unused)
+compare_doubles (const void *a_, const void *b_, void *aux UNUSED)
{
const double *a = a_;
const double *b = b_;
var_renaming structures A and B. */
static int
compare_var_renaming_by_new_name (const void *a_, const void *b_,
- void *foo unused)
+ void *foo UNUSED)
{
const struct var_renaming *a = a_;
const struct var_renaming *b = b_;
static int
corrupt_msg (struct file_handle *h, const char *format,...)
- __attribute__ ((format (printf, 2, 3)));
+ PRINTF_FORMAT (2, 3);
/* Displays a corruption error. */
static int
/* Prototypes. */
static void add_gizmo (struct pool *, struct pool_gizmo *);
static void free_gizmo (struct pool_gizmo *);
+static void free_all_gizmos (struct pool *pool);
static void delete_gizmo (struct pool *, struct pool_gizmo *);
#if !PSPP
if (pool == NULL)
return;
+ /* Remove this pool from its parent's list of gizmos. */
if (pool->parent)
- delete_gizmo (pool,
+ delete_gizmo (pool->parent,
(void *) (((char *) pool) + POOL_SIZE + POOL_BLOCK_SIZE));
- {
- struct pool_gizmo *cur, *next;
+ free_all_gizmos (pool);
- for (cur = pool->gizmos; cur; cur = next)
- {
- next = cur->next;
- free_gizmo (cur);
- }
- }
-
+ /* Free all the memory. */
{
struct pool_block *cur, *next;
}
}
}
+
+/* Release all the memory and gizmos in POOL.
+ Blocks are not given back with free() but kept for later
+ allocations. To give back memory, use a subpool instead. */
+void
+pool_clear (struct pool *pool)
+{
+ free_all_gizmos (pool);
+
+ /* Zero out block sizes. */
+ {
+ struct pool_block *cur;
+
+ cur = pool->blocks;
+ do
+ {
+ cur->ofs = POOL_BLOCK_SIZE;
+ if ((char *) cur + POOL_BLOCK_SIZE == (char *) pool)
+ cur->ofs += POOL_SIZE;
+ cur = cur->next;
+ }
+ while (cur != pool->blocks);
+ }
+}
\f
/* Suballocation routines. */
{
assert (pool != NULL);
-#if !DISCRETE_BLOCKS
+#ifndef DISCRETE_BLOCKS
if (amt <= MAX_SUBALLOC)
{
+ /* If there is space in this block, take it. */
struct pool_block *b = pool->blocks;
b->ofs = ROUND_UP (b->ofs, ALIGN_SIZE);
if (b->ofs + amt <= BLOCK_SIZE)
return p;
}
- b = xmalloc (BLOCK_SIZE);
- b->next = pool->blocks;
- b->prev = pool->blocks->prev;
- b->ofs = POOL_BLOCK_SIZE + amt;
-
- pool->blocks->prev->next = b;
- pool->blocks = pool->blocks->prev = b;
-
- return ((char *) b) + POOL_BLOCK_SIZE;
+ /* No space in this block, so we must make other
+ arrangements. */
+ if (b->next->ofs == 0)
+ {
+ /* The next block is empty. Use it. */
+ b = b->next;
+ b->ofs = POOL_BLOCK_SIZE;
+ if ((char *) b + POOL_BLOCK_SIZE == (char *) pool)
+ b->ofs += POOL_SIZE;
+ }
+ else
+ {
+ /* Create a new block at the start of the list. */
+ b = xmalloc (BLOCK_SIZE);
+ b->next = pool->blocks;
+ b->prev = pool->blocks->prev;
+ b->ofs = POOL_BLOCK_SIZE;
+ pool->blocks->prev->next = b;
+ pool->blocks->prev = b;
+ }
+ pool->blocks = b;
+
+ /* Allocate space from B. */
+ b->ofs += amt;
+ return ((char *) b) + b->ofs - amt;
}
else
-#endif /* !DISCRETE_BLOCKS */
+#endif
return pool_malloc (pool, amt);
}
size = length + 1;
/* Note that strings need not be aligned on any boundary. */
+#ifndef DISCRETE_BLOCKS
{
-#if !DISCRETE_BLOCKS
struct pool_block *const b = pool->blocks;
if (b->ofs + size <= BLOCK_SIZE)
{
- copy = ((char *) b) + b->ofs;
- b->ofs += size;
+ copy = ((char *) b) + b->ofs;
+ b->ofs += size;
}
- else
-#endif
- copy = pool_alloc (pool, size);
}
+#else
+ copy = pool_alloc (pool, size);
+#endif
memcpy (copy, string, length);
copy[length] = '\0';
mark->serial = serial;
}
-/* Restores to POOL the state recorded in MARK. */
+/* Restores to POOL the state recorded in MARK.
+ Emptied blocks are not given back with free() but kept for
+ later allocations. To get that behavior, use a subpool
+ instead. */
void
pool_release (struct pool *pool, const struct pool_mark *mark)
{
}
{
- struct pool_block *cur, *next, *last;
+ struct pool_block *cur;
- last = pool->blocks->prev;
- for (cur = pool->blocks; cur != mark->block; cur = next)
+ for (cur = pool->blocks; cur != mark->block; cur = cur->next)
{
- next = cur->next;
- assert (next != cur);
-
- free (cur);
+ cur->ofs = POOL_BLOCK_SIZE;
+ if ((char *) cur + POOL_BLOCK_SIZE == (char *) pool)
+ cur->ofs += POOL_SIZE;
}
-
- cur->prev = last;
- last->next = pool->blocks = cur;
-
- cur->ofs = mark->ofs;
+ pool->blocks = mark->block;
+ pool->blocks->ofs = mark->ofs;
}
}
\f
assert (0);
}
}
+
+/* Free all the gizmos in POOL. */
+static void
+free_all_gizmos (struct pool *pool)
+{
+ struct pool_gizmo *cur, *next;
+
+ for (cur = pool->gizmos; cur; cur = next)
+ {
+ next = cur->next;
+ free_gizmo (cur);
+ }
+}
\f
/* Memory allocation. */
/* General routines. */
struct pool *pool_create (void);
void pool_destroy (struct pool *);
+void pool_clear (struct pool *);
/* Suballocation routines. */
void *pool_alloc (struct pool *, size_t);
/* Driver initialization. */
static int
-ps_open_global (struct outp_class *this unused)
+ps_open_global (struct outp_class *this UNUSED)
{
init_fonts ();
groff_init ();
}
static int
-ps_close_global (struct outp_class *this unused)
+ps_close_global (struct outp_class *this UNUSED)
{
return 1;
}
static int *
-ps_font_sizes (struct outp_class *this unused, int *n_valid_sizes)
+ps_font_sizes (struct outp_class *this UNUSED, int *n_valid_sizes)
{
/* Allow fonts up to 1" in height. */
static int valid_sizes[] =
/* font_entry comparison function for hash tables. */
static int
-compare_font_entry (const void *a, const void *b, void *foobar unused)
+compare_font_entry (const void *a, const void *b, void *foobar UNUSED)
{
return strcmp (((struct font_entry *) a)->dit, ((struct font_entry *) b)->dit);
}
/* font_entry hash function for hash tables. */
static unsigned
-hash_font_entry (const void *fe_, void *foobar unused)
+hash_font_entry (const void *fe_, void *foobar UNUSED)
{
const struct font_entry *fe = fe_;
return hsh_hash_string (fe->dit);
/* font_entry destructor function for hash tables. */
static void
-free_font_entry (void *pa, void *foo unused)
+free_font_entry (void *pa, void *foo UNUSED)
{
struct font_entry *a = pa;
free (a->dit);
/* Hash table comparison function for ps_encoding's. */
static int
-compare_ps_encoding (const void *pa, const void *pb, void *foo unused)
+compare_ps_encoding (const void *pa, const void *pb, void *foo UNUSED)
{
const struct ps_encoding *a = pa;
const struct ps_encoding *b = pb;
/* Hash table hash function for ps_encoding's. */
static unsigned
-hash_ps_encoding (const void *pa, void *foo unused)
+hash_ps_encoding (const void *pa, void *foo UNUSED)
{
const struct ps_encoding *a = pa;
/* Hash table free function for ps_encoding's. */
static void
-free_ps_encoding (void *pa, void *foo unused)
+free_ps_encoding (void *pa, void *foo UNUSED)
{
struct ps_encoding *a = pa;
/* Hash table comparison function for cached lines. */
static int
-compare_line (const void *a_, const void *b_, void *foo unused)
+compare_line (const void *a_, const void *b_, void *foo UNUSED)
{
const struct line_form *a = a_;
const struct line_form *b = b_;
/* Hash table hash function for cached lines. */
static unsigned
-hash_line (const void *pa, void *foo unused)
+hash_line (const void *pa, void *foo UNUSED)
{
const struct line_form *a = pa;
/* Hash table free function for cached lines. */
static void
-free_line (void *pa, void *foo unused)
+free_line (void *pa, void *foo UNUSED)
{
free (pa);
}
static void
ps_line_horz (struct outp_driver *this, const struct rect *r,
- const struct color *c unused, int style)
+ const struct color *c UNUSED, int style)
{
/* Must match output.h:OUTP_L_*. */
static const int types[OUTP_L_COUNT] =
static void
ps_line_vert (struct outp_driver *this, const struct rect *r,
- const struct color *c unused, int style)
+ const struct color *c UNUSED, int style)
{
/* Must match output.h:OUTP_L_*. */
static const int types[OUTP_L_COUNT] =
static void
ps_line_intersection (struct outp_driver *this, const struct rect *r,
- const struct color *c unused,
+ const struct color *c UNUSED,
const struct outp_styles *style)
{
struct ps_driver_ext *ext = this->ext;
}
static void
-ps_box (struct outp_driver *this unused, const struct rect *r unused,
- const struct color *bord unused, const struct color *fill unused)
+ps_box (struct outp_driver *this UNUSED, const struct rect *r UNUSED,
+ const struct color *bord UNUSED, const struct color *fill UNUSED)
{
assert (this->driver_open && this->page_open);
}
static void
-ps_polyline_begin (struct outp_driver *this unused,
- const struct color *c unused)
+ps_polyline_begin (struct outp_driver *this UNUSED,
+ const struct color *c UNUSED)
{
assert (this->driver_open && this->page_open);
}
static void
-ps_polyline_point (struct outp_driver *this unused, int x unused, int y unused)
+ps_polyline_point (struct outp_driver *this UNUSED, int x UNUSED, int y UNUSED)
{
assert (this->driver_open && this->page_open);
}
static void
-ps_polyline_end (struct outp_driver *this unused)
+ps_polyline_end (struct outp_driver *this UNUSED)
{
assert (this->driver_open && this->page_open);
}
/* Hash table comparison function for ps_combo structs. */
static int
-compare_ps_combo (const void *pa, const void *pb, void *foo unused)
+compare_ps_combo (const void *pa, const void *pb, void *foo UNUSED)
{
const struct ps_font_combo *a = pa;
const struct ps_font_combo *b = pb;
/* Hash table hash function for ps_combo structs. */
static unsigned
-hash_ps_combo (const void *pa, void *foo unused)
+hash_ps_combo (const void *pa, void *foo UNUSED)
{
const struct ps_font_combo *a = pa;
unsigned name_hash = hsh_hash_string (a->font->font->internal_name);
/* Hash table free function for ps_combo structs. */
static void
-free_ps_combo (void *a, void *foo unused)
+free_ps_combo (void *a, void *foo UNUSED)
{
free (a);
}
static void
write_text (struct outp_driver *this,
const struct output_char *cp, const struct output_char *end,
- struct outp_text *t, int width unused, int width_left)
+ struct outp_text *t, int width UNUSED, int width_left)
{
struct ps_driver_ext *ext = this->ext;
int ofs;
/* Hash table comparison function for filename2font structs. */
static int
-compare_filename2font (const void *a, const void *b, void *param unused)
+compare_filename2font (const void *a, const void *b, void *param UNUSED)
{
return strcmp (((struct filename2font *) a)->filename,
((struct filename2font *) b)->filename);
/* Hash table hash function for filename2font structs. */
static unsigned
-hash_filename2font (const void *f2f_, void *param unused)
+hash_filename2font (const void *f2f_, void *param UNUSED)
{
const struct filename2font *f2f = f2f_;
return hsh_hash_string (f2f->filename);
int options; /* PRT_* bitmapped field. */
struct prt_out_spec *spec; /* Output specifications. */
int max_width; /* Maximum line width including null. */
-#if !PAGED_STACK
char *line; /* Buffer for sticking lines in. */
-#endif
};
/* PRT_PRINT or PRT_WRITE. */
prt.handle = NULL;
prt.options = f;
prt.spec = NULL;
-#if !PAGED_STACK
prt.line = NULL;
-#endif
next = NULL;
nrec = 0;
}
/* PORTME: The number of characters in a line terminator. */
-#if __MSDOS__
+#ifdef __MSDOS__
#define LINE_END_WIDTH 2 /* \r\n */
#else
#define LINE_END_WIDTH 1 /* \n */
#endif
/* Calculates the maximum possible line width and allocates a buffer
- big enough to contain it, if necessary (otherwise sets max_width).
- (The action taken depends on compiler & OS as detected by pref.h.) */
+ big enough to contain it */
static void
alloc_line (void)
{
w = pot_w;
}
prt.max_width = w + LINE_END_WIDTH + 1;
-#if !PAGED_STACK
prt.line = xmalloc (prt.max_width);
-#endif
}
\f
/* Transformation. */
struct prt_out_spec *i;
/* Line buffer. */
-#if PAGED_STACK
-#if __GNUC__ && !__STRICT_ANSI__
- char buf[t->max_width];
-#else /* !__GNUC__ */
- char *buf = alloca (t->max_width);
-#endif /* !__GNUC__ */
-#else /* !PAGED_STACK */
char *buf = t->line;
-#endif /* !PAGED_STACK */
/* Length of the line in buf. */
int len = 0;
|| t->handle->mode != FH_MD_BINARY)
{
/* PORTME: Line ends. */
-#if __MSDOS__
+#ifdef __MSDOS__
buf[len++] = '\r';
#endif
buf[len++] = '\n';
n = i->next;
free (i);
}
-#if !PAGED_STACK
free (((struct print_trns *) t)->line);
-#endif
}
\f
/* PRINT SPACE. */
char buf[LINE_END_WIDTH];
/* PORTME: Line ends. */
-#if __MSDOS__
+#ifdef __MSDOS__
buf[0] = '\r';
buf[1] = '\n';
#else
fprintf (stderr, "%s: %s: remove: %s\n", pgmname, ofn, strerror (errno));
}
-#if __GNUC__ >= 2
-void hcf (void) __attribute__ ((noreturn));
-#endif
+void hcf (void) NO_RETURN;
/* Terminate unsuccessfully. */
void
exit (EXIT_FAILURE);
}
-#if __GNUC__ >= 2
-int fail (const char *, ...) __attribute__ ((format (printf, 1, 2)));
-int error (const char *, ...) __attribute__ ((format (printf, 1, 2)));
-#endif
+int fail (const char *, ...) PRINTF_FORMAT (1, 2);
+int error (const char *, ...) PRINTF_FORMAT (1, 2);
/* Output an error message and terminate unsuccessfully. */
int
/* Size of the indent from the left margin. */
int indent;
-#if __GNUC__ >= 2
-void dump (int, const char *, ...) __attribute__ ((format (printf, 2, 3)));
-#endif
+void dump (int, const char *, ...) PRINTF_FORMAT (2, 3);
/* Write line FORMAT to the output file, formatted as with printf,
indented `indent' characters from the left margin. If INDENTION is
dump (0, "static void");
dump (0, "free_%s (struct cmd_%s *p%s)", make_identifier (cmdname),
- make_identifier (cmdname), used ? "" : " unused");
+ make_identifier (cmdname), used ? "" : " UNUSED");
dump (1, "{");
for (sbc = subcommands; sbc; sbc = sbc->next)
}
int
-sample_trns_proc (struct trns_header * trns, struct ccase *c unused)
+sample_trns_proc (struct trns_header * trns, struct ccase *c UNUSED)
{
struct sample_trns *t = (struct sample_trns *) trns;
double U;
}
static int
-stc_custom_pager (struct cmd_set *cmd unused)
+stc_custom_pager (struct cmd_set *cmd UNUSED)
{
lex_match ('=');
#if !USE_INTERNAL_PAGER
SYSMIS or a numeric value; PC+: Syntax is '.', which is equivalent
to SYSMIS, or a numeric value. */
static int
-stc_custom_blanks (struct cmd_set *cmd unused)
+stc_custom_blanks (struct cmd_set *cmd UNUSED)
{
lex_match ('=');
if ((token == T_ID && lex_id_match ("SYSMIS", tokid))
}
static int
-stc_custom_length (struct cmd_set *cmd unused)
+stc_custom_length (struct cmd_set *cmd UNUSED)
{
int page_length;
}
static int
-stc_custom_results (struct cmd_set *cmd unused)
+stc_custom_results (struct cmd_set *cmd UNUSED)
{
struct tuple
{
}
static int
-stc_custom_seed (struct cmd_set *cmd unused)
+stc_custom_seed (struct cmd_set *cmd UNUSED)
{
lex_match ('=');
if (lex_match_id ("RANDOM"))
}
static int
-stc_custom_width (struct cmd_set *cmd unused)
+stc_custom_width (struct cmd_set *cmd UNUSED)
{
int page_width;
/* Parses FORMAT subcommand, which consists of a numeric format
specifier. */
static int
-stc_custom_format (struct cmd_set *cmd unused)
+stc_custom_format (struct cmd_set *cmd UNUSED)
{
struct fmt_spec fmt;
}
static int
-stc_custom_journal (struct cmd_set *cmd unused)
+stc_custom_journal (struct cmd_set *cmd UNUSED)
{
lex_match ('=');
if (lex_match_id ("ON"))
/* Parses COLOR subcommand. PC+: either ON or OFF or two or three
comma-delimited numbers inside parentheses. */
static int
-stc_custom_color (struct cmd_set *cmd unused)
+stc_custom_color (struct cmd_set *cmd UNUSED)
{
msg (MW, _("%s is obsolete."),"COLOR");
}
static int
-stc_custom_listing (struct cmd_set *cmd unused)
+stc_custom_listing (struct cmd_set *cmd UNUSED)
{
lex_match ('=');
if (lex_match_id ("ON") || lex_match_id ("YES"))
}
static int
-stc_custom_disk (struct cmd_set *cmd unused)
+stc_custom_disk (struct cmd_set *cmd UNUSED)
{
stc_custom_listing (cmd);
return 0;
}
static int
-stc_custom_log (struct cmd_set *cmd unused)
+stc_custom_log (struct cmd_set *cmd UNUSED)
{
stc_custom_journal (cmd);
return 0;
}
static int
-stc_custom_rcolor (struct cmd_set *cmd unused)
+stc_custom_rcolor (struct cmd_set *cmd UNUSED)
{
msg (SW, _("%s is obsolete."),"RCOLOR");
}
static int
-stc_custom_viewlength (struct cmd_set *cmd unused)
+stc_custom_viewlength (struct cmd_set *cmd UNUSED)
{
if (lex_match_id ("MINIMUM"))
set_viewlength = 25;
{
if (!lex_force_int ())
return 0;
-#if __MSDOS__
+#ifdef __MSDOS__
if (lex_integer () >= (43 + 25) / 2)
set_viewlength = 43;
else
lex_get ();
}
-#if __MSDOS__
+#ifdef __MSDOS__
msg (SW, _("%s is not yet implemented."),"VIEWLENGTH");
#endif /* dos */
return 1;
}
static int
-stc_custom_workdev (struct cmd_set *cmd unused)
+stc_custom_workdev (struct cmd_set *cmd UNUSED)
{
char c[2];
static void
corrupt_msg (int class, const char *format,...)
- __attribute__ ((format (printf, 2, 3)));
+ PRINTF_FORMAT (2, 3);
/* Displays a corrupt sysfile error. */
static void
structures. */
/* This attribute might avoid some problems. On the other hand... */
-#define P __attribute__((packed))
+#define P ATTRIBUTE ((packed))
#if __BORLANDC__
#pragma option -a- /* Turn off alignment. */
if (dir == NULL)
dir = P_tmpdir;
#endif
-#if __unix__
+#ifdef unix
if (dir == NULL)
dir = "/tmp";
-#elif __MSDOS__
+#elif defined (__MSDOS__)
if (dir == NULL)
dir = getenv ("TEMP");
if (dir == NULL)
buf = xmalloc (strlen (dir) + 1 + 4 + 8 + 4 + 1 + INT_DIGITS + 1);
cp = spprintf (buf, "%s%c%04lX%04lXpspp", dir, DIR_SEPARATOR,
((long) time (0)) & 0xffff, ((long) getpid ()) & 0xffff);
+#ifndef __MSDOS__
if (-1 == mkdir (buf, S_IRWXU))
+#else
+ if (-1 == mkdir (buf))
+#endif
{
free (buf);
msg (SE, _("%s: Cannot create temporary directory: %s."),
void ds_concat (struct string *, const char *);
void ds_concat_buffer (struct string *, const char *buf, size_t len);
void ds_printf (struct string *, const char *, ...)
- __attribute__ ((format (printf, 2, 3)));
+ PRINTF_FORMAT (2, 3);
#if __GNUC__ > 1
extern inline void
static void paired_precalc (void);
static void paired_postcalc (void);
-static int compare_var_name (const void *a_, const void *b_, void *v_ unused);
-static unsigned hash_var_name (const void *a_, void *v_ unused);
+static int compare_var_name (const void *a_, const void *b_, void *v_ UNUSED);
+static unsigned hash_var_name (const void *a_, void *v_ UNUSED);
int
}
static int
-tts_custom_groups (struct cmd_t_test *cmd unused)
+tts_custom_groups (struct cmd_t_test *cmd UNUSED)
{
lex_match('=');
static int
-tts_custom_pairs (struct cmd_t_test *cmd unused)
+tts_custom_pairs (struct cmd_t_test *cmd UNUSED)
{
struct variable **vars;
int n_vars;
/* Initialize the paired values ssbox */
void
-ssbox_paired_init(struct ssbox *this, struct cmd_t_test *cmd unused)
+ssbox_paired_init(struct ssbox *this, struct cmd_t_test *cmd UNUSED)
{
int hsize=6;
/* Populate the ssbox for paired values */
void
-ssbox_paired_populate(struct ssbox *ssb,struct cmd_t_test *cmd unused)
+ssbox_paired_populate(struct ssbox *ssb,struct cmd_t_test *cmd UNUSED)
{
int i;
/* Initialize the independent samples trbox */
void
trbox_independent_samples_init(struct trbox *self,
- struct cmd_t_test *cmd unused)
+ struct cmd_t_test *cmd UNUSED)
{
const int hsize=11;
const int vsize=cmd->n_variables*2+3;
/* Initialize the paired samples trbox */
void
trbox_paired_init(struct trbox *self,
- struct cmd_t_test *cmd unused)
+ struct cmd_t_test *cmd UNUSED)
{
const int hsize=10;
/* Populate the paired samples trbox */
void
trbox_paired_populate(struct trbox *trb,
- struct cmd_t_test *cmd unused)
+ struct cmd_t_test *cmd UNUSED)
{
int i;
static int
-compare_var_name (const void *a_, const void *b_, void *v_ unused)
+compare_var_name (const void *a_, const void *b_, void *v_ UNUSED)
{
const struct variable *a = a_;
const struct variable *b = b_;
}
static unsigned
-hash_var_name (const void *a_, void *v_ unused)
+hash_var_name (const void *a_, void *v_ UNUSED)
{
const struct variable *a = a_;
FIXME: Doesn't use r1? Huh? */
static int
-render_strip (int x, int y, int r, int c1, int c2, int r1 unused, int r2)
+render_strip (int x, int y, int r, int c1, int c2, int r1 UNUSED, int r2)
{
int x_origin = x;
double v, int w, int d);
void tab_text (struct tab_table *, int c, int r, unsigned opt,
const char *, ...)
- __attribute__ ((format (printf, 5, 6)));
+ PRINTF_FORMAT (5, 6);
void tab_joint_text (struct tab_table *, int x1, int y1, int x2, int y2,
unsigned opt, const char *, ...)
- __attribute__ ((format (printf, 7, 8)));
+ PRINTF_FORMAT (7, 8);
/* Cell low-level access. */
#define tab_alloc(TABLE, AMT) pool_alloc ((TABLE)->container, (AMT))
/* Simple output. */
void tab_output_text (int options, const char *string, ...)
- __attribute__ ((format (printf, 2, 3)));
+ PRINTF_FORMAT (2, 3);
#endif /* tab_h */
/* Free a value label. */
void
-free_int_val_lab (void *vl_, void *vls_ unused)
+free_int_val_lab (void *vl_, void *vls_ UNUSED)
{
struct int_val_lab *vl = vl_;
/* A hsh_compare_func that compares A and B. */
static int
-compare_atoms (const void *a_, const void *b_, void *aux unused)
+compare_atoms (const void *a_, const void *b_, void *aux UNUSED)
{
const struct atom *a = a_;
const struct atom *b = b_;
/* A hsh_hash_func that hashes ATOM. */
static unsigned
-hash_atom (const void *atom_, void *aux unused)
+hash_atom (const void *atom_, void *aux UNUSED)
{
const struct atom *atom = atom_;
/* A hsh_free_func that destroys ATOM. */
static void
-free_atom (void *atom_, void *aux unused)
+free_atom (void *atom_, void *aux UNUSED)
{
struct atom *atom = atom_;
/* A hsh_compare_func that orders variables A and B by their
names. */
int
-compare_variables (const void *a_, const void *b_, void *foo unused)
+compare_variables (const void *a_, const void *b_, void *foo UNUSED)
{
const struct variable *a = a_;
const struct variable *b = b_;
/* A hsh_hash_func that hashes variable V based on its name. */
unsigned
-hash_variable (const void *v_, void *foo unused)
+hash_variable (const void *v_, void *foo UNUSED)
{
const struct variable *v = v_;