b47a2ce370e1d000e61c1f05f20c6da21558d02f
[pspp-builds.git] / src / language / line-buffer.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3    Written by Ben Pfaff <blp@gnu.org>.
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    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
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18    02110-1301, USA. */
19
20 #ifndef GETL_H
21 #define GETL_H 1
22
23 #include <stdbool.h>
24 #include <libpspp/str.h>
25
26 enum getl_prompt_style
27   {
28     GETL_PROMPT_FIRST,          /* First line of command. */
29     GETL_PROMPT_LATER,          /* Second or later line of command. */
30     GETL_PROMPT_DATA,           /* Between BEGIN DATA and END DATA. */
31     GETL_PROMPT_CNT
32   };
33
34 /* Current line.  This line may be modified by modules other than
35    getl.c, and by lexer.c in particular.  (Ugh.) */
36 extern struct string getl_buf;
37
38 void getl_initialize (void);
39 void getl_uninitialize (void);
40
41 void getl_clear_include_path (void);
42 void getl_add_include_dir (const char *);
43
44 void getl_append_syntax_file (const char *);
45 void getl_include_syntax_file (const char *);
46 void getl_include_filter (void (*filter) (struct string *, void *aux),
47                           void (*close) (void *aux),
48                           void *aux);
49 void getl_include_function (bool (*read) (struct string *line,
50                                           char **fn, int *ln, void *aux),
51                             void (*close) (void *aux),
52                             void *aux);
53 void getl_append_interactive (bool (*function) (struct string *line,
54                                                 enum getl_prompt_style));
55 void getl_abort_noninteractive (void);
56 bool getl_is_interactive (void);
57
58 bool getl_read_line (bool *interactive);
59
60 void getl_location (const char **, int *);
61
62 const char *getl_get_prompt (enum getl_prompt_style);
63 void getl_set_prompt (enum getl_prompt_style, const char *);
64 void getl_set_prompt_style (enum getl_prompt_style);
65
66 #endif /* line-buffer.h */