Changeset 511 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/Subroutine.cpp
- Timestamp:
- Apr 30, 2008, 8:04:04 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/Subroutine.cpp
r507 r511 321 321 322 322 return true; 323 }324 325 void CollectProcedures( const BasicSource &source, UserProcs &userProcs, DllProcs &dllProcs )326 {327 extern HANDLE hHeap;328 int i,i2,i3;329 char temporary[8192];330 331 // 名前空間管理332 NamespaceScopes &namespaceScopes = compiler.GetNamespaceSupporter().GetLivingNamespaceScopes();333 namespaceScopes.clear();334 335 // Importsされた名前空間の管理336 NamespaceScopesCollection &importedNamespaces = compiler.GetNamespaceSupporter().GetImportedNamespaces();337 importedNamespaces.clear();338 339 i=-1;340 while(1){341 i++;342 343 if(source[i]==1&&(source[i+1]==ESC_CLASS||source[i+1]==ESC_INTERFACE)){344 /* Class ~ End Class345 Interface ~ End Interface346 を飛び越す */347 i3=GetEndXXXCommand(source[i+1]);348 for(i+=2,i2=0;;i++,i2++){349 if(source[i]=='\0') break;350 if(source[i]==1&&source[i+1]==(char)i3){351 i++;352 break;353 }354 }355 if(source[i]=='\0') break;356 continue;357 }358 359 if( source[i] == 1 && source[i+1] == ESC_NAMESPACE ){360 for(i+=2,i2=0;;i2++,i++){361 if( IsCommandDelimitation( source[i] ) ){362 temporary[i2]=0;363 break;364 }365 temporary[i2]=source[i];366 }367 namespaceScopes.push_back( temporary );368 369 continue;370 }371 else if( source[i] == 1 && source[i+1] == ESC_ENDNAMESPACE ){372 if( namespaceScopes.size() <= 0 ){373 compiler.errorMessenger.Output(12, "End Namespace", i );374 }375 else{376 namespaceScopes.pop_back();377 }378 379 i += 2;380 continue;381 }382 else if( source[i] == 1 && source[i+1] == ESC_IMPORTS ){383 for(i+=2,i2=0;;i2++,i++){384 if( IsCommandDelimitation( source[i] ) ){385 temporary[i2]=0;386 break;387 }388 temporary[i2]=source[i];389 }390 if( !compiler.GetNamespaceSupporter().ImportsNamespace( temporary ) )391 {392 compiler.errorMessenger.Output(64,temporary,cp );393 }394 395 continue;396 }397 else if( source[i] == 1 && source[i+1] == ESC_CLEARNAMESPACEIMPORTED ){398 importedNamespaces.clear();399 continue;400 }401 402 if(source[i]==1&&source[i+1]==ESC_DECLARE){403 for(i+=2,i2=0;;i2++,i++){404 if(source[i]=='\n'){405 temporary[i2]=0;406 break;407 }408 temporary[i2]=source[i];409 if(source[i]=='\0') break;410 }411 dllProcs.Add(namespaceScopes,temporary,i);412 413 continue;414 }415 if(source[i]==1&&(source[i+1]==ESC_SUB||source[i+1]==ESC_FUNCTION||source[i+1]==ESC_MACRO)){416 char statementChar = source[i+1];417 418 for(i2=0;;i2++,i++){419 if(IsCommandDelimitation(source[i])){420 temporary[i2]=0;421 break;422 }423 temporary[i2]=source[i];424 if(source[i]=='\0') break;425 }426 userProcs.AddUserProc(namespaceScopes, importedNamespaces, temporary,i,false,NULL,false);427 428 /* Sub ~ End Sub429 Function ~ End Function430 Macro ~ End Macro431 を飛び越す */432 char endStatementChar = GetEndXXXCommand( statementChar );433 for(i2=0;;i++,i2++){434 if( source[i] == '\0' ) break;435 if( source[i] == 1 && source[i+1] == endStatementChar ){436 i++;437 break;438 }439 }440 if(source[i]=='\0') break;441 continue;442 }443 444 //次の行445 for(;;i++){446 if(IsCommandDelimitation(source[i])) break;447 }448 if(source[i]=='\0') break;449 }450 451 ////////////452 // 特殊関数453 ////////////454 namespaceScopes.clear();455 importedNamespaces.clear();456 457 compiler.globalAreaProcName = "_System_GlobalArea_" + compiler.GetModuleName();458 sprintf(temporary,"%c%c%s()",1,ESC_SUB,compiler.globalAreaProcName.c_str());459 userProcs.AddUserProc( namespaceScopes, importedNamespaces, temporary,0,false,NULL,false);460 323 } 461 324
Note:
See TracChangeset
for help on using the changeset viewer.