-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPVMAPILib.c
48 lines (48 loc) · 1.15 KB
/
PVMAPILib.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
44
45
46
47
48
#include "PVMAPILib.h"
void basicIO_Buffer(PBase* p)
{
switch(*(((short*)&p->APICallID)+1))
{
case 0 :printf("%ld ",*(long*)p->exAddr);break;//print 8 i
case 1 :printf("%c ",*(char*)p->exAddr);break;//print c c
case 2 :printf("%s",(char*)p->exAddr);break;//print string
case 3 :scanf("%ld",(long*)p->exAddr);break;//scan 8 i
case 4 :scanf("%c",(char*)p->exAddr);break;//scan c c
default:printf("API Error:no such calling identifier in basicIO_Buffer");
}
}
void basicIO_File(PBase* p)
{
static FILE *fp;
switch(*(((short*)&p->APICallID)+1))
{
default:printf("API Error:no such calling identifier in basicIO_File");
}
}
void APIHandler(PBase *p)
{
switch(*(short*)&p->APICallID)
{
case 0:basicIO_Buffer(p);break;
case 1:basicIO_File(p);break;
default:printf("Error:unknown calling ID\n");
}
}
const int apiir_n=2;
APIIR apiir[]={
{0,0,"BUFF_PRINT_I10"},{0,3,"BUFF_SCAN_I10"}
//{1,0}
};
int fetchAPI(char* target)
{
static int *a0;
static int a1;
//find the ID
for(a1=0;a1<apiir_n;a1++)
{
if(strcmp(target,apiir[a1].key)) continue;
a0=(int*)&apiir[a1].apiNumber;
return *a0;
}
return -1;
}