Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/CellV.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download) (as text)
Mon Feb 23 07:50:11 2015 UTC (9 years, 1 month ago) by yamat0jp
File MIME type: text/x-pascal
File size: 22617 byte(s)


1 unit CellV;
2
3 interface
4
5 uses CellG, SysUtils;
6
7 const
8 ict = 1;
9 ics = 2;
10 lit = 3;
11 lis = 4;
12 lod = 5;
13 los = 6;
14 lda = 7;
15 las = 8;
16 sto = 9;
17 sts = 10;
18 cal = 11;
19 ret = 12;
20 dit = 13;
21 dik = 14;
22 jmp = 15;
23 jpc = 16;
24 arr = 17;
25 adv = 18;
26 opr = 19;
27
28 neg = 20;
29 _add = 21;
30 ads = 22;
31 _sub = 23;
32 sus = 24;
33 _mul = 25;
34 mus = 26;
35 _div = 27;
36 dis = 28;
37
38 eql = 29;
39 eqs = 30;
40 neq = 31;
41 nes = 32;
42 lss = 33;
43 gtr = 34;
44 leq = 35;
45 geq = 36;
46 lid = 37;
47 lds = 38;
48 sid = 39;
49 sls = 40;
50 sds = 41;
51 sld = 42;
52 ini = 43;
53 ins = 44;
54 _inc = 45;
55 _dec = 46;
56 lin = 47;
57 lde = 48;
58 prt = 49;
59 prs = 50;
60 prl = 51;
61 stp = 52;
62
63 MAXCODE = 200;
64 MAXMEM = 2000;
65 MAXREG = 500;
66 MAXMOJI = 100;
67
68 type
69 TInst = class
70 private
71 opCode: integer;
72 public
73 constructor Create(const op: integer);
74 function toString: string; virtual;
75 end;
76
77 TInstAddr = class(TInst)
78 private
79 addr: TRaddr;
80 public
81 constructor Create(const op: integer; a: TRaddr);
82 function toString: string; override;
83 end;
84
85 TInstRet = class(TInst)
86 private
87 level, pI, pS, modori: integer;
88 public
89 constructor Create(const op, l, pi, ps, m: integer);
90 function toString: string; override;
91 end;
92
93 TInstCal = class(TInst)
94 private
95 level: integer;
96 code: integer;
97 public
98 constructor Create(op, l, c: integer);
99 function toString: string; override;
100 end;
101
102 TInstVal = class(TInst)
103 private
104 value: integer;
105 public
106 constructor Create(const op, v: integer);
107 function toString: string; override;
108 end;
109
110 TStrVal = class(TInst)
111 private
112 value: string;
113 public
114 constructor Create(op: integer; v: string);
115 function toString: string; override;
116 end;
117
118 TInstPC = class(TInst)
119 private
120 value: integer;
121 public
122 constructor Create(op, v: integer);
123 function toString: string; override;
124 end;
125
126 TInstOp = class(TInst)
127 private
128 optr: integer;
129 public
130 constructor Create(const op, o: integer);
131 function toString: string; override;
132 end;
133
134 TCellV = class
135 private
136 _cellG: TCellG;
137 code: array [0..MAXCODE] of TInst;
138 cIndex: integer;
139 display, sdisplay: array [0..CellG.MaxLevel] of integer;
140 public
141 _cellK: TObject;
142 pCode, pTrace: Boolean;
143 stack: array [0..MAXMEM] of integer;
144 sstack: array [0..MAXMOJI] of string;
145 top: integer;
146 tos: integer;
147 pc: integer;
148 o1, o2: integer;
149 constructor Create(g: TCellG; c, t: Boolean);
150 destructor Destroy; override;
151 function genCodeT(const op, t: integer): integer;
152 function genCodeA(const op: integer; a: TRaddr): integer;
153 function genCodeV(const op, v: integer): integer;
154 function genCodeP(op,v: integer): integer;
155 function genCodeS(op: integer; v: string): integer;
156 function genCodeO(const p: integer): integer;
157 function genCodeC(l, c: integer): integer;
158 function genCodeR: integer;
159 function genCodeRV: integer;
160 procedure checkMax;
161 procedure backPatch(i, j: integer);
162 procedure backPatchJ(const i: integer);
163 procedure backPatchL(i, j, a: integer);
164 procedure backBreak(const c: integer);
165 procedure backCal(i, l, c: integer);
166 procedure changeS(i, a: integer);
167 function nextCode: integer;
168 procedure printCode;
169 procedure printExe;
170 procedure error;
171 procedure shokika;
172 function execute: integer;
173 end;
174
175 implementation
176
177 function codeName(const c: integer): string;
178 begin
179 case c of
180 ict:
181 result:='ict';
182 ics:
183 result:='ics';
184 lit:
185 result:='lit';
186 lis:
187 result:='lis';
188 lod:
189 result:='lod';
190 los:
191 result:='los';
192 cal:
193 result:='cal';
194 ret:
195 result:='ret';
196 dit:
197 result:='dit';
198 dik:
199 result:='dik';
200 jmp:
201 result:='jmp';
202 jpc:
203 result:='jpc';
204 arr:
205 result:='arr';
206 adv:
207 result:='adv';
208 sto:
209 result:='sto';
210 opr:
211 result:='opr';
212 neg:
213 result:='neg';
214 _add:
215 result:='add';
216 _sub:
217 result:='sub';
218 _mul:
219 result:='mul';
220 _div:
221 result:='div';
222 eql:
223 result:='eql';
224 eqs:
225 result:='eqs';
226 neq:
227 result:='neq';
228 nes:
229 result:='nes';
230 lss:
231 result:='lss';
232 gtr:
233 result:='gtr';
234 leq:
235 result:='leq';
236 geq:
237 result:='geq';
238 prt:
239 result:='prt';
240 prs:
241 result:='prs';
242 prl:
243 result:='prl';
244 sid:
245 result:='sid';
246 sld:
247 result:='sld';
248 sls:
249 result:='sls';
250 lid:
251 result:='lid';
252 lda:
253 result:='lda';
254 las:
255 result:='las';
256 ini:
257 result:='ini';
258 _inc:
259 result:='inc';
260 _dec:
261 result:='dec';
262 lin:
263 result:='lin';
264 lde:
265 result:='lde';
266 ads:
267 result:='ads';
268 sus:
269 result:='sus';
270 stp:
271 result:='stp';
272 lds:
273 result:='lds';
274 sds:
275 result:='sds';
276 else
277 result:=inttostr(c);
278 end;
279 end;
280
281 { TInst }
282
283 constructor TInst.Create(const op: integer);
284 begin
285 inherited Create;
286 opCode:=op;
287 end;
288
289 function TInst.toString: string;
290 begin
291 result:=codeName(opCode);
292 end;
293
294 { TCellV }
295
296 procedure TCellV.backBreak(const c: integer);
297 var
298 bc, t: integer;
299 begin
300 bc:=c;
301 while bc <> 0 do
302 begin
303 t:=(code[bc] as TInstPC).value;
304 (code[bc] as TInstPC).value:=cIndex+1;
305 bc:=t;
306 end;
307 end;
308
309 procedure TCellV.backPatch(i, j: integer);
310 begin
311 (code[i] as TInstPC).value:=_cellG.numAddr;
312 (code[j] as TInstPC).value:=_cellG.snumAddr;
313 end;
314
315 procedure TCellV.backPatchJ(const i: integer);
316 begin
317 (code[i] as TInstPC).value:=cIndex+1;
318 end;
319
320 procedure TCellV.backPatchL(i, j, a: integer);
321 begin
322 if a = 0 then
323 begin
324 code[i].opCode:=lda;
325 end else
326 begin
327 code[i].opCode:=las;
328 end;
329 (code[i] as TInstAddr).addr:=_cellG.tAddr(j);
330 end;
331
332 procedure TCellV.changeS(i, a: integer);
333 begin
334 with code[i] as TInstOp do
335 begin
336 if a = 0 then
337 begin
338 if optr = sds then
339 begin
340 optr:=sid;
341 end else
342 begin
343 optr:=sld;
344 end;
345 end else
346 begin
347 if optr = sid then
348 begin
349 optr:=sds;
350 end else
351 begin
352 optr:=sls;
353 end;
354 end;
355 end;
356 end;
357
358 procedure TCellV.checkMax;
359 begin
360 if cIndex > MAXCODE then
361 begin
362 _cellG.error('�R�[�h�I�[�o�[�����B');
363 end else
364 begin
365 inc(cIndex);
366 end;
367 end;
368
369 constructor TCellV.Create(g: TCellG; c, t: Boolean);
370 begin
371 inherited Create;
372 _cellG:=g;
373 pCode:=c;
374 pTrace:=t;
375 cIndex:=-1;
376 shokika;
377 end;
378
379 destructor TCellV.Destroy;
380 begin
381 shokika;
382 inherited;
383 end;
384
385 procedure TCellV.error;
386 begin
387 code[pc]:=TInstOp.Create(opr,stp);
388 end;
389
390 function TCellV.execute: integer;
391 var
392 lev, m, m1, temp: integer;
393 s1, s2, tems: string;
394 t: TInst;
395 p: string;
396 begin
397 genCodeO(stp);
398 if _cellG.exe = 0 then
399 begin
400 display[0]:=0;
401 sdisplay[0]:=0;
402 end;
403 inc(_cellG.exe);
404 if pCode = true then
405 begin
406 printCode;
407 Writeln;
408 end;
409 if pTrace = true then
410 begin
411 Writeln('--- strat execution ---');
412 end;
413 temp:=0;
414 tems:='';
415 o1:=0;
416 o2:=0;
417 repeat
418 if pTrace = true then
419 begin
420 printExe;
421 end;
422 t:=code[pc];
423 o1:=t.opCode;
424 case o1 of
425 ict:
426 begin
427 inc(top,(t as TInstPC).value);
428 if top >= MAXMEM-MAXREG then
429 begin
430 Writeln('�I�[�o�[�t���[�����B');
431 error;
432 end;
433 end;
434 lit:
435 begin
436 stack[top]:=(t as TInstVal).value;
437 inc(top);
438 end;
439 lod:
440 begin
441 stack[top]:=stack[display[(t as TInstAddr).addr.level]+(t as TInstAddr).addr.addr];
442 inc(top);
443 end;
444 los:
445 begin
446 sstack[tos]:=sstack[sdisplay[(t as TInstAddr).addr.level]+(t as TInstAddr).addr.addr];
447 inc(tos);
448 end;
449 ics:
450 begin
451 inc(tos,(t as TInstPC).value);
452 if tos >= MAXMEM-MAXMOJI then
453 begin
454 Writeln('�I�[�o�[�t���[�����B');
455 error;
456 end;
457 end;
458 lis:
459 begin
460 sstack[tos]:=(t as TStrVal).value;
461 inc(tos);
462 end;
463 lda:
464 begin
465 stack[top]:=display[(t as TInstAddr).addr.level]+(t as TInstAddr).addr.addr;
466 inc(top);
467 end;
468 las:
469 begin
470 stack[top]:=sdisplay[(t as TInstAddr).addr.level]+(t as TInstAddr).addr.addr;
471 inc(top);
472 end;
473 sto:
474 begin
475 dec(top);
476 stack[display[TInstAddr(t).addr.level]+TInstAddr(t).addr.addr]:=stack[top];
477 end;
478 sts:
479 begin
480 dec(tos);
481 sstack[sdisplay[(t as TInstAddr).addr.level]+(t as TInstAddr).addr.addr]:=sstack[tos];
482 end;
483 cal:
484 begin
485 lev:=(t as TInstCal).level+1;
486 stack[top]:=display[lev];
487 stack[top+1]:=sdisplay[lev];
488 stack[top+2]:=pc+1;
489 display[lev]:=top;
490 sdisplay[lev]:=tos;
491 pc:=(t as TInstCal).code;
492 continue;
493 end;
494 ret:
495 begin
496 m:=(t as TInstRet).modori;
497 if m = CellG._I then
498 begin
499 temp:=stack[top-1];
500 end else
501 begin
502 tems:=sstack[tos-1];
503 end;
504 top:=display[(t as TInstRet).level];
505 tos:=sdisplay[(t as TInstRet).level];
506 display[(t as TInstRet).level]:=stack[top];
507 sdisplay[(t as TInstRet).level]:=stack[top+1];
508 pc:=stack[top+2];
509 dec(top,(t as TInstRet).pI);
510 dec(tos,(t as TInstRet).pS);
511 if m = CellG._I then
512 begin
513 stack[top]:=temp;
514 inc(top);
515 end else
516 if m = CellG._S then
517 begin
518 sstack[tos]:=tems;
519 inc(tos);
520 end;
521 continue;
522 end;
523 dit:
524 begin
525 lev:=(t as TInstPC).value;
526 stack[top]:=display[lev];
527 stack[top+1]:=sdisplay[lev];
528 display[lev]:=top;
529 sdisplay[lev]:=tos;
530 end;
531 dik:
532 begin
533 lev:=(t as TInstPC).value;
534 top:=display[lev];
535 tos:=sdisplay[lev];
536 display[lev]:=stack[top];
537 sdisplay[lev]:=stack[top+1];
538 end;
539 jmp:
540 begin
541 pc:=(t as TInstPC).value;
542 continue;
543 end;
544 jpc:
545 begin
546 dec(top);
547 if stack[top] = 0 then
548 begin
549 pc:=(t as TInstPC).value;
550 continue;
551 end;
552 end;
553 arr:
554 begin
555 m:=stack[top-2];
556 m1:=stack[top-1];
557 if (m > TInstAddr(t).addr.level)or(m1 > TInstAddr(t).addr.addr) then
558 begin
559 Writeln('�z���I�[�o�[�����B');
560 error;
561 end;
562 stack[top]:=TInstAddr(t).addr.level;
563 stack[top-2]:=m*stack[top];
564 stack[top-3]:=stack[top-3]+stack[top-2];
565 stack[top-3]:=stack[top-3]+m1;
566 dec(top,2);
567 end;
568 opr:
569 begin
570 o2:=TInstOp(t).optr;
571 case o2 of
572 neg:
573 begin
574 stack[top-1]:=-stack[top-1];
575 end;
576 _add:
577 begin
578 dec(top);
579 stack[top-1]:=stack[top-1]+stack[top];
580 end;
581 _sub:
582 begin
583 dec(top);
584 stack[top-1]:=stack[top-1]-stack[top];
585 end;
586 _mul:
587 begin
588 dec(top);
589 stack[top-1]:=stack[top-1]*stack[top];
590 end;
591 _div:
592 begin
593 dec(top);
594 stack[top-1]:=stack[top-1] div stack[top];
595 end;
596 eql:
597 begin
598 dec(top);
599 if stack[top-1] = stack[top] then
600 begin
601 stack[top-1]:=1;
602 end else
603 begin
604 stack[top-1]:=0;
605 end;
606 end;
607 neq:
608 begin
609 dec(top);
610 if stack[top-1] <> stack[top] then
611 begin
612 stack[top-1]:=1;
613 end else
614 begin
615 stack[top-1]:=0;
616 end;
617 end;
618 eqs:
619 begin
620 if CompareText(sstack[tos-2],sstack[tos-1]) = 0 then
621 begin
622 stack[top]:=1;
623 end else
624 begin
625 stack[top]:=0;
626 end;
627 inc(top);
628 dec(tos,2);
629 end;
630 nes:
631 begin
632 if CompareText(sstack[tos-2],sstack[tos-1]) = 1 then
633 begin
634 stack[top]:=1;
635 end else
636 begin
637 stack[top]:=0;
638 end;
639 inc(top);
640 dec(tos,2);
641 end;
642 lss:
643 begin
644 dec(top);
645 if stack[top-1] < stack[top] then
646 begin
647 stack[top-1]:=1;
648 end else
649 begin
650 stack[top-1]:=0;
651 end;
652 end;
653 gtr:
654 begin
655 dec(top);
656 if stack[top-1] > stack[top] then
657 begin
658 stack[top-1]:=1;
659 end else
660 begin
661 stack[top-1]:=0;
662 end;
663 end;
664 leq:
665 begin
666 dec(top);
667 if stack[top-1] <= stack[top] then
668 begin
669 stack[top-1]:=1;
670 end else
671 begin
672 stack[top-1]:=0;
673 end;
674 end;
675 geq:
676 begin
677 dec(top);
678 if stack[top-1] >= stack[top] then
679 begin
680 stack[top-1]:=1;
681 end else
682 begin
683 stack[top-1]:=0;
684 end;
685 end;
686 prt:
687 begin
688 dec(top);
689 Writeln(IntToStr(stack[top]));
690 end;
691 prs:
692 begin
693 dec(tos);
694 Writeln(sstack[tos]);
695 end;
696 prl:
697 Writeln;
698 ads:
699 begin
700 dec(tos);
701 sstack[tos-1]:=sstack[tos-1]+sstack[tos];
702 end;
703 sus:
704 begin
705 dec(tos);
706 s1:=sstack[tos-1];
707 s2:=sstack[tos];
708 temp:=Pos(s2,s1);
709 if temp > 0 then
710 begin
711 Delete(s1,temp,Length(s2));
712 sstack[tos-1]:=s1;
713 end;
714 end;
715 mus:
716 begin
717 dec(top);
718 s1:='';
719 s2:=sstack[tos-1];
720 for m:=1 to stack[top] do
721 begin
722 s1:=s1+s2;
723 end;
724 sstack[tos-1]:=s1;
725 end;
726 dis:
727 begin
728 s1:=sstack[tos-3];
729 s2:=sstack[tos-2];
730 m:=Pos(s2,s1);
731 while m > 0 do
732 begin
733 Delete(s1,m,Length(s2));
734 Insert(sstack[tos-1],s1,m);
735 m:=Pos(s2,s1);
736 end;
737 sstack[tos-3]:=s1;
738 dec(tos,2);
739 end;
740 ini:
741 begin
742 p:='';
743 while _cellG.checkIn(p) = true do
744 begin
745 Writeln('�����������������������B');
746 Write('>');
747 Readln(p);
748 end;
749 stack[top]:=StrToInt(p);
750 inc(top);
751 end;
752 ins:
753 begin
754 p:='';
755 Write('>');
756 Readln(p);
757 sstack[tos]:=p;
758 inc(tos);
759 end;
760 sid:
761 begin
762 stack[stack[top-2]]:=stack[top-1];
763 dec(top,2);
764 end;
765 lid:
766 stack[top-1]:=stack[stack[top-1]]; //
767 lds:
768 begin
769 dec(top);
770 sstack[tos]:=sstack[stack[top]];
771 inc(tos);
772 end;
773 sld:
774 begin
775 dec(top);
776 stack[stack[top-1]]:=stack[top];
777 stack[top-1]:=stack[top];
778 end;
779 sls:
780 begin
781 dec(top);
782 sstack[stack[top]]:=sstack[tos-1];
783 end;
784 sds:
785 begin
786 dec(top);
787 dec(tos);
788 sstack[stack[top]]:=sstack[tos];
789 end;
790 _inc:
791 begin
792 dec(top);
793 inc(stack[top]);
794 end;
795 _dec:
796 begin
797 dec(top);
798 dec(stack[top]);
799 end;
800 lin,lde:
801 begin
802 m:=stack[top-1];
803 if o2 =lin then
804 begin
805 inc(stack[m]);
806 end else
807 begin
808 dec(stack[m]);
809 end;
810 stack[top-1]:=stack[m];
811 end;
812 end;
813 end;
814 end;
815 inc(pc);
816 until o2 = stp;
817 shokika;
818 _cellG.shokika;
819 _cellG.closeFile;
820 pTrace:=false;
821 pCode:=false;
822 _cellG.pTable:=false;
823 end;
824
825 function TCellV.genCodeA(const op: integer; a: TRaddr): integer;
826 begin
827 checkMax;
828 code[cIndex]:=TInstAddr.Create(op,a);
829 result:=cIndex;
830 end;
831
832 function TCellV.genCodeC(l, c: integer): integer;
833 begin
834 checkMax;
835 code[cIndex]:=TInstCal.Create(cal,l,c);
836 result:=cIndex;
837 end;
838
839 function TCellV.genCodeO(const p: integer): integer;
840 begin
841 checkMax;
842 code[cIndex]:=TInstOp.Create(opr,p);
843 result:=cIndex;
844 end;
845
846 function TCellV.genCodeR: integer;
847 begin
848 if code[cIndex].opCode = ret then
849 begin
850 result:=cIndex;
851 Exit;
852 end;
853 checkMax;
854 code[cIndex]:=TInstRet.Create(ret,_cellG.bLevel,_cellG.funcParIs,_cellG.funcParSs,_cellG.funcModori);
855 result:=cIndex;
856 end;
857
858 function TCellV.genCodeS(op: integer; v: string): integer;
859 begin
860 checkMax;
861 code[cIndex]:=TStrVal.Create(op,v);
862 result:=cIndex;
863 end;
864
865 function TCellV.genCodeT(const op, t: integer): integer;
866 begin
867 checkMax;
868 code[cIndex]:=TInstAddr.Create(op,_cellG.tAddr(t));
869 result:=cIndex;
870 end;
871
872 function TCellV.genCodeV(const op, v: integer): integer;
873 begin
874 checkMax;
875 code[cIndex]:=TInstVal.Create(op,v);
876 result:=cIndex;
877 end;
878
879 function TCellV.nextCode: integer;
880 begin
881 result:=cIndex+1;
882 end;
883
884 procedure TCellV.printCode;
885 var
886 i: integer;
887 begin
888 Writeln('--- code ---');
889 for i:=0 to cIndex do
890 begin
891 Writeln(IntToStr(i)+' : '+code[i].toString);
892 end;
893 end;
894
895 procedure TCellV.printExe;
896 begin
897 if o1 = 0 then
898 begin
899 Exit;
900 end else
901 if o1 = -1 then
902 begin
903 Writeln;
904 Exit;
905 end else
906 if o1 <> opr then
907 begin
908 Write(codeName(o1)+' : ');
909 end;
910 case o1 of
911 ict:
912 Writeln('Istack='+IntToStr(top));
913 ics:
914 Writeln('Sstack='+IntToStr(tos));
915 lit,lod,lda,las,arr:
916 Writeln('Istack='+IntToStr(top-1)+' : '+IntToStr(stack[top-1]));
917 lis,los,lds:
918 Writeln('Sstack='+IntToStr(tos-1)+' : '+sstack[tos-1]);
919 sto:
920 Writeln(IntToStr(stack[top]));
921 ret,jmp,jpc:
922 Writeln(IntToStr(pc));
923 cal:
924 Writeln(IntToStr(pc));
925 dit,dik:
926 Writeln;
927 opr:
928 begin
929 Write(codeName(o2)+' : ');
930 if o2 < ini then
931 begin
932 Writeln('Istack='+IntToStr(top-1)+' : '+IntToStr(stack[top-1]));
933 end else
934 if o2 < prt then
935 begin
936 Writeln(IntToStr(stack[top]));
937 end else
938 begin
939 Writeln(sstack[tos]);
940 end;
941 end;
942 else
943 Writeln(IntToStr(o1));
944 end;
945 end;
946
947 procedure TCellV.backCal(i, l, c: integer);
948 begin
949 (code[i] as TInstCal).code:=c;
950 (code[i] as TInstCal).level:=l;
951 end;
952
953 procedure TCellV.shokika;
954 var
955 i: integer;
956 begin
957 for i:=0 to cIndex do
958 begin
959 code[i].Free;
960 end;
961 cIndex:=-1;
962 top:=0;
963 tos:=0;
964 pc:=0;
965 end;
966
967 function TCellV.genCodeP(op, v: integer): integer;
968 begin
969 checkMax;
970 code[cIndex]:=TInstPC.Create(op,v);
971 result:=cIndex;
972 end;
973
974 function TCellV.genCodeRV: integer;
975 begin
976 if code[cIndex].opCode = ret then
977 begin
978 result:=cIndex;
979 Exit;
980 end;
981 checkMax;
982 code[cIndex]:=TInstRet.Create(ret,_cellG.bLevel+1,_cellG.funcParIs,_cellG.funcParSs,_cellG.funcModori);
983 result:=cIndex;
984 end;
985
986 { TInstAddr }
987
988 constructor TInstAddr.Create(const op: integer; a: TRaddr);
989 begin
990 inherited Create(op);
991 addr:=a;
992 end;
993
994 function TInstAddr.toString: string;
995 begin
996 result:=inherited toString+',addr='+IntToStr(addr.level)+IntToStr(addr.addr);
997 end;
998
999 { TInstRet }
1000
1001 constructor TInstRet.Create(const op, l, pi, ps, m: integer);
1002 begin
1003 inherited Create(op);
1004 level:=l;
1005 self.pI:=pi;
1006 self.pS:=ps;
1007 modori:=m;
1008 end;
1009
1010 function TInstRet.toString: string;
1011 begin
1012 result:=inherited toString+',level='+IntToStr(level)+',pI='+
1013 IntToStr(pI)+',modori='+cellG.hyouji(modori);
1014 end;
1015
1016 { TInstVal }
1017
1018 constructor TInstVal.Create(const op, v: integer);
1019 begin
1020 inherited Create(op);
1021 value:=v;
1022 end;
1023
1024 function TInstVal.toString: string;
1025 begin
1026 result:=inherited toString+',value='+IntToStr(value);
1027 end;
1028
1029 { TInstOp }
1030
1031 constructor TInstOp.Create(const op, o: integer);
1032 begin
1033 inherited Create(op);
1034 optr:=o;
1035 end;
1036
1037 function TInstOp.toString: string;
1038 begin
1039 result:=inherited toString+',optr='+codeName(optr);
1040 end;
1041
1042 { TStrVal }
1043
1044 constructor TStrVal.Create(op: integer; v: string);
1045 begin
1046 inherited Create(op);
1047 value:=v;
1048 end;
1049
1050 function TStrVal.toString: string;
1051 begin
1052 result:=(inherited toString)+'.value='+value;
1053 end;
1054
1055 { TInstCal }
1056
1057 constructor TInstCal.Create(op, l, c: integer);
1058 begin
1059 inherited Create(op);
1060 level:=l;
1061 code:=c;
1062 end;
1063
1064 function TInstCal.toString: string;
1065 begin
1066 result:=(inherited toString)+','+IntToStr(code);
1067 end;
1068
1069 { TInstPC }
1070
1071 constructor TInstPC.Create(op, v: integer);
1072 begin
1073 inherited Create(op);
1074 value:=v;
1075 end;
1076
1077 function TInstPC.toString: string;
1078 begin
1079 result:=(inherited toString)+'.value'+IntToStr(value);
1080 end;
1081
1082 end.

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26