save coefficients in innovations estimate structure
[pspp] / src / language / lexer / format-parser.c
index b3ccba55ced7b4d559966817c438b878ce87a1f8..aa4729b063ffaa780da433b92d7a9e979cf8121d 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
-#include "format.h"
+#include <data/format.h>
 #include <ctype.h>
-#include "message.h"
+#include <libpspp/message.h>
 #include <stdlib.h>
-#include "message.h"
+#include <libpspp/message.h>
 #include "lexer.h"
-#include "misc.h"
-#include "str.h"
-#include "variable.h"
+#include <libpspp/misc.h>
+#include <libpspp/str.h>
+#include <data/variable.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -45,7 +45,7 @@ parse_format_specifier_name (const char **cp, enum fmt_parse_flags flags)
   char *sp, *ep;
   int idx;
 
-  sp = ep = ds_c_str (&tokstr);
+  sp = ep = ds_cstr (&tokstr);
   while (isalpha ((unsigned char) *ep))
     ep++;
 
@@ -72,7 +72,7 @@ parse_format_specifier_name (const char **cp, enum fmt_parse_flags flags)
           /* No match. */
           if (!(flags & FMTP_SUPPRESS_ERRORS))
             msg (SE, _("%.*s is not a valid data format."),
-                 (int) (ep - sp), ds_c_str (&tokstr));
+                 (int) (ep - sp), ds_cstr (&tokstr));
           idx = -1; 
         }
     }
@@ -125,7 +125,12 @@ parse_format_specifier (struct fmt_spec *input, enum fmt_parse_flags flags)
     {
       if (!(flags & FMTP_SUPPRESS_ERRORS))
         msg (SE, _("Data format %s does not specify a width."),
-             ds_c_str (&tokstr));
+             ds_cstr (&tokstr));
+      return 0;
+    }
+  if ( w > MAX_STRING )
+    {
+      msg (SE, _("String variable width may not exceed %d"), MAX_STRING);
       return 0;
     }
 
@@ -142,7 +147,7 @@ parse_format_specifier (struct fmt_spec *input, enum fmt_parse_flags flags)
   if (*cp)
     {
       if (!(flags & FMTP_SUPPRESS_ERRORS))
-        msg (SE, _("Data format %s is not valid."), ds_c_str (&tokstr));
+        msg (SE, _("Data format %s is not valid."), ds_cstr (&tokstr));
       return 0;
     }
   lex_get ();