Changed all the licence notices in all the files.
[pspp] / src / subclist.h
1 #ifndef SUBCLIST_H
2 #define SUBCLIST_H
3
4 /* subclist - lists for PSPP subcommands
5
6    Copyright (C) 2004 Free Software Foundation, Inc.
7
8    Written by John Darrington <john@darrington.wattle.id.au>
9
10
11    This program is free software; you can redistribute it and/or
12    modify it under the terms of the GNU General Public License as
13    published by the Free Software Foundation; either version 2 of the
14    License, or (at your option) any later version.
15
16    This program is distributed in the hope that it will be useful, but
17    WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24    02110-1301, USA. */
25
26
27
28 #include <sys/types.h>
29
30 /* This module provides a rudimentary list class
31    It is intended for use by the command line parser for list subcommands
32 */
33
34
35 struct subc_list_double {
36   double *data ;
37   size_t sz;
38   int n_data;
39 };
40
41 struct subc_list_int {
42   int *data ;
43   size_t sz;
44   int n_data;
45 };
46
47
48 typedef struct subc_list_double subc_list_double ;
49 typedef struct subc_list_int subc_list_int ;
50
51 /* Create a  list */
52 void subc_list_double_create(subc_list_double *l) ;
53 void subc_list_int_create(subc_list_int *l) ;
54
55 /* Push a value onto the list */
56 void subc_list_double_push(subc_list_double *l, double d) ;
57 void subc_list_int_push(subc_list_int *l, int i) ;
58
59 /* Index into the list */
60 double subc_list_double_at(const subc_list_double *l, int idx);
61 int subc_list_int_at(const subc_list_int *l, int idx);
62
63 /* Return the number of values in the list */
64 int subc_list_double_count(const subc_list_double *l);
65 int subc_list_int_count(const subc_list_int *l);
66
67 /* Destroy the list */
68 void subc_list_double_destroy(subc_list_double *l) ;
69 void subc_list_int_destroy(subc_list_int *l) ;
70
71
72 #endif