Rev 1005 | Rev 2870 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1005 | barsuk | 1 | |
2 | #include "parser.h" |
||
3 | #include "kolibri.h" |
||
4 | #include "use_library.h" |
||
5 | |||
6 | |||
7 | const char empty_text[] = "No function loaded. Type file name and press Enter. "; |
||
8 | const char er_file_not_found[] = "Cannot open file. "; |
||
9 | const char str_filename[]="Filename:"; |
||
10 | const char str_editfile[]="Edit"; |
||
11 | |||
12 | |||
13 | #define WND_W 400 |
||
14 | #define WND_H 300 |
||
15 | |||
16 | |||
17 | #define WHITE 0xffffff |
||
18 | #define BLACK 0x0 |
||
19 | #define LIGHTBLUE 0x0000ff |
||
20 | #define LIGHTRED 0xff0000 |
||
21 | |||
22 | |||
23 | #define BIGFONTCOLOR BLACK |
||
24 | #define SMALLFONTCOLOR BLACK |
||
25 | |||
26 | |||
27 | // minimum space: 3 pixels |
||
28 | |||
29 | |||
30 | #define SMALL_HEIGHT 2.0 |
||
31 | #define TEXT_X 15.0 |
||
32 | // numeric format for output |
||
33 | #define FORMAT "%f" |
||
34 | // format for two coords |
||
35 | #define FORMAT_COORD "(%f,%f)" |
||
36 | // special value to text if enough space |
||
37 | #define FORMAT_TEST "0.00" |
||
38 | |||
39 | |||
40 | #define DELTA_SMALL 0.1 |
||
41 | |||
42 | |||
43 | Dword point_count = 0; |
||
44 | double x1,y1,x2,y2; |
||
45 | char *funct = NULL; |
||
46 | |||
47 | |||
48 | //Dword editbox_y = WND_H - 16, editbox_w = WND_W - 70; |
||
49 | edit_box mybox = {0,9*8-5,WND_H - 16-32,0xffffff,0x6a9480,0,0x808080,0,99,(dword)&edit_path,0}; |
||
50 | |||
51 | |||
52 | |||
53 | |||
54 | |||
55 | |||
56 | // параметры командной строки |
||
57 | #ifdef AUTOBUILD |
||
1764 | clevermous | 58 | extern char params[1024]; |
59 | char params[1024]; |
||
60 | #else |
||
61 | char params[1024] = "_FIND_ME_"; |
||
1005 | barsuk | 62 | #endif |
1764 | clevermous | 63 | |
1005 | barsuk | 64 | |
65 | |||
66 | |||
67 | |||
68 | |||
69 | |||
70 | |||
71 | TCoord coord(double x, double y) |
||
72 | { |
||
73 | TCoord r; |
||
74 | r.x = x; |
||
75 | r.y = y; |
||
76 | return r; |
||
77 | } |
||
78 | |||
79 | |||
80 | TCoord mat2Graf(TCoord c, TCoord scrMin, TCoord scrMax, TCoord mMin, TCoord mMax) |
||
81 | { |
||
82 | TCoord r; |
||
83 | if (c.x > mMax.x) |
||
84 | c.x = mMax.x; |
||
85 | if (c.x < mMin.x) |
||
86 | c.x = mMin.x; |
||
87 | if (c.y > mMax.y) |
||
88 | c.y = mMax.y; |
||
89 | if (c.y < mMin.y) |
||
90 | c.y = mMin.y; |
||
91 | r.x = (scrMax.x - scrMin.x) / (mMax.x - mMin.x) * (c.x - mMin.x) + scrMin.x; |
||
92 | r.y = (scrMax.y - scrMin.y) / (mMax.y - mMin.y) * (mMax.y - c.y) + scrMin.y; |
||
93 | |||
94 | |||
95 | } |
||
96 | |||
97 | |||
98 | void line_d( double x1, double y1, double x2, double y2) |
||
99 | { |
||
100 | line(di(x1), di(y1), di(x2), di(y2)); |
||
101 | } |
||
102 | |||
103 | |||
104 | { |
||
105 | outtextxy(di(x), di(y), text, len); |
||
106 | } |
||
107 | |||
108 | |||
109 | void drawAxis( TCoord scrMin, TCoord scrMax, TCoord mMin, TCoord mMax) |
||
110 | { |
||
111 | TCoord cZero={0.0,0.0}, |
||
112 | gMin, gMax, gZero, step; |
||
113 | TCoord from, to; |
||
114 | double i=0.0; |
||
115 | int j; |
||
116 | double xmin, xmin2, ymin, ymin2; |
||
117 | char buf[30]=""; |
||
118 | |||
119 | |||
120 | |||
121 | // m means Mathematical |
||
122 | // g means Graphic(real screen position) |
||
123 | |||
124 | |||
125 | |||
126 | |||
127 | //rtlDebugOutString(debuf); |
||
128 | |||
129 | |||
130 | gMax = mat2Graf(mMax, scrMin, scrMax, mMin, mMax); |
||
131 | gZero = mat2Graf(cZero, scrMin, scrMax, mMin, mMax); |
||
132 | |||
133 | |||
134 | // setcolor(WHITE); |
||
135 | //rectangle(di(gMin.x), di(gMin.y), di(gMax.x), di(gMax.y)); |
||
136 | // ftopku |
||
137 | |||
138 | |||
139 | // osy X |
||
140 | line_d(gMin.x, gZero.y ,gMax.x, gZero.y); |
||
141 | // osy Y |
||
142 | line_d(gZero.x, gMin.y, gZero.x, gMax.y); |
||
143 | // bounding rect |
||
144 | line_d(gMin.x, gMin.y, gMax.x, gMin.y); |
||
145 | line_d(gMin.x, gMax.y, gMax.x, gMax.y); |
||
146 | |||
147 | |||
148 | line_d(gMax.x, gMin.y, gMax.x, gMax.y); |
||
149 | |||
150 | |||
151 | format(buf, 30, FORMAT_COORD, x1, y1); |
||
152 | //rtlDebugOutString(buf); |
||
153 | outtextxy_d(gMin.x, gMin.y + textheight(buf, 20), buf, 20); |
||
154 | // upper left |
||
155 | format(buf, 30, FORMAT_COORD, x1, y2); |
||
156 | outtextxy_d(gMin.x, gMax.y - textheight(buf, 20), buf, 20); |
||
157 | // lower right |
||
158 | format(buf, 30, FORMAT_COORD, x2, y1); |
||
159 | outtextxy_d(gMax.x - textwidth(buf, 20), gMin.y + textheight(buf, 20), buf, 20); |
||
160 | // upper right |
||
161 | format(buf, 30, FORMAT_COORD, x2, y2); |
||
162 | outtextxy_d(gMax.x - textwidth(buf, 20), gMax.y - textheight(buf, 20), buf, 20); |
||
163 | |||
164 | |||
165 | |||
166 | |||
167 | |||
168 | step.y = (mMax.y - mMin.y) / (scrMax.y - scrMin.y); |
||
169 | |||
170 | |||
171 | xmin = id(di((mMin.x / DELTA_BIG) * DELTA_BIG)); |
||
172 | ymin = id(di((mMin.y / DELTA_BIG) * DELTA_BIG)); |
||
173 | |||
174 | |||
175 | |||
176 | |||
177 | { |
||
178 | from.x=0.0; |
||
179 | from.y=0.0; |
||
180 | from = mat2Graf(from, scrMin, scrMax, mMin, mMax); |
||
181 | setcolor(BLACK); |
||
182 | format(buf, 30, FORMAT, 0.0); |
||
183 | outtextxy_d(from.x - textwidth(buf, 20), from.y + textheight(buf, 20), buf, 20); |
||
184 | } |
||
185 | |||
186 | |||
187 | |||
188 | //settextstyle(0, 0, 1); |
||
189 | if (DELTA_BIG / step.x > THREE) |
||
190 | { |
||
191 | for (i = xmin; i <= mMax.x; i += DELTA_BIG) |
||
192 | { |
||
193 | if (i != 0.0) |
||
194 | { |
||
195 | from.x = i; |
||
196 | to.x = from.x; |
||
197 | from.y = -BIG_HEIGHT * step.y; |
||
198 | to.y = BIG_HEIGHT * step.y; |
||
199 | from = mat2Graf(from, scrMin, scrMax, mMin, mMax); |
||
200 | to = mat2Graf(to, scrMin, scrMax, mMin, mMax); |
||
201 | setcolor(BLACK); |
||
202 | line_d(from.x, from.y, to.x, to.y); |
||
203 | // write number |
||
204 | format(buf, 30, FORMAT, i); |
||
205 | // if it fits in the GAP, then write it |
||
206 | if (from.y > scrMin.y && (DELTA_BIG > (textwidth(buf, 20) + 1.0) * step.x)) |
||
207 | { |
||
208 | setcolor(BIGFONTCOLOR); |
||
209 | outtextxy_d(from.x - textwidth(buf, 20) / 2.0, to.y - textheight(buf, 20), buf, 20); |
||
210 | } |
||
211 | } |
||
212 | } |
||
213 | } |
||
214 | //rtlDebugOutString("big marks x painted\n"); |
||
215 | |||
216 | |||
217 | if (DELTA_BIG / step.y > THREE) |
||
218 | { |
||
219 | for (i = ymin; i <= mMax.y; i += DELTA_BIG) |
||
220 | { |
||
221 | if (i != 0.0) |
||
222 | { |
||
223 | from.y = i; |
||
224 | to.y = from.y; |
||
225 | from.x = -BIG_HEIGHT * step.x; |
||
226 | to.x = BIG_HEIGHT * step.x; |
||
227 | from = mat2Graf(from, scrMin, scrMax, mMin, mMax); |
||
228 | to = mat2Graf(to, scrMin, scrMax, mMin, mMax); |
||
229 | setcolor(BLACK); |
||
230 | line_d(from.x, from.y, to.x, to.y); |
||
231 | format(buf, 30, FORMAT, i); |
||
232 | if (from.x > scrMin.x && (DELTA_BIG > textheight(buf, 20) * step.y)) |
||
233 | { |
||
234 | setcolor(BIGFONTCOLOR); |
||
235 | outtextxy_d(from.x + TEXT_X, to.y - textheight(buf, 20) / 2.0, buf, 20); |
||
236 | } |
||
237 | } |
||
238 | } |
||
239 | } |
||
240 | |||
241 | |||
242 | ymin2 = id(di(mMin.y / DELTA_SMALL)) * DELTA_SMALL; |
||
243 | |||
244 | |||
245 | { |
||
246 | j = di((( - xmin + xmin2 ) / DELTA_SMALL)); |
||
247 | for (i = xmin2; i <= mMax.x; i += DELTA_SMALL, j++) |
||
248 | { |
||
249 | if (j % 10 == 0) |
||
250 | { |
||
251 | // we need to skip every tenth mark, to avoid overwriting big marks |
||
252 | j = 0; |
||
253 | continue; |
||
254 | } |
||
255 | from.x = i; |
||
256 | to.x = from.x; |
||
257 | from.y = -SMALL_HEIGHT * step.y; |
||
258 | to.y = SMALL_HEIGHT * step.y; |
||
259 | from = mat2Graf(from, scrMin, scrMax, mMin, mMax); |
||
260 | to = mat2Graf(to, scrMin, scrMax, mMin, mMax); |
||
261 | setcolor(BLACK); |
||
262 | line_d(from.x, from.y, to.x, to.y); |
||
263 | format(buf, 30, FORMAT, i); |
||
264 | |||
265 | |||
266 | { |
||
267 | setcolor(SMALLFONTCOLOR); |
||
268 | outtextxy_d(from.x - textwidth(buf, 20) / 2.0, to.y - textheight(buf, 20), buf, 20); |
||
269 | } |
||
270 | |||
271 | |||
272 | |||
273 | |||
274 | |||
275 | |||
276 | |||
277 | if (DELTA_SMALL / step.y > THREE) |
||
278 | { |
||
279 | //rtlDebugOutString("really small marks y painted\n"); |
||
280 | j = di((( - ymin + ymin2) / DELTA_SMALL)); |
||
281 | for (i = ymin2; i <= mMax.y; i += DELTA_SMALL, j++) |
||
282 | { |
||
283 | if (j % 10 == 0) |
||
284 | { |
||
285 | // we need to skip every tenth, to avoid overwriting |
||
286 | j = 0; |
||
287 | continue; |
||
288 | } |
||
289 | from.y = i; |
||
290 | to.y = from.y; |
||
291 | from.x = -SMALL_HEIGHT * step.x; |
||
292 | to.x = SMALL_HEIGHT * step.x; |
||
293 | from = mat2Graf(from, scrMin, scrMax, mMin, mMax); |
||
294 | to = mat2Graf(to, scrMin, scrMax, mMin, mMax); |
||
295 | setcolor(BLACK); |
||
296 | line_d(from.x, from.y, to.x, to.y); |
||
297 | format(buf, 30, FORMAT, i); |
||
298 | if (from.x > scrMin.x && (DELTA_SMALL > textheight(buf, 20) * step.y)) |
||
299 | { |
||
300 | setcolor(SMALLFONTCOLOR); |
||
301 | outtextxy_d(from.x + TEXT_X, from.y - textheight(buf, 20) / 2.0, buf, 20); |
||
302 | } |
||
303 | } |
||
304 | } |
||
305 | |||
306 | |||
307 | |||
308 | |||
309 | ends fucking piece of shit |
||
310 | */ |
||
311 | |||
312 | |||
313 | TCoord mMin, TCoord mMax, DWORD color) |
||
314 | { |
||
315 | double x; |
||
316 | double y; |
||
317 | int firstPoint = 1; |
||
318 | TCoord p, p0 = {0.0, 0.0}, step; |
||
319 | |||
320 | |||
321 | |||
322 | |||
323 | step.x = (mMax.x - mMin.x) / (scrMax.x - scrMin.x); |
||
324 | |||
325 | |||
326 | { |
||
327 | y = fi(x); |
||
328 | // function is defined here and gets in the range |
||
329 | if (1) // тут было условие, что функция правильно вычислена |
||
330 | { |
||
331 | if ((y > mMin.y) && (y < mMax.y)) |
||
332 | { |
||
333 | p = mat2Graf(coord(x, y), scrMin, scrMax, mMin, mMax); |
||
334 | // if it's our first point, only remember its coords |
||
335 | // otherwise, draw a line_d from prev to current |
||
336 | if (firstPoint == 0) |
||
337 | { |
||
338 | line_d(p0.x, p0.y, p.x, p.y); |
||
339 | } |
||
340 | else |
||
341 | firstPoint = 0; |
||
342 | |||
343 | |||
344 | } |
||
345 | else // too big/small |
||
346 | { |
||
347 | firstPoint = 1; |
||
348 | } |
||
349 | } |
||
350 | else // no value |
||
351 | { |
||
352 | firstPoint = 1; |
||
353 | } |
||
354 | } |
||
355 | |||
356 | |||
357 | |||
358 | |||
359 | { |
||
360 | Dword attrib; |
||
361 | Dword name_type; |
||
362 | Dword create_time; |
||
363 | Dword create_date; |
||
364 | Dword access_time; |
||
365 | Dword access_date; |
||
366 | Dword modify_time; |
||
367 | Dword modify_date; |
||
368 | Dword size_low; |
||
369 | Dword size_high; |
||
370 | }; |
||
371 | |||
372 | |||
373 | int load_points3() |
||
374 | { |
||
375 | kosFileInfo fileInfo; |
||
376 | kosBDVK bdvk; |
||
377 | int filePointer = 0; |
||
378 | |||
379 | |||
380 | int i,j,k; |
||
381 | double d; |
||
382 | Dword filesize, num_number; |
||
383 | |||
384 | |||
385 | |||
386 | |||
387 | return 0; |
||
388 | |||
389 | |||
390 | strcpy(fileInfo.fileURL,edit_path); |
||
391 | fileInfo.OffsetLow = 0; |
||
392 | fileInfo.OffsetHigh = 0; |
||
393 | fileInfo.dataCount = 0; |
||
394 | fileInfo.rwMode = 5; |
||
395 | fileInfo.bufferPtr = (Byte *)&bdvk; |
||
396 | Dword rr = kos_FileSystemAccess( &(fileInfo) ); // в CKosFile нет определения размера |
||
397 | sprintf(debuf, "getsize: %U\n", rr); |
||
398 | rtlDebugOutString(debuf); |
||
399 | if (rr != 0) |
||
400 | { |
||
401 | kos_WriteTextToWindow(10,10,0,0x00,(char*)er_file_not_found,strlen(er_file_not_found)); |
||
402 | return 0; |
||
403 | } |
||
404 | |||
405 | |||
406 | num_number = filesize / 2; |
||
407 | |||
408 | |||
409 | |||
410 | |||
411 | HugeBuf[i] = 0; |
||
412 | |||
413 | |||
414 | fileInfo.OffsetLow = 0; |
||
415 | |||
416 | |||
417 | fileInfo.dataCount = filesize; |
||
418 | fileInfo.rwMode = 0; |
||
419 | fileInfo.bufferPtr = (Byte *)HugeBuf; |
||
420 | rr = kos_FileSystemAccess( &(fileInfo) ); // какая-то проблема с hands.dll, CKosFile не работал |
||
421 | |||
422 | |||
423 | rtlDebugOutString(debuf); |
||
424 | |||
425 | |||
426 | strcpy(full_head+strlen(full_head), " - "); |
||
427 | strcpy(full_head+strlen(full_head), edit_path); // bad code |
||
428 | |||
429 | |||
430 | |||
431 | |||
432 | k=0; |
||
433 | while (i < filesize) |
||
434 | { |
||
435 | |||
436 | |||
437 | if (i == filesize) break; |
||
438 | if (k==4 && HugeBuf[i] == '=') |
||
439 | { |
||
440 | //sprintf(debuf,"function: %S",HugeBuf + i); |
||
441 | //rtlDebugOutString(debuf); |
||
442 | // we have a function here |
||
443 | //HugeBuf[0] = ' '; |
||
444 | funct = HugeBuf + i + 1; |
||
445 | strcpy(full_head+strlen(full_head), ". Function y="); |
||
446 | strcpy(full_head+strlen(full_head), funct); |
||
447 | return 1; |
||
448 | } |
||
449 | |||
450 | |||
451 | if (d == ERROR) |
||
452 | { |
||
453 | sprintf(debuf, "Error in input file, byte %U, count %U\n", i, k); |
||
454 | rtlDebugOutString(debuf); |
||
455 | kos_WriteTextToWindow(10, 10, 0, 0x00, (char*)debuf, strlen(debuf)); |
||
456 | return 0; |
||
457 | } |
||
458 | if (d == ERROR_END) |
||
459 | { |
||
460 | rtlDebugOutString("EOF :)!\n"); |
||
461 | break; |
||
462 | } |
||
463 | |||
464 | |||
465 | switch (k) |
||
466 | { |
||
467 | case 0: |
||
468 | x1=d; |
||
469 | break; |
||
470 | case 1: |
||
471 | x2=d; |
||
472 | break; |
||
473 | case 2: |
||
474 | y1=d; |
||
475 | break; |
||
476 | case 3: |
||
477 | y2=d; |
||
478 | break; |
||
479 | default: |
||
480 | { |
||
481 | if (p2 == NULL) |
||
482 | p2 = (double *)allocmem(num_number * 8); |
||
483 | p2[k-4]=d; |
||
484 | } |
||
485 | } |
||
486 | k++; |
||
487 | } |
||
488 | // format(debuf, 30, "(%f,%f)-(%f,%f)",x1,y1,x2,y2); |
||
489 | // rtlDebugOutString(debuf); |
||
490 | point_count=(k - 4)/2; |
||
491 | |||
492 | |||
493 | points = (double *)allocmem(point_count * 2 * 8); |
||
494 | for (i = 0; i < point_count * 2; i++) |
||
495 | points[i] = p2[i]; |
||
496 | freemem(p2); |
||
497 | // sprintf(debuf, "count: %U\n", point_count); |
||
498 | // rtlDebugOutString(debuf); |
||
499 | sprintf(debuf, ". Number of points: %U.", point_count); |
||
500 | strcpy(full_head+strlen(full_head), debuf); |
||
501 | freemem(HugeBuf); |
||
502 | HugeBuf = NULL; |
||
503 | return 1; |
||
504 | } |
||
505 | |||
506 | |||
507 | { |
||
508 | kosFileInfo fileInfo; |
||
509 | |||
510 | |||
511 | fileInfo.OffsetLow = 0; |
||
512 | fileInfo.OffsetHigh = (Dword)edit_path; |
||
513 | fileInfo.rwMode = 7; // launch |
||
514 | kos_FileSystemAccess(&fileInfo); |
||
515 | |||
516 | |||
517 | |||
518 | |||
519 | double fu(double x) |
||
520 | { |
||
521 | int i; |
||
522 | double res; |
||
523 | |||
524 | |||
525 | |||
526 | { |
||
527 | set_exp(funct,x); |
||
528 | get_exp(&res); // парсить для каждого значения х? да я с ума сошел. |
||
529 | return res; |
||
530 | } |
||
531 | |||
532 | |||
533 | { |
||
534 | return 0.0; |
||
535 | } |
||
536 | |||
537 | |||
538 | return points[1]; |
||
539 | if (x >= points[(point_count-1) * 2]) |
||
540 | return points[(point_count-1) * 2 + 1]; |
||
541 | |||
542 | |||
543 | { |
||
544 | if ((x >= points[2 * i]) && (x < points[2 * (i + 1)])) |
||
545 | break; |
||
546 | } |
||
547 | |||
548 | |||
549 | * (points[2 * (i + 1) + 1] - points[2 * i + 1]) + points[2 * i + 1]; |
||
550 | |||
551 | |||
552 | |||
553 | |||
554 | { |
||
555 | char str[80]; |
||
556 | int i; |
||
557 | double xx0=0.0, yy0=0.0, xx,yy; |
||
558 | sProcessInfo info; |
||
559 | Dword wi, he; |
||
560 | void *p; |
||
561 | |||
562 | |||
563 | info.rawData[i] = 0; |
||
564 | kos_ProcessInfo(&info, 0xFFFFFFFF); |
||
565 | |||
566 | |||
567 | wi = *(Dword *)(p); |
||
568 | he = *(Dword *)((Byte *)p + 4); |
||
569 | |||
570 | |||
571 | wi = WND_W; |
||
572 | if (he == 0) |
||
573 | he = WND_H; |
||
574 | |||
575 | |||
576 | mybox.width = wi - mybox.left - 80; |
||
577 | |||
578 | |||
579 | kos_WindowRedrawStatus(1); |
||
580 | kos_DefineAndDrawWindow(10,40,WND_W,WND_H, |
||
581 | 0x33,0xFFFFFF,0,0,(Dword)full_head); |
||
582 | |||
583 | |||
584 | |||
585 | |||
586 | { |
||
587 | kos_WriteTextToWindow((wi - 6 * strlen(empty_text))/2,he/2,0,0x000000,(char *)empty_text,strlen(empty_text)); |
||
588 | } |
||
589 | else |
||
590 | { |
||
591 | drawFunction(&fu, coord(10, 20), coord(id(wi - 20), id(he - 70)), |
||
592 | coord(x1,y1), coord(x2,y2), 0x00ff0000); |
||
593 | |||
594 | |||
595 | |||
596 | |||
597 | |||
598 | |||
599 | edit_box_draw((DWORD)&mybox); |
||
600 | |||
601 | |||
602 | kos_WriteTextToWindow(wi - 58, mybox.top + 4, 0, 0, (char*)str_editfile, strlen(str_editfile)); |
||
603 | |||
604 | |||
605 | kos_WindowRedrawStatus(2); |
||
606 | } |
||
607 | |||
608 | |||
609 | { |
||
610 | kos_InitHeap(); |
||
611 | full_head = (char*)allocmem(300); |
||
612 | strcpy(full_head, "Graph"); |
||
613 | load_edit_box(); |
||
614 | if (params[0]) // fuck[0] for debug |
||
615 | { |
||
616 | rtlDebugOutString("launched with params"); |
||
617 | rtlDebugOutString((char*)params); |
||
618 | strcpy(edit_path, params); |
||
619 | //rtlDebugOutString((char*)edit_path); |
||
620 | load_points3(); |
||
621 | } |
||
622 | rtlDebugOutString("data loaded.\n"); |
||
623 | draw_window(); |
||
624 | for (;;) |
||
625 | { |
||
626 | edit_box_mouse((dword)&mybox); |
||
627 | switch (kos_WaitForEvent()) |
||
628 | { |
||
629 | case 1: |
||
630 | draw_window(); |
||
631 | break; |
||
632 | case 2: |
||
633 | // key pressed, read it |
||
634 | Byte keyCode; |
||
635 | kos_GetKey(keyCode); |
||
636 | |||
637 | |||
638 | { |
||
639 | case 0x0D: |
||
640 | if (HugeBuf!=NULL) |
||
641 | { |
||
642 | //sprintf(debuf, "freemem: HugeBuf = %X", HugeBuf); |
||
643 | //rtlDebugOutString(debuf); |
||
644 | freemem((void*)HugeBuf); // что за баг - понять не могу. |
||
645 | HugeBuf = NULL; |
||
646 | funct = NULL; |
||
647 | } |
||
648 | if (points!=NULL) |
||
649 | { |
||
650 | //sprintf(debuf, "freemem: points = %X", points); |
||
651 | //rtlDebugOutString(debuf); |
||
652 | freemem((void*)points); // и тут. ну не обращаюсь я к этому указателю, только память в него |
||
653 | // потом снова выделяю |
||
654 | points = NULL; |
||
655 | } |
||
656 | point_count = 0; |
||
657 | kos_DrawBar(10,10,200,20,0xFFFFFF); // фон для сообщений об ошибках |
||
658 | if (load_points3()) |
||
659 | draw_window(); |
||
660 | break; |
||
661 | default: |
||
662 | { |
||
663 | __asm |
||
664 | { |
||
665 | mov ah, keyCode |
||
666 | } |
||
667 | edit_box_key((dword)&mybox); |
||
668 | } |
||
669 | } |
||
670 | break; |
||
671 | |||
672 | |||
673 | |||
674 | // button pressed; we have only one button, close |
||
675 | Dword button; |
||
676 | kos_GetButtonID(button); |
||
677 | if (button == 1) |
||
678 | kos_ExitApp(); |
||
679 | else if (button == 5) |
||
680 | { |
||
681 | LaunchTinypad(); |
||
682 | } |
||
683 | } |
||
684 | } |
||
685 | }>>>=>>> |
||
686 | >>>=>=>=>=>=>=>>> |
||
687 |