Changeset 73 in dev for BasicCompiler_Common


Ignore:
Timestamp:
Mar 16, 2007, 11:07:14 PM (17 years ago)
Author:
dai_9181
Message:

Parameterクラスを適用。32bit側は動くようになったので、64bitのほうを調整する。

Location:
BasicCompiler_Common
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/BasicCompiler.h

    r69 r73  
    2424DWORD ImageBase;
    2525INCLUDEFILEINFO IncludeFileInfo;
    26 SUBINFO **ppSubHash;
     26SubInfo **ppSubHash;
    2727int SubNum;
    2828char **ppMacroNames;
  • BasicCompiler_Common/Class.cpp

    r71 r73  
    267267    staticMembers.push_back( member );
    268268}
    269 void CClass::AddMethod( SUBINFO *psi,DWORD dwAccess, bool isConst, BOOL bAbstract, BOOL bVirtual ){
     269void CClass::AddMethod( SubInfo *psi,DWORD dwAccess, bool isConst, BOOL bAbstract, BOOL bVirtual ){
    270270    CMethod *method = new CMethod();
    271271    method->psi = psi;
     
    278278    methods.push_back( method );
    279279}
    280 void CClass::AddStaticMethod(SUBINFO *psi,DWORD dwAccess){
     280void CClass::AddStaticMethod(SubInfo *psi,DWORD dwAccess){
    281281    CMethod *method = new CMethod();
    282282    method->psi=psi;
     
    322322    return 0;
    323323}
    324 CMethod *CClass::GetMethodInfo( SUBINFO *psi ){
     324CMethod *CClass::GetMethodInfo( SubInfo *psi ){
    325325    for( int i=(int)methods.size()-1; i>=0; i-- ){
    326326        if( psi == methods[i]->psi ) return methods[i];
     
    328328    return NULL;
    329329}
    330 CMethod *CClass::GetStaticMethodInfo( SUBINFO *psi ){
     330CMethod *CClass::GetStaticMethodInfo( SubInfo *psi ){
    331331    for( int i=(int)staticMethods.size()-1; i>=0; i-- ){
    332332        if( psi == staticMethods[i]->psi ) return staticMethods[i];
     
    347347}
    348348
    349 void CClass::EnumStaticMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const
     349void CClass::EnumStaticMethod( const char *methodName, std::vector<SubInfo *> &subs ) const
    350350{
    351351    foreach( CMethod *method, staticMethods ){
     
    356356}
    357357
    358 void CClass::EnumMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const
     358void CClass::EnumMethod( const char *methodName, std::vector<SubInfo *> &subs ) const
    359359{
    360360    //オブジェクトのメンバ関数の場合
     
    367367}
    368368
    369 void CClass::EnumMethod( const BYTE idOperatorCalc, std::vector<SUBINFO *> &subs ) const
     369void CClass::EnumMethod( const BYTE idOperatorCalc, std::vector<SubInfo *> &subs ) const
    370370{
    371371    //オブジェクトのメンバ関数の場合
    372372    //※オーバーライドされた関数を先にサーチする必要があるため、バックサーチを行う
    373373    for( int i=(int)methods.size()-1; i>=0; i-- ){
    374         SUBINFO *psi = methods[i]->psi;
     374        SubInfo *psi = methods[i]->psi;
    375375        char *temp = psi->name;
    376376        if(temp[0]==1&&temp[1]==ESC_OPERATOR){
     
    508508
    509509
    510 int CClass::GetFuncNumInVtbl( const SUBINFO *psi ) const
     510int CClass::GetFuncNumInVtbl( const SubInfo *psi ) const
    511511{
    512512    int n = 0;
     
    527527    //////////////////////////////////////
    528528
    529     SUBINFO **ppsi;
    530     ppsi=(SUBINFO **)HeapAlloc(hHeap,0,vtbl_num*sizeof(SUBINFO *));
     529    SubInfo **ppsi;
     530    ppsi=(SubInfo **)HeapAlloc(hHeap,0,vtbl_num*sizeof(SubInfo *));
    531531
    532532    //関数テーブルに値をセット
     
    565565    int i;
    566566    for(i=0;i<vtbl_num;i++){
    567         SUBINFO *psi;
    568         psi=(SUBINFO *)pVtbl[i];
     567        SubInfo *psi;
     568        psi=(SubInfo *)pVtbl[i];
    569569        if(!psi) continue;
    570570        pVtbl[i]=psi->CompileAddress+ImageBase+MemPos_CodeSection;
     
    835835
    836836    //関数ハッシュへ登録
    837     SUBINFO *psi;
     837    SubInfo *psi;
    838838    psi=AddSubData(buffer,NowLine,bVirtual,pobj_c,bStatic);
    839839    if(!psi) return;
     
    849849
    850850        //標準コンストラクタ(引数なし)
    851         if(psi->ParmNum==0) fConstructor=1;
     851        if(psi->params.size()==0) fConstructor=1;
    852852
    853853        //強制的にConst修飾子をつける
     
    894894
    895895        if(lstrcmp(temporary,method->psi->name)==0){
    896             if(CompareParameter(
    897                 method->psi->pParmInfo,method->psi->ParmNum,
    898                 psi->pParmInfo,psi->ParmNum
    899                 )==0){
     896            if( Parameter::Equals( method->psi->params, psi->params ) ){
    900897                //関数名、パラメータ属性が合致したとき
    901898                SetError(15,psi->name,NowLine);
     
    911908    foreach( CMethod *method, pobj_c->methods ){
    912909        if(lstrcmp(temporary,method->psi->name)==0){
    913             if(CompareParameter(
    914                 method->psi->pParmInfo,method->psi->ParmNum,
    915                 psi->pParmInfo,psi->ParmNum
    916                 )==0){
     910            if( Parameter::Equals( method->psi->params, psi->params ) ){
    917911
    918912                if(method->psi->bVirtual){
     
    14441438}
    14451439
    1446 void CDBClass::StartCompile( SUBINFO *psi ){
     1440void CDBClass::StartCompile( SubInfo *psi ){
    14471441    pCompilingClass = psi->pobj_ParentClass;
    14481442    if( pCompilingClass ){
  • BasicCompiler_Common/Class.h

    r71 r73  
    22
    33class CClass;
    4 struct SUBINFO;
     4class SubInfo;
    55
    66//データ型
     
    4848class CMethod{
    4949public:
    50     SUBINFO *psi;
     50    SubInfo *psi;
    5151    DWORD dwAccess;
    5252    BOOL bAbstract;
     
    116116    void AddMember( DWORD dwAccess, bool idConst, bool isRef, char *buffer );
    117117    void AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int NowLine );
    118     void AddMethod( SUBINFO *psi,DWORD dwAccess, bool isConst, BOOL bAbstract, BOOL bVirtual );
    119     void AddStaticMethod(SUBINFO *psi,DWORD dwAccess);
     118    void AddMethod( SubInfo *psi,DWORD dwAccess, bool isConst, BOOL bAbstract, BOOL bVirtual );
     119    void AddStaticMethod(SubInfo *psi,DWORD dwAccess);
    120120
    121121    //重複チェック
     
    124124
    125125    //メソッド取得
    126     CMethod *GetMethodInfo( SUBINFO *psi );
    127     CMethod *GetStaticMethodInfo( SUBINFO *psi );
     126    CMethod *GetMethodInfo( SubInfo *psi );
     127    CMethod *GetStaticMethodInfo( SubInfo *psi );
    128128
    129129    //メソッドの存在を確認
     
    132132
    133133    //メソッドを列挙
    134     void EnumStaticMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const;
    135     void EnumMethod( const char *methodName, std::vector<SUBINFO *> &subs ) const;
    136     void EnumMethod( const BYTE idOperatorCalc, std::vector<SUBINFO *> &subs ) const;
     134    void EnumStaticMethod( const char *methodName, std::vector<SubInfo *> &subs ) const;
     135    void EnumMethod( const char *methodName, std::vector<SubInfo *> &subs ) const;
     136    void EnumMethod( const BYTE idOperatorCalc, std::vector<SubInfo *> &subs ) const;
    137137
    138138    //デフォルト コンストラクタ メソッドを取得
     
    157157    long vtbl_offset;
    158158public:
    159     int GetFuncNumInVtbl( const SUBINFO *psi ) const;
     159    int GetFuncNumInVtbl( const SubInfo *psi ) const;
    160160    LONG_PTR GetVtblGlobalOffset(void);
    161161    void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
     
    245245public:
    246246    //コンパイル開始の通知を受け取るメソッド
    247     void StartCompile( SUBINFO *psi );
     247    void StartCompile( SubInfo *psi );
    248248
    249249    //現在コンパイル中のメソッド情報を取得
  • BasicCompiler_Common/Debug.cpp

    r4 r73  
    224224    SendDlgItemMessage(hMainDlg,IDC_DEBUGLIST,EM_REPLACESEL,0,(LPARAM)buffer);
    225225}
    226 SUBINFO *GetSubFromObp(ULONG_PTR pos){
    227     extern SUBINFO **ppSubHash;
    228     SUBINFO *psi;
     226SubInfo *GetSubFromObp(ULONG_PTR pos){
     227    extern SubInfo **ppSubHash;
     228    SubInfo *psi;
    229229    int i2;
    230230
     
    447447    pobj_dti=new CDebugThreadInfo();
    448448
    449     SUBINFO *psi;
     449    SubInfo *psi;
    450450
    451451    extern DWORD dwStepRun;
     
    681681                        if(!bRet) MessageBox(hMainDlg,"プロセスメモリーの読み込みに失敗","error",MB_OK);
    682682
    683                         extern SUBINFO *pSub_DebugSys_EndProc;
     683                        extern SubInfo *pSub_DebugSys_EndProc;
    684684                        if((BYTE)temporary[0]==0xE8&&
    685685                            *((long *)(temporary+1))+5==(long)rva_to_real(pSub_DebugSys_EndProc->CompileAddress)-(long)EIP_RIP(Context)){
  • BasicCompiler_Common/DebugMiddleFile.cpp

    r64 r73  
    213213
    214214    //プロシージャ情報
    215     extern SUBINFO **ppSubHash;
     215    extern SubInfo **ppSubHash;
    216216    extern int SubNum;
    217     SUBINFO *psi;
     217    SubInfo *psi;
    218218    *(long *)(buffer+i2)=SubNum;
    219219    i2+=sizeof(long);
     
    585585
    586586    //プロシージャ情報
    587     SUBINFO *psi;
     587    SubInfo *psi;
    588588    SubNum=*(long *)(buffer+i2);
    589589    i2+=sizeof(long);
    590     ppSubHash=(SUBINFO **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(SUBINFO *));
     590    ppSubHash=(SubInfo **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(SubInfo *));
    591591    for(i3=0;i3<SubNum;i3++){
    592         psi=(SUBINFO *)HeapAlloc(hHeap,0,sizeof(SUBINFO));
     592        psi = new SubInfo();
    593593        psi->pNextData=0;
    594594
     
    618618        i2+=sizeof(long);
    619619
    620         psi->ParmNum=0;
    621         psi->pParmInfo=0;
    622         psi->RealParmNum=0;
    623         psi->pRealParmInfo=0;
    624620        psi->bCompile=1;
    625621
     
    677673        i4=hash_default(psi->name);
    678674
    679         SUBINFO *psi2;
     675        SubInfo *psi2;
    680676        if(ppSubHash[i4]){
    681677            psi2=ppSubHash[i4];
     
    804800
    805801
    806     extern SUBINFO **ppSubHash;
     802    extern SubInfo **ppSubHash;
    807803    ppSubHash=this->ppSubHash;
    808804    pSub_DebugSys_EndProc=GetSubHash("_DebugSys_EndProc");
     
    973969    extern char **ppMacroNames;
    974970    ppMacroNames=0;
    975     extern SUBINFO **ppSubHash;
     971    extern SubInfo **ppSubHash;
    976972    extern int SubNum;
    977973    ppSubHash=this->ppSubHash;
    978974    SubNum=this->SubNum;
    979975
    980     extern SUBINFO *pSub_DebugSys_EndProc;
     976    extern SubInfo *pSub_DebugSys_EndProc;
    981977    pSub_DebugSys_EndProc=this->pSub_DebugSys_EndProc;
    982978
     
    998994
    999995    //ローカル変数に関する情報を解放
    1000     SUBINFO *psi;
     996    SubInfo *psi;
    1001997    for(i2=0;i2<MAX_HASH;i2++){
    1002998        psi=ppSubHash[i2];
  • BasicCompiler_Common/DebugSection.h

    r15 r73  
    4949
    5050    //プロシージャ
    51     SUBINFO **ppSubHash;
     51    SubInfo **ppSubHash;
    5252    int SubNum;
    5353
    54     SUBINFO *pSub_DebugSys_EndProc;
     54    SubInfo *pSub_DebugSys_EndProc;
    5555
    5656    //ネイティブコードバッファ
  • BasicCompiler_Common/LexicalScoping.cpp

    r64 r73  
    226226
    227227            //call free
    228             extern SUBINFO *pSub_free;
     228            extern SubInfo *pSub_free;
    229229            op_call(pSub_free);
    230230
  • BasicCompiler_Common/MakeExe.cpp

    r15 r73  
    223223
    224224    //ローカル変数に関する情報を解放
    225     extern SUBINFO **ppSubHash;
    226     SUBINFO *psi;
     225    extern SubInfo **ppSubHash;
     226    SubInfo *psi;
    227227    for(i2=0;i2<MAX_HASH;i2++){
    228228        psi=ppSubHash[i2];
     
    238238
    239239    //サブルーチン(ユーザー定義)情報のメモリ解放
    240     extern SUBINFO **ppSubHash;
     240    extern SubInfo **ppSubHash;
    241241    extern char **ppMacroNames;
    242242    extern int MacroNum;
  • BasicCompiler_Common/NumOpe_GetType.cpp

    r69 r73  
    193193    pobj_c=(CClass *)index_stack[sp-2];
    194194
    195     std::vector<SUBINFO *> subs;
     195    std::vector<SubInfo *> subs;
    196196    pobj_c->EnumMethod( idCalc, subs );
    197197    if( subs.size() == 0 ){
     
    230230    if(idCalc==CALC_EQUAL) lstrcpy(temporary,"==");
    231231    else GetCalcName(idCalc,temporary);
    232     SUBINFO *psi;
     232    SubInfo *psi;
    233233    psi=OverloadSolution(temporary,subs,ppi,iParmNum,pBaseTypeInfo);
    234234
     
    240240    else{
    241241        //オーバーロードされていないが、パラメータ個数が一致しないとき
    242         if(iParmNum!=psi->ParmNum){
     242        if(iParmNum!=psi->params.size()){
    243243            HeapDefaultFree(ppi);
    244244            return 0;
     
    299299}
    300300
    301 int NumOpe_GetType(char *Command,TYPEINFO *pBaseType,LONG_PTR *plpIndex){
     301int NumOpe_GetType_Old( const char *Command,TYPEINFO *pBaseType,LONG_PTR *plpIndex){
    302302    extern int cp;
    303303    int i,i2,i3,i4;
     
    454454
    455455                            //マクロ関数の場合
    456                             i2=NumOpe_GetType(temp3,NULL,&index_stack[sp]);
     456                            i2=NumOpe_GetType_Old(temp3,NULL,&index_stack[sp]);
    457457
    458458                            if(!IS_LITERAL(index_stack[sp])){
     
    740740    return RetType;
    741741}
     742
     743bool NumOpe_GetType( const char *expression, const Type &baseType, Type &resultType ){
     744    TYPEINFO baseTypeInfo = {
     745        baseType.GetBasicType(),
     746        baseType.GetIndex()
     747    };
     748    LONG_PTR lpIndex;
     749    int basicType = NumOpe_GetType_Old( expression,
     750        baseType.IsNull() ? NULL:&baseTypeInfo,
     751        &lpIndex );
     752
     753    resultType.SetBasicType( basicType );
     754    resultType.SetIndex( lpIndex );
     755
     756    return ( basicType != -1 );
     757}
  • BasicCompiler_Common/Object.cpp

    r63 r73  
    1919    pobj_c=(CClass *)TypeInfo.u.lpIndex;
    2020
    21     SUBINFO *psi;
     21    SubInfo *psi;
    2222    psi=GetMethodHash(ObjectName,pobj_c->name,Parameter);
    2323    if(!psi){
  • BasicCompiler_Common/Overload.cpp

    r71 r73  
    77#endif
    88
    9 SUBINFO *OverloadSolutionWithStrParam(
     9SubInfo *OverloadSolutionWithStrParam(
    1010    const char *name,
    11     std::vector<SUBINFO *> &subs,
     11    std::vector<SubInfo *> &subs,
    1212    const char *Parameter,
    1313    const char *ObjectName,
     
    3737*/
    3838        //パラメータオブジェクトを生成
     39        if(lstrcmp(Parameter,"\"test\"")==0){
     40            int i=0;
     41        }
    3942        pobj_parameter=new ParamImpl(Parameter);
    4043        if(pReturnTypeInfo) pobj_parameter->SetReturnType(pReturnTypeInfo);
    4144
    4245
    43         SUBINFO *psi;
     46        SubInfo *psi;
    4447        psi=pobj_parameter->OverloadSolution(name,subs);
    4548
     
    5255}
    5356
    54 SUBINFO *OverloadSolution(
     57SubInfo *OverloadSolution(
    5558    const char *name,
    56     std::vector<SUBINFO *> &subs,
     59    std::vector<SubInfo *> &subs,
    5760    const PARAMETER_INFO *ppi,
    5861    const int ParmNum,
     
    6871        if(pReturnTypeInfo) pobj_Parameter->SetReturnType(pReturnTypeInfo);
    6972
    70         SUBINFO *psi;
     73        SubInfo *psi;
    7174        psi=pobj_Parameter->OverloadSolution(name,subs);
    7275
  • BasicCompiler_Common/PESchedule.cpp

    r44 r73  
    220220
    221221CSubAddrSchedule::CSubAddrSchedule(){
    222     ppsi=(SUBINFO **)HeapAlloc(hHeap,0,1);
     222    ppsi=(SubInfo **)HeapAlloc(hHeap,0,1);
    223223    pbCall=(BOOL *)HeapAlloc(hHeap,0,1);
    224224}
     
    228228}
    229229
    230 void CSubAddrSchedule::add(SUBINFO *psi,BOOL bCall){
     230void CSubAddrSchedule::add(SubInfo *psi,BOOL bCall){
    231231    if(!psi) return;
    232232
    233     ppsi=(SUBINFO **)HeapReAlloc(hHeap,0,ppsi,(num+1)*sizeof(SUBINFO *));
     233    ppsi=(SubInfo **)HeapReAlloc(hHeap,0,ppsi,(num+1)*sizeof(SubInfo *));
    234234    ppsi[num]=psi;
    235235    pbCall=(BOOL *)HeapReAlloc(hHeap,0,pbCall,(num+1)*sizeof(BOOL));
     
    282282CTempSchedule *pobj_TempSchedule;
    283283
     284
  • BasicCompiler_Common/PESchedule.h

    r34 r73  
    7979class CSubAddrSchedule:public CSchedule{
    8080public:
    81     SUBINFO **ppsi;
     81    SubInfo **ppsi;
    8282    BOOL *pbCall;
    8383
     
    8585    ~CSubAddrSchedule();
    8686
    87     void add(SUBINFO *psi,BOOL bCall);
     87    void add(SubInfo *psi,BOOL bCall);
    8888};
    8989extern CSubAddrSchedule *pobj_SubAddrSchedule;
  • BasicCompiler_Common/ParamImpl.cpp

    r71 r73  
    7373    ReturnTypeInfo.u.lpIndex=-1;
    7474}
     75ParamImpl::ParamImpl(const Parameters &params){
     76    int count = 0;
     77    foreach( Parameter *pParam, params ){
     78        types[count].type = pParam->GetBasicType();
     79        types[count].u.lpIndex = pParam->GetIndex();
     80        count++;
     81    }
     82    this->ParmsNum=params.size();
     83
     84    ReturnTypeInfo.type=DEF_NON;
     85    ReturnTypeInfo.u.lpIndex=-1;
     86}
    7587ParamImpl::~ParamImpl(){
    7688    int i2;
     
    88100}
    89101
    90 BOOL ParamImpl::_overload_check(PARAMETER_INFO *ppi,int pi_num,TYPEINFO *pReturnTypeInfo,int overload_level){
     102BOOL ParamImpl::_overload_check( Parameters &params,TYPEINFO *pReturnTypeInfo,int overload_level){
    91103    //パラメータを識別してオーバーロードを解決
    92104
    93105    //パラメータの個数が不一致の場合
    94     if(pi_num!=ParmsNum) return 0;
    95 
    96     int i,type;
    97     LONG_PTR lpIndex;
    98     for(i=0;i<pi_num;i++){
     106    int max = (int)params.size();
     107    if(max!=ParmsNum) return 0;
     108
     109    Type argType;
     110    for(int i=0;i<max;i++){
     111        Parameter &param = *params[i];
     112
    99113        if(Parms[i]){
    100             TYPEINFO BaseType={ppi[i].type,ppi[i].u.index};
    101             type=NumOpe_GetType(Parms[i],
    102                 (overload_level==OVERLOAD_LEVEL0) ? NULL : &BaseType,
    103                 &lpIndex);
     114            Type nullParam( DEF_NON );
     115
     116            NumOpe_GetType(Parms[i],
     117                (overload_level==OVERLOAD_LEVEL0)? nullParam : param,
     118                argType);
    104119        }
    105120        else{
    106             type=types[i].type;
    107             lpIndex=types[i].u.lpIndex;
    108         }
    109 
    110         if(type!=ppi[i].type){
     121            argType.SetType( types[i].type, types[i].u.lpIndex );
     122        }
     123
     124        if(argType.GetBasicType()!=param.GetBasicType()){
    111125            if(overload_level==OVERLOAD_LEVEL1 || overload_level == OVERLOAD_LEVEL0){
    112126                return 0;
     
    114128            else if(overload_level==OVERLOAD_LEVEL2){
    115129                if(!(
    116                     IsWholeNumberType(type)&&IsWholeNumberType(ppi[i].type)||
    117                     IsRealNumberType(type)&&IsRealNumberType(ppi[i].type)
     130                    IsWholeNumberType(argType.GetBasicType())&&IsWholeNumberType(param.GetBasicType())||
     131                    IsRealNumberType(argType.GetBasicType())&&IsRealNumberType(param.GetBasicType())
    118132                    )) return 0;
    119133            }
    120134            else if(overload_level==OVERLOAD_LEVEL3){
    121                 if(type==DEF_OBJECT||ppi[i].type==DEF_OBJECT) return 0;
     135                if(argType.GetBasicType()==DEF_OBJECT||param.GetBasicType()==DEF_OBJECT) return 0;
    122136            }
    123137        }
    124138        else{
    125             if(NATURAL_TYPE(type)==DEF_OBJECT || NATURAL_TYPE(type)==DEF_STRUCT){
    126                 if(lpIndex!=ppi[i].u.index) return 0;
     139            if(NATURAL_TYPE(argType.GetBasicType())==DEF_OBJECT || NATURAL_TYPE(argType.GetBasicType())==DEF_STRUCT){
     140                if(argType.GetIndex()!=param.GetIndex()) return 0;
    127141            }
    128142        }
     
    143157}
    144158
    145 SUBINFO *ParamImpl::OverloadSolutionWithReturnType( const char *name, std::vector<SUBINFO *> &subs ){
     159SubInfo *ParamImpl::OverloadSolutionWithReturnType( const char *name, std::vector<SubInfo *> &subs ){
    146160    int sw=0;
    147     SUBINFO *psi;
     161    SubInfo *psi;
    148162    psi=0;
    149163
    150164    for( int level=OVERLOAD_MIN_LEVEL; level<=OVERLOAD_MAX_LEVEL; level++ ){
    151         foreach( SUBINFO *temp_psi, subs ){
     165        foreach( SubInfo *temp_psi, subs ){
    152166
    153167            TYPEINFO ReturnTypeInfo;
     
    156170
    157171            //エラーチェック
    158             if(_overload_check(temp_psi->pParmInfo,temp_psi->ParmNum,&ReturnTypeInfo,level)){
     172            if(_overload_check(temp_psi->params,&ReturnTypeInfo,level)){
    159173                if(sw){
    160174                    SetError(52,name,cp);
     
    178192    return psi;
    179193}
    180 SUBINFO *ParamImpl::OverloadSolution( const char *name, std::vector<SUBINFO *> &subs ){
     194SubInfo *ParamImpl::OverloadSolution( const char *name, std::vector<SubInfo *> &subs ){
    181195    int sw=0;
    182     SUBINFO *psi;
     196    SubInfo *psi;
    183197    psi=0;
    184198
    185199    for( int level=OVERLOAD_MIN_LEVEL; level<=OVERLOAD_MAX_LEVEL; level++ ){
    186200
    187         foreach( SUBINFO *temp_psi, subs ){
     201        foreach( SubInfo *temp_psi, subs ){
    188202
    189203            //エラーチェック
    190             if(_overload_check(temp_psi->pParmInfo,temp_psi->ParmNum,NULL,level)){
     204            if(_overload_check(temp_psi->params,NULL,level)){
    191205                if(sw){
    192206                    return OverloadSolutionWithReturnType(name,subs);
     
    202216
    203217    if(!sw){
    204         SUBINFO *temp_psi;
     218        SubInfo *temp_psi;
    205219        foreach( temp_psi, subs ){
    206220
    207221            //エラーチェック
    208             if(temp_psi->ParmNum==this->ParmsNum){
     222            if(temp_psi->params.size()==this->ParmsNum){
    209223                if(sw){
    210224                    sw=0;
     
    258272    return 1;
    259273}
     274bool ParamImpl::ErrorCheck( const char *procName, const Parameters &params, int SecondParmNum ){
     275    if(ParmsNum>(int)params.size()){
     276        if(params[params.size()-1]->GetBasicType()!=DEF_ELLIPSE){
     277            //パラメータが多すぎるとき
     278            SetError(10,procName,cp);
     279            return false;
     280        }
     281    }
     282    else if(ParmsNum<(int)params.size()){
     283        if(ParmsNum<SecondParmNum){
     284            if(params[ParmsNum]->GetBasicType()==DEF_ELLIPSE){
     285                return true;
     286            }
     287
     288            //パラメータが少なすぎるとき
     289            SetError(10,procName,cp);
     290            return false;
     291        }
     292
     293        //省略パラメータに "0" を指定する
     294        for(;ParmsNum < (int)params.size();ParmsNum++){
     295            extern HANDLE hHeap;
     296            char temporary[64];
     297            if(params[ParmsNum]->IsRef() == false) lstrcpy(temporary,"0");
     298            else sprintf(temporary,"%c%c0",1,ESC_BYVAL);
     299            Parms[ParmsNum]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
     300            lstrcpy(Parms[ParmsNum],temporary);
     301        }
     302    }
     303
     304    return true;
     305}
    260306
    261307void ParamImpl::MacroParameterSupport(PARAMETER_INFO *ppi){
    262     int i;
    263     for(i=0;i<ParmsNum;i++){
     308    for(int i=0;i<ParmsNum;i++){
    264309        if(Parms[i][0]=='\0'){
    265310            extern HANDLE hHeap;
     
    273318    }
    274319}
     320void ParamImpl::MacroParameterSupport( const Parameters &params ){
     321    for(int i=0;i<ParmsNum;i++){
     322        if(Parms[i][0]=='\0'){
     323            extern HANDLE hHeap;
     324            char temporary[64];
     325            if( params[i]->IsRef() == false ) lstrcpy(temporary,"0");
     326            else sprintf(temporary,"%c%c0",1,ESC_BYVAL);
     327            HeapDefaultFree(Parms[i]);
     328            Parms[i]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
     329            lstrcpy(Parms[i],temporary);
     330        }
     331    }
     332}
  • BasicCompiler_Common/Parameter.h

    r71 r73  
    55
    66class Parameter;
    7 typedef vector<Parameter> Parameters;
     7typedef vector<Parameter *> Parameters;
    88
    99class Parameter : public Type
     
    1616public:
    1717    Parameter( const string &varName, const Type &type, bool isRef = false ):
    18         Type( type )
     18        Type( type ),
     19        varName( varName ),
     20        isRef( isRef ),
     21        isArray( false )
    1922    {
    20         this->varName = varName;
    21         this->isRef = isRef;
    22         isArray = false;
     23        subScripts[0] = -1;
     24    }
     25    Parameter( const Parameter &param ):
     26        Type( param ),
     27        varName( param.varName ),
     28        isRef( param.isRef ),
     29        isArray( false )
     30    {
     31        subScripts[0] = -1;
     32        if( param.isArray ){
     33            SetArray( param.subScripts );
     34        }
    2335    }
    2436    ~Parameter(){}
     
    2739        isArray = true;
    2840        memcpy( this->subScripts, pSubScripts, sizeof(int) * MAX_ARRAYDIM );
     41    }
     42
     43    const string &GetVarName() const
     44    {
     45        return varName;
    2946    }
    3047
     
    4663        else{
    4764
    48             if( this->isRef && this->BasicType() == DEF_ANY &&
     65            if( this->isRef && this->GetBasicType() == DEF_ANY &&
    4966                param.isRef == false && param.IsPointer()
    5067                ||
    5168                this->isRef == false && this->IsPointer() &&
    52                 param.isRef && param.BasicType() == DEF_ANY ){
     69                param.isRef && param.GetBasicType() == DEF_ANY ){
    5370                    /* ByRef var As Any
    5471                            と
     
    7188        int max = (int)paramsA.size();
    7289        for( int i=0; i<max; i++ ){
    73             if( !paramsA[i].Equals( paramsB[i] ) ){
     90            if( !paramsA[i]->Equals( *paramsB[i] ) ){
    7491                return false;
    7592            }
  • BasicCompiler_Common/Subroutine.cpp

    r69 r73  
    88
    99//コンパイル中の関数情報
    10 SUBINFO *pCompilingSubInfo;
     10SubInfo *pCompilingSubInfo;
    1111
    1212int GetCallProcName(char *buffer,char *name){
     
    114114        /////////////////////
    115115
    116         SUBINFO *psi;
    117         psi=(SUBINFO *)pInfo;
     116        SubInfo *pSub;
     117        pSub=(SubInfo *)pInfo;
    118118
    119119        //GetSubHash内でエラー提示が行われた場合
    120         if(psi==(SUBINFO *)-1) return -1;
     120        if(pSub==(SubInfo *)-1) return -1;
    121121
    122122
     
    131131        ////////////////////////
    132132
    133         std::vector<SUBINFO *> subs;
     133        std::vector<SubInfo *> subs;
    134134        GetOverloadSubHash(name,subs);
    135135        if(subs.size()){
    136136            //オーバーロードを解決
    137             psi=OverloadSolutionWithStrParam(name,subs,Parameter,ObjectName,NULL);
    138 
    139             if(!psi) return 0;
    140         }
    141 
    142 
    143         Opcode_CallProc(Parameter,psi,0,ObjectName,RefType);
     137            pSub=OverloadSolutionWithStrParam(name,subs,Parameter,ObjectName,NULL);
     138
     139            if(!pSub) return 0;
     140        }
     141
     142
     143        Opcode_CallProc(Parameter,pSub,0,ObjectName,RefType);
    144144        if( plpRetIndex ){
    145             *plpRetIndex = psi->u.ReturnIndex;
    146         }
    147         return psi->ReturnType;
     145            *plpRetIndex = pSub->u.ReturnIndex;
     146        }
     147        return pSub->ReturnType;
    148148    }
    149149    else if(idProc==PROC_DLL){
     
    197197
    198198    //オーバーロード用の関数リストを作成
    199     std::vector<SUBINFO *> subs;
     199    std::vector<SubInfo *> subs;
    200200    GetOverloadSubHash(VarName,subs);
    201201    if(subs.size()==0){
     
    213213
    214214    //オーバーロードを解決
    215     SUBINFO *psi;
    216     psi=OverloadSolutionWithStrParam(VarName,subs,Parameter,ObjectName,NULL);
    217 
    218     if(psi){
     215    SubInfo *pSub;
     216    pSub=OverloadSolutionWithStrParam(VarName,subs,Parameter,ObjectName,NULL);
     217
     218    if(pSub){
    219219        //呼び出し
    220         Opcode_CallProc(Parameter,psi,0,ObjectName,RefType);
     220        Opcode_CallProc(Parameter,pSub,0,ObjectName,RefType);
    221221
    222222        if( pRetTypeInfo ){
    223             pRetTypeInfo->type = psi->ReturnType;
    224             pRetTypeInfo->u.lpIndex = psi->u.ReturnIndex;
     223            pRetTypeInfo->type = pSub->ReturnType;
     224            pRetTypeInfo->u.lpIndex = pSub->u.ReturnIndex;
    225225        }
    226226    }
     
    240240        /////////////////////
    241241
    242         SUBINFO *psi;
    243         psi=(SUBINFO *)pInfo;
     242        SubInfo *pSub;
     243        pSub=(SubInfo *)pInfo;
    244244
    245245        //GetSubHash内でエラー提示が行われた場合
    246         if(psi==(SUBINFO *)-1) return -1;
     246        if(pSub==(SubInfo *)-1) return -1;
    247247
    248248
     
    257257        ////////////////////////
    258258
    259         std::vector<SUBINFO *> subs;
     259        std::vector<SubInfo *> subs;
    260260        GetOverloadSubHash(name,subs);
    261261        if( subs.size() > 0 ){
    262262            //オーバーロードを解決
    263             psi=OverloadSolutionWithStrParam(name,subs,Parameter,ObjectName,NULL);
    264 
    265             if(!psi) return 0;
    266         }
    267 
    268 
    269         ret_type=psi->ReturnType;
    270         *plpRetIndex=psi->u.ReturnIndex;
     263            pSub=OverloadSolutionWithStrParam(name,subs,Parameter,ObjectName,NULL);
     264
     265            if(!pSub) return 0;
     266        }
     267
     268
     269        ret_type=pSub->ReturnType;
     270        *plpRetIndex=pSub->u.ReturnIndex;
    271271    }
    272272    else if(idProc==PROC_DLL){
     
    318318
    319319    //オーバーロード用の関数リストを作成
    320     std::vector<SUBINFO *> subs;
     320    std::vector<SubInfo *> subs;
    321321    GetOverloadSubHash(VarName,subs);
    322322    if(subs.size()==0){
     
    334334
    335335    //オーバーロードを解決
    336     SUBINFO *psi;
    337     psi=OverloadSolutionWithStrParam(VarName,subs,Parameter,ObjectName,NULL);
    338 
    339     if(psi){
     336    SubInfo *pSub;
     337    pSub=OverloadSolutionWithStrParam(VarName,subs,Parameter,ObjectName,NULL);
     338
     339    if(pSub){
    340340        if(pRetTypeInfo){
    341             pRetTypeInfo->type=psi->ReturnType;
    342             pRetTypeInfo->u.lpIndex=psi->u.ReturnIndex;
     341            pRetTypeInfo->type=pSub->ReturnType;
     342            pRetTypeInfo->u.lpIndex=pSub->u.ReturnIndex;
    343343        }
    344344    }
     
    349349//インデクサ(getter)の戻り値を取得
    350350bool GetReturnTypeOfIndexerGetterProc(CClass *pobj_Class,TYPEINFO &RetTypeInfo){
    351     std::vector<SUBINFO *> subs;
     351    std::vector<SubInfo *> subs;
    352352    pobj_Class->EnumMethod( CALC_ARRAY_GET, subs );
    353353    if( subs.size() == 0 ){
     
    644644    return 0;
    645645}
    646 SUBINFO *AddSubData(char *buffer,int NowLine,BOOL bVirtual,CClass *pobj_c,BOOL bStatic){
     646SubInfo *AddSubData(char *buffer,int NowLine,BOOL bVirtual,CClass *pobj_c,BOOL bStatic){
    647647    int i,i2,i3,sw;
    648648    DWORD dwType;
     
    761761    SubNum++;
    762762
    763     SUBINFO *psi;
    764     psi=(SUBINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(SUBINFO));
     763    SubInfo *pSub = new SubInfo();
    765764
    766765    //クラス名
    767     psi->pobj_ParentClass=pobj_c;
     766    pSub->pobj_ParentClass=pobj_c;
    768767
    769768    //ID
    770769    static int id_base=0;
    771     psi->id=(id_base++);
     770    pSub->id=(id_base++);
    772771
    773772    //関数名
    774     psi->name=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
    775     lstrcpy(psi->name,temporary);
     773    pSub->name=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
     774    lstrcpy(pSub->name,temporary);
    776775
    777776    //ソースコードの位置
    778     psi->address=NowLine;
    779 
    780     psi->bExport=bExport;
    781     psi->bCdecl=bCdecl;
    782     psi->bVirtual=bVirtual;
    783     if(bExport) psi->bUse=1;
    784     else psi->bUse=0;
    785     psi->bCompile=0;
    786     psi->bSystem=0;
    787 
    788     psi->dwType=dwType;
    789 
    790 
    791     if(psi->dwType==SUBTYPE_FUNCTION){
     777    pSub->address=NowLine;
     778
     779    pSub->bExport=bExport;
     780    pSub->bCdecl=bCdecl;
     781    pSub->bVirtual=bVirtual;
     782    if(bExport) pSub->bUse=1;
     783    else pSub->bUse=0;
     784    pSub->bCompile=0;
     785    pSub->bSystem=0;
     786
     787    pSub->dwType=dwType;
     788
     789
     790    if(pSub->dwType==SUBTYPE_FUNCTION){
    792791        ///////////////////
    793792        // 戻り値を取得
    794793        ///////////////////
    795794
    796         psi->isReturnRef = false;
     795        pSub->isReturnRef = false;
    797796
    798797        if(pobj_c){
    799             if(lstrcmp(psi->name,pobj_c->name)==0||
    800                 psi->name[0]=='~'){
     798            if(lstrcmp(pSub->name,pobj_c->name)==0||
     799                pSub->name[0]=='~'){
    801800                //クラスのコンストラクタ、デストラクタがFunction定義の場合はエラーをだす
    802801                SetError(115,NULL,NowLine);
     
    814813                if( buffer[i2-2] == 1 && buffer[i2-1] == ESC_BYREF ){
    815814                    //参照型
    816                     psi->isReturnRef = true;
     815                    pSub->isReturnRef = true;
    817816                }
    818817
     
    827826                    temporary[i3]=buffer[i2];
    828827                }
    829                 psi->ReturnType=GetTypeFixed(temporary,&psi->u.ReturnIndex);
    830                 if(psi->ReturnType==DEF_NON) SetError(3,temporary,NowLine);
     828                pSub->ReturnType=GetTypeFixed(temporary,&pSub->u.ReturnIndex);
     829                if(pSub->ReturnType==DEF_NON) SetError(3,temporary,NowLine);
    831830
    832831                sw_as=1;
     
    836835
    837836        if(!sw_as){
    838             SetError(-104,psi->name,NowLine);
    839 
    840             psi->ReturnType=DEF_DOUBLE;
     837            SetError(-104,pSub->name,NowLine);
     838
     839            pSub->ReturnType=DEF_DOUBLE;
    841840        }
    842841    }
    843842    else{
    844843        //戻り値なしのSub定義
    845         psi->ReturnType=DEF_NON;
    846         psi->u.ReturnIndex=-1;
    847     }
    848 
    849 
    850 
    851     psi->pParmInfo=(PARAMETER_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(PARAMETER_INFO)*2);
    852     psi->ParmNum=0;
     844        pSub->ReturnType=DEF_NON;
     845        pSub->u.ReturnIndex=-1;
     846    }
    853847
    854848    //パラメータ
     
    860854    if(buffer[i]!=')'&&pobj_c){
    861855        //クラスのメンバ関数の場合のみ、デストラクタにパラメータがある場合にエラーをだす
    862         if(psi->name[0]=='~'){
     856        if(pSub->name[0]=='~'){
    863857            SetError(114,NULL,NowLine);
    864858            i=JumpStringInPare(buffer,i);
     
    868862        if(buffer[i]==')') break;
    869863
    870         psi->pParmInfo=(PARAMETER_INFO *)HeapReAlloc(hHeap,0,psi->pParmInfo,(psi->ParmNum+1)*sizeof(PARAMETER_INFO));
    871 
    872         //ByVal
     864        //ByRef
     865        bool isRef;
    873866        if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
    874             psi->pParmInfo[psi->ParmNum].bByVal=1;
     867            isRef = false;
    875868            i+=2;
    876869        }
    877870        else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
    878             psi->pParmInfo[psi->ParmNum].bByVal=0;
     871            isRef = true;
    879872            i+=2;
    880873        }
    881         else psi->pParmInfo[psi->ParmNum].bByVal=1;
     874        else isRef = false;
    882875
    883876        //パラメータ名
     877        bool isArray = false;
     878        int subScripts[MAX_ARRAYDIM];
     879        char name[VN_SIZE];
    884880        sw=0;
    885881        for(i2=0;;i++,i2++){
     
    887883                if(!sw) sw=1;
    888884
    889                 i3=GetStringInPare(temporary+i2,buffer+i);
     885                i3=GetStringInPare(name+i2,buffer+i);
    890886                i2+=i3-1;
    891887                i+=i3-1;
     
    895891                if(!sw) sw=1;
    896892
    897                 i3=GetStringInBracket(temporary+i2,buffer+i);
     893                i3=GetStringInBracket(name+i2,buffer+i);
    898894                i2+=i3-1;
    899895                i+=i3-1;
     
    901897            }
    902898            if(!IsVariableChar(buffer[i])){
    903                 temporary[i2]=0;
     899                name[i2]=0;
    904900                break;
    905901            }
    906             temporary[i2]=buffer[i];
     902            name[i2]=buffer[i];
    907903        }
    908904        if(sw){
    909905            //配列パラメータ
    910             if(psi->pParmInfo[psi->ParmNum].bByVal) SetError(29,NULL,NowLine);
    911             psi->pParmInfo[psi->ParmNum].bArray=1;
    912 
    913             if((temporary[i2-2]=='('&&temporary[i2-1]==')')||
    914                 (temporary[i2-2]=='['&&temporary[i2-1]==']')){
    915                 psi->pParmInfo[psi->ParmNum].SubScripts[0]=LONG_MAX;
    916                 psi->pParmInfo[psi->ParmNum].SubScripts[1]=-1;
    917 
    918                 temporary[i2-2]=0;
     906            if( isRef == false ) SetError(29,NULL,NowLine);
     907            isArray = true;
     908
     909            if((name[i2-2]=='('&&name[i2-1]==')')||
     910                (name[i2-2]=='['&&name[i2-1]==']')){
     911                subScripts[0]=LONG_MAX;
     912                subScripts[1]=-1;
     913
     914                name[i2-2]=0;
    919915            }
    920916            else{
    921                 GetArrange(temporary,temp2,psi->pParmInfo[psi->ParmNum].SubScripts);
    922                 lstrcpy(temporary,temp2);
    923             }
    924 
    925             i2=lstrlen(temporary);
    926         }
    927         else{
    928             psi->pParmInfo[psi->ParmNum].bArray=0;
    929             psi->pParmInfo[psi->ParmNum].SubScripts[0]=-1;
    930         }
    931         psi->pParmInfo[psi->ParmNum].name=(char *)HeapAlloc(hHeap,0,i2+1);
    932         lstrcpy(psi->pParmInfo[psi->ParmNum].name,temporary);
     917                GetArrange(name,temp2,subScripts);
     918                lstrcpy(name,temp2);
     919            }
     920
     921            i2=lstrlen(name);
     922        }
    933923
    934924        //型
     925        Type type( DEF_NON );
    935926        if(buffer[i]==1&&buffer[i+1]==ESC_AS){
    936927            i+=2;
     
    955946            }
    956947
    957             psi->pParmInfo[psi->ParmNum].type=
    958                 GetTypeFixed(temporary,&psi->pParmInfo[psi->ParmNum].u.index);
     948            Type::StringToType( temporary, type );
    959949
    960950            if(temporary[0]=='*'&&
     
    963953                if(buffer[i]!='('){
    964954                    SetError(10,temporary,NowLine);
    965                     return 0;
     955                    break;
    966956                }
    967957                i3=GetStringInPare(temporary+i2,buffer+i);
     
    986976            }
    987977
    988             if(psi->pParmInfo[psi->ParmNum].type==-1){
     978            if( type.IsNull() ){
    989979                SetError(3,temporary,NowLine);
    990                 psi->pParmInfo[psi->ParmNum].type=DEF_PTR_VOID;
    991             }
    992 
    993             /*未完成(構造体パラメータを値参照として渡してよいものか!?)
    994             if(psi->pParmInfo[psi->ParmNum].type==DEF_OBJECT){
    995                 if(psi->pParmInfo[psi->ParmNum].bByVal) SetError(28,temporary,NowLine);
    996             }*/
     980                type.SetBasicType( DEF_PTR_VOID );
     981            }
    997982        }
    998983        else{
    999             psi->pParmInfo[psi->ParmNum].type=GetTypeFromSimpleName(temporary);
     984            type.SetBasicType( GetTypeFromSimpleName(temporary) );
    1000985            SetError(-103,temporary,NowLine);
    1001986        }
    1002987
    1003         if(psi->pParmInfo[psi->ParmNum].type==DEF_PTR_PROC){
     988        if( type.IsProcPtr() ){
    1004989            //関数ポインタの場合
    1005             psi->pParmInfo[psi->ParmNum].u.index=AddProcPtrInfo(temporary+3,temporary[2]);
    1006         }
    1007 
    1008         //パラメータの数を更新
    1009         psi->ParmNum++;
     990            type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2]) );
     991        }
     992
     993        Parameter *pParam = new Parameter( name, type, isRef );
     994        if( isArray ){
     995            pParam->SetArray( subScripts );
     996        }
     997
     998        //パラメータを追加
     999        pSub->params.push_back( pParam );
    10101000
    10111001        if(buffer[i]==','){
     
    10161006        else{
    10171007            SetError(1,NULL,NowLine);
    1018             return 0;
    1019         }
    1020     }
    1021     psi->SecondParmNum=psi->ParmNum;
     1008            break;
     1009        }
     1010    }
     1011    pSub->SecondParmNum = (int)pSub->params.size();
    10221012    i++;
    10231013    if(buffer[i]=='('){
     
    10261016            if(buffer[i]==')') break;
    10271017
    1028             psi->pParmInfo=(PARAMETER_INFO *)HeapReAlloc(hHeap,0,psi->pParmInfo,(psi->ParmNum+1)*sizeof(PARAMETER_INFO));
    1029 
    1030             //ByVal
     1018            //ByRef
     1019            bool isRef;
    10311020            if(buffer[i]==1&&buffer[i+1]==ESC_BYVAL){
    1032                 psi->pParmInfo[psi->ParmNum].bByVal=1;
     1021                isRef = false;
    10331022                i+=2;
    10341023            }
    10351024            else if(buffer[i]==1&&buffer[i+1]==ESC_BYREF){
    1036                 psi->pParmInfo[psi->ParmNum].bByVal=0;
     1025                isRef = true;
    10371026                i+=2;
    10381027            }
    1039             else psi->pParmInfo[psi->ParmNum].bByVal=1;
     1028            else isRef = false;
    10401029
    10411030            //パラメータ名
     1031            bool isArray = false;
     1032            int subScripts[MAX_ARRAYDIM];
     1033            char name[VN_SIZE];
    10421034            sw=0;
    10431035            for(i2=0;;i++,i2++){
     
    10451037                    if(!sw) sw=1;
    10461038
    1047                     i3=GetStringInPare(temporary+i2,buffer+i);
     1039                    i3=GetStringInPare(name+i2,buffer+i);
    10481040                    i2+=i3-1;
    10491041                    i+=i3-1;
     
    10531045                    if(!sw) sw=1;
    10541046
    1055                     i3=GetStringInBracket(temporary+i2,buffer+i);
     1047                    i3=GetStringInBracket(name+i2,buffer+i);
    10561048                    i2+=i3-1;
    10571049                    i+=i3-1;
     
    10591051                }
    10601052                if(!IsVariableChar(buffer[i])){
    1061                     temporary[i2]=0;
     1053                    name[i2]=0;
    10621054                    break;
    10631055                }
    1064                 temporary[i2]=buffer[i];
     1056                name[i2]=buffer[i];
    10651057            }
    10661058            if(sw){
    10671059                //配列パラメータ
    1068                 if(psi->pParmInfo[psi->ParmNum].bByVal) SetError(29,NULL,NowLine);
    1069                 psi->pParmInfo[psi->ParmNum].bArray=1;
    1070 
    1071                 if((temporary[i2-2]=='('&&temporary[i2-1]==')')||
    1072                     (temporary[i2-2]=='['&&temporary[i2-1]==']')){
    1073                     psi->pParmInfo[psi->ParmNum].SubScripts[0]=LONG_MAX;
    1074                     psi->pParmInfo[psi->ParmNum].SubScripts[1]=-1;
    1075 
    1076                     temporary[i2-2]=0;
     1060                if( isRef == false ) SetError(29,NULL,NowLine);
     1061                isArray = true;
     1062
     1063                if((name[i2-2]=='('&&name[i2-1]==')')||
     1064                    (name[i2-2]=='['&&name[i2-1]==']')){
     1065                    subScripts[0]=LONG_MAX;
     1066                    subScripts[1]=-1;
     1067
     1068                    name[i2-2]=0;
    10771069                }
    10781070                else{
    1079                     GetArrange(temporary,temp2,psi->pParmInfo[psi->ParmNum].SubScripts);
    1080                     lstrcpy(temporary,temp2);
    1081                 }
    1082 
    1083                 i2=lstrlen(temporary);
    1084             }
    1085             else{
    1086                 psi->pParmInfo[psi->ParmNum].bArray=0;
    1087                 psi->pParmInfo[psi->ParmNum].SubScripts[0]=-1;
    1088             }
    1089             psi->pParmInfo[psi->ParmNum].name=(char *)HeapAlloc(hHeap,0,i2+1);
    1090             lstrcpy(psi->pParmInfo[psi->ParmNum].name,temporary);
     1071                    GetArrange(name,temp2,subScripts);
     1072                    lstrcpy(name,temp2);
     1073                }
     1074
     1075                i2=lstrlen(name);
     1076            }
    10911077
    10921078            //型
     1079            Type type( DEF_NON );
    10931080            if(buffer[i]==1&&buffer[i+1]==ESC_AS){
    10941081                i+=2;
     1082
    10951083                i2=0;
    10961084                while(buffer[i]=='*'){
     
    11011089                for(;;i++,i2++){
    11021090                    if(!IsVariableChar(buffer[i])){
     1091                        if(buffer[i]==1&&(buffer[i+1]==ESC_FUNCTION||buffer[i+1]==ESC_SUB)){
     1092                            temporary[i2++]=buffer[i++];
     1093                            temporary[i2]=buffer[i];
     1094                            continue;
     1095                        }
    11031096                        temporary[i2]=0;
    11041097                        break;
     
    11061099                    temporary[i2]=buffer[i];
    11071100                }
    1108                 psi->pParmInfo[psi->ParmNum].type=
    1109                     GetTypeFixed(temporary,&psi->pParmInfo[psi->ParmNum].u.index);
    1110                 if(psi->pParmInfo[psi->ParmNum].type==-1) SetError(3,temporary,NowLine);
     1101
     1102                Type::StringToType( temporary, type );
     1103
     1104                if(temporary[0]=='*'&&
     1105                    temporary[1]==1&&
     1106                    (temporary[2]==ESC_FUNCTION||temporary[2]==ESC_SUB)){
     1107                    if(buffer[i]!='('){
     1108                        SetError(10,temporary,NowLine);
     1109                        break;
     1110                    }
     1111                    i3=GetStringInPare(temporary+i2,buffer+i);
     1112                    i+=i3;
     1113                    i2+=i3;
     1114
     1115                    if(temporary[2]==ESC_FUNCTION&&buffer[i]==1&&buffer[i+1]==ESC_AS){
     1116                        temporary[i2++]=buffer[i++];
     1117                        temporary[i2++]=buffer[i++];
     1118                        for(;;i++,i2++){
     1119                            if(!IsVariableChar(buffer[i])){
     1120                                temporary[i2]=0;
     1121                                break;
     1122                            }
     1123                            temporary[i2]=buffer[i];
     1124                        }
     1125                    }
     1126                }
     1127                else{
     1128                    //TypeDefをする前のベース型を取得
     1129                    GetOriginalTypeName(temporary);
     1130                }
     1131
     1132                if( type.IsNull() ){
     1133                    SetError(3,temporary,NowLine);
     1134                    type.SetBasicType( DEF_PTR_VOID );
     1135                }
    11111136            }
    11121137            else{
    1113                 psi->pParmInfo[psi->ParmNum].type=GetTypeFromSimpleName(temporary);
     1138                type.SetBasicType( GetTypeFromSimpleName(temporary) );
    11141139                SetError(-103,temporary,NowLine);
    11151140            }
    11161141
    1117             psi->ParmNum++;
     1142            if( type.IsProcPtr() ){
     1143                //関数ポインタの場合
     1144                type.SetIndex( AddProcPtrInfo(temporary+3,temporary[2]) );
     1145            }
     1146
     1147            Parameter *pParam = new Parameter( name, type, isRef );
     1148            if( isArray ){
     1149                pParam->SetArray( subScripts );
     1150            }
     1151
     1152            //パラメータを追加
     1153            pSub->params.push_back( pParam );
    11181154
    11191155            if(buffer[i]==','){
     
    11241160            else{
    11251161                SetError(1,NULL,NowLine);
    1126                 return 0;
     1162                break;
    11271163            }
    11281164        }
     
    11301166    }
    11311167
    1132     //リアルパラメータ領域を取得(_System_LocalThisを考慮して2つだけ多く確保する)
    1133     psi->pRealParmInfo=(PARAMETER_INFO *)HeapAlloc(hHeap,0,(psi->ParmNum+2)*sizeof(PARAMETER_INFO));
    1134     psi->RealParmNum=0;
     1168    //リアルパラメータ領域を取得(_System_LocalThisを考慮して2つだけ多く確保する場合がある)
    11351169
    11361170    if(pobj_c&&bStatic==0){
    1137         i = psi->RealParmNum;
    1138 
    11391171        //オブジェクトメンバの場合は、第一パラメータを_System_LocalThis引き渡し用として利用
    1140         psi->pRealParmInfo[i].name = "_System_LocalThis";
    1141         psi->pRealParmInfo[i].type=DEF_PTR_VOID;
    1142         psi->pRealParmInfo[i].u.index=-1;
    1143         psi->pRealParmInfo[i].bByVal=1;
    1144         psi->pRealParmInfo[i].bArray=0;
    1145         psi->pRealParmInfo[i].SubScripts[0]=-1;
    1146 
    1147         psi->RealParmNum++;
    1148     }
    1149 
    1150     if(psi->ReturnType==DEF_STRUCT){
    1151         i = psi->RealParmNum;
    1152 
     1172        string name = "_System_LocalThis";
     1173        Type type( DEF_PTR_VOID );
     1174        pSub->realParams.push_back( new Parameter( name, type ) );
     1175    }
     1176
     1177    if(pSub->ReturnType==DEF_STRUCT){
    11531178        //構造体を戻り値として持つ場合
    11541179        //※第一パラメータ(Thisポインタありの場合は第二パラメータ)を戻り値用の参照宣言にする
    11551180
    1156         if(psi->name[0]==1&&psi->name[1]==ESC_OPERATOR)
    1157             psi->pRealParmInfo[i].name="_System_ReturnValue";
    1158         else psi->pRealParmInfo[i].name=psi->name;
    1159         psi->pRealParmInfo[i].type=DEF_STRUCT;
    1160         psi->pRealParmInfo[i].u.index=psi->u.ReturnIndex;
    1161         psi->pRealParmInfo[i].bByVal=0;
    1162         psi->pRealParmInfo[i].bArray=0;
    1163         psi->pRealParmInfo[i].SubScripts[0]=-1;
    1164        
    1165         psi->RealParmNum++;
     1181        string name = pSub->name;
     1182        if(pSub->name[0]==1&&pSub->name[1]==ESC_OPERATOR){
     1183            name="_System_ReturnValue";
     1184        }
     1185        Type type( DEF_STRUCT, pSub->u.ReturnIndex );
     1186        pSub->realParams.push_back( new Parameter( name, type, true ) );
    11661187    }
    11671188
    11681189    //パラメータをコピー
    1169     for( i = 0; i < psi->ParmNum; i++, psi->RealParmNum++ ){
    1170         psi->pRealParmInfo[psi->RealParmNum]=psi->pParmInfo[i];
     1190    foreach( Parameter *pParam, pSub->params ){
     1191        pSub->realParams.push_back( new Parameter( *pParam ) );
    11711192    }
    11721193
     
    11771198
    11781199    int key;
    1179     key=hash_default(psi->name);
    1180 
    1181     extern SUBINFO **ppSubHash;
     1200    key=hash_default(pSub->name);
     1201
     1202    extern SubInfo **ppSubHash;
    11821203    if(ppSubHash[key]){
    1183         SUBINFO *psi2;
     1204        SubInfo *psi2;
    11841205        psi2=ppSubHash[key];
    11851206        while(1){
    11861207            if(pobj_c==psi2->pobj_ParentClass){
    11871208                //重複エラーチェックを行う
    1188                 if(lstrcmp(psi2->name,psi->name)==0){
    1189                     if(CompareParameter(psi2->pParmInfo,psi2->ParmNum,psi->pParmInfo,psi->ParmNum)==0){
    1190                         SetError(15,psi->name,NowLine);
     1209                if(lstrcmp(psi2->name,pSub->name)==0){
     1210                    if( Parameter::Equals( psi2->params, pSub->params ) ){
     1211                        SetError(15,pSub->name,NowLine);
    11911212                        return 0;
    11921213                    }
     
    11971218            psi2=psi2->pNextData;
    11981219        }
    1199         psi2->pNextData=psi;
     1220        psi2->pNextData=pSub;
    12001221    }
    12011222    else{
    1202         ppSubHash[key]=psi;
    1203     }
    1204 
    1205     return psi;
     1223        ppSubHash[key]=pSub;
     1224    }
     1225
     1226    return pSub;
    12061227}
    12071228
     
    12171238
    12181239    //サブルーチン(ユーザー定義)情報を初期化
    1219     extern SUBINFO **ppSubHash;
     1240    extern SubInfo **ppSubHash;
    12201241    extern int SubNum;
    1221     ppSubHash=(SUBINFO **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(SUBINFO *));
     1242    ppSubHash=(SubInfo **)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,MAX_HASH*sizeof(SubInfo *));
    12221243    SubNum=0;
    12231244
     
    13131334    AddSubData(temporary,0,0,0);
    13141335}
    1315 void Delete_si(SUBINFO *psi){
    1316     int i2;
    1317 
    1318     for(i2=0;i2<psi->ParmNum;i2++){
    1319         HeapDefaultFree(psi->pParmInfo[i2].name);
    1320     }
    1321     HeapDefaultFree(psi->pRealParmInfo);
    1322     if(psi->pParmInfo) HeapDefaultFree(psi->pParmInfo);
    1323     psi->pRealParmInfo=0;
    1324     psi->pParmInfo=0;
    1325 
    1326     if(psi->pNextData) Delete_si(psi->pNextData);
    1327 
    1328     HeapDefaultFree(psi->name);
    1329     HeapDefaultFree(psi);
    1330 }
    1331 void DeleteSubInfo(SUBINFO **ppSubHash,char **ppMacroNames,int MacroNum){   //サブルーチン情報のメモリ解放
     1336void Delete_si(SubInfo *pSub){
     1337    foreach( Parameter *pParam, pSub->params ){
     1338        delete pParam;
     1339    }
     1340
     1341    foreach( Parameter *pParam, pSub->realParams ){
     1342        delete pParam;
     1343    }
     1344
     1345    if(pSub->pNextData) Delete_si(pSub->pNextData);
     1346
     1347    HeapDefaultFree(pSub->name);
     1348    delete pSub;
     1349}
     1350void DeleteSubInfo(SubInfo **ppSubHash,char **ppMacroNames,int MacroNum){   //サブルーチン情報のメモリ解放
    13321351    int i;
    13331352    for(i=0;i<MAX_HASH;i++){
  • BasicCompiler_Common/Type.cpp

    r71 r73  
    108108    return false;
    109109}
     110
     111
     112bool Type::Equals( const Type &type ) const
     113{
     114    if( basicType == type.basicType ){
     115        if( NATURAL_TYPE( basicType ) == DEF_OBJECT
     116            || NATURAL_TYPE( basicType ) == DEF_STRUCT ){
     117
     118                if( index == type.index ){
     119                    return true;
     120                }
     121
     122        }
     123        else{
     124            return true;
     125        }
     126    }
     127    return false;
     128}
     129
     130bool Type::IsNull() const{
     131  if( basicType == DEF_NON ){
     132      return true;
     133  }
     134  return false;
     135}
     136bool Type::IsPointer() const
     137{
     138    if(PTR_LEVEL( basicType )|| basicType == DEF_PTR_VOID || basicType == DEF_PTR_PROC
     139        || ( basicType & FLAG_PTR ) ){
     140            return true;
     141    }
     142
     143    return false;
     144}
     145bool Type::IsSigned() const
     146{
     147    switch( basicType ){
     148        case DEF_SBYTE:
     149        case DEF_INTEGER:
     150        case DEF_LONG:
     151        case DEF_INT64:
     152        case DEF_SINGLE:
     153        case DEF_DOUBLE:
     154            return true;
     155        default:
     156            break;
     157    }
     158    return false;
     159}
     160bool Type::IsNaturalWhole() const
     161{
     162    switch( basicType ){
     163        case DEF_SBYTE:
     164        case DEF_BYTE:
     165        case DEF_INTEGER:
     166        case DEF_WORD:
     167        case DEF_LONG:
     168        case DEF_DWORD:
     169        case DEF_INT64:
     170        case DEF_QWORD:
     171            return true;
     172        default:
     173            break;
     174    }
     175    return false;
     176}
     177bool Type::IsWhole() const
     178{
     179    return (
     180        IsNaturalWhole()
     181        || IsPtrType( basicType )
     182        || basicType == DEF_BOOLEAN
     183        );
     184}
     185bool Type::IsReal() const
     186{
     187    switch( basicType ){
     188        case DEF_SINGLE:
     189        case DEF_DOUBLE:
     190            return true;
     191        default:
     192            break;
     193    }
     194    return false;
     195}
     196bool Type::Is64() const
     197{
     198    switch( basicType ){
     199        case DEF_QWORD:
     200        case DEF_INT64:
     201            return true;
     202        default:
     203            break;
     204    }
     205    return false;
     206}
     207bool Type::IsProcPtr() const
     208{
     209    if( basicType == DEF_PTR_PROC ){
     210        return true;
     211    }
     212    return false;
     213}
     214bool Type::IsStruct() const
     215{
     216    if( basicType == DEF_STRUCT ){
     217        return true;
     218    }
     219    return false;
     220}
  • BasicCompiler_Common/Type.h

    r71 r73  
    44
    55class Type{
     6    static const int basicTypeList[];
     7    static const string basicTypeNameList[];
     8
     9
    610    int basicType;
    711    union{
     
    1014    };
    1115
    12     static const int basicTypeList[];
    13     static const string basicTypeNameList[];
    14 
    1516public:
    1617
     18    static bool StringToBasicType( const string &typeName, int &basicType );
     19    static bool StringToType( const string &typeName, Type &type );
     20
     21    Type():
     22      basicType( DEF_NON ),
     23      index( -1 ){}
    1724    Type( int basicType ):
    1825      basicType( basicType ),
     
    3138      index( type.index ){}
    3239
    33     int BasicType() const
     40    int GetBasicType() const
    3441    {
     42#ifdef _DEBUG
     43        if( basicType<-10000 ){
     44            DebugBreak();
     45        }
     46#endif
    3547        return basicType;
    3648    }
     
    4456    }
    4557
     58    void SetBasicType( int basicType ){
     59        this->basicType = basicType;
     60    }
     61    void SetIndex( LONG_PTR index ){
     62        this->index = index;
     63    }
     64    void SetNull(){
     65        SetBasicType( DEF_NON );
     66    }
     67    void SetType( int basicType, LONG_PTR index ){
     68        SetBasicType( basicType );
     69        SetIndex( index );
     70    }
     71    void SetType( int basicType, CClass *pClass ){
     72        SetBasicType( basicType );
     73        this->pClass = pClass;
     74    }
     75
    4676    void PtrLevelUp(){
    4777        PTR_LEVEL_UP( basicType );
    4878    }
    4979
    50     bool Equals( const Type &type ) const
    51     {
    52         if( basicType == type.basicType ){
    53             if( NATURAL_TYPE( basicType ) == DEF_OBJECT
    54                 || NATURAL_TYPE( basicType ) == DEF_STRUCT ){
     80    bool Equals( const Type &type ) const;
    5581
    56                     if( index == type.index ){
    57                         return true;
    58                     }
     82    bool IsNull() const;
     83    bool IsPointer() const;
     84    bool IsSigned() const;
     85    bool IsNaturalWhole() const;
     86    bool IsWhole() const;
     87    bool IsReal() const;
     88    bool Is64() const;
     89    bool IsProcPtr() const;
     90    bool IsStruct() const;
    5991
    60             }
    61             else{
    62                 return true;
    63             }
    64         }
    65         return false;
    66     }
    67 
    68     bool IsPointer() const
    69     {
    70         if(PTR_LEVEL( basicType )|| basicType == DEF_PTR_VOID || basicType == DEF_PTR_PROC
    71             || ( basicType & FLAG_PTR ) ){
    72                 return true;
    73         }
    74 
    75         return false;
    76     }
    77 
    78 
    79 
    80     static bool StringToBasicType( const string &typeName, int &basicType );
    81     static bool StringToType( const string &typeName, Type &type );
    8292};
    8393
  • BasicCompiler_Common/Variable.cpp

    r68 r73  
    819819
    820820    char temporary[VN_SIZE];
    821     extern SUBINFO *pCompilingSubInfo;
     821    extern SubInfo *pCompilingSubInfo;
    822822    if(pCompilingSubInfo){
    823823        GetNowStaticVarFullName(VarName,temporary);
     
    11001100            //初期値の型を判別して自動的に型情報を付加する
    11011101            TYPEINFO BaseType = GetStringTypeInfo();
    1102             int result = NumOpe_GetType( InitBuf, &BaseType, &pTypeInfo->u.lpIndex );
     1102            int result = NumOpe_GetType_Old( InitBuf, &BaseType, &pTypeInfo->u.lpIndex );
    11031103
    11041104            //エラーの場合
     
    11301130
    11311131BOOL GetNowStaticVarFullName(char *VarName,char *FullName){
    1132     extern SUBINFO *pCompilingSubInfo;
     1132    extern SubInfo *pCompilingSubInfo;
    11331133    if(!pCompilingSubInfo) return 0;
    11341134
  • BasicCompiler_Common/calculation.cpp

    r69 r73  
    11951195    return 0;
    11961196}
    1197 BOOL IsStringSubsituation(CClass *pobj_c){
    1198     //String受け入れ可能な "=" 演算子をオーバーロードしているかどうかを調べる
    1199     BOOL bRet=0;
    1200 
    1201     std::vector<SUBINFO *> subs;
    1202     pobj_c->EnumMethod( CALC_SUBSITUATION, subs );
    1203     if( subs.size() == 0 ){
    1204         bRet=0;
    1205         goto finish;
    1206     }
    1207 
    1208     foreach( SUBINFO *psi, subs ){
    1209         if(psi->ParmNum==2){
    1210             TYPEINFO TypeInfo={psi->pParmInfo[1].type,psi->pParmInfo[1].u.index};
    1211             if(IsStringObjectType( TypeInfo )){
    1212                 bRet=1;
    1213                 goto finish;
    1214             }
    1215         }
    1216     }
    1217 
    1218 finish:
    1219     return bRet;
    1220 }
    12211197int IsStrCalculation(char *Command){
    12221198    int i,i2,i3,i4,type,PareNum;
     
    12821258
    12831259                    //ユーザー定義関数
    1284                     SUBINFO *psi;
     1260                    SubInfo *psi;
    12851261                    psi=GetSubHash(temporary);
    12861262                    if(psi){
  • BasicCompiler_Common/common.h

    r71 r73  
    155155#include "Parameter.h"
    156156
     157// プロシージャ管理用のクラス
     158#include "Procedure.h"
     159
    157160
    158161
     
    229232};
    230233
    231 #define SUBTYPE_SUB         1
    232 #define SUBTYPE_FUNCTION    2
    233 #define SUBTYPE_MACRO       3
    234 struct SUBINFO{
    235     DWORD dwType;
    236 
    237     //クラス情報
    238     CClass *pobj_ParentClass;
    239 
    240     long id;
    241 
    242     char *name;
    243     long address;
    244 
    245     //パラメータ
    246     PARAMETER_INFO *pParmInfo;
    247     int ParmNum;
    248     int SecondParmNum;
    249     PARAMETER_INFO *pRealParmInfo;
    250     int RealParmNum;
    251     int RealSecondParmNum;
    252 
    253     /*
    254     //パラメータ
    255     Parameters params;
    256     int SecondParmNum;
    257     Parameters realParams;
    258     int RealSecondParmNum;*/
    259 
    260     //戻り値
    261     int ReturnType;
    262     union{
    263         LONG_PTR ReturnIndex;
    264         CClass *Return_pobj_c;
    265     }u;
    266     bool isReturnRef;
    267 
    268     DWORD CompileAddress;
    269     DWORD EndOpAddr;
    270     VARIABLE *pVar;
    271     int VarNum;
    272 
    273     BOOL bExport;
    274     BOOL bCdecl;
    275     BOOL bVirtual;
    276     BOOL bUse;
    277     BOOL bCompile;
    278     BOOL bSystem;
    279 
    280     SUBINFO *pNextData;
    281 };
    282234#define DECLARE_DYNAMIC 1
    283235#define DECLARE_STATIC  2
     
    435387CONSTINFO *GetConstHash(char *name);
    436388DECLAREINFO *GetDeclareHash(char *name);
    437 SUBINFO *GetSubHash(const char *name,BOOL bError=0);
    438 SUBINFO *GetMethodHash(char *ObjectName,char *MethodName,char *Parameter,BOOL bError=0);
    439 void GetOverloadSubHash( const char *lpszName, std::vector<SUBINFO *> &subs );
     389SubInfo *GetSubHash(const char *name,BOOL bError=0);
     390SubInfo *GetMethodHash(char *ObjectName,char *MethodName,char *Parameter,BOOL bError=0);
     391void GetOverloadSubHash( const char *lpszName, std::vector<SubInfo *> &subs );
    440392
    441393//Object.cpp
     
    444396
    445397//Overload.sbp
    446 SUBINFO *OverloadSolutionWithStrParam(
     398SubInfo *OverloadSolutionWithStrParam(
    447399    const char *name,
    448     std::vector<SUBINFO *> &subs,
     400    std::vector<SubInfo *> &subs,
    449401    const char *Parameter,
    450402    const char *ObjectName,
    451403    TYPEINFO *pReturnTypeInfo);
    452 SUBINFO *OverloadSolution(
     404SubInfo *OverloadSolution(
    453405    const char *name,
    454     std::vector<SUBINFO *> &subs,
     406    std::vector<SubInfo *> &subs,
    455407    const PARAMETER_INFO *ppi,
    456408    const int ParmNum,
     
    464416void Debugger_Pause(void);
    465417ULONG_PTR rva_to_real(DWORD p);
    466 SUBINFO *GetSubFromObp(ULONG_PTR pos);
     418SubInfo *GetSubFromObp(ULONG_PTR pos);
    467419void ReadOpBuffer();
    468420void DebugProgram(void);
     
    561513DWORD GetConstValue(char *name,double *dbl,char *buffer,LONG_PTR *plpIndex);
    562514bool IsStringObjectType(const TYPEINFO &TypeInfo);
    563 BOOL IsStringSubsituation(CClass *pobj_c);
    564515int IsStrCalculation(char *Command);
    565516BYTE GetCalcId(const char *Command,int *pi);
     
    567518                       char *values[255],long calc[255],long stack[255]);
    568519
    569 //NumOpe_GetType.cpp
     520//NumOpe_GetType_Old.cpp
    570521int AutoBigCast(int BaseType,int CalcType);
    571522BOOL CheckCalcType(int idCalc,int *type,int sp);
    572 int NumOpe_GetType(char *Command,TYPEINFO *pBaseType,LONG_PTR *plpIndex);
     523int NumOpe_GetType_Old( const char *Command, TYPEINFO *pBaseTypeInfo, LONG_PTR *plpIndex );
     524bool NumOpe_GetType( const char *expression, const Type &baseType, Type &resultType );
    573525
    574526//Subroutine.cpp
     
    583535bool GetReturnTypeOfIndexerGetterProc(CClass *pobj_Class,TYPEINFO &RetTypeInfo);
    584536BOOL CompareParameter(PARAMETER_INFO *ppi1,int pi_num1,PARAMETER_INFO *ppi2,int pi_num2);
    585 SUBINFO *AddSubData(char *buffer,int NowLine,BOOL bVirtual,CClass *pobj_c,BOOL bStatic=0);
     537SubInfo *AddSubData(char *buffer,int NowLine,BOOL bVirtual,CClass *pobj_c,BOOL bStatic=0);
    586538void GetSubInfo(void);
    587 void DeleteSubInfo(SUBINFO **ppSubHash,char **ppMacroNames,int MacroNum);
     539void DeleteSubInfo(SubInfo **ppSubHash,char **ppMacroNames,int MacroNum);
    588540void DeleteDeclareInfo(void);
    589541int AddProcPtrInfo(char *buffer,DWORD dwProcType);
  • BasicCompiler_Common/hash.cpp

    r51 r73  
    5353}
    5454
    55 void GetOverloadSubHash( const char *lpszName, std::vector<SUBINFO *> &subs ){
    56     extern SUBINFO *pSubInfo;
    57     extern int SubInfoNum;
    58     extern int cp;
    59 
     55void GetOverloadSubHash( const char *lpszName, std::vector<SubInfo *> &subs ){
    6056    char name[VN_SIZE];
    6157
     
    127123
    128124        //格納位置を取得
    129         extern SUBINFO **ppSubHash;
    130         SUBINFO *psi;
     125        extern SubInfo **ppSubHash;
     126        SubInfo *psi;
    131127        psi=ppSubHash[key];
    132128        while(psi){
     
    144140
    145141//オーバーロードされていない関数を取得(昔のコンパイラソースコードとの互換性保持)
    146 SUBINFO *GetSubHash(const char *lpszName,BOOL bError){
    147     std::vector<SUBINFO *> subs;
     142SubInfo *GetSubHash(const char *lpszName,BOOL bError){
     143    std::vector<SubInfo *> subs;
    148144    GetOverloadSubHash(lpszName,subs);
    149145
     
    158154    }
    159155
    160     SUBINFO *psi;
     156    SubInfo *psi;
    161157    psi = subs[0];
    162158
    163159    return psi;
    164160}
    165 SUBINFO *GetMethodHash(char *ObjectName,char *MethodName,char *Parameter,BOOL bError){
     161SubInfo *GetMethodHash(char *ObjectName,char *MethodName,char *Parameter,BOOL bError){
    166162    char temporary[VN_SIZE];
    167163    sprintf(temporary,"%s.%s",ObjectName,MethodName);
    168164
    169     std::vector<SUBINFO *> subs;
    170     SUBINFO *psi;
     165    std::vector<SubInfo *> subs;
     166    SubInfo *psi;
    171167    GetOverloadSubHash(temporary,subs);
    172168
Note: See TracChangeset for help on using the changeset viewer.