author | sheepluva |
Sun, 14 Dec 2014 21:54:54 +0100 | |
changeset 10672 | c2004c3e9c7d |
parent 10625 | 125e120165aa |
child 10838 | 2abe883c9c21 |
permissions | -rw-r--r-- |
7983 | 1 |
#include "system.h" |
2 |
#include <string.h> |
|
3 |
#include <stdio.h> |
|
4 |
#include <stdlib.h> |
|
5 |
#include <wchar.h> |
|
6 |
||
8053 | 7 |
#ifndef M_PI |
8 |
// some math.h do not have M_PI macros |
|
9 |
# define M_PI 3.14159265358979323846 /* pi */ |
|
10 |
# define M_PI_2 1.57079632679489661923 /* pi/2 */ |
|
11 |
# define M_PI_4 0.78539816339744830962 /* pi/4 */ |
|
12 |
# define M_PIl 3.1415926535897932384626433832795029L /* pi */ |
|
13 |
# define M_PI_2l 1.5707963267948966192313216916397514L /* pi/2 */ |
|
14 |
# define M_PI_4l 0.7853981633974483096156608458198757L /* pi/4 */ |
|
15 |
#endif |
|
16 |
||
17 |
double pi = M_PI; |
|
18 |
||
7983 | 19 |
int paramCount; |
20 |
string255 params[MAX_PARAMS]; |
|
21 |
||
22 |
string255 fpcrtl_copy(string255 s, Integer index, Integer count) { |
|
23 |
string255 result = STRINIT(""); |
|
24 |
||
25 |
if (count < 1) { |
|
26 |
return result; |
|
27 |
} |
|
28 |
||
29 |
if (index < 1) { |
|
30 |
index = 1; |
|
31 |
} |
|
32 |
||
33 |
if (index > s.len) { |
|
34 |
return result; |
|
35 |
} |
|
36 |
||
37 |
if (index + count > s.len + 1) { |
|
38 |
count = s.len + 1 - index; |
|
39 |
} |
|
40 |
||
41 |
memcpy(result.str, s.str + index - 1, count); |
|
42 |
||
10128 | 43 |
result.len = count; |
44 |
||
45 |
return result; |
|
46 |
} |
|
47 |
||
48 |
astring fpcrtl_copyA(astring s, Integer index, Integer count) { |
|
49 |
astring result; |
|
50 |
||
51 |
result.len = 0; |
|
52 |
||
53 |
if (count < 1) { |
|
54 |
return result; |
|
55 |
} |
|
56 |
||
57 |
if (index < 1) { |
|
58 |
index = 1; |
|
59 |
} |
|
60 |
||
61 |
if (index > s.len) { |
|
62 |
return result; |
|
63 |
} |
|
64 |
||
65 |
if (index + count > s.len + 1) { |
|
66 |
count = s.len + 1 - index; |
|
67 |
} |
|
68 |
||
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
69 |
memcpy(result.s + 1, s.s + index, count); |
10128 | 70 |
|
7983 | 71 |
result.len = count; |
72 |
||
73 |
return result; |
|
74 |
} |
|
75 |
||
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
76 |
void __attribute__((overloadable)) fpcrtl_delete__vars(string255 *s, SizeInt index, SizeInt count) { |
7983 | 77 |
// number of chars to be move |
78 |
int num_move; |
|
79 |
int new_length; |
|
80 |
||
81 |
if (index < 1) { |
|
82 |
// in fpc, if index < 1, the string won't be modified |
|
83 |
return; |
|
84 |
} |
|
85 |
||
86 |
if(index > s->len){ |
|
87 |
return; |
|
88 |
} |
|
89 |
||
90 |
if (count > s->len - index + 1) { |
|
91 |
s->len = index - 1; |
|
92 |
return; |
|
93 |
} |
|
94 |
||
95 |
num_move = s->len - index + 1 - count; |
|
96 |
new_length = s->len - count; |
|
97 |
||
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
98 |
memmove(s->str + index - 1, s->str + index - 1 + count, num_move); |
7983 | 99 |
s->str[new_length] = 0; |
100 |
||
101 |
s->len = new_length; |
|
102 |
||
103 |
} |
|
104 |
||
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
105 |
void __attribute__((overloadable)) fpcrtl_delete__vars(astring *s, SizeInt index, SizeInt count) { |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
106 |
// number of chars to be move |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
107 |
int num_move; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
108 |
int new_length; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
109 |
|
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
110 |
if (index < 1) { |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
111 |
// in fpc, if index < 1, the string won't be modified |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
112 |
return; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
113 |
} |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
114 |
|
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
115 |
if(index > s->len){ |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
116 |
return; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
117 |
} |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
118 |
|
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
119 |
if (count > s->len - index + 1) { |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
120 |
s->len = index - 1; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
121 |
return; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
122 |
} |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
123 |
|
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
124 |
num_move = s->len - index + 1 - count; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
125 |
new_length = s->len - count; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
126 |
|
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
127 |
memmove(s->s + index, s->s + index + count, num_move); |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
128 |
|
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
129 |
s->len = new_length; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
130 |
|
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
131 |
} |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
132 |
|
7983 | 133 |
string255 fpcrtl_floatToStr(double n) { |
134 |
string255 t; |
|
135 |
sprintf(t.str, "%f", n); |
|
136 |
t.len = strlen(t.str); |
|
137 |
||
138 |
return t; |
|
139 |
} |
|
140 |
||
141 |
void fpcrtl_move__vars(void *src, void *dst, SizeInt count) { |
|
142 |
memmove(dst, src, count); |
|
143 |
} |
|
144 |
||
145 |
Integer __attribute__((overloadable)) fpcrtl_pos(Char c, string255 str) { |
|
10134
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
146 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
147 |
unsigned char* p; |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
148 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
149 |
if (str.len == 0) { |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
150 |
return 0; |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
151 |
} |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
152 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
153 |
FIX_STRING(str); |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
154 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
155 |
p = strchr(str.str, c); |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
156 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
157 |
if (p == NULL) { |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
158 |
return 0; |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
159 |
} |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
160 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
161 |
return p - (unsigned char*)&str.s; |
7983 | 162 |
} |
163 |
||
164 |
Integer __attribute__((overloadable)) fpcrtl_pos(string255 substr, string255 str) { |
|
165 |
||
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
166 |
unsigned char* p; |
7983 | 167 |
|
168 |
if (str.len == 0) { |
|
169 |
return 0; |
|
170 |
} |
|
171 |
||
172 |
if (substr.len == 0) { |
|
173 |
return 0; |
|
174 |
} |
|
175 |
||
10128 | 176 |
FIX_STRING(substr); |
177 |
FIX_STRING(str); |
|
7983 | 178 |
|
179 |
p = strstr(str.str, substr.str); |
|
180 |
||
181 |
if (p == NULL) { |
|
182 |
return 0; |
|
183 |
} |
|
184 |
||
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
185 |
return p - (unsigned char*)&str.s; |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
186 |
} |
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
187 |
|
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
188 |
Integer __attribute__((overloadable)) fpcrtl_pos(Char c, astring str) { |
10134
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
189 |
unsigned char* p; |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
190 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
191 |
if (str.len == 0) { |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
192 |
return 0; |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
193 |
} |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
194 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
195 |
p = strchr(str.s + 1, c); |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
196 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
197 |
if (p == NULL) { |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
198 |
return 0; |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
199 |
} |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
200 |
|
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
201 |
return p - (unsigned char*)&str.s; |
81d733899e06
Use strchr instead of strstr with specially constructed string255 struct (not tested)
unc0rr
parents:
10131
diff
changeset
|
202 |
|
7983 | 203 |
} |
204 |
||
10128 | 205 |
Integer __attribute__((overloadable)) fpcrtl_pos(string255 substr, astring str) { |
206 |
||
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
207 |
unsigned char* p; |
10128 | 208 |
|
209 |
if (str.len == 0) { |
|
210 |
return 0; |
|
211 |
} |
|
212 |
||
213 |
if (substr.len == 0) { |
|
214 |
return 0; |
|
215 |
} |
|
216 |
||
217 |
FIX_STRING(substr); |
|
218 |
str.s[str.len] = 0; |
|
219 |
||
220 |
p = strstr(str.s + 1, substr.str); |
|
221 |
||
222 |
if (p == NULL) { |
|
223 |
return 0; |
|
224 |
} |
|
225 |
||
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10128
diff
changeset
|
226 |
return p - (unsigned char *)&str.s; |
10128 | 227 |
} |
228 |
||
7983 | 229 |
Integer fpcrtl_length(string255 s) { |
230 |
return s.len; |
|
231 |
} |
|
232 |
||
10128 | 233 |
Integer fpcrtl_lengthA(astring s) |
234 |
{ |
|
235 |
return s.len; |
|
236 |
} |
|
237 |
||
238 |
||
7983 | 239 |
string255 fpcrtl_lowerCase(string255 s) { |
240 |
int i; |
|
241 |
||
242 |
for (i = 0; i < s.len; i++) { |
|
243 |
if (s.str[i] >= 'A' && s.str[i] <= 'Z') { |
|
244 |
s.str[i] += 'a' - 'A'; |
|
245 |
} |
|
246 |
} |
|
247 |
||
248 |
return s; |
|
249 |
} |
|
250 |
||
251 |
void fpcrtl_fillChar__vars(void *x, SizeInt count, Byte value) { |
|
252 |
memset(x, value, count); |
|
253 |
} |
|
254 |
||
255 |
void fpcrtl_new__vars(void **p, int size) { |
|
256 |
*p = malloc(size); |
|
257 |
} |
|
258 |
||
259 |
Integer fpcrtl_trunc(extended n) { |
|
260 |
return (int) n; |
|
261 |
} |
|
262 |
||
263 |
LongInt str_to_int(char *src) |
|
264 |
{ |
|
265 |
int i; |
|
266 |
int len = strlen(src); |
|
267 |
char *end; |
|
268 |
for(i = 0; i < len; i++) |
|
269 |
{ |
|
270 |
if(src[i] == '$'){ |
|
271 |
// hex |
|
272 |
return strtol(src + i + 1, &end, 16); |
|
273 |
} |
|
274 |
} |
|
275 |
||
276 |
// decimal |
|
277 |
return atoi(src); |
|
278 |
} |
|
8850
ae8a957c69fd
engine to c now compiles with some manual intervention (as of bug 596)
koda
parents:
8053
diff
changeset
|
279 |
|
ae8a957c69fd
engine to c now compiles with some manual intervention (as of bug 596)
koda
parents:
8053
diff
changeset
|
280 |
void __attribute__((overloadable)) fpcrtl_val__vars(string255 s, LongInt *a) |
ae8a957c69fd
engine to c now compiles with some manual intervention (as of bug 596)
koda
parents:
8053
diff
changeset
|
281 |
{ |
7983 | 282 |
FIX_STRING(s); |
283 |
*a = str_to_int(s.str); |
|
284 |
} |
|
285 |
||
8850
ae8a957c69fd
engine to c now compiles with some manual intervention (as of bug 596)
koda
parents:
8053
diff
changeset
|
286 |
void __attribute__((overloadable)) fpcrtl_val__vars(string255 s, Byte *a) |
ae8a957c69fd
engine to c now compiles with some manual intervention (as of bug 596)
koda
parents:
8053
diff
changeset
|
287 |
{ |
7983 | 288 |
FIX_STRING(s); |
289 |
*a = str_to_int(s.str); |
|
290 |
} |
|
291 |
||
8850
ae8a957c69fd
engine to c now compiles with some manual intervention (as of bug 596)
koda
parents:
8053
diff
changeset
|
292 |
void __attribute__((overloadable)) fpcrtl_val__vars(string255 s, LongWord *a) |
ae8a957c69fd
engine to c now compiles with some manual intervention (as of bug 596)
koda
parents:
8053
diff
changeset
|
293 |
{ |
7983 | 294 |
FIX_STRING(s); |
295 |
*a = str_to_int(s.str); |
|
296 |
} |
|
297 |
||
298 |
LongInt fpcrtl_random(LongInt l) { |
|
10625
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10134
diff
changeset
|
299 |
// random(0) is undefined in docs but effectively returns 0 in free pascal |
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10134
diff
changeset
|
300 |
if (l == 0) { |
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10134
diff
changeset
|
301 |
printf("WARNING: random(0) called!"); |
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10134
diff
changeset
|
302 |
return 0; |
125e120165aa
flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents:
10134
diff
changeset
|
303 |
} |
7983 | 304 |
return (LongInt) (rand() / (double) RAND_MAX * l); |
305 |
} |
|
306 |
||
307 |
void __attribute__((overloadable)) fpcrtl_str__vars(float x, string255 *s) { |
|
308 |
sprintf(s->str, "%f", x); |
|
309 |
s->len = strlen(s->str); |
|
310 |
} |
|
311 |
void __attribute__((overloadable)) fpcrtl_str__vars(double x, string255 *s) { |
|
312 |
sprintf(s->str, "%f", x); |
|
313 |
s->len = strlen(s->str); |
|
314 |
} |
|
315 |
void __attribute__((overloadable)) fpcrtl_str__vars(uint8_t x, string255 *s) { |
|
316 |
sprintf(s->str, "%u", x); |
|
317 |
s->len = strlen(s->str); |
|
318 |
} |
|
319 |
void __attribute__((overloadable)) fpcrtl_str__vars(int8_t x, string255 *s) { |
|
320 |
sprintf(s->str, "%d", x); |
|
321 |
s->len = strlen(s->str); |
|
322 |
} |
|
323 |
void __attribute__((overloadable)) fpcrtl_str__vars(uint16_t x, string255 *s) { |
|
324 |
sprintf(s->str, "%u", x); |
|
325 |
s->len = strlen(s->str); |
|
326 |
} |
|
327 |
void __attribute__((overloadable)) fpcrtl_str__vars(int16_t x, string255 *s) { |
|
328 |
sprintf(s->str, "%d", x); |
|
329 |
s->len = strlen(s->str); |
|
330 |
} |
|
331 |
void __attribute__((overloadable)) fpcrtl_str__vars(uint32_t x, string255 *s) { |
|
332 |
sprintf(s->str, "%u", x); |
|
333 |
s->len = strlen(s->str); |
|
334 |
} |
|
335 |
void __attribute__((overloadable)) fpcrtl_str__vars(int32_t x, string255 *s) { |
|
336 |
sprintf(s->str, "%d", x); |
|
337 |
s->len = strlen(s->str); |
|
338 |
} |
|
339 |
void __attribute__((overloadable)) fpcrtl_str__vars(uint64_t x, string255 *s) { |
|
340 |
sprintf(s->str, "%llu", x); |
|
341 |
s->len = strlen(s->str); |
|
342 |
} |
|
343 |
void __attribute__((overloadable)) fpcrtl_str__vars(int64_t x, string255 *s) { |
|
344 |
sprintf(s->str, "%lld", x); |
|
345 |
s->len = strlen(s->str); |
|
346 |
} |
|
347 |
||
348 |
/* |
|
349 |
* XXX No protection currently! |
|
350 |
*/ |
|
351 |
void fpcrtl_interlockedIncrement__vars(int *i) { |
|
352 |
(*i)++; |
|
353 |
} |
|
354 |
||
355 |
void fpcrtl_interlockedDecrement__vars(int *i) { |
|
356 |
(*i)--; |
|
357 |
} |
|
358 |
||
359 |
/* |
|
360 |
* This function should be called when entering main |
|
361 |
*/ |
|
362 |
void fpcrtl_init(int argc, char** argv) { |
|
363 |
int i; |
|
364 |
paramCount = argc; |
|
365 |
||
366 |
printf("ARGC = %d\n", paramCount); |
|
367 |
||
368 |
for (i = 0; i < argc; i++) { |
|
369 |
if (strlen(argv[i]) > 255) { |
|
370 |
assert(0); |
|
371 |
} |
|
372 |
strcpy(params[i].str, argv[i]); |
|
373 |
params[i].len = strlen(params[i].str); |
|
374 |
} |
|
375 |
||
376 |
} |
|
377 |
||
378 |
int fpcrtl_paramCount() { |
|
379 |
return paramCount - 1; // ignore the first one |
|
380 |
} |
|
381 |
||
382 |
string255 fpcrtl_paramStr(int i) { |
|
383 |
return params[i]; |
|
384 |
} |
|
385 |
||
386 |
int fpcrtl_UTF8ToUnicode(PWideChar dest, PChar src, SizeInt maxLen) { |
|
387 |
//return swprintf(dest, maxLen, L"%hs", "src"); //doesn't work in emscripten |
|
388 |
return 0; |
|
389 |
} |
|
390 |
||
391 |
uint32_t __attribute__((overloadable)) fpcrtl_lo(uint64_t i) { |
|
392 |
return (i & 0xFFFFFFFF); |
|
393 |
} |
|
394 |