Edinburgh Speech Tools  2.1-release
slib_repl.cc
Go to the documentation of this file.
1 /* Scheme In One Defun, but in C this time.
2 
3  * COPYRIGHT (c) 1988-1994 BY *
4  * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. *
5  * See the source file SLIB.C for more information. *
6 
7 */
8 
9 /*
10 
11 gjc@paradigm.com or gjc@mitech.com or gjc@world.std.com
12 
13 Paradigm Associates Inc Phone: 617-492-6079
14 29 Putnam Ave, Suite 6
15 Cambridge, MA 02138
16 
17  */
18 
19 /***************************************************************/
20 /* This has been modified to act as an interface to siod as an */
21 /* embedded Lisp module. */
22 /* Also a (large) number of other functions have been added */
23 /* */
24 /* Alan W Black (awb@cstr.ed.ac.uk) 8th April 1996 */
25 /***************************************************************/
26 
27 /****************************************************************/
28 /* */
29 /* read-eval print loop functions separated from main functions */
30 /* so LISP functions may be used without requiring full */
31 /* evaluation to be linked (and termcap) */
32 #include <cstdio>
33 #include "EST_unix.h"
34 #include <cstdlib>
35 #include <cstring>
36 #include "EST_String.h"
37 #include "EST_cutils.h"
38 #include "siod.h"
39 #include "siodp.h"
40 #include "siodeditline.h"
41 
42 using namespace std;
43 
44 int siod_repl(int interactive)
45 {
46  int retval;
47  LISP histsize;
48 
50 
51  /* Set history size (ignored if no command-line editing included) */
52  histsize = siod_get_lval("editline_histsize",NULL);
53  if (histsize != NIL)
54  editline_histsize = get_c_int(histsize);
55  editline_history_file = walloc(char,strlen(siod_prog_name)+10);
56  sprintf(editline_history_file,".%s_history",siod_prog_name);
57  if (siod_get_lval("editline_no_echo",NULL) != NULL)
58  el_no_echo = 1;
59 
60  siod_interactive = interactive;
61  siod_el_init();
64  retval = repl_driver(1,0,NULL);
65  if (interactive)
66  cout << endl;
67 
68  return retval;
69 }
70 
int el_no_echo
Definition: editline.c:146
#define walloc(TYPE, SIZE)
Definition: EST_walloc.h:52
repl_getc_fn siod_fancy_getc
Definition: slib.cc:148
LISP siod_get_lval(const char *name, const char *message)
Definition: siod.cc:94
char * editline_history_file
Definition: editline.c:76
int editline_histsize
Definition: editline.c:75
long int get_c_int(LISP x)
Definition: slib.cc:1850
#define NIL
Definition: siod_defs.h:92
const char * siod_prog_name
Definition: slib.cc:171
int siod_el_getc(FILE *f)
Definition: siodeditline.c:66
const char * siod_primary_prompt
Definition: slib.cc:172
int siod_interactive
Definition: slib.cc:164
const char * repl_prompt
Definition: siod.cc:43
NULL
Definition: EST_WFST.cc:55
int siod_repl(int interactive)
Definition: slib_repl.cc:44
void siod_el_ungetc(int c, FILE *f)
Definition: siodeditline.c:86
void siod_el_init(void)
Definition: siodeditline.c:91
long repl_driver(long want_sigint, long want_init, struct repl_hooks *)
Definition: slib.cc:329
repl_ungetc_fn siod_fancy_ungetc
Definition: slib.cc:149