Edinburgh Speech Tools 2.4-release
slib_repl.cc
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
11gjc@paradigm.com or gjc@mitech.com or gjc@world.std.com
12
13Paradigm Associates Inc Phone: 617-492-6079
1429 Putnam Ave, Suite 6
15Cambridge, 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
42int siod_repl(int interactive)
43{
44 int retval;
45 LISP histsize;
46
47 repl_prompt = siod_primary_prompt;
48
49 /* Set history size (ignored if no command-line editing included) */
50 histsize = siod_get_lval("editline_histsize",NULL);
51 if (histsize != NIL)
52 editline_histsize = get_c_int(histsize);
53 editline_history_file = walloc(char,strlen(siod_prog_name)+10);
54 sprintf(editline_history_file,".%s_history",siod_prog_name);
55 if (siod_get_lval("editline_no_echo",NULL) != NULL)
56 el_no_echo = 1;
57
58 siod_interactive = interactive;
59 siod_el_init();
60 siod_fancy_getc = siod_el_getc;
61 siod_fancy_ungetc = siod_el_ungetc;
62 retval = repl_driver(1,0,NULL);
63 if (interactive)
64 cout << endl;
65
66 return retval;
67}
68