1/*	$NetBSD$	*/
2
3/* session.h -- Functions found in session.c.
4   Id: session.h,v 1.3 2004/04/11 17:56:46 karl Exp
5
6   Copyright (C) 1993, 1998, 1999, 2001, 2002, 2004 Free Software
7   Foundation, Inc.
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2, or (at your option)
12   any later version.
13
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software
21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23   Written by Brian Fox (bfox@ai.mit.edu). */
24
25#ifndef SESSION_H
26#define SESSION_H
27
28#include "info.h"
29#include "dribble.h"
30
31/* All commands that can be invoked from within info_session () receive
32   arguments in the same way.  This simple define declares the header
33   of a function named NAME, with associated documentation DOC.  The
34   documentation string is groveled out of the source files by the
35   utility program `makedoc', which is also responsible for making
36   the documentation/function-pointer maps. */
37#define DECLARE_INFO_COMMAND(name, doc) \
38void name (WINDOW *window, int count, unsigned char key)
39
40/* Variables found in session.h. */
41extern VFunction *info_last_executed_command;
42
43/* Variable controlling the garbage collection of files briefly visited
44   during searches.  Such files are normally gc'ed, unless they were
45   compressed to begin with.  If this variable is non-zero, it says
46   to gc even those file buffer contents which had to be uncompressed. */
47extern int gc_compressed_files;
48
49/* When non-zero, tiling takes place automatically when info_split_window
50   is called. */
51extern int auto_tiling_p;
52
53/* Variable controlling the behaviour of default scrolling when you are
54   already at the bottom of a node. */
55extern int info_scroll_behaviour;
56extern char *info_scroll_choices[];
57
58/* Values for info_scroll_behaviour. */
59#define IS_Continuous 0 /* Try to get first menu item, or failing that, the
60                           "Next:" pointer, or failing that, the "Up:" and
61                           "Next:" of the up. */
62#define IS_NextOnly   1 /* Try to get "Next:" menu item. */
63#define IS_PageOnly   2 /* Simply give up at the bottom of a node. */
64
65/* Utility functions found in session.c */
66extern void info_dispatch_on_key (unsigned char key, Keymap map);
67extern unsigned char info_get_input_char (void);
68extern unsigned char info_get_another_input_char (void);
69extern unsigned char info_input_pending_p (void);
70extern void remember_window_and_node (WINDOW *window, NODE *node);
71extern void set_remembered_pagetop_and_point (WINDOW *window);
72extern void set_window_pagetop (WINDOW *window, int desired_top);
73extern void info_set_node_of_window (int remember, WINDOW *window,
74    NODE *node);
75extern void initialize_keyseq (void);
76extern void add_char_to_keyseq (char character);
77extern void info_gather_typeahead (void);
78extern FILE_BUFFER *file_buffer_of_window (WINDOW *window);
79extern long info_search_in_node (char *string, NODE *node,
80    long int start, WINDOW *window, int dir, int case_sensitive);
81extern long info_target_search_node (NODE *node, char *string,
82    long int start);
83extern void info_select_reference (WINDOW *window, REFERENCE *entry);
84extern int info_any_buffered_input_p (void);
85extern void print_node (NODE *node);
86extern void dump_node_to_file (NODE *node, char *filename,
87    int dump_subnodes);
88extern void dump_nodes_to_file (char *filename, char **nodenames,
89    char *output_filename, int dump_subnodes);
90extern char *program_name_from_file_name (char *file_name);
91
92/* Do the physical deletion of WINDOW, and forget this window and
93   associated nodes. */
94extern void info_delete_window_internal (WINDOW *window);
95
96/* Tell Info that input is coming from the file FILENAME. */
97extern void info_set_input_from_file (char *filename);
98
99#define return_if_control_g(val) \
100  do { \
101    info_gather_typeahead (); \
102    if (info_input_pending_p () == Control ('g')) \
103      return (val); \
104  } while (0)
105
106/* The names of the functions that run an info session. */
107
108/* Starting an info session. */
109extern void begin_multiple_window_info_session (char *filename,
110    char **nodenames);
111extern void begin_info_session (NODE *initial_node);
112extern void begin_info_session_with_error (NODE *initial_node,
113    char *format, void *arg1, void *arg2);
114extern void info_session (void);
115extern void initialize_info_session (NODE *node, int clear_screen);
116extern void info_read_and_dispatch (void);
117extern void info_intuit_options_node (WINDOW *window,
118    NODE *initial_node, char *program);
119
120/* Moving the point within a node. */
121extern void info_next_line (WINDOW *window, int count, unsigned char key);
122extern void info_prev_line (WINDOW *window, int count, unsigned char key);
123extern void info_end_of_line (WINDOW *window, int count, unsigned char key);
124extern void info_beginning_of_line (WINDOW *window, int count, unsigned char key);
125extern void info_forward_char (WINDOW *window, int count, unsigned char key);
126extern void info_backward_char (WINDOW *window, int count, unsigned char key);
127extern void info_forward_word (WINDOW *window, int count, unsigned char key);
128extern void info_backward_word (WINDOW *window, int count, unsigned char key);
129extern void info_beginning_of_node (WINDOW *window, int count, unsigned char key);
130extern void info_end_of_node (WINDOW *window, int count, unsigned char key);
131extern void info_move_to_prev_xref (WINDOW *window, int count, unsigned char key);
132extern void info_move_to_next_xref (WINDOW *window, int count, unsigned char key);
133
134/* Scrolling text within a window. */
135extern void info_scroll_forward (WINDOW *window, int count, unsigned char key);
136extern void info_scroll_backward (WINDOW *window, int count, unsigned char key);
137extern void info_redraw_display (WINDOW *window, int count, unsigned char key);
138extern void info_toggle_wrap (WINDOW *window, int count, unsigned char key);
139extern void info_move_to_window_line (WINDOW *window, int count,
140    unsigned char key);
141extern void info_up_line (WINDOW *window, int count, unsigned char key);
142extern void info_down_line (WINDOW *window, int count, unsigned char key);
143extern void info_scroll_half_screen_down (WINDOW *window, int count,
144    unsigned char key);
145extern void info_scroll_half_screen_up (WINDOW *window, int count,
146    unsigned char key);
147extern void info_scroll_forward_set_window (WINDOW *window, int count,
148    unsigned char key);
149extern void info_scroll_forward_page_only (WINDOW *window, int count,
150    unsigned char key);
151extern void info_scroll_forward_page_only_set_window (WINDOW *window, int count,
152    unsigned char key);
153extern void info_scroll_backward_set_window (WINDOW *window, int count,
154    unsigned char key);
155extern void info_scroll_backward_page_only (WINDOW *window, int count,
156    unsigned char key);
157extern void info_scroll_backward_page_only_set_window (WINDOW *window, int count,
158    unsigned char key);
159extern void info_scroll_other_window_backward (WINDOW *window, int count,
160    unsigned char key);
161
162/* Manipulating multiple windows. */
163extern void info_split_window (WINDOW *window, int count, unsigned char key);
164extern void info_delete_window (WINDOW *window, int count, unsigned char key);
165extern void info_keep_one_window (WINDOW *window, int count, unsigned char key);
166extern void info_grow_window (WINDOW *window, int count, unsigned char key);
167extern void info_scroll_other_window (WINDOW *window, int count,
168    unsigned char key);
169extern void info_tile_windows (WINDOW *window, int count, unsigned char key);
170extern void info_next_window (WINDOW *window, int count, unsigned char key);
171extern void info_prev_window (WINDOW *window, int count, unsigned char key);
172
173/* Selecting nodes. */
174extern void info_next_node (WINDOW *window, int count, unsigned char key);
175extern void info_prev_node (WINDOW *window, int count, unsigned char key);
176extern void info_up_node (WINDOW *window, int count, unsigned char key);
177extern void info_last_node (WINDOW *window, int count, unsigned char key);
178extern void info_first_node (WINDOW *window, int count, unsigned char key);
179extern void info_history_node (WINDOW *window, int count, unsigned char key);
180extern void info_goto_node (WINDOW *window, int count, unsigned char key);
181extern void info_goto_invocation_node (WINDOW *window, int count,
182    unsigned char key);
183extern void info_top_node (WINDOW *window, int count, unsigned char key);
184extern void info_dir_node (WINDOW *window, int count, unsigned char key);
185extern void info_global_next_node (WINDOW *window, int count, unsigned char key);
186extern void info_global_prev_node (WINDOW *window, int count, unsigned char key);
187extern void info_kill_node (WINDOW *window, int count, unsigned char key);
188extern void info_view_file (WINDOW *window, int count, unsigned char key);
189extern void info_menu_sequence (WINDOW *window, int count, unsigned char key);
190extern NODE *info_follow_menus (NODE *initial_node, char **menus,
191    const char **errstr, char **errarg1, char **errarg2);
192extern void info_man (WINDOW *window, int count, unsigned char key);
193extern void list_visited_nodes (WINDOW *window, int count, unsigned char key);
194extern void select_visited_node (WINDOW *window, int count, unsigned char key);
195
196/* Selecting cross references. */
197extern void info_menu_digit (WINDOW *window, int count, unsigned char key);
198extern void info_menu_item (WINDOW *window, int count, unsigned char key);
199extern void info_xref_item (WINDOW *window, int count, unsigned char key);
200extern void info_find_menu (WINDOW *window, int count, unsigned char key);
201extern void info_select_reference_this_line (WINDOW *window, int count,
202    unsigned char key);
203extern void info_last_menu_item (WINDOW *window, int count, unsigned char key);
204extern void info_visit_menu (WINDOW *window, int count, unsigned char key);
205
206/* Hacking numeric arguments. */
207extern int info_explicit_arg, info_numeric_arg, info_numeric_arg_sign;
208
209extern void info_add_digit_to_numeric_arg (WINDOW *window, int count,
210    unsigned char key);
211extern void info_universal_argument (WINDOW *window, int count,
212    unsigned char key);
213extern void info_initialize_numeric_arg (void);
214extern void info_numeric_arg_digit_loop (WINDOW *window, int count,
215    unsigned char key);
216
217/* Searching commands. */
218extern void info_search (WINDOW *window, int count, unsigned char key);
219extern void isearch_forward (WINDOW *window, int count, unsigned char key);
220extern void isearch_backward (WINDOW *window, int count, unsigned char key);
221extern void info_search_case_sensitively (WINDOW *window, int count,
222    unsigned char key);
223extern void info_search_backward (WINDOW *window, int count, unsigned char key);
224extern void info_search_next (WINDOW *window, int count, unsigned char key);
225extern void info_search_previous (WINDOW *window, int count, unsigned char key);
226
227/* Dumping and printing nodes. */
228extern void info_print_node (WINDOW *window, int count, unsigned char key);
229
230/* Footnotes.  */
231extern void info_show_footnotes (WINDOW *window, int count, unsigned char key);
232
233/* Miscellaneous commands. */
234extern void info_abort_key (WINDOW *window, int count, unsigned char key);
235extern void info_quit (WINDOW *window, int count, unsigned char key);
236extern void info_do_lowercase_version (WINDOW *window, int count,
237    unsigned char key);
238
239#endif /* not SESSION_H */
240