[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[q2c 10/12] q2c: Use new subc_list_error() to report too many subcommand
From: |
Ben Pfaff |
Subject: |
[q2c 10/12] q2c: Use new subc_list_error() to report too many subcommands. |
Date: |
Sat, 5 Nov 2011 20:11:32 -0700 |
This removes one string from q2c.c that needs translation but
cannot currently be translated.
---
src/language/lexer/q2c.c | 3 ++-
src/language/lexer/subcommand-list.c | 17 ++++++++++++++---
src/language/lexer/subcommand-list.h | 4 +++-
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/language/lexer/q2c.c b/src/language/lexer/q2c.c
index 5473e11..e38be02 100644
--- a/src/language/lexer/q2c.c
+++ b/src/language/lexer/q2c.c
@@ -1745,7 +1745,8 @@ dump_subcommand (const subcommand *sbc)
{
dump (0, "if ( p->sbc_%s > MAXLISTS)",st_lower(sbc->name));
dump (1, "{");
- dump (0, "msg (SE, \"No more than %%d %s subcommands
allowed\",MAXLISTS);",st_lower(sbc->name));
+ dump (0, "subc_list_error (lexer, \"%s\", MAXLISTS);",
+ st_lower(sbc->name));
dump (0, "goto lossage;");
dump (-1,"}");
diff --git a/src/language/lexer/subcommand-list.c
b/src/language/lexer/subcommand-list.c
index 5cec533..289179b 100644
--- a/src/language/lexer/subcommand-list.c
+++ b/src/language/lexer/subcommand-list.c
@@ -1,5 +1,5 @@
/* PSPP - a program for statistical analysis.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2011 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
@@ -16,9 +16,13 @@
#include <config.h>
-#include "subcommand-list.h"
+#include "language/lexer/subcommand-list.h"
#include <stdlib.h>
-#include "xalloc.h"
+#include "language/lexer/lexer.h"
+#include "gl/xalloc.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
/* I call these objects `lists' but they are in fact simple dynamic arrays */
@@ -107,3 +111,10 @@ subc_list_int_destroy(subc_list_int *l)
{
free(l->data);
}
+
+void
+subc_list_error (struct lexer *lexer, const char *sbc, int max_list)
+{
+ lex_error (lexer, _("No more than %d %s subcommands allowed."),
+ max_list, sbc);
+}
diff --git a/src/language/lexer/subcommand-list.h
b/src/language/lexer/subcommand-list.h
index 74c53da..8d664f5 100644
--- a/src/language/lexer/subcommand-list.h
+++ b/src/language/lexer/subcommand-list.h
@@ -1,5 +1,5 @@
/* PSPP - a program for statistical analysis.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2011 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
@@ -24,6 +24,7 @@
It is intended for use by the command line parser for list subcommands
*/
+struct lexer;
struct subc_list_double {
double *data ;
@@ -61,5 +62,6 @@ int subc_list_int_count(const subc_list_int *l);
void subc_list_double_destroy(subc_list_double *l) ;
void subc_list_int_destroy(subc_list_int *l) ;
+void subc_list_error (struct lexer *, const char *sbc, int max_list);
#endif
--
1.7.2.5
- [q2c 01/12] SET: Warn for more obsolete subcommands., (continued)
- [q2c 01/12] SET: Warn for more obsolete subcommands., Ben Pfaff, 2011/11/05
- [q2c 04/12] LOOP: Correctly implement MXLOOPS and add a test., Ben Pfaff, 2011/11/05
- [q2c 03/12] settings: Implement MXLOOPS subcommand., Ben Pfaff, 2011/11/05
- [q2c 09/12] lexer: New function lex_force_string_or_id()., Ben Pfaff, 2011/11/05
- [q2c 08/12] lexer: New functions lex_spec_missing(), lex_spec_only_once()., Ben Pfaff, 2011/11/05
- [q2c 07/12] lexer: Use error helper functions in more situations., Ben Pfaff, 2011/11/06
- [q2c 12/12] q2c: Remove gettext.h #include from generated code., Ben Pfaff, 2011/11/06
- [q2c 02/12] settings: Update default MXLOOPS and document., Ben Pfaff, 2011/11/06
- [q2c 06/12] lexer: Drop lexer parameter from lex_sbc_missing()., Ben Pfaff, 2011/11/06
- [q2c 11/12] q2c: Remove final untranslated strings from q2c.c., Ben Pfaff, 2011/11/06
- [q2c 10/12] q2c: Use new subc_list_error() to report too many subcommands.,
Ben Pfaff <=
- [q2c 05/12] lexer: New function lex_error_expecting()., Ben Pfaff, 2011/11/06
- Re: [q2c 00/12] Fix i18n problems in q2c-generated strings, John Darrington, 2011/11/06