Changeset 809 in dev for branches/egtra/ab5.0/abdev/BasicCompiler_Common/error.cpp
- Timestamp:
- Feb 13, 2011, 4:10:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/egtra/ab5.0/abdev/BasicCompiler_Common/error.cpp
r562 r809 4 4 5 5 #define STRING_SYSTEM_DECLAREHANDLE "*_System_DeclareHandle_" 6 void DifferentTypeError( const Type &varType, const Type &calcFormalType, const int iWarning,const char *pszFuncName,const int ParmNum){ 6 void DifferentTypeError(const Type &varType, const Type &calcFormalType, const int iWarning, const char *pszFuncName, const int ParmNum) 7 { 7 8 ////////////////////////// 8 9 // キャストに関する警告 9 10 ////////////////////////// 10 char temporary[255];11 Type calcType( calcFormalType);12 13 if (IS_LITERAL(calcType.GetIndex()))11 std::ostringstream s; 12 Type calcType(calcFormalType); 13 14 if (IS_LITERAL(calcType.GetIndex())) 14 15 { 15 16 calcType.SetIndex( -1 ); 16 17 } 17 18 18 if(pszFuncName) 19 sprintf(temporary,"\"%s\"の第%dパラメータが、",pszFuncName,ParmNum+1); 20 else temporary[0]=0; 21 22 std::string varTypeName = compiler.TypeToString( varType ); 23 if(memcmp( varTypeName.c_str(),STRING_SYSTEM_DECLAREHANDLE,lstrlen(STRING_SYSTEM_DECLAREHANDLE))==0) 24 { 25 varTypeName = varTypeName.substr( lstrlen(STRING_SYSTEM_DECLAREHANDLE) ); 26 } 27 28 std::string calcTypeName = compiler.TypeToString( calcType ); 29 if(memcmp( calcTypeName.c_str(),STRING_SYSTEM_DECLAREHANDLE,lstrlen(STRING_SYSTEM_DECLAREHANDLE))==0) 30 { 31 calcTypeName = calcTypeName.substr( lstrlen(STRING_SYSTEM_DECLAREHANDLE) ); 32 } 33 sprintf(temporary+lstrlen(temporary),"%sから%s",calcTypeName.c_str(),varTypeName.c_str()); 19 if (pszFuncName) 20 { 21 s << boost::format("\"%s\"の第%dパラメータが、") % pszFuncName % (ParmNum + 1); 22 } 23 24 std::string varTypeName = compiler.TypeToString(varType); 25 if (memcmp(varTypeName.c_str(), STRING_SYSTEM_DECLAREHANDLE, lstrlen(STRING_SYSTEM_DECLAREHANDLE)) == 0) 26 { 27 varTypeName = varTypeName.substr(strlen(STRING_SYSTEM_DECLAREHANDLE)); 28 } 29 30 std::string calcTypeName = compiler.TypeToString(calcType); 31 if (memcmp(calcTypeName.c_str(), STRING_SYSTEM_DECLAREHANDLE, strlen(STRING_SYSTEM_DECLAREHANDLE)) == 0) 32 { 33 calcTypeName = calcTypeName.substr(strlen(STRING_SYSTEM_DECLAREHANDLE)); 34 } 35 s << boost::format("%sから%s") % calcTypeName % varTypeName; 34 36 35 37 extern int cp; 36 if(iWarning==1) compiler.errorMessenger.Output(-101,temporary,cp); 37 else if(iWarning==2) compiler.errorMessenger.Output(-102,temporary,cp); 38 else if(iWarning==3) compiler.errorMessenger.Output(50,temporary,cp); 38 int errorCode; 39 switch (iWarning) 40 { 41 case 1: errorCode = -101; break; 42 case 2: errorCode = -102; break; 43 case 3: errorCode = 50; break; 44 } 45 compiler.errorMessenger.Output(errorCode, s.str().c_str(), cp); 39 46 } 40 47
Note:
See TracChangeset
for help on using the changeset viewer.