1 /* session.h -- Functions found in session.c.
2
3 Copyright 1993-2023 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU 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, see <http://www.gnu.org/licenses/>.
17
18 Originally written by Brian Fox. */
19
20 #ifndef SESSION_H
21 #define SESSION_H
22
23 #include "info.h"
24 #include "window.h"
25 #include "dribble.h"
26
27 /* Variable controlling the garbage collection of files briefly visited
28 during searches. Such files are normally gc'ed, unless they were
29 compressed to begin with. If this variable is non-zero, it says
30 to gc even those file buffer contents which had to be uncompressed. */
31 extern int gc_compressed_files;
32
33 /* When non-zero, tiling takes place automatically when info_split_window
34 is called. */
35 extern int auto_tiling_p;
36
37 /* Variable controlling the behaviour of default scrolling when you are
38 already at the bottom of a node. */
39 extern int info_scroll_behaviour;
40
41 /* Values for info_scroll_behaviour. */
42 #define IS_Continuous 0 /* Try to get first menu item, or failing that, the
43 "Next:" pointer, or failing that, the "Up:" and
44 "Next:" of the up. */
45 #define IS_NextOnly 1 /* Try to get "Next:" menu item. */
46 #define IS_PageOnly 2 /* Simply give up at the bottom of a node. */
47
48 extern int cursor_movement_scrolls_p;
49
50 /* Controls what to do when a scrolling command is issued at the end of the
51 last node. */
52 extern int scroll_last_node;
53
54 /* Values for scroll_last_node */
55 #define SLN_Stop 0 /* Stop at the last node */
56 #define SLN_Top 1 /* Go to the top node */
57
58 int get_input_key (void);
59 int get_another_input_key (void);
60
61 VFunction *read_key_sequence (Keymap map, int menu, int mouse,
62 int insert, int *count);
63 unsigned char info_input_pending_p (void);
64 void info_set_node_of_window (WINDOW *window, NODE *node);
65 void info_set_node_of_window_fast (WINDOW *window, NODE *node);
66 void initialize_keyseq (void);
67 void add_char_to_keyseq (int character);
68 FILE_BUFFER *file_buffer_of_window (WINDOW *window);
69 int info_select_reference (WINDOW *window, REFERENCE *entry);
70 int info_any_buffered_input_p (void);
71 void pause_or_input (void);
72
73 void dump_nodes_to_file (REFERENCE **references,
74 char *output_filename, int flags);
75 int write_node_to_stream (NODE *node, FILE *stream);
76
77 char *program_name_from_file_name (char *file_name);
78
79 /* Do the physical deletion of WINDOW, and forget this window and
80 associated nodes. */
81 void info_delete_window_internal (WINDOW *window);
82
83 void forget_window_and_nodes (WINDOW *window);
84 void forget_node (WINDOW *win);
85 int forget_node_fast (WINDOW *win);
86
87 /* Tell Info that input is coming from the file FILENAME. */
88 void info_set_input_from_file (char *filename);
89
90 /* Error and debugging messages */
91 extern unsigned debug_level;
92
93 #define debug(n,c) \
94 do \
95 { \
96 if (debug_level >= (n)) \
97 info_debug c; \
98 } \
99 while (0)
100
101 void info_debug (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);
102
103 /* Print args as per FORMAT. If the window system was initialized,
104 then the message is printed in the echo area. Otherwise, a message is
105 output to stderr. */
106 void info_error (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);
107
108 void initialize_info_session (void);
109 void info_read_and_dispatch (void);
110 void close_info_session (void);
111 void info_session (REFERENCE **ref_list, char *user_filename, char *error);
112 void initialize_terminal_and_keymaps (char *init_file);
113 REFERENCE *info_intuit_options_node (NODE *initial_node, char *program);
114
115 void info_scroll_forward (WINDOW *window, int count);
116 void info_abort_key (WINDOW *window, int count);
117
118 NODE *info_follow_menus (NODE *initial_node, char **menus,
119 char **error_msg, int strict);
120
121 /* Adding numeric arguments. */
122 extern int info_explicit_arg;
123 extern int ea_explicit_arg;
124 void info_initialize_numeric_arg (void);
125
126 /* Found in m-x.c. */
127 char *read_function_name (char *prompt, WINDOW *window);
128
129 void show_error_node (char *error_msg);
130
131 #endif /* not SESSION_H */