source: dev/trunk/abdev/BasicCompiler_Common/Intermediate_Step2.cpp@ 148

Last change on this file since 148 was 128, checked in by dai_9181, 18 years ago

Blittable型を導入した。

File size: 17.2 KB
Line 
1#include "../BasicCompiler_Common/common.h"
2
3CONSTINFO *GetNewConstHash(char *name){
4 extern int cp;
5 CONSTINFO *pci;
6
7 int key;
8 key=hash_default(name);
9
10 extern CONSTINFO **ppConstHash;
11 if(ppConstHash[key]){
12 pci=ppConstHash[key];
13 while(1){
14 if(lstrcmp(pci->name,name)==0){
15 //重複エラー
16 SetError(15,name,cp);
17 return 0;
18 }
19
20 if(pci->pNextData==0){
21 pci->pNextData=(CONSTINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(CONSTINFO));
22 break;
23 }
24 pci=pci->pNextData;
25 }
26 pci=pci->pNextData;
27 }
28 else{
29 ppConstHash[key]=(CONSTINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(CONSTINFO));
30 pci=ppConstHash[key];
31 }
32
33 return pci;
34}
35
36// マクロ定数を追加するための関数
37void AddConstData(char *Command){
38 extern HANDLE hHeap;
39 extern int cp;
40 int i,i2;
41 char temporary[VN_SIZE];
42
43 for(i=0;;i++){
44 if(Command[i]=='\0'){
45 SetError(10,"Const",cp);
46 return;
47 }
48 if(Command[i]=='=' || Command[i] == 1 && Command[i+1] == ESC_AS ){
49 //定数定義は新しいクラスモジュール(CDBConst)へ移行
50 // ※この関数はマクロ定数のみを扱う
51 return;
52 }
53 if(Command[i]=='('){
54 temporary[i]=0;
55 break;
56 }
57 temporary[i]=Command[i];
58 }
59
60
61 /////////////////////////////////
62 // 格納位置を計算してpciにセット
63 /////////////////////////////////
64
65 CONSTINFO *pci;
66 pci=GetNewConstHash(temporary);
67 if(!pci) return;
68
69
70
71 ////////////////////
72 // 定数情報を取得
73 ////////////////////
74
75 //定数名
76 pci->name=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
77 lstrcpy(pci->name,temporary);
78
79 if(Command[i]=='('){
80 pci->ppParm=(char **)HeapAlloc(hHeap,0,1);
81 pci->ParmNum=0;
82 for(i++,i2=0;;i++,i2++){
83 if(Command[i]=='\0'){
84 SetError(1,NULL,cp);
85 return;
86 }
87 if(Command[i]==','||Command[i]==')'){
88 temporary[i2]=0;
89 pci->ppParm=(char **)HeapReAlloc(hHeap,0,pci->ppParm,(pci->ParmNum+1)*sizeof(char *));
90 pci->ppParm[pci->ParmNum]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
91 lstrcpy(pci->ppParm[pci->ParmNum],temporary);
92 pci->ParmNum++;
93 if(Command[i]==')'){
94 i++;
95 if(Command[i]!='='){
96 SetError(1,NULL,cp);
97 return;
98 }
99 break;
100 }
101
102 i2=-1;
103 continue;
104 }
105 temporary[i2]=Command[i];
106 }
107 }
108 else pci->ParmNum=0;
109
110 //データ
111 lstrcpy(temporary,Command+i+1);
112 if(pci->ParmNum){
113 pci->StrValue=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
114 lstrcpy(pci->StrValue,temporary);
115 }
116 else if(temporary[0]=='\"'){
117 //文字列定数
118 RemoveStringQuotes(temporary);
119 i2=lstrlen(temporary);
120
121 pci->StrValue=(char *)HeapAlloc(hHeap,0,i2+1);
122 memcpy(pci->StrValue,temporary,i2);
123 pci->StrValue[i2]=0;
124
125 pci->DblValue=(double)i2;
126
127 pci->type=DEF_STRING;
128 pci->lpIndex=-1;
129 }
130 else if((temporary[0]=='e'||temporary[0]=='E')&&
131 (temporary[1]=='x'||temporary[1]=='X')&&
132 temporary[2]=='\"'){
133 //文字列定数
134 RemoveStringQuotes(temporary+2);
135 i2=FormatString_EscapeSequence(temporary+2);
136 pci->StrValue=(char *)HeapAlloc(hHeap,0,i2+1);
137 memcpy(pci->StrValue,temporary+2,i2);
138 pci->StrValue[i2]=0;
139
140 pci->DblValue=(double)i2;
141
142 pci->type=DEF_STRING;
143 pci->lpIndex=-1;
144 }
145 else{
146 //数値定数
147 _int64 i64data;
148 Type resultType;
149 StaticCalculation(true, temporary,0,&i64data,resultType);
150 pci->type=resultType.GetBasicType();
151 if(IsRealNumberType(pci->type)){
152 //実数型
153 memcpy(&pci->DblValue,&i64data,sizeof(double));
154 }
155 else if(Is64Type(pci->type)){
156 //64ビット型
157 pci->i64Value=i64data;
158 }
159 else if(IsWholeNumberType(pci->type)){
160 //その他整数型
161 pci->DblValue=(double)i64data;
162 }
163
164 pci->StrValue=0;
165 }
166}
167void AddConstEnum( const NamespaceScopes &namespaceScopes, char *buffer){
168 extern int cp;
169 int i=0,i2;
170
171 if(!(buffer[i]==1&&buffer[i+1]==ESC_ENUM)) return;
172 i+=2;
173
174 //列挙体の名前を取得
175 char temporary[VN_SIZE];
176 for(i2=0;;i++,i2++){
177 if(IsCommandDelimitation(buffer[i])){
178 temporary[i2]=0;
179 break;
180 }
181 if(!IsVariableChar(buffer[i])){
182 SetError(1,NULL,i);
183 break;
184 }
185 temporary[i2]=buffer[i];
186 }
187
188 if(buffer[i]=='\0'){
189 SetError(22,"Enum",cp);
190 return;
191 }
192
193 int NextValue=0;
194 while(1){
195 i++;
196
197 if(buffer[i]==1&&buffer[i+1]==ESC_ENDENUM) break;
198
199 for(i2=0;;i2++,i++){
200 if(IsCommandDelimitation(buffer[i])){
201 temporary[i2]=0;
202 break;
203 }
204 if(buffer[i]=='='){
205 temporary[i2]=0;
206 break;
207 }
208 temporary[i2]=buffer[i];
209 }
210 if(temporary[0]=='\0'){
211 if(buffer[i]=='\0'){
212 SetError(22,"Enum",cp);
213 break;
214 }
215 continue;
216 }
217
218 if(buffer[i]!='='){
219 NextValue++;
220 }
221 else{
222 char temp2[VN_SIZE];
223 for(i++,i2=0;;i2++,i++){
224 if(IsCommandDelimitation(buffer[i])){
225 temp2[i2]=0;
226 break;
227 }
228 temp2[i2]=buffer[i];
229 }
230
231 _int64 i64data;
232 StaticCalculation(true, temp2,DEF_LONG,&i64data,Type());
233 NextValue=(int)i64data;
234 }
235
236 //定数を追加
237 CDBConst::obj.AddConst( namespaceScopes, temporary, NextValue);
238 }
239}
240bool GetConstInfo(void){
241 ////////////////////////////////////////////
242 // Const命令の情報を取得
243 ////////////////////////////////////////////
244
245 int i2;
246 char temporary[1024];
247
248 // 名前空間管理
249 NamespaceScopes &namespaceScopes = Smoothie::Lexical::liveingNamespaceScopes;
250 namespaceScopes.clear();
251
252 //定数に関する情報
253 extern CONSTINFO **ppConstHash;
254 ppConstHash=(CONSTINFO **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(CONSTINFO *));
255
256 extern char *basbuf;
257 for(int i=0;;i++){
258 if( basbuf[i] == '\0' ) break;
259
260 if( basbuf[i] == 1 && basbuf[i+1] == ESC_NAMESPACE ){
261 for(i+=2,i2=0;;i2++,i++){
262 if( IsCommandDelimitation( basbuf[i] ) ){
263 temporary[i2]=0;
264 break;
265 }
266 temporary[i2]=basbuf[i];
267 }
268 namespaceScopes.push_back( temporary );
269
270 continue;
271 }
272 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENDNAMESPACE ){
273 if( namespaceScopes.size() <= 0 ){
274 SetError(12, "End Namespace", i );
275 }
276 else{
277 namespaceScopes.pop_back();
278 }
279
280 i += 2;
281 continue;
282 }
283
284 if( basbuf[i] == 1 ){
285 if(basbuf[i]==1&&basbuf[i+1]==ESC_CONST){
286 i+=2;
287
288 extern int cp;
289 cp=i; //エラー用
290
291
292 if(basbuf[i]==1&&basbuf[i+1]==ESC_ENUM){
293 AddConstEnum( namespaceScopes, basbuf+i);
294 continue;
295 }
296
297 for(i2=0;;i++,i2++){
298 if(basbuf[i]=='\"'){
299 temporary[i2]=basbuf[i];
300 for(i++,i2++;;i++,i2++){
301 temporary[i2]=basbuf[i];
302 if(basbuf[i]=='\"') break;
303 }
304 continue;
305 }
306 if(IsCommandDelimitation(basbuf[i])){
307 temporary[i2]=0;
308 break;
309 }
310 temporary[i2]=basbuf[i];
311 }
312 CDBConst::obj.Add( namespaceScopes, temporary);
313 if(basbuf[i]=='\0') break;
314 }
315 else{
316 int result = JumpStatement( basbuf, i );
317 if( result == -1 ){
318 //エラー
319 return false;
320 }
321 else if( result == 1 ){
322 //ジャンプした場合
323 i--;
324 }
325 }
326 }
327 }
328 return true;
329}
330
331char ConstructorDestructorSchedule[MAX_PATH];
332void MakeConstructorAndDestructor(char *buffer,int nowLine,char *ClassName){
333 int i,i2;
334 char temporary[MAX_PATH],*pTemp;
335 BOOL bConstructor,bDestructor;
336
337 ConstructorDestructorSchedule[0]=0;
338 bConstructor=0;
339 bDestructor=0;
340
341 for(i=nowLine;;i++){
342 if(buffer[i]=='\0') break;
343 if(buffer[i]==1&&buffer[i+1]==ESC_ENDCLASS){
344 if((!bConstructor)||(!bDestructor)){
345 pTemp=ConstructorDestructorSchedule;
346
347 lstrcpy(pTemp,"Public:");
348
349 if(!bConstructor){
350 //コンストラクタが無いときは生成する
351 sprintf(pTemp+lstrlen(pTemp),"%c%c%s():%c%c:",
352 1,ESC_SUB,
353 ClassName,
354 1,ESC_ENDSUB);
355 }
356
357 if(!bDestructor){
358 //デストラクタが無いときは生成する
359 sprintf(pTemp+lstrlen(pTemp),"%c%c~%s():%c%c:",
360 1,ESC_SUB,
361 ClassName,
362 1,ESC_ENDSUB);
363 }
364 }
365 break;
366 }
367
368 if(buffer[i]==1&&(buffer[i+1]==ESC_SUB||buffer[i+1]==ESC_FUNCTION)){
369 i+=2;
370 while(IsBlank(buffer[i])) i++;
371 if(buffer[i]=='~'){
372 //デストラクタ
373 bDestructor=1;
374 }
375 else{
376 //コンストラクタかどうかをチェック
377 for(i2=0;;i++,i2++){
378 if(!IsVariableChar(buffer[i])){
379 temporary[i2]=0;
380 break;
381 }
382 temporary[i2]=buffer[i];
383 }
384 if(lstrcmp(temporary,ClassName)==0) bConstructor=1;
385 }
386 }
387 }
388}
389void ChangeCommand(char *buffer,int nowLine,char *Command){
390 int i,i2,IsStr;
391 unsigned _int16 ComNum;
392 char com[8192],pam[8192];
393
394 static int nCountOfNonGlobalScope = 0;
395
396 if(Command[0]==1){
397 switch(Command[1]){
398 case ESC_SELECTCASE:
399 case ESC_CASE:
400 KillStringSpaces(Command+2);
401 break;
402 case ESC_WITH:
403 KillStringSpaces(Command+2);
404 break;
405 case ESC_TYPEDEF:
406 KillStringSpaces(Command+2);
407 break;
408 case ESC_DECLARE:
409 KillStringSpaces(Command+2);
410 break;
411 case ESC_IF:
412 KillStringSpaces(Command+2);
413 break;
414
415 case ESC_CLASS:
416 KillStringSpaces(Command+2);
417 i2 = 2;
418 if( Command[i2] == 1 && Command[i2+1] == ESC_ENUM ){
419 i2 += 2;
420 }
421 else if( memicmp( Command + i2, "Blittable(", 10 ) == 0 ){
422 i2 += 10;
423 i2 = JumpStringInPare(Command,i2)+1;
424 }
425
426 //コンストラクタ、デストラクタを暗黙的に生成
427 MakeConstructorAndDestructor(buffer,nowLine,Command + i2);
428 break;
429 case ESC_INTERFACE:
430 KillStringSpaces(Command+2);
431 break;
432 case ESC_ENDCLASS:
433 if(ConstructorDestructorSchedule[0]){
434 //生成されたコンストラクタ、デストラクタを挿入
435 sprintf(Command,"%s%c%c",ConstructorDestructorSchedule,1,ESC_ENDCLASS);
436 }
437 break;
438
439 case ESC_TYPE:
440 KillStringSpaces(Command+2);
441 break;
442
443 case ESC_CONST:
444 KillStringSpaces(Command+2);
445 if( Command[2] == 1 && Command[3] == ESC_ENUM ){
446 nCountOfNonGlobalScope++;
447 }
448 break;
449
450 case ESC_ENUM:
451 nCountOfNonGlobalScope++;
452 KillStringSpaces(Command+2);
453 break;
454
455 case ESC_ENDENUM:
456 nCountOfNonGlobalScope--;
457 break;
458
459 case ESC_INHERITS:
460 case ESC_VIRTUAL:
461 case ESC_OVERRIDE:
462 case ESC_ABSTRACT:
463 case ESC_SUB:
464 case ESC_FUNCTION:
465 case ESC_MACRO:
466 case ESC_STATIC:
467 case ESC_NAMESPACE:
468 case ESC_IMPORTS:
469 KillStringSpaces(Command+2);
470 break;
471 }
472 return;
473 }
474
475 bool isPare = false;
476 for(i=0;;i++){
477 if(Command[i]==' '||Command[i]=='\t'||Command[i]=='('||Command[i]=='\"'||Command[i]=='@'||Command[i]=='-'){
478 com[i]=0;
479 while(Command[i]==' '||Command[i]=='\t') i++;
480 if( Command[i] == '(' ) isPare = true;
481 break;
482 }
483 if(Command[i]=='='){
484 KillStringSpaces(Command);
485 return;
486 }
487 com[i]=Command[i];
488 if(Command[i]=='\0') break;
489 }
490
491 //マクロによるコマンド
492 i2=1;
493 if( nCountOfNonGlobalScope == 0 ){
494 //グローバル
495 if(lstrcmpi(com,"Open")==0) ComOpen(Command+i,pam,nowLine);
496 else if(lstrcmpi(com,"Close")==0) ComClose(Command+i,pam);
497 else if(lstrcmpi(com,"Field")==0||
498 lstrcmpi(com,"Get")==0||
499 lstrcmpi(com,"Put")==0) ComField(Command+i,pam);
500 else if(lstrcmpi(com,"Line")==0) ComLine(Command+i,pam,nowLine);
501 else if(lstrcmpi(com,"Circle")==0) ComCircle(Command+i,pam,nowLine);
502 else if(lstrcmpi(com,"PSet")==0) ComPSet(Command+i,pam,nowLine);
503 else if(lstrcmpi(com,"Paint")==0) ComPaint(Command+i,pam,nowLine);
504
505 else if(
506 lstrcmpi(com,"EXEC")==0||
507 lstrcmpi(com,"INPUT")==0||
508 lstrcmpi(com,"PRINT")==0||
509 lstrcmpi(com,"RANDOMIZE")==0||
510 ( lstrcmpi(com,"WRITE")==0 && isPare == false )||
511 lstrcmpi(com,"MSGBOX")==0||
512 lstrcmpi(com,"WINDOW")==0||
513 lstrcmpi(com,"DELWND")==0||
514 lstrcmpi(com,"INSMENU")==0||
515 lstrcmpi(com,"CHDIR")==0||
516 lstrcmpi(com,"MKDIR")==0||
517 lstrcmpi(com,"KILL")==0||
518 lstrcmpi(com,"CLS")==0||
519 lstrcmpi(com,"COLOR")==0||
520 lstrcmpi(com,"LOCATE")==0
521 ){
522 KillSpaces(Command+i,pam);
523
524 //大文字に変換
525 CharUpper(com);
526
527 sprintf(Command,"%s(%s)",com,pam);
528 return;
529 }
530
531 else i2=0;
532 }
533 else i2=0;
534 if(i2){
535 //大文字に変換
536 CharUpper(com);
537
538 sprintf(Command,"%s(%s)",com,pam);
539 return;
540 }
541
542
543
544 //コンパイラに搭載されるコマンド
545 if(lstrcmpi(com,"Do")==0){
546 KillSpaces(Command+i,pam);
547 ComNum=COM_DO;
548 }
549 else if(lstrcmpi(com,"goto")==0){
550 KillSpaces(Command+i,pam);
551 ComNum=COM_GOTO;
552 }
553 else if(lstrcmpi(com,"gosub")==0){
554 KillSpaces(Command+i,pam);
555 ComNum=COM_GOSUB;
556 }
557 else if(lstrcmpi(com,"Loop")==0){
558 if((Command[i]=='w'||Command[i]=='W')&&(Command[i+1]=='h'||Command[i+1]=='H')&&(Command[i+2]=='i'||Command[i+2]=='I')&&(Command[i+3]=='l'||Command[i+3]=='L')&&(Command[i+4]=='e'||Command[i+4]=='E')){
559 lstrcpy(pam,"0,");
560 KillSpaces(Command+i+5,pam+2);
561 }
562 else if((Command[i]=='u'||Command[i]=='U')&&(Command[i+1]=='n'||Command[i+1]=='N')&&(Command[i+2]=='t'||Command[i+2]=='T')&&(Command[i+3]=='i'||Command[i+3]=='I')&&(Command[i+4]=='l'||Command[i+4]=='L')){
563 lstrcpy(pam,"1,");
564 KillSpaces(Command+i+5,pam+2);
565 }
566 else pam[0]=0;
567 ComNum=COM_LOOP;
568 }
569 else if(lstrcmpi(com,"For")==0){
570 for(i2=0,IsStr=0;;i++,i2++){
571 while(Command[i]==' '||Command[i]=='\t') i++;
572 if(Command[i]=='\"') IsStr^=1;
573 if((Command[i-1]==' '||Command[i-1]=='\t')&&(Command[i]=='t'||Command[i]=='T')&&(Command[i+1]=='o'||Command[i+1]=='O')&&(Command[i+2]==' '||Command[i+2]=='\t')&&IsStr==0){
574 pam[i2]=',';
575 break;
576 }
577 pam[i2]=Command[i];
578 if(Command[i]=='\0') break;
579 }
580 if(Command[i]){
581 for(i+=3,i2++,IsStr=0;;i++,i2++){
582 while(Command[i]==' '||Command[i]=='\t') i++;
583 if((Command[i-1]==' '||Command[i-1]=='\t')&&(Command[i]=='s'||Command[i]=='S')&&(Command[i+1]=='t'||Command[i+1]=='T')&&(Command[i+2]=='e'||Command[i+2]=='E')&&(Command[i+3]=='p'||Command[i+3]=='P')&&(Command[i+4]==' '||Command[i+4]=='\t')){
584 pam[i2]=',';
585 i+=4;
586 continue;
587 }
588 pam[i2]=Command[i];
589 if(Command[i]=='\0') break;
590 }
591 }
592 ComNum=COM_FOR;
593 }
594 else if(lstrcmpi(com,"Next")==0){
595 KillSpaces(Command+i,pam);
596 ComNum=COM_NEXT;
597 }
598 else if(lstrcmpi(com,"Return")==0){
599 KillSpaces(Command+i,pam);
600 ComNum=COM_RETURN;
601 }
602 else if(lstrcmpi(com,"While")==0){
603 KillSpaces(Command+i,pam);
604 ComNum=COM_WHILE;
605 }
606 else if(lstrcmpi(com,"Wend")==0){
607 pam[0]=0;
608 ComNum=COM_WEND;
609 }
610
611 //変数、データ操作
612 else if(lstrcmpi(com,"dim")==0){
613 KillSpaces(Command+i,pam);
614 ComNum=COM_DIM;
615 }
616 else if(lstrcmpi(com,"Delete")==0){
617 KillSpaces(Command+i,pam);
618 ComNum=COM_DELETE;
619 }
620 else if( lstrcmpi( com, "_System_SweepingDelete" ) == 0 ){
621 KillSpaces(Command+i,pam);
622 ComNum=COM_SWEEPINGDELETE;
623 }
624
625 //その他
626 else if(lstrcmpi(com,"Debug")==0){
627 pam[0]=0;
628 ComNum=COM_DEBUG;
629 }
630 else if(lstrcmpi(com,"let")==0){
631 KillSpaces(Command+i,pam);
632 ComNum=COM_LET;
633 }
634 else if(lstrcmpi(com,"rem")==0){
635 Command[0]=0;
636 return;
637 }
638
639 //ポインタ
640 else if(lstrcmpi(com,"SetDouble")==0){
641 KillSpaces(Command+i,pam);
642 ComNum=COM_SETDOUBLE;
643 }
644 else if(lstrcmpi(com,"SetSingle")==0){
645 KillSpaces(Command+i,pam);
646 ComNum=COM_SETSINGLE;
647 }
648 else if(lstrcmpi(com,"SetQWord")==0){
649 KillSpaces(Command+i,pam);
650 ComNum=COM_SETQWORD;
651 }
652 else if(lstrcmpi(com,"SetDWord")==0){
653 KillSpaces(Command+i,pam);
654 ComNum=COM_SETDWORD;
655 }
656 else if(lstrcmpi(com,"SetWord")==0){
657 KillSpaces(Command+i,pam);
658 ComNum=COM_SETWORD;
659 }
660 else if(lstrcmpi(com,"SetByte")==0){
661 KillSpaces(Command+i,pam);
662 ComNum=COM_SETBYTE;
663 }
664
665 else{
666 //その他のコマンド(一般コード)
667 lstrcpy(com,Command);
668 KillSpaces(com,Command);
669 return;
670 }
671
672 i=lstrlen(pam);
673 while(pam[i-1]==' '||pam[i-1]=='\t') i--;
674 pam[i]=0;
675 if(pam[0]) sprintf(Command,"%c%c%s",HIBYTE(ComNum),LOBYTE(ComNum),pam);
676 else sprintf(Command,"%c%c",HIBYTE(ComNum),LOBYTE(ComNum));
677
678 return;
679}
680
681void ChangeCommandToCode(char *buffer){
682 extern HANDLE hHeap;
683 int i,i2,i3,IsStr,CommandBufferSize;
684 char *temporary,*tempBase,temp2[VN_SIZE],*lpCommand;
685
686 tempBase=(char *)HeapAlloc(hHeap,0,(lstrlen(buffer)+1)*2+8192);
687 temporary=tempBase+1;
688 temporary[0]=0;
689 i=0;
690 i3=0;
691
692 CommandBufferSize=512;
693 lpCommand=(char *)HeapAlloc(hHeap,0,CommandBufferSize);
694
695 while(1){
696 i2=0;
697 while(buffer[i]==' '||buffer[i]=='\t') i++;
698 while(buffer[i]>='0'&&buffer[i]<='9'){
699 temp2[i2]=buffer[i];
700 i++;
701 i2++;
702 }
703 temp2[i2]=0;
704 while(buffer[i]==' '||buffer[i]=='\t') i++;
705 for(i2=0,IsStr=0;;i++,i2++){
706 if(i2>=CommandBufferSize){ //バッファ領域が足りなくなった場合はバッファを増量する
707 CommandBufferSize+=512;
708 lpCommand=(char *)HeapReAlloc(hHeap,0,lpCommand,CommandBufferSize);
709 }
710 if(buffer[i]=='\"') IsStr^=1;
711 if(buffer[i]=='\n'||(buffer[i]==':'&&IsStr==0)||buffer[i]=='\0'){
712 lpCommand[i2]=0;
713
714 if(temp2[0]){
715 //行番号ラベル
716 sprintf(temporary+i3,"%c%c%s,",1,ESC_LINENUM,temp2);
717 i3+=lstrlen(temporary+i3);
718
719 temp2[0]=0;
720 }
721
722 //命令コードへ変換
723 if(i2){
724 //エラー用
725 extern int cp;
726 cp=i;
727
728 ChangeCommand(buffer,i,lpCommand);
729
730 lstrcpy(temporary+i3,lpCommand);
731 i3+=lstrlen(temporary+i3);
732 }
733
734 if(!(lpCommand[0]=='\0'&&buffer[i]==':')){
735 temporary[i3++]=buffer[i];
736 temporary[i3]=0;
737 }
738
739 if(buffer[i]=='\n'){
740 i++;
741 break;
742 }
743 else if(buffer[i]==':'){
744 while(buffer[i+1]==' '||buffer[i+1]=='\t') i++;
745 }
746 if(buffer[i]=='\0') break;
747 i2=-1;
748 continue;
749 }
750 lpCommand[i2]=buffer[i];
751 }
752 if(buffer[i]=='\0') break;
753 }
754 HeapDefaultFree(lpCommand);
755 lstrcpy(buffer,temporary);
756
757 HeapDefaultFree(tempBase);
758}
Note: See TracBrowser for help on using the repository browser.