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
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 <data/caseproto.h>
-#include <data/val-type.h>
-#include <data/value.h>
-#include <libpspp/array.h>
-#include <libpspp/assertion.h>
-#include <libpspp/pool.h>
+#include "data/caseproto.h"
size_t idx, size_t count);
/* Returns the number of bytes to allocate for a struct caseproto
size_t idx, size_t count);
/* Returns the number of bytes to allocate for a struct caseproto
proto = caseproto_reserve (proto, proto->n_widths + 1);
proto->widths[proto->n_widths++] = width;
proto = caseproto_reserve (proto, proto->n_widths + 1);
proto->widths[proto->n_widths++] = width;
proto = caseproto_reserve (proto, idx + 1);
while (idx >= proto->n_widths)
proto->widths[proto->n_widths++] = -1;
proto = caseproto_reserve (proto, idx + 1);
while (idx >= proto->n_widths)
proto->widths[proto->n_widths++] = -1;
assert (before <= proto->n_widths);
proto = caseproto_reserve (proto, proto->n_widths + 1);
assert (before <= proto->n_widths);
proto = caseproto_reserve (proto, proto->n_widths + 1);
insert_element (proto->widths, proto->n_widths, sizeof *proto->widths,
before);
proto->widths[before] = width;
insert_element (proto->widths, proto->n_widths, sizeof *proto->widths,
before);
proto->widths[before] = width;
remove_range (proto->widths, proto->n_widths, sizeof *proto->widths,
remove_range (proto->widths, proto->n_widths, sizeof *proto->widths,
starting at index OLD_WIDTH now start at index NEW_WIDTH, with
other widths shifting out of the way to make room. */
struct caseproto *
caseproto_move_widths (struct caseproto *proto,
size_t old_start, size_t new_start,
starting at index OLD_WIDTH now start at index NEW_WIDTH, with
other widths shifting out of the way to make room. */
struct caseproto *
caseproto_move_widths (struct caseproto *proto,
size_t old_start, size_t new_start,
- assert (caseproto_range_is_valid (proto, old_start, cnt));
- assert (caseproto_range_is_valid (proto, new_start, cnt));
+ assert (caseproto_range_is_valid (proto, old_start, n));
+ assert (caseproto_range_is_valid (proto, new_start, n));
proto = caseproto_unshare (proto);
move_range (proto->widths, proto->n_widths, sizeof *proto->widths,
proto = caseproto_unshare (proto);
move_range (proto->widths, proto->n_widths, sizeof *proto->widths,
- init_long_strings (proto, 0, proto->n_long_strings, values);
+ init_strings (proto, 0, proto->n_strings, values);
- return try_init_long_strings (proto, 0, proto->n_long_strings, values);
+ return try_init_strings (proto, 0, proto->n_strings, values);
caseproto_reinit_values (const struct caseproto *old,
const struct caseproto *new, union value values[])
{
caseproto_reinit_values (const struct caseproto *old,
const struct caseproto *new, union value values[])
{
expensive_assert (caseproto_is_conformable (old, new));
if (new_n_long > old_n_long)
expensive_assert (caseproto_is_conformable (old, new));
if (new_n_long > old_n_long)
- init_long_strings (new, old_n_long, new_n_long, values);
+ init_strings (new, old_n_long, new_n_long, values);
- destroy_long_strings (old, new_n_long, old_n_long, values);
+ destroy_strings (old, new_n_long, old_n_long, values);
- destroy_long_strings (proto, 0, proto->n_long_strings, values);
+ destroy_strings (proto, 0, proto->n_strings, values);
- if (proto->widths[i] > MAX_SHORT_STRING)
- proto->long_strings[n++] = i;
- assert (n == proto->n_long_strings);
+ if (proto->widths[i] > 0)
+ proto->strings[n++] = i;
+ assert (n == proto->n_strings);
- destroy_long_strings (proto, first, i, values);
+ destroy_strings (proto, first, i, values);
- if (!try_init_long_strings (proto, first, last, values))
+ if (!try_init_strings (proto, first, last, values))
-destroy_long_strings (const struct caseproto *proto, size_t first, size_t last,
+destroy_strings (const struct caseproto *proto, size_t first, size_t last,