1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
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.
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.
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
24 #include <libpspp/ll.h>
30 /* Syntax rules that apply to a given source line. */
33 /* Each line that begins in column 1 starts a new command. A
34 `+' or `-' in column 1 is ignored to allow visual
35 indentation of new commands. Continuation lines must be
36 indented from the left margin. A period at the end of a
37 line does end a command, but it is optional. */
40 /* Each command must end in a period or in a blank line. */
44 /* An abstract base class for objects which act as line buffers for the
45 PSPP. Ie anything which might contain content for the lexer */
48 /* Returns true if the interface is interactive, that is, if
49 it prompts a human user. This property is independent of
50 the syntax mode returned by the read member function. */
51 bool (*interactive) (const struct getl_interface *);
53 /* Read a line the intended syntax mode from the interface.
54 Returns true if succesful, false on failure or at end of
56 bool (*read) (struct getl_interface *,
57 struct string *, enum getl_syntax *);
59 /* Close and destroy the interface */
60 void (*close) (struct getl_interface *);
62 /* Filter for current and all included sources, which may
63 modify the line. Usually null. */
64 void (*filter) (struct getl_interface *,
65 struct string *line, enum getl_syntax);
67 /* Returns the name of the source */
68 const char * (*name) (const struct getl_interface *);
70 /* Returns the current location within the source */
71 int (*location) (const struct getl_interface *);
76 struct source_stream * create_source_stream (void);
77 void destroy_source_stream (struct source_stream *);
79 void getl_clear_include_path (struct source_stream *);
80 void getl_add_include_dir (struct source_stream *, const char *);
81 const char * getl_include_path (const struct source_stream *);
83 void getl_abort_noninteractive (struct source_stream *);
84 bool getl_is_interactive (const struct source_stream *);
86 bool getl_read_line (struct source_stream *, struct string *,
89 void getl_append_source (struct source_stream *, struct getl_interface *s) ;
90 void getl_include_source (struct source_stream *, struct getl_interface *s) ;
92 const char * getl_source_name (const struct source_stream *);
93 int getl_source_location (const struct source_stream *);
95 #endif /* line-buffer.h */