File: slib_repl.cc

package info (click to toggle)
speech-tools 1:2.5.0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,848 kB
  • sloc: cpp: 67,350; ansic: 12,175; sh: 4,047; java: 3,748; makefile: 1,109; lisp: 711; perl: 501; awk: 85; xml: 9
file content (68 lines) | stat: -rw-r--r-- 2,180 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* Scheme In One Defun, but in C this time.
 
 *                    COPYRIGHT (c) 1988-1994 BY                            *
 *        PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS.       *
 *        See the source file SLIB.C for more information.                  *

*/

/*

gjc@paradigm.com or gjc@mitech.com or gjc@world.std.com

Paradigm Associates Inc          Phone: 617-492-6079
29 Putnam Ave, Suite 6
Cambridge, MA 02138

  */

/***************************************************************/
/* This has been modified to act as an interface to siod as an */
/* embedded Lisp module.                                       */
/* Also a (large) number of other functions have been added    */
/*                                                             */
/*    Alan W Black (awb@cstr.ed.ac.uk) 8th April 1996          */
/***************************************************************/

/****************************************************************/
/*                                                              */
/* read-eval print loop functions separated from main functions */
/* so LISP functions may be used without requiring full         */
/* evaluation to be linked (and termcap)                        */
#include <cstdio>
#include "EST_unix.h"
#include <cstdlib>
#include <cstring>
#include "EST_String.h"
#include "EST_cutils.h"
#include "siod.h"
#include "siodp.h"
#include "siodeditline.h"

int siod_repl(int interactive)
{
    int retval;
    LISP histsize;

    repl_prompt = siod_primary_prompt;
    
    /* Set history size (ignored if no command-line editing included) */
    histsize = siod_get_lval("editline_histsize",NULL);
    if (histsize != NIL)
	editline_histsize = get_c_int(histsize);
    editline_history_file = walloc(char,strlen(siod_prog_name)+10);
    sprintf(editline_history_file,".%s_history",siod_prog_name);
    if (siod_get_lval("editline_no_echo",NULL) != NULL)
	el_no_echo = 1;

    siod_interactive = interactive;
    siod_el_init();
    siod_fancy_getc = siod_el_getc;
    siod_fancy_ungetc = siod_el_ungetc;
    retval = repl_driver(1,0,NULL);
    if (interactive)
	cout << endl;

    return retval;
}