1 /* subclist - lists for PSPP subcommands
3 Copyright (C) 2004 Free Software Foundation, Inc.
5 Written by John Darrington <john@darrington.wattle.id.au>
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 /* I call these objects `lists' but they are in fact simple dynamic arrays */
34 subc_list_double_create(subc_list_double *l)
36 l->data = xnmalloc (CHUNKSIZE, sizeof *l->data);
41 /* Push a value onto the list */
43 subc_list_double_push(subc_list_double *l, double d)
45 l->data[l->n_data++] = d;
47 if (l->n_data >= l->sz )
50 l->data = xnrealloc (l->data, l->sz, sizeof *l->data);
55 /* Return the number of items in the list */
57 subc_list_double_count(const subc_list_double *l)
63 /* Index into the list (array) */
65 subc_list_double_at(const subc_list_double *l, int idx)
70 /* Free up the list */
72 subc_list_double_destroy(subc_list_double *l)