.h files should stand alone, but we shouldn't include <sys/types.h>
[pspp] / lib / readtokens.h
1 /* readtokens.h -- Functions for reading tokens from an input stream.
2
3    Copyright (C) 1990, 1991, 1999, 2001, 2003 Jim Meyering.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19    Written by Jim Meyering. */
20
21 #ifndef H_READTOKENS_H
22 # define H_READTOKENS_H
23
24 # include <stdio.h>
25
26 # ifndef INITIAL_TOKEN_LENGTH
27 #  define INITIAL_TOKEN_LENGTH 20
28 # endif
29
30 # ifndef TOKENBUFFER_DEFINED
31 #  define TOKENBUFFER_DEFINED
32 struct tokenbuffer
33 {
34   long size;
35   char *buffer;
36 };
37 typedef struct tokenbuffer token_buffer;
38
39 # endif /* not TOKENBUFFER_DEFINED */
40
41 # undef __P
42 # if defined (__STDC__) && __STDC__
43 #  define       __P(x) x
44 # else
45 #  define       __P(x) ()
46 # endif
47
48 void init_tokenbuffer __P ((token_buffer *tokenbuffer));
49
50 long
51   readtoken __P ((FILE *stream, const char *delim, int n_delim,
52              token_buffer *tokenbuffer));
53 int
54   readtokens __P ((FILE *stream, int projected_n_tokens,
55               const char *delim, int n_delim,
56               char ***tokens_out, long **token_lengths));
57
58 #endif /* not H_READTOKENS_H */