Changeset 46 in dev for BasicCompiler_Common


Ignore:
Timestamp:
Feb 6, 2007, 1:19:17 AM (18 years ago)
Author:
dai_9181
Message:

VarPtrの戻り値の型をVoidPtrではなく、ポインタレベルを増加した型にした。
関連関数のパラメータにconstを適用。

Location:
BasicCompiler_Common
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/BasicFixed.h

    r41 r46  
    5454#define NATURAL_TYPE(t) ((t)&MASK_NATURAL)
    5555#define MAKE_PTR_TYPE(t,p)  ((t)|((p)<<8))
    56 #define PTR_LEVEL_UP(t)     MAKE_PTR_TYPE(NATURAL_TYPE(t),PTR_LEVEL(t)+1)
    57 #define PTR_LEVEL_DOWN(t)   MAKE_PTR_TYPE(NATURAL_TYPE(t),PTR_LEVEL(t)-1)
     56#define PTR_LEVEL_UP(t)     t = MAKE_PTR_TYPE(NATURAL_TYPE(t),PTR_LEVEL(t)+1)
     57#define PTR_LEVEL_DOWN(t)   t = MAKE_PTR_TYPE(NATURAL_TYPE(t),PTR_LEVEL(t)-1)
    5858
    5959#define DEF_PTR_BYTE    MAKE_PTR_TYPE(DEF_BYTE,1)
  • BasicCompiler_Common/Class.cpp

    r40 r46  
    181181
    182182
    183 CClass::CClass(char *name){
     183CClass::CClass(const char *name){
    184184    memset(this,0,sizeof(CClass));
    185185
     
    316316    iStaticMethodNum++;
    317317}
    318 BOOL CClass::DupliCheckAll(char *name){
     318BOOL CClass::DupliCheckAll(const char *name){
    319319    //重複チェック
    320320
     
    333333    return 0;
    334334}
    335 BOOL CClass::DupliCheckMember(char *name){
     335BOOL CClass::DupliCheckMember(const char *name){
    336336    //重複チェック
    337337
     
    374374    return ppobj_StaticMethod[i];
    375375}
    376 bool CClass::IsExistMethod( char *name ){
     376bool CClass::IsExistMethod( const char *name ){
    377377    for( int i=0; i<iMethodNum; i++ ){
    378378        if( lstrcmp( ppobj_Method[i]->psi->name, name ) == 0 ) return true;
     
    380380    return false;
    381381}
    382 bool CClass::IsExistStaticMethod( char *name ){
     382bool CClass::IsExistStaticMethod( const char *name ){
    383383    for( int i=0; i<iStaticMethodNum; i++ ){
    384384        if( lstrcmp( ppobj_StaticMethod[i]->psi->name, name ) == 0 ) return true;
     
    538538
    539539
    540 int CDBClass::hash(char *name){
     540int CDBClass::hash(const char *name){
    541541    int key;
    542542
     
    584584}
    585585
    586 CClass *CDBClass::check(char *name){
     586CClass *CDBClass::check(const char *name){
    587587    int key;
    588588    key=hash(name);
     
    604604}
    605605
    606 CClass *CDBClass::AddClass(char *name,int NowLine){
     606CClass *CDBClass::AddClass(const char *name,int NowLine){
    607607    //////////////////////////////////////////////////////////////////////////
    608608    // クラスを追加
     
    849849}
    850850
    851 void CDBClass::GetClass_recur(char *lpszInheritsClass){
     851void CDBClass::GetClass_recur(const char *lpszInheritsClass){
    852852    extern char *basbuf;
    853853    int i,i2,i3,sub_address,top_pos;
  • BasicCompiler_Common/Class.h

    r40 r46  
    9595
    9696public:
    97     CClass(char *name);
     97    CClass(const char *name);
    9898    ~CClass();
    9999
     
    106106    void AddStaticMethod(SUBINFO *psi,DWORD dwAccess);
    107107
    108     BOOL DupliCheckAll(char *name);
    109     BOOL DupliCheckMember(char *name);
     108    BOOL DupliCheckAll(const char *name);
     109    BOOL DupliCheckMember(const char *name);
    110110
    111111    //メソッド取得
     
    114114
    115115    //メソッドの存在を確認
    116     bool IsExistMethod( char *name );
    117     bool IsExistStaticMethod( char *name );
     116    bool IsExistMethod( const char *name );
     117    bool IsExistStaticMethod( const char *name );
    118118
    119119
     
    162162#define MAX_CLASS_HASH 65535
    163163class CDBClass{
    164     int hash(char *name);
     164    int hash(const char *name);
    165165    void DestroyClass(CClass *pobj_c);
    166166public:
     
    170170    ~CDBClass();
    171171
    172     CClass *check(char *name);
    173 
    174     CClass *AddClass(char *name,int NowLine);
     172    CClass *check(const char *name);
     173
     174    CClass *AddClass(const char *name,int NowLine);
    175175
    176176    void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
     
    182182public:
    183183    void InitNames(void);
    184     void GetClass_recur(char *lpszInheritsClass);
     184    void GetClass_recur(const char *lpszInheritsClass);
    185185    void GetObjectClassInfo(void);
    186186
  • BasicCompiler_Common/Overload.cpp

    r36 r46  
    4646}
    4747
    48 SUBINFO *OverloadSolution(char *name,SUBINFO **ppsi,int num,PARAMETER_INFO *ppi,int ParmNum,TYPEINFO *pReturnTypeInfo){
     48SUBINFO *OverloadSolution(const char *name,SUBINFO **ppsi,int num,PARAMETER_INFO *ppi,int ParmNum,TYPEINFO *pReturnTypeInfo){
    4949    // オーバーロードの解決
    5050
  • BasicCompiler_Common/Subroutine.cpp

    r40 r46  
    6464}
    6565
    66 void SplitObjectName(char *name,char *ObjectName,int *pRefType){
     66void SplitObjectName(const char *name,char *ObjectName,int *pRefType){
    6767    int i4;
    6868    for(i4=lstrlen(name)-1;i4>=0;i4--){
  • BasicCompiler_Common/TypeDef.cpp

    r4 r46  
    55
    66
    7 CTypeDef::CTypeDef(char *name,char *base){
     7CTypeDef::CTypeDef(const char *name,char *base){
    88    lpszName=(char *)malloc(lstrlen(name)+1);
    99    lstrcpy(lpszName,name);
     
    3232    iNum=0;
    3333}
    34 void CDBTypeDef::add(char *name,char *base){
     34void CDBTypeDef::add(const char *name,char *base){
    3535    ppobj_TypeDef=(CTypeDef **)realloc(ppobj_TypeDef,(iNum+1)*sizeof(CTypeDef *));
    3636    ppobj_TypeDef[iNum]=new CTypeDef(name,base);
     
    6565    }
    6666}
    67 int CDBTypeDef::check(char *name){
     67int CDBTypeDef::check(const char *name){
    6868    int i;
    6969    for(i=0;i<iNum;i++){
  • BasicCompiler_Common/TypeDef.h

    r4 r46  
    44    char *lpszName;
    55    char *lpszBaseName;
    6     CTypeDef(char *name,char *base);
     6    CTypeDef(const char *name,char *base);
    77    ~CTypeDef();
    88};
     
    1717    void init();
    1818
    19     void add(char *name,char *base);
    20     int check(char *name);
     19    void add(const char *name,char *base);
     20    int check(const char *name);
    2121};
    2222extern CDBTypeDef *pobj_DBTypeDef;
  • BasicCompiler_Common/Variable.cpp

    r40 r46  
    160160    return MAKE_PTR_TYPE(NATURAL_TYPE(type),PTR_LEVEL(type)+1);
    161161}
    162 int GetTypeFixed(char *TypeName,LONG_PTR *lpNum){
     162int GetTypeFixed(const char *TypeName,LONG_PTR *lpNum){
    163163    int type;
    164164
  • BasicCompiler_Common/Variable.h

    r40 r46  
    1313int GetTypeSize(int type,LONG_PTR lpIndex);
    1414int GetPtrType(int type,LONG_PTR lpIndex);
    15 int GetTypeFixed(char *TypeName,LONG_PTR *lpNum);
     15int GetTypeFixed(const char *TypeName,LONG_PTR *lpNum);
    1616void GetOriginalTypeName(char *buffer);
    1717BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name);
  • BasicCompiler_Common/common.h

    r45 r46  
    415415CONSTINFO *GetConstHash(char *name);
    416416DECLAREINFO *GetDeclareHash(char *name);
    417 SUBINFO *GetSubHash(char *name,BOOL bError=0);
     417SUBINFO *GetSubHash(const char *name,BOOL bError=0);
    418418SUBINFO *GetMethodHash(char *ObjectName,char *MethodName,char *Parameter,BOOL bError=0);
    419419SUBINFO **GetOverloadObjectSubHash(char *name,CClass *pobj_c, int *pNum);
    420 SUBINFO **GetOverloadSubHash(char *name,int *pNum);
     420SUBINFO **GetOverloadSubHash(const char *name,int *pNum);
    421421
    422422//Object.cpp
     
    428428//Overload.sbp
    429429SUBINFO *OverloadSolutionWithStrParam(char *name,SUBINFO **ppsi,int num,char *Parameter,char *ObjectName,TYPEINFO *pReturnTypeInfo);
    430 SUBINFO *OverloadSolution(char *name,SUBINFO **ppsi,int num,PARAMETER_INFO *ppi,int ParmNum,TYPEINFO *pReturnTypeInfo);
     430SUBINFO *OverloadSolution(const char *name,SUBINFO **ppsi,int num,PARAMETER_INFO *ppi,int ParmNum,TYPEINFO *pReturnTypeInfo);
    431431
    432432//Debug.cpp
     
    548548int GetCallProcName(char *buffer,char *name);
    549549int GetProc(char *name,void **ppInfo);
    550 void SplitObjectName(char *name,char *ObjectName,int *pRefType);
     550void SplitObjectName(const char *name,char *ObjectName,int *pRefType);
    551551bool SplitMemberName( const char *desc, char *object, char *member );
    552552int GetReturnTypeOfProc(int idProc,void *pInfo,char *name,char *Parameter,LONG_PTR *plpRetIndex);
     
    578578void SetError(int ErrorNum,const char *KeyWord,int pos);
    579579void CompileMessage(char *buffer);
    580 bool CheckDifferentType(int VarType,LONG_PTR lpVarIndex,int CalcType,LONG_PTR lpCalcIndex,char *pszFuncName,int ParmNum);
     580bool CheckDifferentType(const int VarType,const LONG_PTR lpVarIndex,const int CalcType,const LONG_PTR lpCalcIndex,const char *pszFuncName,const int ParmNum);
    581581
    582582//Compile.cpp
  • BasicCompiler_Common/error.cpp

    r45 r46  
    364364
    365365#define STRING_SYSTEM_DECLAREHANDLE "*_System_DeclareHandle_"
    366 void DifferentTypeError(int VarType,LONG_PTR VarIndex,int CalcType,LONG_PTR CalcIndex,int iWarning,char *pszFuncName,int ParmNum){
     366void DifferentTypeError(const int VarType,LONG_PTR VarIndex,const int CalcType,LONG_PTR CalcIndex,const int iWarning,const char *pszFuncName,const int ParmNum){
    367367    //////////////////////////
    368368    // キャストに関する警告
     
    396396}
    397397
    398 bool CheckDifferentType(int VarType,LONG_PTR lpVarIndex,int CalcType,LONG_PTR lpCalcIndex,char *pszFuncName,int ParmNum){
     398bool CheckDifferentType(const int VarType,const LONG_PTR lpVarIndex,int CalcType,const LONG_PTR lpCalcIndex,const char *pszFuncName,const int ParmNum){
    399399
    400400    if(VarType==DEF_OBJECT||CalcType==DEF_OBJECT){
  • BasicCompiler_Common/hash.cpp

    r31 r46  
    7777}
    7878
    79 SUBINFO **GetOverloadSubHash(char *lpszName,int *pNum){
     79SUBINFO **GetOverloadSubHash( const char *lpszName, int *pNum ){
    8080    extern SUBINFO *pSubInfo;
    8181    extern int SubInfoNum;
     
    225225
    226226//オーバーロードされていない関数を取得(昔のコンパイラソースコードとの互換性保持)
    227 SUBINFO *GetSubHash(char *lpszName,BOOL bError){
     227SUBINFO *GetSubHash(const char *lpszName,BOOL bError){
    228228    int num;
    229229    SUBINFO **ppsi,*psi;
Note: See TracChangeset for help on using the changeset viewer.