Subversion Repositories Kolibri OS

Rev

Rev 7562 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7562 Rev 7563
Line 1... Line 1...
1
dword StdCall(dword count, name, args)
1
:dword std_print(dword count, args)
2
{
-
 
3
	dword tmp = 0;
-
 
4
	if(!strcmp(name, "print"))
-
 
5
	{
2
{
6
		consoleInit();
3
	consoleInit();
-
 
4
	WHILE(count)
-
 
5
	{
7
		con_printf stdcall (DSDWORD[args]);
6
		con_printf stdcall (DSDWORD[args]);
-
 
7
		args+=4;
-
 
8
		count--;
8
	}
9
	}
9
	else if(!strcmp(name, "input"))
-
 
10
	{
-
 
11
		
-
 
12
	}
10
}
-
 
11
 
13
	else if(!strcmp(name, "str"))
12
:dword std_str(dword count, args)
14
	{
13
{
-
 
14
	dword tmp = 0;
15
		tmp = malloc(15);
15
	tmp = malloc(15);
16
		itoa_(tmp,DSDWORD[args]);
16
	itoa_(tmp,DSDWORD[args]);
17
		return tmp;
17
	RETURN tmp;
-
 
18
}
-
 
19
 
-
 
20
:dword std_add(dword count, args)
-
 
21
{
-
 
22
	dword ret = 0;
-
 
23
	WHILE(count)
-
 
24
	{
-
 
25
		ret += DSDWORD[args];
-
 
26
		args+=4;
-
 
27
		count--;
-
 
28
	}
-
 
29
	RETURN ret;
-
 
30
}
-
 
31
 
-
 
32
:dword std_sub(dword count, args)
-
 
33
{
-
 
34
	dword ret = 0;
-
 
35
	IF(count)
-
 
36
	{ 
-
 
37
		ret = DSDWORD[args];
-
 
38
		count--;
-
 
39
		args+=4;
18
	}
40
	}
19
	else if(!strcmp(name, "exit"))
41
	WHILE(count)
20
	{
42
	{
-
 
43
		ret -= DSDWORD[args];
21
		ExitProcess();
44
		args+=4;
-
 
45
		count--;
22
	}
46
	}
-
 
47
	RETURN ret;
-
 
48
}
-
 
49
 
-
 
50
void Init()
-
 
51
{
-
 
52
	functions.init(100);
-
 
53
	
-
 
54
	/* Console functions */
-
 
55
	functions.set("print", #std_print);
-
 
56
	
-
 
57
	/* String functions */
-
 
58
	functions.set("str", #std_str);
-
 
59
	
-
 
60
	/* System functions */
-
 
61
	functions.set("exit", #ExitProcess);
-
 
62
	
-
 
63
	/* Math functions */
-
 
64
	functions.set("+", #std_add);
-
 
65
	functions.set("-", #std_sub);
-
 
66
	
-
 
67
	variables.init(100);
-
 
68
}
-
 
69
 
-
 
70
dword StdCall(dword count, name, args)
-
 
71
{
-
 
72
	dword tmp = 0;
-
 
73
	functions.get(name);
-
 
74
	IF(EAX)RETURN EAX(count, args);
23
	return 0;
75
	RETURN 0;
24
}
76
}
25
77