Beginning of VFM cleanup.
[pspp-builds.git] / src / format.c
index 61b223e2ead79c70c44fd7efa6022db1cf5aa1f9..33a81ff30142366fc5c044ee1deadd86b8e10e1c 100644 (file)
    02111-1307, USA. */
 
 #include <config.h>
-
+#include "format.h"
 #include <ctype.h>
 #include <assert.h>
 #include <stdlib.h>
 #include "error.h"
-#include "format.h"
 #include "lexer.h"
 #include "misc.h"
 #include "str.h"
@@ -341,3 +340,13 @@ parse_format_specifier (struct fmt_spec *input, int allow_xt)
   return 1;
 }
 
+int
+get_format_var_width (const struct fmt_spec *spec) 
+{
+  if (spec->type == FMT_AHEX)
+    return spec->w * 2;
+  else if (spec->type == FMT_A)
+    return spec->w;
+  else
+    return 0;
+}