/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
-#include <libpspp/alloc.h>
+#include <libpspp/cast.h>
#include <libpspp/ll.h>
#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <data/variable.h>
#include "intprops.h"
+#include "xalloc.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
&command_ends_after_line);
if (recognize_do_repeat (ds_ss (&text)))
{
- if (get_syntax () == COMPATIBLE)
+ if (settings_get_syntax () == COMPATIBLE)
msg (SE, _("DO REPEAT may not nest in compatibility mode."));
else
nesting_level++;
/* Makes appropriate DO REPEAT macro substitutions within the
repeated lines. */
static void
-do_repeat_filter (struct getl_interface *block_,
- struct string *line)
+do_repeat_filter (struct getl_interface *interface, struct string *line)
{
- struct repeat_block *block = (struct repeat_block *) block_;
+ struct repeat_block *block
+ = UP_CAST (interface, struct repeat_block, parent);
bool in_apos, in_quote, dot;
struct substring input;
struct string output;
/* Strip trailing whitespace, check for & remove terminal dot. */
ds_rtrim (line, ss_cstr (CC_SPACES));
- dot = ds_chomp (line, get_endcmd ());
-
+ dot = ds_chomp (line, settings_get_endcmd ());
input = ds_ss (line);
in_apos = in_quote = false;
while ((c = ss_first (input)) != EOF)
}
}
if (dot)
- ds_put_char (&output, get_endcmd ());
+ ds_put_char (&output, settings_get_endcmd ());
ds_swap (line, &output);
ds_destroy (&output);
static struct repeat_line *
current_line (const struct getl_interface *interface)
{
- struct repeat_block *block = (struct repeat_block *) interface;
+ struct repeat_block *block
+ = UP_CAST (interface, struct repeat_block, parent);
return (block->cur_line != ll_null (&block->lines)
? ll_data (block->cur_line, struct repeat_line, ll)
: NULL);
do_repeat_read (struct getl_interface *interface,
struct string *output)
{
- struct repeat_block *block = (struct repeat_block *) interface;
+ struct repeat_block *block
+ = UP_CAST (interface, struct repeat_block, parent);
struct repeat_line *line;
block->cur_line = ll_next (block->cur_line);
/* Frees a DO REPEAT block.
Called by getl to close out the DO REPEAT block. */
static void
-do_repeat_close (struct getl_interface *block_)
+do_repeat_close (struct getl_interface *interface)
{
- struct repeat_block *block = (struct repeat_block *) block_;
+ struct repeat_block *block
+ = UP_CAST (interface, struct repeat_block, parent);
pool_destroy (block->pool);
}