X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fcontrol%2Frepeat.c;h=0b4607ffd6a24b0fffd36c12317af76b0c1fb1a7;hb=8297784ffdab47d35820735eb130a484ba9b6c01;hp=b68973614907896244b43ae677fcfdb7079e8381;hpb=75c3e2cb72c17151b0f6f8f3b0f5d0956db91acf;p=pspp-builds.git diff --git a/src/language/control/repeat.c b/src/language/control/repeat.c index b6897361..0b4607ff 100644 --- a/src/language/control/repeat.c +++ b/src/language/control/repeat.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -136,7 +137,7 @@ parse_specification (struct repeat_block *block) /* Get a stand-in variable name and make sure it's unique. */ if (!lex_force_id ()) return false; - if (dict_lookup_var (default_dict, tokid)) + if (dict_lookup_var (dataset_dict (current_dataset), tokid)) msg (SW, _("Dummy variable name \"%s\" hides dictionary " "variable \"%s\"."), tokid, tokid); @@ -288,11 +289,11 @@ parse_lines (struct repeat_block *block) || !strcmp (cur_file_name, previous_file_name)) previous_file_name = pool_strdup (block->pool, cur_file_name); - ds_rtrim_spaces (&getl_buf); + ds_rtrim (&getl_buf, ss_cstr (CC_SPACES)); dot = ds_chomp (&getl_buf, get_endcmd ()); - if (recognize_do_repeat (ds_c_str (&getl_buf))) + if (recognize_do_repeat (ds_cstr (&getl_buf))) nesting_level++; - else if (recognize_end_repeat (ds_c_str (&getl_buf), &block->print)) + else if (recognize_end_repeat (ds_cstr (&getl_buf), &block->print)) { if (nesting_level-- == 0) { @@ -301,13 +302,13 @@ parse_lines (struct repeat_block *block) } } if (dot) - ds_putc (&getl_buf, get_endcmd ()); + ds_put_char (&getl_buf, get_endcmd ()); line = *last_line = pool_alloc (block->pool, sizeof *line); line->next = NULL; line->file_name = previous_file_name; line->line_number = cur_line_number; - line->line = pool_strdup (block->pool, ds_c_str (&getl_buf)); + line->line = pool_strdup (block->pool, ds_cstr (&getl_buf)); last_line = &line->next; } @@ -330,7 +331,7 @@ create_vars (struct repeat_block *block) { /* Ignore return value: if the variable already exists there is no harm done. */ - dict_create_var (default_dict, iter->replacement[i], 0); + dict_create_var (dataset_dict (current_dataset), iter->replacement[i], 0); } } } @@ -469,7 +470,7 @@ do_repeat_filter (struct string *line, void *block_) struct string output; bool dot; - ds_init (&output, ds_capacity (line)); + ds_init_empty (&output); /* Strip trailing whitespace, check for & remove terminal dot. */ while (isspace (ds_last (line))) @@ -477,7 +478,7 @@ do_repeat_filter (struct string *line, void *block_) dot = ds_chomp (line, get_endcmd ()); in_apos = in_quote = false; - for (cp = ds_c_str (line); cp < ds_end (line); ) + for (cp = ds_cstr (line); cp < ds_end (line); ) { if (*cp == '\'' && !in_quote) in_apos = !in_apos; @@ -485,7 +486,7 @@ do_repeat_filter (struct string *line, void *block_) in_quote = !in_quote; if (in_quote || in_apos || !lex_is_id1 (*cp)) - ds_putc (&output, *cp++); + ds_put_char (&output, *cp++); else { const char *start = cp; @@ -493,14 +494,14 @@ do_repeat_filter (struct string *line, void *block_) const char *substitution = find_substitution (block, start, end - start); if (substitution != NULL) - ds_puts (&output, substitution); + ds_put_cstr (&output, substitution); else - ds_concat (&output, start, end - start); + ds_put_substring (&output, ss_buffer (start, end - start)); cp = end; } } if (dot) - ds_putc (&output, get_endcmd ()); + ds_put_char (&output, get_endcmd ()); ds_swap (line, &output); ds_destroy (&output); @@ -526,7 +527,7 @@ do_repeat_read (struct string *output, char **file_name, int *line_number, } line = block->cur_line; - ds_assign_c_str (output, line->line); + ds_assign_cstr (output, line->line); *file_name = line->file_name; *line_number = -line->line_number; block->cur_line = line->next;