projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix some typos (found by codespell)
[pspp]
/
src
/
language
/
stats
/
rank.c
diff --git
a/src/language/stats/rank.c
b/src/language/stats/rank.c
index a29a3fd11f7870a746b1d26c06d8a63eaae96690..65a0fb8b574a9fb66b75031ed65332c7514e0ceb 100644
(file)
--- a/
src/language/stats/rank.c
+++ b/
src/language/stats/rank.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc
+ Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013
, 2014, 2016
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
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
@@
-162,7
+162,7
@@
try_new_name (const char *new_name,
}
/* Returns a variable name for storing ranks of a variable named SRC_NAME
}
/* Returns a variable name for storing ranks of a variable named SRC_NAME
- accoring to the rank function F. The name chosen will not be one already in
+ accor
d
ing to the rank function F. The name chosen will not be one already in
DICT or NEW_NAMES.
If successful, adds the new name to NEW_NAMES and returns the name added.
DICT or NEW_NAMES.
If successful, adds the new name to NEW_NAMES and returns the name added.
@@
-257,7
+257,7
@@
parse_into (struct lexer *lexer, struct rank *cmd,
cmd->rs = pool_realloc (cmd->pool, cmd->rs, sizeof (*cmd->rs) * (cmd->n_rs + 1));
rs = &cmd->rs[cmd->n_rs];
cmd->rs = pool_realloc (cmd->pool, cmd->rs, sizeof (*cmd->rs) * (cmd->n_rs + 1));
rs = &cmd->rs[cmd->n_rs];
-
+
if (lex_match_id (lexer, "RANK"))
{
rs->rfunc = RANK;
if (lex_match_id (lexer, "RANK"))
{
rs->rfunc = RANK;
@@
-290,13
+290,13
@@
parse_into (struct lexer *lexer, struct rank *cmd,
{
if ( !lex_force_match (lexer, T_LPAREN))
return false;
{
if ( !lex_force_match (lexer, T_LPAREN))
return false;
-
+
if (! lex_force_int (lexer) )
return false;
if (! lex_force_int (lexer) )
return false;
-
+
cmd->k_ntiles = lex_integer (lexer);
lex_get (lexer);
cmd->k_ntiles = lex_integer (lexer);
lex_get (lexer);
-
+
if ( !lex_force_match (lexer, T_RPAREN))
return false;
if ( !lex_force_match (lexer, T_RPAREN))
return false;
@@
-304,6
+304,7
@@
parse_into (struct lexer *lexer, struct rank *cmd,
}
else
{
}
else
{
+ lex_error (lexer, NULL);
return false;
}
return false;
}
@@
-318,7
+319,7
@@
parse_into (struct lexer *lexer, struct rank *cmd,
const char *name = lex_tokcstr (lexer);
if ( var_count >= subcase_get_n_fields (&cmd->sc) )
const char *name = lex_tokcstr (lexer);
if ( var_count >= subcase_get_n_fields (&cmd->sc) )
- msg (SE, _("Too many variables in
INTO clause.")
);
+ msg (SE, _("Too many variables in
%s clause."), "INTO"
);
else if ( dict_lookup_var (cmd->dict, name) != NULL )
msg (SE, _("Variable %s already exists."), name);
else if (string_set_contains (new_names, name))
else if ( dict_lookup_var (cmd->dict, name) != NULL )
msg (SE, _("Variable %s already exists."), name);
else if (string_set_contains (new_names, name))
@@
-637,7
+638,7
@@
create_var_label (struct rank *cmd, const struct variable *src_var,
function_name[f], var_get_name (src_var));
pool_label = pool_strdup (cmd->pool, ds_cstr (&label));
function_name[f], var_get_name (src_var));
pool_label = pool_strdup (cmd->pool, ds_cstr (&label));
-
+
ds_destroy (&label);
return pool_label;
ds_destroy (&label);
return pool_label;
@@
-667,7
+668,8
@@
cmd_rank (struct lexer *lexer, struct dataset *ds)
string_set_init (&new_names);
if (lex_match_id (lexer, "VARIABLES"))
string_set_init (&new_names);
if (lex_match_id (lexer, "VARIABLES"))
- lex_force_match (lexer, T_EQUALS);
+ if (! lex_force_match (lexer, T_EQUALS))
+ goto error;
if (!parse_sort_criteria (lexer, rank.dict,
&rank.sc,
if (!parse_sort_criteria (lexer, rank.dict,
&rank.sc,
@@
-687,10
+689,12
@@
cmd_rank (struct lexer *lexer, struct dataset *ds)
while (lex_token (lexer) != T_ENDCMD )
{
while (lex_token (lexer) != T_ENDCMD )
{
- lex_force_match (lexer, T_SLASH);
+ if (! lex_force_match (lexer, T_SLASH))
+ goto error;
if (lex_match_id (lexer, "TIES"))
{
if (lex_match_id (lexer, "TIES"))
{
- lex_force_match (lexer, T_EQUALS);
+ if (! lex_force_match (lexer, T_EQUALS))
+ goto error;
if (lex_match_id (lexer, "MEAN"))
{
rank.ties = TIES_MEAN;
if (lex_match_id (lexer, "MEAN"))
{
rank.ties = TIES_MEAN;
@@
-715,7
+719,8
@@
cmd_rank (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "FRACTION"))
{
}
else if (lex_match_id (lexer, "FRACTION"))
{
- lex_force_match (lexer, T_EQUALS);
+ if (! lex_force_match (lexer, T_EQUALS))
+ goto error;
if (lex_match_id (lexer, "BLOM"))
{
rank.fraction = FRAC_BLOM;
if (lex_match_id (lexer, "BLOM"))
{
rank.fraction = FRAC_BLOM;
@@
-740,7
+745,8
@@
cmd_rank (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "PRINT"))
{
}
else if (lex_match_id (lexer, "PRINT"))
{
- lex_force_match (lexer, T_EQUALS);
+ if (! lex_force_match (lexer, T_EQUALS))
+ goto error;
if (lex_match_id (lexer, "YES"))
{
rank.print = true;
if (lex_match_id (lexer, "YES"))
{
rank.print = true;
@@
-757,7
+763,8
@@
cmd_rank (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "MISSING"))
{
}
else if (lex_match_id (lexer, "MISSING"))
{
- lex_force_match (lexer, T_EQUALS);
+ if (! lex_force_match (lexer, T_EQUALS))
+ goto error;
if (lex_match_id (lexer, "INCLUDE"))
{
rank.exclude = MV_SYSTEM;
if (lex_match_id (lexer, "INCLUDE"))
{
rank.exclude = MV_SYSTEM;
@@
-820,7
+827,7
@@
cmd_rank (struct lexer *lexer, struct dataset *ds)
{
int v;
{
int v;
- tab_output_text
(0, _("Variables Created By RANK")
);
+ tab_output_text
_format (0, _("Variables Created By %s"), "RANK"
);
tab_output_text (0, "");
for (i = 0 ; i < rank.n_rs ; ++i )
tab_output_text (0, "");
for (i = 0 ; i < rank.n_rs ; ++i )
@@
-1123,7
+1130,7
@@
rank_cmd (struct dataset *ds, const struct rank *cmd)
var = dict_create_var_assert (d, rs->dest_names[i], 0);
var_set_both_formats (var, &dest_format[rs->rfunc]);
var = dict_create_var_assert (d, rs->dest_names[i], 0);
var_set_both_formats (var, &dest_format[rs->rfunc]);
- var_set_label (var, rs->dest_labels[i]
, false
);
+ var_set_label (var, rs->dest_labels[i]);
iv->output_vars[j] = var;
}
iv->output_vars[j] = var;
}