forked from cotillion/cd-gamedriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.c
43 lines (35 loc) · 879 Bytes
/
interface.c
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
#include <stdio.h>
#include <string.h>
#include "lint.h"
#include "interface.h"
void init_cfuns(void);
extern struct interface efun;
extern struct interface stdobject;
extern struct interface gl_language;
extern struct interface auto_interface;
struct interface *(interface[]) =
{
&efun,
&stdobject,
&gl_language,
(struct interface *)0,
};
void (*
get_C_fun_address(char *prog_name, char *name))(struct svalue *)
{
int i, j;
for(i = 0; interface[i]; i++)
if (strcmp(interface[i]->program, prog_name) == 0)
for(j = 0; interface[i]->funcs[j]; j++)
if (strcmp(interface[i]->funcs[j]->name, name) == 0)
return interface[i]->funcs[j]->address;
return (void (*)(struct svalue *))0;
}
void
init_cfuns()
{
int i,j;
for(i = 0; interface[i]; i++)
for(j = 0; interface[i]->vars[j]; j++)
interface[i]->vars[j]->num = j;
}