Debian Codegraph @

src/repl.c

raw
1 /*
2 * repl.c - repl
3 *
4 * Copyright (c) 2000-2024 Shiro Kawai <[email protected]>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the authors nor the names of its contributors
18 * may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #define LIBGAUCHE_BODY
35 #include "gauche.h"
36 #include "gauche/priv/configP.h"
37 #include "gauche/vm.h"
38
39 /* This file will be gone in 1.0 release */
40
41 /* This has never been exposed in public header files, but it wasn't 'static'
42 so it was visible. To keep binary-level compatibility, we provide
43 this stub---but nobody should've called this. */
44 ScmObj Scm_VMRepl(ScmObj reader SCM_UNUSED,
45 ScmObj evaluator SCM_UNUSED,
46 ScmObj printer SCM_UNUSED,
47 ScmObj prompter SCM_UNUSED)
48 {
49 Scm_Panic("Scm_VMRepl is obsoleted.");
50 return SCM_UNDEFINED;
51 }
52
53 /* C API - deprecated
54 main.c used to call this to invoke repl, but now it uses
55 Scm_EvalCString. Now we have multiple versions of read-eval-print-loop
56 (the 'bare' one in libeval.scm and the user-friendly one in
57 gauche.interactive), we want to allow the caller to specify which.
58 Furthermore, the caller always use Scm_Eval family to call desired
59 read-eval-print-loop. Hence the point of having this API as is
60 is diminishing.
61 */
62 void Scm_Repl(ScmObj reader, ScmObj evaluator, ScmObj printer,
63 ScmObj prompter)
64 {
65 static ScmObj repl = SCM_UNDEFINED;
66 SCM_BIND_PROC(repl, "read-eval-print-loop", Scm_GaucheModule());
67 Scm_ApplyRec(repl, SCM_LIST4(reader, evaluator, printer, prompter));
68 }