1 /*
2  * hist - definitions for command history module
3  *
4  * Copyright (C) 1999-2007,2014,2021  David I. Bell
5  *
6  * Calc is open software; you can redistribute it and/or modify it under
7  * the terms of the version 2.1 of the GNU Lesser General Public License
8  * as published by the Free Software Foundation.
9  *
10  * Calc is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU Lesser General
13  * Public License for more details.
14  *
15  * A copy of version 2.1 of the GNU Lesser General Public License is
16  * distributed with calc under the filename COPYING-LGPL.  You should have
17  * received a copy with calc; if not, write to Free Software Foundation, Inc.
18  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  *
20  * Under source code control:	1993/05/02 20:09:20
21  * File existed as early as:	1993
22  *
23  * Share and enjoy!  :-)	http://www.isthe.com/chongo/tech/comp/calc/
24  */
25 
26 
27 #if !defined(INCLUDE_HIST_H)
28 #define INCLUDE_HIST_H
29 
30 
31 /*
32  * Default binding file and history size.
33  */
34 #ifndef HIST_BINDING_FILE
35 #define HIST_BINDING_FILE	"/usr/lib/hist.bind"
36 #endif
37 
38 #ifndef HIST_SIZE
39 #define HIST_SIZE		(1024*32)
40 #endif
41 
42 
43 /*
44  * path search defines
45  */
46 #define HOMECHAR	'~'	/* char which indicates home directory */
47 #define DOTCHAR		'.'	/* char which indicates current directory */
48 #define PATHCHAR	'/'	/* char which separates path components */
49 #if defined(_WIN32) || defined(_WIN64)
50 #define LISTCHAR	';'	/* char which separates paths in a list */
51 #else
52 #define LISTCHAR	':'	/* char which separates paths in a list */
53 #endif
54 
55 
56 /*
57  * Possible returns from hist_init.  Note that an error from hist_init does
58  * not prevent calling the other routines, but fancy command line editing
59  * is then disabled.
60  */
61 #define HIST_SUCCESS	0	/* successfully initialized */
62 #define HIST_INITED	1	/* initialization is already done */
63 #define HIST_NOFILE	2	/* bindings file could not be read */
64 #define HIST_NOTTY	3	/* terminal modes could not be set */
65 
66 
67 E_FUNC	int	hist_init(char *filename);
68 E_FUNC	void	hist_term(void);
69 E_FUNC	size_t	hist_getline(char *prompt, char *buf, size_t len);
70 E_FUNC	void	hist_saveline(char *line, int len);
71 
72 
73 #endif /* !INCLUDE_HIST_H */
74