forked from chorny/AI-MegaHAL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MegaHAL.xs
142 lines (121 loc) · 1.71 KB
/
MegaHAL.xs
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "megahal.h"
static int
not_here(char *s)
{
croak("%s not implemented on this architecture", s);
return -1;
}
static double
constant(char *name, int arg)
{
errno = 0;
switch (*name) {
case 'A':
break;
case 'B':
break;
case 'C':
break;
case 'D':
break;
case 'E':
break;
case 'F':
break;
case 'G':
break;
case 'H':
break;
case 'I':
break;
case 'J':
break;
case 'K':
break;
case 'L':
break;
case 'M':
if (strEQ(name, "MEGAHAL_H"))
#ifdef MEGAHAL_H
return MEGAHAL_H;
#else
goto not_there;
#endif
break;
case 'N':
break;
case 'O':
break;
case 'P':
break;
case 'Q':
break;
case 'R':
break;
case 'S':
break;
case 'T':
break;
case 'U':
break;
case 'V':
break;
case 'W':
break;
case 'X':
break;
case 'Y':
break;
case 'Z':
break;
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
MODULE = AI::MegaHAL PACKAGE = AI::MegaHAL
PROTOTYPES: DISABLE
double
constant(name,arg)
char * name
int arg
void
megahal_setnoprompt ()
void
megahal_setnowrap ()
void
megahal_setnobanner ()
void
megahal_seterrorfile(filename)
char* filename
void
megahal_setstatusfile(filename)
char* filename
void
megahal_initialize()
char*
megahal_initial_greeting()
int
megahal_command(input)
char* input
char*
megahal_do_reply(input,log)
char* input
int log
void
megahal_learn(input,log)
char* input
int log
void
megahal_output(output)
char* output
char*
megahal_input(prompt)
char* prompt
void
megahal_cleanup()