Eliminated global variable getl_buf
[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
35 void getl_initialize (void);
36 void getl_uninitialize (void);
37
38 void getl_clear_include_path (void);
39 void getl_add_include_dir (const char *);
40
41 void getl_append_syntax_file (const char *);
42 void getl_include_syntax_file (const char *);
43 void getl_include_filter (void (*filter) (struct string *, void *aux),
44                           void (*close) (void *aux),
45                           void *aux);
46 void getl_include_function (bool (*read) (struct string *line,
47                                           char **fn, int *ln, void *aux),
48                             void (*close) (void *aux),
49                             void *aux);
50 void getl_append_interactive (bool (*function) (struct string *line,
51                                                 enum getl_prompt_style));
52 void getl_abort_noninteractive (void);
53 bool getl_is_interactive (void);
54
55 bool getl_read_line (bool *interactive);
56
57 const char *getl_get_prompt (enum getl_prompt_style);
58 void getl_set_prompt (enum getl_prompt_style, const char *);
59 void getl_set_prompt_style (enum getl_prompt_style);
60
61 struct msg_locator;
62 void get_msg_location (struct msg_locator *loc);
63
64 void getl_location (const char **fn, int *ln);
65
66 bool do_read_line (struct string *line, bool *interactive);
67
68
69 #endif /* line-buffer.h */