Rev 7564 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7564 | Rev 7565 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | dword std_print(dword count, args) |
- | |
2 | { |
- | |
3 | consoleInit(); |
- | |
4 | count = 1; |
1 | /* Lisp functions */ |
5 | WHILE(count) |
- | |
6 | { |
- | |
7 | con_printf stdcall (DSDWORD[args]); |
- | |
8 | args+=4; |
- | |
9 | count--; |
- | |
10 | } |
- | |
11 | } |
- | |
12 | - | ||
13 | :dword std_set(dword count, args) |
- | |
14 | { |
2 | :dword std_set(dword count, args) |
15 | dword name = 0; |
3 | { |
16 | dword value = 0; |
4 | dword name = 0; |
17 | WHILE(count>0) |
5 | dword value = 0; |
18 | { |
6 | WHILE(count > 0) |
Line 27... | Line 15... | ||
27 | 15 | } |
|
28 | :dword std_get(dword count, args) |
16 | |
Line 29... | Line 17... | ||
29 | { |
17 | :dword std_get(dword count, args) |
30 | RETURN variables.get(DSDWORD[args]); |
18 | { |
- | 19 | IF(!count) RETURN 0; |
|
31 | } |
20 | RETURN variables.get(DSDWORD[args]); |
32 | 21 | } |
|
Line 33... | Line 22... | ||
33 | :dword std_str(dword count, args) |
22 | |
34 | { |
23 | :dword std_str(dword count, args) |
35 | dword tmp = 0; |
24 | { |
- | 25 | dword tmp = 0; |
|
36 | tmp = malloc(15); |
26 | IF(!count) RETURN ""; |
37 | itoa_(tmp,DSDWORD[args]); |
27 | tmp = malloc(15); |
38 | RETURN tmp; |
28 | itoa_(tmp,DSDWORD[args]); |
39 | } |
29 | RETURN tmp; |
Line -... | Line 30... | ||
- | 30 | } |
|
40 | 31 | ||
41 | :dword std_add(dword count, args) |
32 | /* Math functions */ |
42 | { |
33 | :dword std_add(dword count, args) |
43 | dword ret = 0; |
34 | { |
44 | WHILE(count) |
35 | dword ret = 0; |
Line 68... | Line 59... | ||
68 | RETURN ret; |
59 | } |
69 | } |
60 | RETURN ret; |
70 | 61 | } |
|
71 | void Init() |
62 | |
Line -... | Line 63... | ||
- | 63 | /* Console functions */ |
|
- | 64 | :dword std_print(dword count, args) |
|
- | 65 | { |
|
- | 66 | dword ret = 0; |
|
- | 67 | WHILE(count) |
|
- | 68 | { |
|
- | 69 | con_printf stdcall (DSDWORD[args]); |
|
- | 70 | args+=4; |
|
- | 71 | count--; |
|
- | 72 | } |
|
- | 73 | RETURN ret; |
|
- | 74 | } |
|
- | 75 | ||
- | 76 | :dword std_input(dword count, args) |
|
- | 77 | { |
|
- | 78 | dword buf = 0; |
|
- | 79 | buf = malloc(100); |
|
- | 80 | WHILE(count) |
|
- | 81 | { |
|
- | 82 | con_printf stdcall (DSDWORD[args]); |
|
- | 83 | args+=4; |
|
- | 84 | count--; |
|
- | 85 | } |
|
- | 86 | con_gets stdcall(buf, 100); |
|
- | 87 | RETURN EAX; |
|
- | 88 | } |
|
- | 89 | ||
72 | { |
90 | void Init() |
73 | functions.init(100); |
91 | { |
74 | 92 | functions.init(100); |
|
Line 75... | Line 93... | ||
75 | /* Console functions */ |
93 | |
76 | - | ||
- | 94 | /* Console functions */ |
|
- | 95 | functions.set("print", #std_print); |
|
Line 77... | Line 96... | ||
77 | 96 | functions.set("input", #std_input); |
|
78 | /* String functions */ |
97 | |
Line 79... | Line 98... | ||
79 | functions.set("str", #std_str); |
98 | /* String functions */ |
Line 94... | Line 113... | ||
94 | 113 | } |
|
95 | dword StdCall(dword count, name, args) |
114 | |
Line 96... | Line 115... | ||
96 | { |
115 | dword StdCall(dword count, name, args) |
97 | dword tmp = 0; |
116 | { |
98 | - | ||
99 | functions.get(name); |
- | |
100 | IF(EAX) RETURN EAX(count, args); |
117 | functions.get(name); |
101 | IF(!strcmp(name, "print")) |
118 | IF(EAX) RETURN EAX(count, args); |
102 | { |
- | |
103 | consoleInit(); |
- | |
104 | count = 1; |
- | |
105 | WHILE(count) |
- | |
106 | { |
- | |
107 | con_printf stdcall (DSDWORD[args]); |
- | |
108 | args += 4; |
- | |
109 | count--; |
- | |
110 | } |
- | |
111 | } |
- | |
112 | RETURN 0; |
- | |
113 | } |
119 | RETURN 0; |
114 | 120 | } |