X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fnumeric.c;h=2a7dbe575c1dd570949d070d5f56c52a02f1c10a;hb=c38b1e667a1fdb12df302ce54872dee88c04e65e;hp=1619a99af342236c7ccc78b0fb7e8adaaf794d3d;hpb=3a7fba81ceae5b049d0f7d671e9e3c3c43bbf703;p=pspp diff --git a/src/numeric.c b/src/numeric.c index 1619a99af3..2a7dbe575c 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -14,36 +14,38 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include -#include +#include "error.h" #include -#include "cases.h" #include "command.h" +#include "dictionary.h" #include "error.h" #include "lexer.h" #include "str.h" #include "var.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) + #include "debug-print.h" /* Parses the NUMERIC command. */ int cmd_numeric (void) { - int i; + size_t i; /* Names of variables to create. */ char **v; - int nv; + size_t nv; /* Format spec for variables to create. f.type==-1 if default is to be used. */ struct fmt_spec f; - lex_match_id ("NUMERIC"); do { if (!parse_DATA_LIST_vars (&v, &nv, PV_NONE)) @@ -80,7 +82,6 @@ cmd_numeric (void) { if (f.type != -1) new_var->print = new_var->write = f; - envector (new_var); } } @@ -106,11 +107,11 @@ fail: int cmd_string (void) { - int i; + size_t i; /* Names of variables to create. */ char **v; - int nv; + size_t nv; /* Format spec for variables to create. */ struct fmt_spec f; @@ -118,7 +119,6 @@ cmd_string (void) /* Width of variables to create. */ int width; - lex_match_id ("STRING"); do { if (!parse_DATA_LIST_vars (&v, &nv, PV_NONE)) @@ -150,6 +150,7 @@ cmd_string (void) break; default: assert (0); + abort (); } /* Create each variable. */ @@ -160,10 +161,7 @@ cmd_string (void) if (!new_var) msg (SE, _("There is already a variable named %s."), v[i]); else - { - new_var->print = new_var->write = f; - envector (new_var); - } + new_var->print = new_var->write = f; } /* Clean up. */ @@ -189,20 +187,18 @@ int cmd_leave (void) { struct variable **v; - int nv; + size_t nv; - int i; + size_t i; - lex_match_id ("LEAVE"); if (!parse_variables (default_dict, &v, &nv, PV_NONE)) return CMD_FAILURE; for (i = 0; i < nv; i++) { - if (v[i]->left) + if (!v[i]->reinit) continue; - devector (v[i]); - v[i]->left = 1; - envector (v[i]); + v[i]->reinit = 0; + v[i]->init = 1; } free (v);