blob: 89a008895b9747cca7dd72d52acccd5a2f360e2a [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// LISP.C -- Lisp2Closure compiler
2// (c) 1994 by Hate@MorgenGrauen, TUBmud, NightFall
3// --
4// Copy, change and distribute this bit of software as much as you like,
5// but keep the name of the original author in the header.
6
7#pragma strong_types
8
9#include "tweak.h"
10
11private inherit HOME("parser");
12
13static varargs mixed lisp(string input, int interactive, int in)
14{
15 string msg, error;
16 add_input(input); // put lines on stack
17 switch(parse(&msg, interactive))
18 {
19 case 0: return msg; // ok
20 case -1: clear_input(); return 0; // empty list
21 case -2: initialize(); // exec error
22 clear_input();
23 return (in ? (printf(msg), 0): (interactive ? msg : -1));
24 case -3: if(interactive) // missing )
25 {
26 printf("%s? ", msg);
27 input_to("lisp", 0, 1, 1);
28 return -1;
29 }
30 else return (in ? (printf(msg), 0): (interactive ? msg : -1));
31 default: if(!msg) msg ="*Unknown error occured\n"; // unknown error
32 clear_input();
33 return (in ? (printf(msg), 0):
34 (interactive ? msg : -1));
35 }
36 return 0;
37}
38
39static void create()
40{
41 parser::create();
42 lisp(read_file(__FILE__[0..<3]+".l"));
43}
44
45static void init(int arg) { }
46