projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for reading SPSS/PC+ system files.
[pspp]
/
src
/
data
/
format.c
diff --git
a/src/data/format.c
b/src/data/format.c
index 58e16d3075a4249080db940efcb1e7dd7285c938..55e166e817a0c075de9fab55c29a5ae4afab73c5 100644
(file)
--- a/
src/data/format.c
+++ b/
src/data/format.c
@@
-33,6
+33,7
@@
#include "libpspp/misc.h"
#include "libpspp/str.h"
#include "libpspp/misc.h"
#include "libpspp/str.h"
+#include "gl/c-strcase.h"
#include "gl/minmax.h"
#include "gl/xalloc.h"
#include "gl/minmax.h"
#include "gl/xalloc.h"
@@
-474,8
+475,10
@@
fmt_equal (const struct fmt_spec *a, const struct fmt_spec *b)
return a->type == b->type && a->w == b->w && a->d == b->d;
}
return a->type == b->type && a->w == b->w && a->d == b->d;
}
-/* Adjusts FMT to be valid for a value of the given WIDTH. */
-void
+/* Adjusts FMT to be valid for a value of the given WIDTH if necessary.
+ If nothing needed to be changed the return value is false
+ */
+bool
fmt_resize (struct fmt_spec *fmt, int width)
{
if ((width > 0) != fmt_is_string (fmt->type))
fmt_resize (struct fmt_spec *fmt, int width)
{
if ((width > 0) != fmt_is_string (fmt->type))
@@
-493,7
+496,9
@@
fmt_resize (struct fmt_spec *fmt, int width)
else
{
/* Still numeric. */
else
{
/* Still numeric. */
+ return false;
}
}
+ return true;
}
/* Adjusts FMT's width and decimal places to be valid for USE. */
}
/* Adjusts FMT's width and decimal places to be valid for USE. */
@@
-581,7
+586,7
@@
fmt_from_name (const char *name, enum fmt_type *type)
int i;
for (i = 0; i < FMT_NUMBER_OF_FORMATS; i++)
int i;
for (i = 0; i < FMT_NUMBER_OF_FORMATS; i++)
- if (!strcasecmp (name, get_fmt_desc (i)->name))
+ if (!
c_
strcasecmp (name, get_fmt_desc (i)->name))
{
*type = i;
return true;
{
*type = i;
return true;
@@
-1153,3
+1158,6
@@
get_fmt_desc (enum fmt_type type)
}
const struct fmt_spec F_8_0 = {FMT_F, 8, 0};
}
const struct fmt_spec F_8_0 = {FMT_F, 8, 0};
+const struct fmt_spec F_8_2 = {FMT_F, 8, 2};
+const struct fmt_spec F_4_3 = {FMT_F, 4, 3};
+const struct fmt_spec F_5_1 = {FMT_F, 5, 1};