#include <limits.h>
#include <stdlib.h>
#include "value.h"
-#include "alloc.h"
-#include "str.h"
+#include <libpspp/alloc.h>
+#include <libpspp/str.h>
#include "variable.h"
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
#undef NDEBUG
#else
#ifndef NDEBUG
+ value_cnt * sizeof (union value));
}
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Initializes C as a null case. */
void
case_nullify (struct ccase *c)
c->case_data = NULL;
c->this = c;
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Returns true iff C is a null case. */
int
case_is_null (const struct ccase *c)
{
return c->case_data == NULL;
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
/* Initializes C as a new case that can store VALUE_CNT values.
The values have indeterminate contents until explicitly
xalloc_die ();
}
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Initializes CLONE as a copy of ORIG. */
void
case_clone (struct ccase *clone, const struct ccase *orig)
}
orig->case_data->ref_cnt++;
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Replaces DST by SRC and nullifies SRC.
DST and SRC must be initialized cases at entry. */
void
dst->this = dst;
case_nullify (src);
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Destroys case C. */
void
case_destroy (struct ccase *c)
free (cd);
}
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
/* Resizes case C from OLD_CNT to NEW_CNT values. */
void
c->case_data = malloc (case_size (value_cnt));
if (c->case_data != NULL)
{
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
c->this = c;
#endif
c->case_data->value_cnt = value_cnt;
}
else
{
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
c->this = c;
#endif
return 0;
return 1;
}
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Copies VALUE_CNT values from SRC (starting at SRC_IDX) to DST
(starting at DST_IDX). */
void
src->case_data->values + src_idx,
sizeof *dst->case_data->values * value_cnt);
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Copies case C to OUTPUT.
OUTPUT_SIZE is the number of `union values' in OUTPUT,
which must match the number of `union values' in C. */
memcpy (output, c->case_data->values,
c->case_data->value_cnt * sizeof *output);
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Copies INPUT into case C.
INPUT_SIZE is the number of `union values' in INPUT,
which must match the number of `union values' in C. */
memcpy (c->case_data->values, input,
c->case_data->value_cnt * sizeof *input);
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Returns a pointer to the `union value' used for the
element of C numbered IDX.
The caller must not modify the returned data. */
return &c->case_data->values[idx];
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Returns the numeric value of the `union value' in C numbered
IDX. */
double
return c->case_data->values[idx].f;
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Returns the string value of the `union value' in C numbered
IDX.
(Note that the value is not null-terminated.)
return c->case_data->values[idx].s;
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
-#ifdef GLOBAL_DEBUGGING
+#ifdef DEBUGGING
/* Returns a pointer to the `union value' used for the
element of C numbered IDX.
The caller is allowed to modify the returned data. */
case_unshare (c);
return &c->case_data->values[idx];
}
-#endif /* GLOBAL_DEBUGGING */
+#endif /* DEBUGGING */
/* Compares the values of the VAR_CNT variables in VP
in cases A and B and returns a strcmp()-type result. */