1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 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., 59 Temple Place - Suite 330, Boston, MA
25 /* Defines a list of lines used by DO REPEAT. */
26 /* Special case: if LEN is negative then it is a line number; in this
27 case LINE is a file name. This is used to allow errors to be
28 reported for the correct file and line number when DO REPEAT spans
32 char *line; /* Line contents. */
33 int len; /* Line length. */
34 struct getl_line_list *next; /* Next line. */
40 struct getl_script *included_from; /* File that this is nested inside. */
41 struct getl_script *includes; /* File nested inside this file. */
42 struct getl_script *next; /* Next file in list. */
43 char *fn; /* Filename. */
44 int ln; /* Line number. */
45 int separate; /* !=0 means this is a separate job. */
46 FILE *f; /* File handle. */
48 /* Used only if F is NULL. Used for DO REPEAT. */
49 struct getl_line_list *first_line; /* First line in line buffer. */
50 struct getl_line_list *cur_line; /* Current line in line buffer. */
51 int remaining_loops; /* Number of remaining loops through LINES. */
52 int loop_index; /* Number of loops through LINES so far. */
53 void *macros; /* Pointer to macro table. */
54 int print; /* 1=Print lines as executed. */
57 /* List of script files. */
58 extern struct getl_script *getl_head; /* Current file. */
59 extern struct getl_script *getl_tail; /* End of list. */
61 /* If getl_head==0 and getl_interactive!=0, lines will be read from
62 the console rather than terminating. */
63 extern int getl_interactive;
65 /* 1=the welcome message has been printed. */
66 extern int getl_welcomed;
71 GETL_PRPT_STANDARD, /* Just asks for a command. */
72 GETL_PRPT_CONTINUATION, /* Continuation lines for a single command. */
73 GETL_PRPT_DATA /* Between BEGIN DATA and END DATA. */
79 GETL_MODE_BATCH, /* Batch mode. */
80 GETL_MODE_INTERACTIVE /* Interactive mode. */
83 /* One of GETL_MODE_*, representing the current mode. */
86 /* Current prompting style: one of GETL_PRPT_*. */
87 extern int getl_prompt;
89 /* Are we reading a script? Are we interactive? */
90 #define getl_am_interactive (getl_head == NULL)
91 #define getl_reading_script (getl_head != NULL)
93 /* Current line. This line may be modified by modules other than
94 getline.c, and by lexer.c in particular. */
95 extern struct string getl_buf;
97 /* Name of the command history file. */
98 #if HAVE_LIBREADLINE && HAVE_LIBHISTORY
99 extern char *getl_history;
102 void getl_initialize (void);
103 void getl_uninitialize (void);
104 void getl_clear_include_path (void);
105 char *getl_get_current_directory (void);
106 void getl_add_include_dir (const char *);
107 void getl_add_file (const char *fn, int separate, int where);
108 void getl_include (const char *fn);
109 int getl_read_line (void);
110 void getl_close_file (void);
111 void getl_close_all (void);
112 int getl_perform_delayed_reset (void);
113 void getl_add_DO_REPEAT_file (struct getl_script *);
114 void getl_add_virtual_file (struct getl_script *);
115 void getl_location (const char **, int *);
117 #endif /* getline_h */