source: dev/BasicCompiler_Common/Subroutine.cpp@ 43

Last change on this file since 43 was 40, checked in by dai_9181, 18 years ago

ByRef修飾子を関数戻り値とDimステートメントで指定可能にした。

File size: 31.5 KB
Line 
1#include "../BasicCompiler_Common/common.h"
2
3#ifdef _AMD64_
4#include "../BasicCompiler64/opcode.h"
5#else
6#include "../BasicCompiler32/opcode.h"
7#endif
8
9//コンパイル中の関数情報
10SUBINFO *pCompilingSubInfo;
11
12int GetCallProcName(char *buffer,char *name){
13 int i2,i3,IsStr=0;
14
15 for(i2=0;;i2++){
16 if(buffer[i2]=='\"') IsStr^=1;
17 if(IsDBCSLeadByte(buffer[i2])){
18 name[i2]=buffer[i2];
19 i2++;
20 name[i2]=buffer[i2];
21 continue;
22 }
23 if(buffer[i2]=='['&&IsStr==0){
24 i3=GetStringInBracket(name+i2,buffer+i2);
25 i2+=i3-1;
26 continue;
27 }
28 if(buffer[i2]=='('&&IsStr==0){
29 name[i2]=0;
30 break;
31 }
32 if(buffer[i2]=='='&&IsStr==0){
33 name[i2]=0;
34 break;
35 }
36
37 name[i2]=buffer[i2];
38 if(buffer[i2]=='\0') break;
39 }
40 return i2;
41}
42
43int GetProc(char *name,void **ppInfo){
44
45 //ユーザー定義関数
46 *ppInfo=(void *)GetSubHash(name);
47 if(*ppInfo) return PROC_DEFAULT;
48
49 //DLL関数
50 *ppInfo=(void *)GetDeclareHash(name);
51 if(*ppInfo) return PROC_DLL;
52
53 //コンパイラ埋め込み型
54 *ppInfo=(void *)(_int64)GetFunctionFromName(name);
55 if(*ppInfo) return PROC_BUILTIN;
56
57 //関数ポインタ
58 int type;
59 LONG_PTR lpIndex;
60 type=GetVarType(name,&lpIndex,0);
61 if(type==DEF_PTR_PROC) return PROC_PTR;
62
63 return 0;
64}
65
66void SplitObjectName(char *name,char *ObjectName,int *pRefType){
67 int i4;
68 for(i4=lstrlen(name)-1;i4>=0;i4--){
69 if(name[i4]=='.'||(name[i4]==1&&name[i4+1]==ESC_PSMEM))
70 break;
71 }
72 if(i4==-1) ObjectName[0]=0;
73 else{
74 //参照タイプを判別
75 if(name[i4]=='.') *pRefType=DEF_OBJECT;
76 else *pRefType=DEF_PTR_OBJECT;
77
78 if(i4==0) GetWithName(ObjectName);
79 else{
80 memcpy(ObjectName,name,i4);
81 ObjectName[i4]=0;
82 }
83 }
84}
85bool SplitMemberName( const char *desc, char *object, char *member ){
86 int i;
87 for(i=lstrlen(desc)-1;i>=0;i--){
88 if(desc[i]=='.'||(desc[i]==1&&desc[i+1]==ESC_PSMEM))
89 break;
90 }
91 if(i==-1) return false;
92 else{
93 if(desc[i]=='.')
94 lstrcpy(member,desc+i+1);
95 else
96 lstrcpy(member,desc+i+2);
97
98 if( object ){
99 lstrcpy( object, desc );
100 object[i]=0;
101 }
102 }
103
104 return true;
105}
106int GetReturnTypeOfProc(int idProc,void *pInfo,char *name,char *Parameter,LONG_PTR *plpRetIndex){
107 int ret_type;
108
109 if(idProc==PROC_DEFAULT){
110 /////////////////////
111 // ユーザー定義関数
112 /////////////////////
113
114 SUBINFO *psi;
115 psi=(SUBINFO *)pInfo;
116
117 //GetSubHash内でエラー提示が行われた場合
118 if(psi==(SUBINFO *)-1) return -1;
119
120
121 //オブジェクト名を取得
122 char ObjectName[VN_SIZE];
123 int RefType;
124 SplitObjectName(name,ObjectName,&RefType);
125
126
127 ////////////////////////
128 // オーバーロードを解決
129 ////////////////////////
130
131 SUBINFO **ppsi;
132 int num;
133 ppsi=GetOverloadSubHash(name,&num);
134 if(num){
135 //オーバーロードを解決
136 psi=OverloadSolutionWithStrParam(name,ppsi,num,Parameter,ObjectName,NULL);
137 HeapDefaultFree(ppsi);
138
139 if(!psi) return 0;
140 }
141
142
143 ret_type=psi->ReturnType;
144 *plpRetIndex=psi->u.ReturnIndex;
145 }
146 else if(idProc==PROC_DLL){
147 /////////////////////////
148 // DLL関数
149 /////////////////////////
150 DECLAREINFO *pdi;
151 pdi=(DECLAREINFO *)pInfo;
152
153 ret_type=pdi->ReturnType;
154 *plpRetIndex=pdi->u.ReturnIndex;
155 }
156 else if(idProc==PROC_BUILTIN){
157 /////////////////////////
158 // 組み込み関数
159 /////////////////////////
160 int FuncId;
161 FuncId=(int)(_int64)pInfo;
162
163 ret_type=GetFunctionType(FuncId);
164 *plpRetIndex=-1;
165 }
166 else if(idProc==PROC_PTR){
167 /////////////////
168 // 関数ポインタ
169 /////////////////
170
171 LONG_PTR lpIndex;
172 GetVarType(name,&lpIndex,0);
173
174 extern PROCPTRINFO *pProcPtrInfo;
175 ret_type=pProcPtrInfo[lpIndex].ReturnType;
176 *plpRetIndex=pProcPtrInfo[lpIndex].u.ReturnIndex;
177 }
178
179 return ret_type;
180}
181BOOL GetReturnTypeOfPropertyMethod(char *variable,char *RightSide,TYPEINFO *pRetTypeInfo){
182 //プロパティ用のメソッドを呼び出す
183
184 //配列要素を取得
185 char VarName[VN_SIZE],ArrayElements[VN_SIZE];
186 GetArrayElement(variable,VarName,ArrayElements);
187
188 //オブジェクト名を取得
189 char ObjectName[VN_SIZE];
190 int RefType;
191 SplitObjectName(VarName,ObjectName,&RefType);
192
193 //オーバーロード用の関数リストを作成
194 SUBINFO **ppsi;
195 int num;
196 ppsi=GetOverloadSubHash(VarName,&num);
197 if(num==0){
198 return 0;
199 }
200
201 //パラメータを整備
202 char *Parameter;
203 Parameter=(char *)HeapAlloc(hHeap,0,lstrlen(ArrayElements)+lstrlen(RightSide)+32);
204 lstrcpy(Parameter,ArrayElements);
205 if(RightSide){
206 if(Parameter[0]&&RightSide[0]) lstrcat(Parameter,",");
207 lstrcat(Parameter,RightSide);
208 }
209
210 //オーバーロードを解決
211 SUBINFO *psi;
212 psi=OverloadSolutionWithStrParam(VarName,ppsi,num,Parameter,ObjectName,NULL);
213 HeapDefaultFree(ppsi);
214
215 if(psi){
216 if(pRetTypeInfo){
217 pRetTypeInfo->type=psi->ReturnType;
218 pRetTypeInfo->u.lpIndex=psi->u.ReturnIndex;
219 }
220 }
221
222 return 1;
223}
224
225//インデクサ(getter)の戻り値を取得
226bool GetReturnTypeOfIndexerGetterProc(CClass *pobj_Class,TYPEINFO &RetTypeInfo){
227 SUBINFO **ppsi;
228 int num;
229 ppsi=pobj_Class->GetOperatorSubInfo(CALC_ARRAY_GET,num);
230 if(num==0){
231 HeapDefaultFree(ppsi);
232
233 return false;
234 }
235
236 RetTypeInfo.type = ppsi[0]->ReturnType;
237 RetTypeInfo.u.lpIndex = ppsi[0]->u.ReturnIndex;
238
239 HeapDefaultFree(ppsi);
240
241 return true;
242}
243
244
245void AddDeclareData(char *buffer,int NowLine){
246 extern HANDLE hHeap;
247 int i,i2,i3,i4,sw,IsFunction;
248 char temporary[VN_SIZE];
249
250 i=0;
251
252 DWORD dwType;
253 BOOL bCdecl=0;
254
255 //Static/Dynamic
256 if(buffer[i]==ESC_STATIC){
257 dwType=DECLARE_STATIC;
258 i++;
259 }
260 else dwType=DECLARE_DYNAMIC;
261
262 //Sub/Function
263 if(buffer[i]==ESC_SUB) IsFunction=0;
264 else if(buffer[i]==ESC_FUNCTION) IsFunction=1;
265 else{
266 SetError(1,NULL,NowLine);
267 return;
268 }
269 i++;
270
271 //プロシージャ名
272 for(i2=0;;i++,i2++){
273 if(buffer[i]==1&&buffer[i+1]==ESC_CDECL){
274 bCdecl=1;
275
276 i+=2;
277 temporary[i2]=0;
278 break;
279 }
280 if(buffer[i]==','){
281 temporary[i2]=0;
282 break;
283 }
284 if(buffer[i]=='\0'){
285 SetError(1,NULL,NowLine);
286 return;
287 }
288 temporary[i2]=buffer[i];
289 }
290
291 //ユーザー定義関数との重複チェック
292 if(GetSubHash(temporary)){
293 SetError(15,temporary,NowLine);
294 return;
295 }
296
297
298 /////////////////////////////////
299 // 格納位置を計算してpciにセット
300 /////////////////////////////////
301
302 //ハッシュ値を取得
303 int key;
304 key=hash_default(temporary);
305
306 extern DECLAREINFO **ppDeclareHash;
307 DECLAREINFO *pdi;
308 if(ppDeclareHash[key]){
309 pdi=ppDeclareHash[key];
310 while(1){
311 if(lstrcmpi(pdi->name,temporary)==0){
312 //重複エラー
313 SetError(15,temporary,NowLine);
314 return;
315 }
316
317 if(pdi->pNextData==0){
318 pdi->pNextData=(DECLAREINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(DECLAREINFO));
319 break;
320 }
321 pdi=pdi->pNextData;
322 }
323 pdi=pdi->pNextData;
324 }
325 else{
326 ppDeclareHash[key]=(DECLAREINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(DECLAREINFO));
327 pdi=ppDeclareHash[key];
328 }
329
330 pdi->dwType=dwType;
331 pdi->bCdecl=bCdecl;
332
333 pdi->name=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
334 lstrcpy(pdi->name,temporary);
335 i++;
336
337 //ライブラリ
338 if(buffer[i]!='\"'){
339 SetError(1,NULL,NowLine);
340 return;
341 }
342 for(i++,i2=0;;i++,i2++){
343 if(buffer[i]=='\"'){
344 temporary[i2]=0;
345 break;
346 }
347 if(buffer[i]=='\0'){
348 SetError(1,NULL,NowLine);
349 return;
350 }
351 temporary[i2]=buffer[i];
352 }
353 CharUpper(temporary);
354 if(!strstr(temporary,".")){
355 if(pdi->dwType==DECLARE_STATIC) lstrcat(temporary,".LIB");
356 else{
357 lstrcat(temporary,".DLL");
358 if(lstrlen(temporary)>=16){
359 SetError(7,NULL,NowLine);
360 return;
361 }
362 }
363 }
364 pdi->file=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
365 lstrcpy(pdi->file,temporary);
366 i++;
367
368 if(buffer[i]==','){
369 i++;
370 if(buffer[i]!='\"'){
371 SetError(1,NULL,NowLine);
372 return;
373 }
374 for(i++,i2=0;;i++,i2++){
375 if(buffer[i]=='\"'){
376 temporary[i2]=0;
377 break;
378 }
379 if(buffer[i]=='\0'){
380 SetError(1,NULL,NowLine);
381 return;
382 }
383 temporary[i2]=buffer[i];
384 }
385 pdi->alias=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
386 lstrcpy(pdi->alias,temporary);
387 i++;
388 }
389 else{
390 pdi->alias=(char *)HeapAlloc(hHeap,0,lstrlen(pdi->name)+1);
391 lstrcpy(pdi->alias,pdi->name);
392 }
393
394 //パラメータの始めのカッコ
395 if(buffer[i]!='('){
396 SetError(1,NULL,NowLine);
397 return;
398 }
399 i++;
400
401 pdi->pParmInfo=(PARAMETER_INFO *)HeapAlloc(hHeap,0,1);
402
403 //各パラメータ
404 for(i3=0;;i3++){
405 if(buffer[i]==')') break;
406
407 pdi->pParmInfo=(PARAMETER_INFO *)HeapReAlloc(hHeap,0,pdi->pParmInfo,(i3+1)*sizeof(PARAMETER_INFO));
408
409 //ByVal
410 if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
411 pdi->pParmInfo[i3].bByVal=1;
412 i+=2;
413 }
414 else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
415 pdi->pParmInfo[i3].bByVal=0;
416 i+=2;
417 }
418 else pdi->pParmInfo[i3].bByVal=1;
419
420 //変数名は無視(temporaryの変数名は型宣言文字判断のため)
421 sw=0;
422 for(i2=0;;i++,i2++){
423 if(buffer[i]=='('){
424 if(!sw) sw=1;
425
426 i4=GetStringInPare(temporary+i2,buffer+i);
427 i2+=i4-1;
428 i+=i4-1;
429 continue;
430 }
431 if(buffer[i]=='['){
432 if(!sw) sw=1;
433
434 i4=GetStringInBracket(temporary+i2,buffer+i);
435 i2+=i4-1;
436 i+=i4-1;
437 continue;
438 }
439 if(!IsVariableChar(buffer[i])){
440 temporary[i2]=0;
441 break;
442 }
443 temporary[i2]=buffer[i];
444 }
445 if(lstrcmp(temporary,"...")==0) pdi->pParmInfo[i3].type=DEF_ELLIPSE;
446 else{
447 //型
448 if(buffer[i]==1&&buffer[i+1]==ESC_AS){
449 i+=2;
450 for(i2=0;;i++,i2++){
451 if(!(IsVariableChar(buffer[i])||buffer[i]=='*')){
452 temporary[i2]=0;
453 break;
454 }
455 temporary[i2]=buffer[i];
456 }
457 pdi->pParmInfo[i3].type=GetTypeFixed(temporary,&pdi->pParmInfo[i3].u.index);
458 }
459 else{
460 pdi->pParmInfo[i3].type=GetTypeFromSimpleName(temporary);
461 SetError(-103,temporary,NowLine);
462 }
463
464 if(sw){
465 //配列ポインタを引き渡すとき
466 pdi->pParmInfo[i3].type=GetPtrType(pdi->pParmInfo[i3].type,pdi->pParmInfo[i3].u.index);
467 }
468 }
469
470 //名前はダミー(使用しないため)
471 pdi->pParmInfo[i3].name="";
472
473 //構造体の場合はエラーチェック
474 if(pdi->pParmInfo[i3].type==-1) SetError(3,temporary,NowLine);
475 if(pdi->pParmInfo[i3].type==DEF_OBJECT){
476 if(pdi->pParmInfo[i3].bByVal) pdi->pParmInfo[i3].type=DEF_LONG;//SetError(28,temporary,NowLine);
477 }
478
479 //構造体アドレスの空白部
480 while(buffer[i]==' ') i++;
481
482 if(buffer[i]==','){
483 i++;
484 continue;
485 }
486 else if(buffer[i]==')') continue;
487 else{
488 SetError(1,NULL,NowLine);
489 break;
490 }
491 }
492 pdi->ParmNum=i3;
493
494 //戻り値
495 i++;
496 if(buffer[i]==1&&buffer[i+1]==ESC_AS){
497 if(IsFunction==0) SetError(1,NULL,NowLine);
498 i+=2;
499 pdi->ReturnType=GetTypeFixed(buffer+i,&pdi->u.ReturnIndex);
500 if(pdi->ReturnType==-1) SetError(3,buffer+i,NowLine);
501 if(pdi->ReturnType==DEF_OBJECT) SetError(40,NULL,NowLine);
502 }
503 else if(buffer[i]) SetError(1,NULL,NowLine);
504 else pdi->ReturnType=-1;
505
506 pdi->pos=NowLine;
507}
508
509BOOL CompareParameter(PARAMETER_INFO *ppi1,int pi_num1,PARAMETER_INFO *ppi2,int pi_num2){
510 if(pi_num1!=pi_num2) return 1;
511
512 int i;
513 for(i=0;i<pi_num1;i++){
514 if(ppi1[i].type!=ppi2[i].type){
515
516 if(ppi1[i].bByVal==0&&ppi1[i].type==DEF_ANY&&
517 ppi2[i].bByVal==1&&IsPtrType(ppi2[i].type)||
518 ppi1[i].bByVal==1&&IsPtrType(ppi1[i].type)&&
519 ppi2[i].bByVal==0&&ppi2[i].type==DEF_ANY){
520 /* ByRef var As Any
521
522 var As VoidPtr
523 は同等
524 */
525 continue;
526 }
527
528 return 1;
529 }
530 else{
531 if(NATURAL_TYPE(ppi1[i].type)==DEF_OBJECT){
532 if(ppi1[i].u.index!=ppi2[i].u.index) return 1;
533 }
534 }
535 }
536
537 return 0;
538}
539SUBINFO *AddSubData(char *buffer,int NowLine,BOOL bVirtual,CClass *pobj_c,BOOL bStatic){
540 int i,i2,i3,sw;
541 DWORD dwType;
542 char temporary[8192],temp2[VN_SIZE];
543
544 i=1;
545 if(buffer[i]==ESC_SUB) dwType=SUBTYPE_SUB;
546 else if(buffer[i]==ESC_FUNCTION) dwType=SUBTYPE_FUNCTION;
547 else if(buffer[i]==ESC_MACRO) dwType=SUBTYPE_MACRO;
548
549 i++;
550
551 BOOL bExport=0,bCdecl=0;
552 while(1){
553 if(buffer[i]==1&&buffer[i+1]==ESC_EXPORT&&bExport==0){
554 bExport=1;
555
556 i+=2;
557 }
558 else if(buffer[i]==1&&buffer[i+1]==ESC_CDECL&&bCdecl==0){
559 bCdecl=1;
560
561 i+=2;
562 }
563 else break;
564 }
565
566 i2=0;
567 if(buffer[i]==1&&buffer[i+1]==ESC_OPERATOR){
568 if(!pobj_c){
569 SetError(126,NULL,NowLine);
570 return 0;
571 }
572
573 //オペレータの場合
574 temporary[i2++]=buffer[i++];
575 temporary[i2++]=buffer[i++];
576
577 int iCalcId;
578 if(buffer[i]=='='&&buffer[i+1]=='='){
579 iCalcId=CALC_EQUAL;
580 i3=2;
581 }
582 else if(buffer[i]=='='){
583 iCalcId=CALC_SUBSITUATION;
584 i3=1;
585 }
586 else if(buffer[i]=='('){
587 iCalcId=CALC_AS;
588 i3=0;
589 }
590 else if(buffer[i]=='['&&buffer[i+1]==']'&&buffer[i+2]=='='){
591 iCalcId=CALC_ARRAY_SET;
592 i3=3;
593 }
594 else if(buffer[i]=='['&&buffer[i+1]==']'){
595 iCalcId=CALC_ARRAY_GET;
596 i3=2;
597 }
598 else{
599 iCalcId=GetCalcId(buffer+i,&i3);
600 i3++;
601 }
602 if(!iCalcId){
603 SetError(1,NULL,NowLine);
604 return 0;
605 }
606 temporary[i2++]=iCalcId;
607 temporary[i2]=0;
608
609 i+=i3;
610 }
611 else{
612 if(pobj_c){
613 //クラスメンバの場合、デストラクタには~が付くことを考慮
614 if(buffer[i]=='~'){
615 temporary[i2]='~';
616 i++;
617 i2++;
618 }
619 }
620
621 for(;;i++,i2++){
622 if(!IsVariableChar(buffer[i])){
623 temporary[i2]=0;
624 break;
625 }
626 temporary[i2]=buffer[i];
627 }
628 }
629
630 if(dwType==SUBTYPE_MACRO){
631 //大文字に変換
632 CharUpper(temporary);
633
634 //マクロ関数の場合は名前リストに追加
635 extern char **ppMacroNames;
636 extern int MacroNum;
637 ppMacroNames=(char **)HeapReAlloc(hHeap,0,ppMacroNames,(MacroNum+1)*sizeof(char *));
638 ppMacroNames[MacroNum]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
639 lstrcpy(ppMacroNames[MacroNum],temporary);
640 MacroNum++;
641 }
642
643 if(!pobj_c){
644 //クラスメンバ以外の場合のみ
645 //重複チェック
646
647 if(GetDeclareHash(temporary)){
648 SetError(15,temporary,NowLine);
649 return 0;
650 }
651 }
652
653 extern int SubNum;
654 SubNum++;
655
656 SUBINFO *psi;
657 psi=(SUBINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(SUBINFO));
658
659 //クラス名
660 psi->pobj_ParentClass=pobj_c;
661
662 //ID
663 static int id_base=0;
664 psi->id=(id_base++);
665
666 //関数名
667 psi->name=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
668 lstrcpy(psi->name,temporary);
669
670 //ソースコードの位置
671 psi->address=NowLine;
672
673 psi->bExport=bExport;
674 psi->bCdecl=bCdecl;
675 psi->bVirtual=bVirtual;
676 if(bExport) psi->bUse=1;
677 else psi->bUse=0;
678 psi->bCompile=0;
679 psi->bSystem=0;
680
681 psi->dwType=dwType;
682
683
684 if(psi->dwType==SUBTYPE_FUNCTION){
685 ///////////////////
686 // 戻り値を取得
687 ///////////////////
688
689 psi->isReturnRef = false;
690
691 if(pobj_c){
692 if(lstrcmp(psi->name,pobj_c->name)==0||
693 psi->name[0]=='~'){
694 //クラスのコンストラクタ、デストラクタがFunction定義の場合はエラーをだす
695 SetError(115,NULL,NowLine);
696 }
697 }
698
699
700 i2=lstrlen(buffer)-2;
701
702 int sw_as=0;
703 for(;i2>0;i2--){
704 if(buffer[i2]==')') break;
705
706 if(buffer[i2]==1&&buffer[i2+1]==ESC_AS){
707 if( buffer[i2-2] == 1 && buffer[i2-1] == ESC_BYREF ){
708 //参照型
709 psi->isReturnRef = true;
710 }
711
712 i2+=2;
713 i3=0;
714 while(buffer[i2]=='*') temporary[i3++]=buffer[i2++];
715 for(;;i2++,i3++){
716 if(!IsVariableChar(buffer[i2])){
717 temporary[i3]=0;
718 break;
719 }
720 temporary[i3]=buffer[i2];
721 }
722 psi->ReturnType=GetTypeFixed(temporary,&psi->u.ReturnIndex);
723 if(psi->ReturnType==-1) SetError(3,temporary,NowLine);
724
725 sw_as=1;
726 break;
727 }
728 }
729
730 if(!sw_as){
731 SetError(-104,psi->name,NowLine);
732
733 psi->ReturnType=DEF_DOUBLE;
734 }
735 }
736 else{
737 //戻り値なしのSub定義
738 psi->ReturnType=-1;
739 psi->u.ReturnIndex=-1;
740 }
741
742
743
744 psi->pParmInfo=(PARAMETER_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(PARAMETER_INFO)*2);
745 psi->ParmNum=0;
746
747 //パラメータ
748 if(buffer[i]!='('){
749 SetError(1,NULL,NowLine);
750 return 0;
751 }
752 i++;
753 if(buffer[i]!=')'&&pobj_c){
754 //クラスのメンバ関数の場合のみ、デストラクタにパラメータがある場合にエラーをだす
755 if(psi->name[0]=='~'){
756 SetError(114,NULL,NowLine);
757 i=JumpStringInPare(buffer,i);
758 }
759 }
760 while(1){
761 if(buffer[i]==')') break;
762
763 psi->pParmInfo=(PARAMETER_INFO *)HeapReAlloc(hHeap,0,psi->pParmInfo,(psi->ParmNum+1)*sizeof(PARAMETER_INFO));
764
765 //ByVal
766 if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
767 psi->pParmInfo[psi->ParmNum].bByVal=1;
768 i+=2;
769 }
770 else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
771 psi->pParmInfo[psi->ParmNum].bByVal=0;
772 i+=2;
773 }
774 else psi->pParmInfo[psi->ParmNum].bByVal=1;
775
776 //パラメータ名
777 sw=0;
778 for(i2=0;;i++,i2++){
779 if(buffer[i]=='('){
780 if(!sw) sw=1;
781
782 i3=GetStringInPare(temporary+i2,buffer+i);
783 i2+=i3-1;
784 i+=i3-1;
785 continue;
786 }
787 if(buffer[i]=='['){
788 if(!sw) sw=1;
789
790 i3=GetStringInBracket(temporary+i2,buffer+i);
791 i2+=i3-1;
792 i+=i3-1;
793 continue;
794 }
795 if(!IsVariableChar(buffer[i])){
796 temporary[i2]=0;
797 break;
798 }
799 temporary[i2]=buffer[i];
800 }
801 if(sw){
802 //配列パラメータ
803 if(psi->pParmInfo[psi->ParmNum].bByVal) SetError(29,NULL,NowLine);
804 psi->pParmInfo[psi->ParmNum].bArray=1;
805
806 if((temporary[i2-2]=='('&&temporary[i2-1]==')')||
807 (temporary[i2-2]=='['&&temporary[i2-1]==']')){
808 psi->pParmInfo[psi->ParmNum].SubScripts[0]=LONG_MAX;
809 psi->pParmInfo[psi->ParmNum].SubScripts[1]=-1;
810
811 temporary[i2-2]=0;
812 }
813 else{
814 GetArrange(temporary,temp2,psi->pParmInfo[psi->ParmNum].SubScripts);
815 lstrcpy(temporary,temp2);
816 }
817
818 i2=lstrlen(temporary);
819 }
820 else{
821 psi->pParmInfo[psi->ParmNum].bArray=0;
822 psi->pParmInfo[psi->ParmNum].SubScripts[0]=-1;
823 }
824 psi->pParmInfo[psi->ParmNum].name=(char *)HeapAlloc(hHeap,0,i2+1);
825 lstrcpy(psi->pParmInfo[psi->ParmNum].name,temporary);
826
827 //型
828 if(buffer[i]==1&&buffer[i+1]==ESC_AS){
829 i+=2;
830
831 i2=0;
832 while(buffer[i]=='*'){
833 temporary[i2]=buffer[i];
834 i++;
835 i2++;
836 }
837 for(;;i++,i2++){
838 if(!IsVariableChar(buffer[i])){
839 if(buffer[i]==1&&(buffer[i+1]==ESC_FUNCTION||buffer[i+1]==ESC_SUB)){
840 temporary[i2++]=buffer[i++];
841 temporary[i2]=buffer[i];
842 continue;
843 }
844 temporary[i2]=0;
845 break;
846 }
847 temporary[i2]=buffer[i];
848 }
849
850 psi->pParmInfo[psi->ParmNum].type=
851 GetTypeFixed(temporary,&psi->pParmInfo[psi->ParmNum].u.index);
852
853 if(temporary[0]=='*'&&
854 temporary[1]==1&&
855 (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){
856 if(buffer[i]!='('){
857 SetError(10,temporary,NowLine);
858 return 0;
859 }
860 i3=GetStringInPare(temporary+i2,buffer+i);
861 i+=i3;
862 i2+=i3;
863
864 if(temporary[2]==ESC_FUNCTION&&buffer[i]==1&&buffer[i+1]==ESC_AS){
865 temporary[i2++]=buffer[i++];
866 temporary[i2++]=buffer[i++];
867 for(;;i++,i2++){
868 if(!IsVariableChar(buffer[i])){
869 temporary[i2]=0;
870 break;
871 }
872 temporary[i2]=buffer[i];
873 }
874 }
875 }
876 else{
877 //TypeDefをする前のベース型を取得
878 GetOriginalTypeName(temporary);
879 }
880
881 if(psi->pParmInfo[psi->ParmNum].type==-1){
882 SetError(3,temporary,NowLine);
883 psi->pParmInfo[psi->ParmNum].type=DEF_PTR_VOID;
884 }
885
886 /*未完成(構造体パラメータを値参照として渡してよいものか!?)
887 if(psi->pParmInfo[psi->ParmNum].type==DEF_OBJECT){
888 if(psi->pParmInfo[psi->ParmNum].bByVal) SetError(28,temporary,NowLine);
889 }*/
890 }
891 else{
892 psi->pParmInfo[psi->ParmNum].type=GetTypeFromSimpleName(temporary);
893 SetError(-103,temporary,NowLine);
894 }
895
896 if(psi->pParmInfo[psi->ParmNum].type==DEF_PTR_PROC){
897 //関数ポインタの場合
898 psi->pParmInfo[psi->ParmNum].u.index=AddProcPtrInfo(temporary+3,temporary[2]);
899 }
900
901 //パラメータの数を更新
902 psi->ParmNum++;
903
904 if(buffer[i]==','){
905 i++;
906 continue;
907 }
908 else if(buffer[i]==')') continue;
909 else{
910 SetError(1,NULL,NowLine);
911 return 0;
912 }
913 }
914 psi->SecondParmNum=psi->ParmNum;
915 i++;
916 if(buffer[i]=='('){
917 i++;
918 while(1){
919 if(buffer[i]==')') break;
920
921 psi->pParmInfo=(PARAMETER_INFO *)HeapReAlloc(hHeap,0,psi->pParmInfo,(psi->ParmNum+1)*sizeof(PARAMETER_INFO));
922
923 //ByVal
924 if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
925 psi->pParmInfo[psi->ParmNum].bByVal=1;
926 i+=2;
927 }
928 else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
929 psi->pParmInfo[psi->ParmNum].bByVal=0;
930 i+=2;
931 }
932 else psi->pParmInfo[psi->ParmNum].bByVal=1;
933
934 //パラメータ名
935 sw=0;
936 for(i2=0;;i++,i2++){
937 if(buffer[i]=='('){
938 if(!sw) sw=1;
939
940 i3=GetStringInPare(temporary+i2,buffer+i);
941 i2+=i3-1;
942 i+=i3-1;
943 continue;
944 }
945 if(buffer[i]=='['){
946 if(!sw) sw=1;
947
948 i3=GetStringInBracket(temporary+i2,buffer+i);
949 i2+=i3-1;
950 i+=i3-1;
951 continue;
952 }
953 if(!IsVariableChar(buffer[i])){
954 temporary[i2]=0;
955 break;
956 }
957 temporary[i2]=buffer[i];
958 }
959 if(sw){
960 //配列パラメータ
961 if(psi->pParmInfo[psi->ParmNum].bByVal) SetError(29,NULL,NowLine);
962 psi->pParmInfo[psi->ParmNum].bArray=1;
963
964 if((temporary[i2-2]=='('&&temporary[i2-1]==')')||
965 (temporary[i2-2]=='['&&temporary[i2-1]==']')){
966 psi->pParmInfo[psi->ParmNum].SubScripts[0]=LONG_MAX;
967 psi->pParmInfo[psi->ParmNum].SubScripts[1]=-1;
968
969 temporary[i2-2]=0;
970 }
971 else{
972 GetArrange(temporary,temp2,psi->pParmInfo[psi->ParmNum].SubScripts);
973 lstrcpy(temporary,temp2);
974 }
975
976 i2=lstrlen(temporary);
977 }
978 else{
979 psi->pParmInfo[psi->ParmNum].bArray=0;
980 psi->pParmInfo[psi->ParmNum].SubScripts[0]=-1;
981 }
982 psi->pParmInfo[psi->ParmNum].name=(char *)HeapAlloc(hHeap,0,i2+1);
983 lstrcpy(psi->pParmInfo[psi->ParmNum].name,temporary);
984
985 //型
986 if(buffer[i]==1&&buffer[i+1]==ESC_AS){
987 i+=2;
988 i2=0;
989 while(buffer[i]=='*'){
990 temporary[i2]=buffer[i];
991 i++;
992 i2++;
993 }
994 for(;;i++,i2++){
995 if(!IsVariableChar(buffer[i])){
996 temporary[i2]=0;
997 break;
998 }
999 temporary[i2]=buffer[i];
1000 }
1001 psi->pParmInfo[psi->ParmNum].type=
1002 GetTypeFixed(temporary,&psi->pParmInfo[psi->ParmNum].u.index);
1003 if(psi->pParmInfo[psi->ParmNum].type==-1) SetError(3,temporary,NowLine);
1004 }
1005 else{
1006 psi->pParmInfo[psi->ParmNum].type=GetTypeFromSimpleName(temporary);
1007 SetError(-103,temporary,NowLine);
1008 }
1009
1010 psi->ParmNum++;
1011
1012 if(buffer[i]==','){
1013 i++;
1014 continue;
1015 }
1016 else if(buffer[i]==')') continue;
1017 else{
1018 SetError(1,NULL,NowLine);
1019 return 0;
1020 }
1021 }
1022 i++;
1023 }
1024
1025 //リアルパラメータ領域を取得(_System_LocalThis、_System_ReturnValueを考慮して2つだけ多く確保する)
1026 psi->pRealParmInfo=(PARAMETER_INFO *)HeapAlloc(hHeap,0,(psi->ParmNum+2)*sizeof(PARAMETER_INFO));
1027 psi->RealParmNum=0;
1028
1029 if(pobj_c&&bStatic==0){
1030 i = psi->RealParmNum;
1031
1032 //オブジェクトメンバの場合は、第一パラメータを_System_LocalThis引き渡し用として利用
1033 psi->pRealParmInfo[i].name = "_System_LocalThis";
1034 psi->pRealParmInfo[i].type=DEF_PTR_VOID;
1035 psi->pRealParmInfo[i].u.index=-1;
1036 psi->pRealParmInfo[i].bByVal=1;
1037 psi->pRealParmInfo[i].bArray=0;
1038 psi->pRealParmInfo[i].SubScripts[0]=-1;
1039
1040 psi->RealParmNum++;
1041 }
1042
1043 if(psi->ReturnType==DEF_OBJECT && psi->isReturnRef == false){
1044 i = psi->RealParmNum;
1045
1046 //実体オブジェクトを戻り値として持つ場合
1047 //※第一パラメータ(Thisポインタありの場合は第二パラメータ)を戻り値用の参照宣言にする
1048
1049 if(psi->name[0]==1&&psi->name[1]==ESC_OPERATOR)
1050 psi->pRealParmInfo[i].name="_System_ReturnValue";
1051 else psi->pRealParmInfo[i].name=psi->name;
1052 psi->pRealParmInfo[i].type=DEF_OBJECT;
1053 psi->pRealParmInfo[i].u.index=psi->u.ReturnIndex;
1054 psi->pRealParmInfo[i].bByVal=0;
1055 psi->pRealParmInfo[i].bArray=0;
1056 psi->pRealParmInfo[i].SubScripts[0]=-1;
1057
1058 psi->RealParmNum++;
1059 }
1060
1061 //パラメータをコピー
1062 for( i = 0; i < psi->ParmNum; i++, psi->RealParmNum++ ){
1063 psi->pRealParmInfo[psi->RealParmNum]=psi->pParmInfo[i];
1064 }
1065
1066
1067 /////////////////////////////////
1068 // ハッシュデータに追加
1069 /////////////////////////////////
1070
1071 int key;
1072 key=hash_default(psi->name);
1073
1074 extern SUBINFO **ppSubHash;
1075 if(ppSubHash[key]){
1076 SUBINFO *psi2;
1077 psi2=ppSubHash[key];
1078 while(1){
1079 if(pobj_c==psi2->pobj_ParentClass){
1080 //重複エラーチェックを行う
1081 if(lstrcmp(psi2->name,psi->name)==0){
1082 if(CompareParameter(psi2->pParmInfo,psi2->ParmNum,psi->pParmInfo,psi->ParmNum)==0){
1083 SetError(15,psi->name,NowLine);
1084 return 0;
1085 }
1086 }
1087 }
1088
1089 if(psi2->pNextData==0) break;
1090 psi2=psi2->pNextData;
1091 }
1092 psi2->pNextData=psi;
1093 }
1094 else{
1095 ppSubHash[key]=psi;
1096 }
1097
1098 return psi;
1099}
1100
1101void GetSubInfo(void){ //サブルーチン情報を取得
1102 extern HANDLE hHeap;
1103 extern char *basbuf;
1104 int i,i2,i3;
1105 char temporary[8192];
1106
1107 //Declare(DLL関数)情報を初期化
1108 extern DECLAREINFO **ppDeclareHash;
1109 ppDeclareHash=(DECLAREINFO **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(DECLAREINFO *));
1110
1111 //サブルーチン(ユーザー定義)情報を初期化
1112 extern SUBINFO **ppSubHash;
1113 extern int SubNum;
1114 ppSubHash=(SUBINFO **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(SUBINFO *));
1115 SubNum=0;
1116
1117 //マクロ関数の名前リストを初期化
1118 extern char **ppMacroNames;
1119 extern int MacroNum;
1120 ppMacroNames=(char **)HeapAlloc(hHeap,0,1);
1121 MacroNum=0;
1122
1123 i=-1;
1124 while(1){
1125 i++;
1126
1127 if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_INTERFACE)){
1128 /* Class ~ End Class
1129 Interface ~ End Interface
1130 を飛び越す */
1131 i3=GetEndXXXCommand(basbuf[i+1]);
1132 for(i+=2,i2=0;;i++,i2++){
1133 if(basbuf[i]=='\0') break;
1134 if(basbuf[i]==1&&basbuf[i+1]==(char)i3){
1135 i++;
1136 break;
1137 }
1138 }
1139 if(basbuf[i]=='\0') break;
1140 continue;
1141 }
1142
1143 if(basbuf[i]==1&&basbuf[i+1]==ESC_DECLARE){
1144 for(i+=2,i2=0;;i2++,i++){
1145 if(basbuf[i]=='\n'){
1146 temporary[i2]=0;
1147 break;
1148 }
1149 temporary[i2]=basbuf[i];
1150 if(basbuf[i]=='\0') break;
1151 }
1152 AddDeclareData(temporary,i);
1153
1154 continue;
1155 }
1156 if(basbuf[i]==1&&(basbuf[i+1]==ESC_SUB||basbuf[i+1]==ESC_FUNCTION||basbuf[i+1]==ESC_MACRO)){
1157 for(i2=0;;i2++,i++){
1158 if(IsCommandDelimitation(basbuf[i])){
1159 temporary[i2]=0;
1160 break;
1161 }
1162 temporary[i2]=basbuf[i];
1163 if(basbuf[i]=='\0') break;
1164 }
1165 AddSubData(temporary,i,0,0);
1166
1167 continue;
1168 }
1169
1170 //次の行
1171 for(;;i++){
1172 if(IsCommandDelimitation(basbuf[i])) break;
1173 }
1174 if(basbuf[i]=='\0') break;
1175 }
1176
1177 ////////////
1178 // 特殊関数
1179 ////////////
1180
1181 sprintf(temporary,"%c%c_allrem()",1,ESC_SUB);
1182 AddSubData(temporary,0,0,0);
1183
1184 sprintf(temporary,"%c%c_aullrem()",1,ESC_SUB);
1185 AddSubData(temporary,0,0,0);
1186
1187 sprintf(temporary,"%c%c_allmul()",1,ESC_SUB);
1188 AddSubData(temporary,0,0,0);
1189
1190 sprintf(temporary,"%c%c_alldiv()",1,ESC_SUB);
1191 AddSubData(temporary,0,0,0);
1192
1193 sprintf(temporary,"%c%c_aulldiv()",1,ESC_SUB);
1194 AddSubData(temporary,0,0,0);
1195
1196 sprintf(temporary,"%c%c_allshl()",1,ESC_SUB);
1197 AddSubData(temporary,0,0,0);
1198
1199 sprintf(temporary,"%c%c_allshr()",1,ESC_SUB);
1200 AddSubData(temporary,0,0,0);
1201
1202 sprintf(temporary,"%c%c_aullshr()",1,ESC_SUB);
1203 AddSubData(temporary,0,0,0);
1204
1205 sprintf(temporary,"%c%c_System_InitStaticLocalVariables()",1,ESC_SUB);
1206 AddSubData(temporary,0,0,0);
1207}
1208void Delete_si(SUBINFO *psi){
1209 int i2;
1210
1211 for(i2=0;i2<psi->ParmNum;i2++){
1212 HeapDefaultFree(psi->pParmInfo[i2].name);
1213 }
1214 HeapDefaultFree(psi->pRealParmInfo);
1215 if(psi->pParmInfo) HeapDefaultFree(psi->pParmInfo);
1216 psi->pRealParmInfo=0;
1217 psi->pParmInfo=0;
1218
1219 if(psi->pNextData) Delete_si(psi->pNextData);
1220
1221 HeapDefaultFree(psi->name);
1222 HeapDefaultFree(psi);
1223}
1224void DeleteSubInfo(SUBINFO **ppSubHash,char **ppMacroNames,int MacroNum){ //サブルーチン情報のメモリ解放
1225 int i;
1226 for(i=0;i<MAX_HASH;i++){
1227 if(!ppSubHash[i]) continue;
1228
1229 Delete_si(ppSubHash[i]);
1230 }
1231 HeapDefaultFree(ppSubHash);
1232
1233 //マクロの名前リスト
1234 if(ppMacroNames){
1235 for(i=0;i<MacroNum;i++){
1236 HeapDefaultFree(ppMacroNames[i]);
1237 }
1238 HeapDefaultFree(ppMacroNames);
1239 }
1240}
1241void Delete_di(DECLAREINFO *pdi){
1242 if(pdi->pParmInfo) HeapDefaultFree(pdi->pParmInfo);
1243
1244 HeapDefaultFree(pdi->name);
1245 if(pdi->file) HeapDefaultFree(pdi->file);
1246 if(pdi->alias) HeapDefaultFree(pdi->alias);
1247
1248 if(pdi->pNextData) Delete_di(pdi->pNextData);
1249
1250 HeapDefaultFree(pdi);
1251}
1252void DeleteDeclareInfo(void){
1253 //DLL情報を解放
1254 extern DECLAREINFO **ppDeclareHash;
1255 int i;
1256 for(i=0;i<MAX_HASH;i++){
1257 if(!ppDeclareHash[i]) continue;
1258
1259 Delete_di(ppDeclareHash[i]);
1260 }
1261 HeapDefaultFree(ppDeclareHash);
1262}
1263
1264
1265
1266///////////////////////
1267// 関数ポインタの管理
1268///////////////////////
1269
1270int AddProcPtrInfo(char *buffer,DWORD dwProcType){
1271 extern HANDLE hHeap;
1272 extern int cp;
1273 extern PROCPTRINFO *pProcPtrInfo;
1274 extern int ProcPtrInfoNum;
1275 int i,i2,i3,sw;
1276 PROCPTRINFO *pi;
1277 char temporary[VN_SIZE],temp2[VN_SIZE];
1278
1279 pProcPtrInfo=(PROCPTRINFO *)HeapReAlloc(hHeap,0,pProcPtrInfo,(ProcPtrInfoNum+1)*sizeof(PROCPTRINFO));
1280 pi=&pProcPtrInfo[ProcPtrInfoNum];
1281 ProcPtrInfoNum++;
1282
1283 pi->pParmInfo=(PARAMETER_INFO *)HeapAlloc(hHeap,0,1);
1284 pi->ParmNum=0;
1285
1286 //buffer[0]は'('となっている
1287 i=1;
1288
1289 while(1){
1290 if(buffer[i]==')') break;
1291
1292 pi->pParmInfo=(PARAMETER_INFO *)HeapReAlloc(hHeap,0,pi->pParmInfo,(pi->ParmNum+1)*sizeof(PARAMETER_INFO));
1293
1294 //ByVal
1295 if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
1296 pi->pParmInfo[pi->ParmNum].bByVal=1;
1297 i+=2;
1298 }
1299 else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
1300 pi->pParmInfo[pi->ParmNum].bByVal=0;
1301 i+=2;
1302 }
1303 else pi->pParmInfo[pi->ParmNum].bByVal=1;
1304
1305 //パラメータ名
1306 sw=0;
1307 for(i2=0;;i++,i2++){
1308 if(buffer[i]=='('){
1309 if(!sw) sw=1;
1310
1311 i3=GetStringInPare(temporary+i2,buffer+i);
1312 i2+=i3-1;
1313 i+=i3-1;
1314 continue;
1315 }
1316 if(buffer[i]=='['){
1317 if(!sw) sw=1;
1318
1319 i3=GetStringInBracket(temporary+i2,buffer+i);
1320 i2+=i3-1;
1321 i+=i3-1;
1322 continue;
1323 }
1324 if(!IsVariableChar(buffer[i])){
1325 temporary[i2]=0;
1326 break;
1327 }
1328 temporary[i2]=buffer[i];
1329 }
1330 pi->pParmInfo[pi->ParmNum].name=0;
1331
1332 if(sw){
1333 //配列パラメータ
1334 if(pi->pParmInfo[pi->ParmNum].bByVal) SetError(29,NULL,cp);
1335 pi->pParmInfo[pi->ParmNum].bArray=1;
1336
1337 if((temporary[i2-2]=='('&&temporary[i2-1]==')')||
1338 (temporary[i2-2]=='['&&temporary[i2-1]==']')){
1339 pi->pParmInfo[pi->ParmNum].SubScripts[0]=LONG_MAX;
1340 pi->pParmInfo[pi->ParmNum].SubScripts[1]=-1;
1341
1342 temporary[i2-2]=0;
1343 }
1344 else{
1345 GetArrange(temporary,temp2,pi->pParmInfo[pi->ParmNum].SubScripts);
1346 lstrcpy(temporary,temp2);
1347 }
1348
1349 i2=lstrlen(temporary);
1350 }
1351 else{
1352 pi->pParmInfo[pi->ParmNum].bArray=0;
1353 pi->pParmInfo[pi->ParmNum].SubScripts[0]=-1;
1354 }
1355
1356 //型
1357 if(buffer[i]==1&&buffer[i+1]==ESC_AS){
1358 i+=2;
1359
1360 i2=0;
1361 while(buffer[i]=='*'){
1362 temporary[i2]=buffer[i];
1363 i++;
1364 i2++;
1365 }
1366 for(;;i++,i2++){
1367 if(!IsVariableChar(buffer[i])){
1368 temporary[i2]=0;
1369 break;
1370 }
1371 temporary[i2]=buffer[i];
1372 }
1373
1374 pi->pParmInfo[pi->ParmNum].type=
1375 GetTypeFixed(temporary,&pi->pParmInfo[pi->ParmNum].u.index);
1376 if(pi->pParmInfo[pi->ParmNum].type==-1){
1377 SetError(3,temporary,cp);
1378 pi->pParmInfo[pi->ParmNum].type=DEF_PTR_VOID;
1379 }
1380 if(pi->pParmInfo[pi->ParmNum].type==DEF_OBJECT){
1381 if(pi->pParmInfo[pi->ParmNum].bByVal) SetError(28,temporary,cp);
1382 }
1383 }
1384 else{
1385 pi->pParmInfo[pi->ParmNum].type=GetTypeFromSimpleName(temporary);
1386 SetError(-103,temporary,cp);
1387 }
1388
1389 pi->ParmNum++;
1390
1391 if(buffer[i]==','){
1392 i++;
1393 continue;
1394 }
1395 else if(buffer[i]==')') continue;
1396 else{
1397 SetError(1,NULL,cp);
1398 return 0;
1399 }
1400 }
1401 i++;
1402
1403 //戻り値
1404 if(dwProcType==ESC_FUNCTION){
1405 if(buffer[i]==1&&buffer[i+1]==ESC_AS){
1406 i+=2;
1407 i2=0;
1408 if(buffer[i]=='*') temporary[i2++]=buffer[i++];
1409 for(;;i++,i2++){
1410 if(!IsVariableChar(buffer[i])){
1411 temporary[i2]=0;
1412 break;
1413 }
1414 temporary[i2]=buffer[i];
1415 }
1416 pi->ReturnType=GetTypeFixed(temporary,&pi->u.ReturnIndex);
1417 if(pi->ReturnType==-1) SetError(3,temporary,cp);
1418 if(pi->ReturnType==DEF_OBJECT) SetError(40,NULL,cp);
1419 }
1420 else pi->ReturnType=DEF_DOUBLE;
1421 }
1422 else pi->ReturnType=-1;
1423
1424 return ProcPtrInfoNum-1;
1425}
1426void DeleteProcPtrInfo(void){
1427 extern PROCPTRINFO *pProcPtrInfo;
1428 extern int ProcPtrInfoNum;
1429 int i;
1430
1431 for(i=0;i<ProcPtrInfoNum;i++){
1432 HeapDefaultFree(pProcPtrInfo[i].pParmInfo);
1433 }
1434
1435 HeapDefaultFree(pProcPtrInfo);
1436}
Note: See TracBrowser for help on using the repository browser.