gui: Fix compatibility with older gettext.
[pspp] / src / language / lexer / subcommand-list.c
index 5cec533c965756a80782eff1ae753ffe99fa33fd..33deac0bb69c97d2277586752c17d8236790674d 100644 (file)
@@ -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
 
 
 #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 */
 
@@ -47,7 +51,7 @@ subc_list_double_push(subc_list_double *l, double d)
 {
   l->data[l->n_data++] = d;
 
-  if (l->n_data >= l->sz )
+  if (l->n_data >= l->sz)
     {
       l->sz += CHUNKSIZE;
       l->data = xnrealloc (l->data, l->sz, sizeof *l->data);
@@ -60,7 +64,7 @@ subc_list_int_push(subc_list_int *l, int d)
 {
   l->data[l->n_data++] = d;
 
-  if (l->n_data >= l->sz )
+  if (l->n_data >= l->sz)
     {
       l->sz += CHUNKSIZE;
       l->data = xnrealloc (l->data, l->sz, sizeof *l->data);
@@ -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);
+}