tests/automake.mk: Fix building of test runners
[pspp] / src / language / lexer / subcommand-list.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2004, 2011 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef SUBCLIST_H
18 #define SUBCLIST_H
19
20
21 #include <sys/types.h>
22
23 /* This module provides a rudimentary list class
24    It is intended for use by the command line parser for list subcommands
25 */
26
27 struct lexer;
28
29 struct subc_list_double {
30   double *data ;
31   size_t sz;
32   int n_data;
33 };
34
35 struct subc_list_int {
36   int *data ;
37   size_t sz;
38   int n_data;
39 };
40
41
42 typedef struct subc_list_double subc_list_double ;
43 typedef struct subc_list_int subc_list_int ;
44
45 /* Create a  list */
46 void subc_list_double_create(subc_list_double *l) ;
47 void subc_list_int_create(subc_list_int *l) ;
48
49 /* Push a value onto the list */
50 void subc_list_double_push(subc_list_double *l, double d) ;
51 void subc_list_int_push(subc_list_int *l, int i) ;
52
53 /* Index into the list */
54 double subc_list_double_at(const subc_list_double *l, int idx);
55 int subc_list_int_at(const subc_list_int *l, int idx);
56
57 /* Return the number of values in the list */
58 int subc_list_double_count(const subc_list_double *l);
59 int subc_list_int_count(const subc_list_int *l);
60
61 /* Destroy the list */
62 void subc_list_double_destroy(subc_list_double *l) ;
63 void subc_list_int_destroy(subc_list_int *l) ;
64
65 void subc_list_error (struct lexer *, const char *sbc, int max_list);
66
67 #endif