Changeset 708 in dev
- Timestamp:
- Jul 26, 2008, 7:27:20 AM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/ParamImpl.cpp
r673 r708 309 309 lstrcpy(Parms[ParmsNum],param.GetInitValue().c_str() ); 310 310 ParmsNum++; 311 312 types.push_back( Type() ); 311 313 } 312 314 } … … 334 336 335 337 //省略パラメータに "0" を指定する 336 for(;ParmsNum < (int)params.size();ParmsNum++){ 338 while( ParmsNum < (int)params.size() ) 339 { 337 340 extern HANDLE hHeap; 338 341 char temporary[64]; … … 341 344 Parms[ParmsNum]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); 342 345 lstrcpy(Parms[ParmsNum],temporary); 346 347 ParmsNum++; 348 349 types.push_back( Type() ); 343 350 } 344 351 } -
trunk/ab5.0/abdev/BasicCompiler_Common/include/LexicalAnalyzer.h
r632 r708 48 48 49 49 // グローバルプロシージャを収集する 50 static bool ExtractParameterVarNames( const char *sourceOfParams, Jenga::Common::Strings ¶mVarNames, int nowLine ); 50 51 static bool AnalyzeParameter( Parameters ¶ms, const Jenga::Common::Strings ¶meterStrings, int nowLine ); 51 52 static bool SetParamsAndReturnTypeForUserProc( UserProc &userProc, const char *sourceOfParams, int nowLine, bool isStatic ); -
trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Delegate.cpp
r692 r708 201 201 } 202 202 203 values.insert( std::map<std::string,std::string>::value_type( "#params#", dg.GetParamStr() ) ); 203 // 呼び出し側の実引数文字列を作成 204 Jenga::Common::Strings paramVarNames; 205 LexicalAnalyzer::ExtractParameterVarNames( dg.GetParamStr().c_str(), paramVarNames, dg.GetSourceIndex() ); 206 std::string tempParamStrForCall; 207 BOOST_FOREACH( const std::string &varName, paramVarNames ) 208 { 209 if( !tempParamStrForCall.empty() ) 210 { 211 tempParamStrForCall += ","; 212 } 213 tempParamStrForCall += varName; 214 } 215 values.insert( std::map<std::string,std::string>::value_type( "#params#", tempParamStrForCall ) ); 204 216 205 217 destSource += sourceTemplate.GetResult( values ); -
trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp
r671 r708 2 2 3 3 using namespace ActiveBasic::Compiler; 4 5 bool LexicalAnalyzer::ExtractParameterVarNames( const char *sourceOfParams, Jenga::Common::Strings ¶mVarNames, int nowLine ) 6 { 7 int i = 0; 8 int i2,i3,sw; 9 char temporary[8192],temp2[VN_SIZE]; 10 11 while(1){ 12 if(sourceOfParams[i]=='\0') break; 13 14 //ByRef 15 bool isRef; 16 if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){ 17 isRef = false; 18 i+=2; 19 } 20 else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){ 21 isRef = true; 22 i+=2; 23 } 24 else isRef = false; 25 26 //パラメータ名 27 bool isArray = false; 28 Subscripts subscripts; 29 char name[VN_SIZE]; 30 sw=0; 31 for(i2=0;;i++,i2++){ 32 if(sourceOfParams[i]=='('){ 33 if(!sw) sw=1; 34 35 i3=GetStringInPare(name+i2,sourceOfParams+i); 36 i2+=i3-1; 37 i+=i3-1; 38 continue; 39 } 40 if(sourceOfParams[i]=='['){ 41 if(!sw) sw=1; 42 43 i3=GetStringInBracket(name+i2,sourceOfParams+i); 44 i2+=i3-1; 45 i+=i3-1; 46 continue; 47 } 48 if(!IsVariableChar(sourceOfParams[i])){ 49 name[i2]=0; 50 break; 51 } 52 name[i2]=sourceOfParams[i]; 53 } 54 if(sw){ 55 //配列パラメータ 56 if( isRef == false ) compiler.errorMessenger.Output(29,NULL,nowLine); 57 isArray = true; 58 59 if((name[i2-2]=='('&&name[i2-1]==')')|| 60 (name[i2-2]=='['&&name[i2-1]==']')) 61 { 62 subscripts.push_back( LONG_MAX ); 63 64 name[i2-2]=0; 65 } 66 else{ 67 GetArrange(name,temp2,subscripts); 68 lstrcpy(name,temp2); 69 } 70 71 i2=lstrlen(name); 72 } 73 74 paramVarNames.push_back( name ); 75 76 //型 77 Type type( DEF_NON ); 78 if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS) 79 { 80 i+=2; 81 82 i2=0; 83 while(sourceOfParams[i]=='*'){ 84 temporary[i2]=sourceOfParams[i]; 85 i++; 86 i2++; 87 } 88 for(;;i++,i2++){ 89 if(!IsVariableChar(sourceOfParams[i], true)){ 90 if(sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){ 91 temporary[i2++]=sourceOfParams[i++]; 92 temporary[i2]=sourceOfParams[i]; 93 continue; 94 } 95 temporary[i2]=0; 96 break; 97 } 98 temporary[i2]=sourceOfParams[i]; 99 } 100 } 101 102 if(sourceOfParams[i]==','){ 103 i++; 104 continue; 105 } 106 else if(sourceOfParams[i]=='\0') break; 107 else{ 108 compiler.errorMessenger.Output(1,NULL,nowLine); 109 break; 110 } 111 } 112 113 return true; 114 } 4 115 5 116 bool LexicalAnalyzer::AnalyzeParameter( Parameters ¶ms, const Jenga::Common::Strings ¶meterStrings, int nowLine ) -
trunk/ab5.0/abdev/ab_common/src/Lexical/Parameter.cpp
r632 r708 40 40 bool Parameter::Equals( const Parameter ¶m, bool isContravariant ) const 41 41 { 42 if( Type::Equals( param ) )42 if( Type::Equals( param ) && this->isRef == param.isRef ) 43 43 { 44 44 return true; … … 64 64 { 65 65 // 反変引数を許可する 66 if( this->IsContravariant( param ) )66 if( this->IsContravariant( param ) && this->isRef == param.isRef ) 67 67 { 68 68 // 反変引数だったとき
Note:
See TracChangeset
for help on using the changeset viewer.