2 |
- |
1 |
/* Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
|
|
|
3 |
This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
implied.
|
|
|
5 |
|
|
|
6 |
This software is distributed under license and may not be copied,
|
|
|
7 |
modified or distributed except as expressly authorized under the terms
|
|
|
8 |
of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
|
|
|
10 |
For more information about licensing, please refer to
|
|
|
11 |
http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/* $Id: srdline.h,v 1.5 2002/06/16 05:00:54 lpd Exp $ */
|
|
|
18 |
/* Interface for readline */
|
|
|
19 |
/* Requires gsmemory.h, gstypes.h */
|
|
|
20 |
|
|
|
21 |
#ifndef srdline_INCLUDED
|
|
|
22 |
# define srdline_INCLUDED
|
|
|
23 |
|
|
|
24 |
/*
|
|
|
25 |
* Read a line from s_in, starting at index *pcount in buf. Start by
|
|
|
26 |
* printing prompt on s_out. If the string is longer than size - 1 (we need
|
|
|
27 |
* 1 extra byte at the end for a null or an EOL), use bufmem to reallocate
|
|
|
28 |
* buf; if bufmem is NULL, just return 1. In any case, store in *pcount the
|
|
|
29 |
* first unused index in buf. *pin_eol is normally false; it should be set
|
|
|
30 |
* to true (and true should be recognized) to indicate that the last
|
|
|
31 |
* character read was a ^M, which should cause a following ^J to be
|
|
|
32 |
* discarded. is_stdin(s) returns true iff s is stdin: this is needed for
|
|
|
33 |
* an obscure condition in the default implementation.
|
|
|
34 |
*/
|
|
|
35 |
#ifndef stream_DEFINED
|
|
|
36 |
# define stream_DEFINED
|
|
|
37 |
typedef struct stream_s stream;
|
|
|
38 |
#endif
|
|
|
39 |
#define sreadline_proc(proc)\
|
|
|
40 |
int proc(stream *s_in, stream *s_out, void *readline_data,\
|
|
|
41 |
gs_const_string *prompt, gs_string *buf,\
|
|
|
42 |
gs_memory_t *bufmem, uint *pcount, bool *pin_eol,\
|
|
|
43 |
bool (*is_stdin)(const stream *))
|
|
|
44 |
|
|
|
45 |
/* Declare the default implementation. */
|
|
|
46 |
extern sreadline_proc(sreadline);
|
|
|
47 |
|
|
|
48 |
#endif /* srdline_INCLUDED */
|