#include "stdafx.h" #include #include #include "../common.h" #ifdef _AMD64_ #include "../../compiler_x64/opcode.h" #else #include "../../compiler_x86/opcode.h" #endif using namespace ActiveBasic::Compiler; bool UserProc::IsEqualForOverride( const Types &actualTypeParametersForThisProc, const UserProc *pUserProc ) const { if( this->GetName() == pUserProc->GetName() // 名前空間及び名前が等しい && this->Params().Equals( actualTypeParametersForThisProc, pUserProc->Params() ) ) // パラメータが等しい { if( this->returnType.Equals( pUserProc->returnType ) ) { // 戻り値が等しい return true; } else if( this->returnType.IsCovariant( pUserProc->returnType ) ) { // 戻り値が共変 return true; } else if( this->returnType.IsTypeParameter() ) { // 型パラメータだったとき if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].Equals( pUserProc->returnType ) ) { // 戻り値が等しい return true; } else if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].IsCovariant( pUserProc->returnType ) ) { // 戻り値が共変 return true; } } } return false; } std::string UserProc::GetFullName() const { if( HasParentClass() ){ return GetParentClass().GetName() + "." + GetName(); } return GetName(); } bool UserProc::IsCastOperator() const { if( GetName()[0] == 1 && GetName()[1] == ESC_OPERATOR && GetName()[2] == CALC_AS ) { return true; } return false; } const NamespaceScopes &UserProc::GetNamespaceScopes() const { if( HasParentClass() ){ return GetParentClassPtr()->GetNamespaceScopes(); } return Symbol::GetNamespaceScopes(); } const NamespaceScopesCollection &UserProc::GetImportedNamespaces() const { if( pParentClass ) { return pParentClass->GetImportedNamespaces(); } return importedNamespaces; } bool UserProc::IsVirtual() const { if( pMethod == NULL ){ return false; } return ( pMethod->IsVirtual() != 0 ); } const CMethod &UserProc::GetMethod() const { if( !HasParentClass() ) { Jenga::Throw( "グローバル関数に対してUserProc::GetMethodメソッドが呼ばれた" ); } return *pMethod; } bool UserProc::SetParamsAndReturnType( const char *sourceOfParams, int nowLine, bool isStatic ){ int i = 0; int i2,i3,sw; char temporary[8192],temp2[VN_SIZE]; //ソースコードの位置 this->codePos = nowLine; //パラメータ if(sourceOfParams[i]!='('){ compiler.errorMessenger.Output(1,NULL,nowLine); return false; } if(sourceOfParams[i + 1]!=')'&& this->pParentClass ){ //クラスのメンバ関数の場合のみ、デストラクタにパラメータがある場合にエラーをだす if(this->GetName()[0]=='~'){ compiler.errorMessenger.Output(114,NULL,nowLine); return false; } } // カッコ内のパラメータ文字列を取得 char parametersStr1[8192]; char parametersStr2[8192] = ""; i += GetStringInPare( parametersStr1, sourceOfParams + i, true ); if( sourceOfParams[i] == '(' ) { i += GetStringInPare( parametersStr2, sourceOfParams + i, true ); } // 戻り値文字列を取得 char returnTypeStr[VN_SIZE] = ""; if( sourceOfParams[i] ) { if( sourceOfParams[i] == 1 && sourceOfParams[i+1] == ESC_AS ) { if( !this->IsFunction() ){ // Sub/Macroの場合 compiler.errorMessenger.Output(38,this->GetName(),nowLine); } lstrcpy( returnTypeStr, sourceOfParams + i + 2 ); } else { compiler.errorMessenger.Output(1,NULL,nowLine); return false; } } // パラメータを分割 Jenga::Common::Strings parameters; SplitParameter( parametersStr1, parameters ); BOOST_FOREACH( const std::string ¶mStr, parameters ) { int i = 0; bool isRef = false; if( paramStr[i] == 1 ) { if( paramStr[i+1] == ESC_BYVAL ) { isRef = false; i += 2; } else if( paramStr[i+1] == ESC_BYREF ) { isRef = true; i += 2; } } //パラメータ名 bool isArray = false; Subscripts subscripts; char name[VN_SIZE]; sw=0; for(i2=0;;i++,i2++){ if(paramStr[i]=='('){ if(!sw) sw=1; i3=GetStringInPare(name+i2,paramStr.c_str()+i); i2+=i3-1; i+=i3-1; continue; } if(paramStr[i]=='['){ if(!sw) sw=1; i3=GetStringInBracket(name+i2,paramStr.c_str()+i); i2+=i3-1; i+=i3-1; continue; } if(!IsVariableChar(paramStr[i])){ name[i2]=0; break; } name[i2]=paramStr[i]; } if(sw){ //配列パラメータ if( isRef == false ) { compiler.errorMessenger.Output(29,NULL,nowLine); } isArray = true; if((name[i2-2]=='('&&name[i2-1]==')')|| (name[i2-2]=='['&&name[i2-1]==']')) { subscripts.push_back( LONG_MAX ); name[i2-2]=0; } else{ GetArrange(name,temp2,subscripts); lstrcpy(name,temp2); } i2=lstrlen(name); } Type type( DEF_NON ); char initValue[8192] = ""; if( paramStr[i] == '=' ){ i++; i = GetOneParameter( paramStr.c_str(), i, initValue ); if( paramStr[i-1] == ',' ) { i--; } // TODO: エラー用 fix me!!! //cp = nowLine; NumOpe_GetType( initValue, GetStringTypeInfo(), type ); if( IS_LITERAL(type.GetIndex()) ) { type.SetIndex( -1 ); } } else if(paramStr[i]==1&¶mStr[i+1]==ESC_AS){ // As指定 i+=2; i2=0; lstrcpy( temporary, paramStr.c_str() + i ); compiler.StringToType( temporary, type ); if( type.IsNull() ){ compiler.errorMessenger.Output(3,temporary,nowLine); type.SetBasicType( DEF_PTR_VOID ); } if( type.IsObject() ){ if( type.GetClass().IsBlittableType() ){ // Blittable型のときは基本型として扱う type = type.GetClass().GetBlittableType(); } } } else{ type.SetBasicType( Type::GetBasicTypeFromSimpleName(name) ); compiler.errorMessenger.Output(-103,name,nowLine); } Parameter *pParam = new Parameter( name, type, isRef, initValue ); if( isArray ){ pParam->SetArray( subscripts ); } //パラメータを追加 this->params.push_back( pParam ); } this->secondParmNum = (int)this->params.size(); SplitParameter( parametersStr2, parameters ); BOOST_FOREACH( const std::string ¶mStr, parameters ) { int i = 0; bool isRef = false; if( paramStr[i] == 1 ) { if( paramStr[i+1] == ESC_BYVAL ) { isRef = true; i += 2; } else if( paramStr[i+1] == ESC_BYREF ) { isRef = false; i += 2; } } //パラメータ名 bool isArray = false; Subscripts subscripts; char name[VN_SIZE]; sw=0; for(i2=0;;i++,i2++){ if(paramStr[i]=='('){ if(!sw) sw=1; i3=GetStringInPare(name+i2,paramStr.c_str()+i); i2+=i3-1; i+=i3-1; continue; } if(paramStr[i]=='['){ if(!sw) sw=1; i3=GetStringInBracket(name+i2,paramStr.c_str()+i); i2+=i3-1; i+=i3-1; continue; } if(!IsVariableChar(paramStr[i])){ name[i2]=0; break; } name[i2]=paramStr[i]; } if(sw){ //配列パラメータ if( isRef == false ) compiler.errorMessenger.Output(29,NULL,nowLine); isArray = true; if((name[i2-2]=='('&&name[i2-1]==')')|| (name[i2-2]=='['&&name[i2-1]==']')) { subscripts.push_back( LONG_MAX ); name[i2-2]=0; } else{ GetArrange(name,temp2,subscripts); lstrcpy(name,temp2); } i2=lstrlen(name); } Type type( DEF_NON ); char initValue[8192] = ""; if( paramStr[i] == '=' ){ i++; i = GetOneParameter( paramStr.c_str(), i, initValue ); if( paramStr[i-1] == ',' ) { i--; } // TODO: エラー用 fix me!!! //cp = nowLine; NumOpe_GetType( initValue, GetStringTypeInfo(), type ); if( IS_LITERAL(type.GetIndex()) ) { type.SetIndex( -1 ); } } else if(paramStr[i]==1&¶mStr[i+1]==ESC_AS){ // As指定 i+=2; i2=0; while(paramStr[i]=='*'){ temporary[i2]=paramStr[i]; i++; i2++; } for(;;i++,i2++){ if(!IsVariableChar(paramStr[i])){ if(paramStr[i]==1&&(paramStr[i+1]==ESC_FUNCTION||paramStr[i+1]==ESC_SUB)){ temporary[i2++]=paramStr[i++]; temporary[i2]=paramStr[i]; continue; } temporary[i2]=0; break; } temporary[i2]=paramStr[i]; } compiler.StringToType( temporary, type ); if( type.IsNull() ){ compiler.errorMessenger.Output(3,temporary,nowLine); type.SetBasicType( DEF_PTR_VOID ); } if( type.IsObject() ){ if( type.GetClass().IsBlittableType() ){ // Blittable型のときは基本型として扱う type = type.GetClass().GetBlittableType(); } } } else{ type.SetBasicType( Type::GetBasicTypeFromSimpleName(temporary) ); compiler.errorMessenger.Output(-103,temporary,nowLine); } Parameter *pParam = new Parameter( name, type, isRef, initValue ); if( isArray ){ pParam->SetArray( subscripts ); } //パラメータを追加 this->params.push_back( pParam ); } if(returnTypeStr[0]){ /////////////////// // 戻り値を取得 /////////////////// if( !this->IsFunction() ){ // Sub/Macroの場合 compiler.errorMessenger.Output(38,this->GetName(),nowLine); } if( this->pParentClass ){ if( this->GetName() == this->pParentClass->GetName() || this->GetName()[0]=='~'){ //クラスのコンストラクタ、デストラクタがFunction定義の場合はエラーをだす compiler.errorMessenger.Output(115,NULL,nowLine); } } compiler.StringToType( returnTypeStr, this->returnType ); if( this->returnType.IsNull() ) { compiler.errorMessenger.Output(3,returnTypeStr,nowLine); } } else{ if( this->IsFunction() ) { // Function定義なのに、戻り値の型がセットされていない compiler.errorMessenger.Output(-104,this->GetName().c_str(),nowLine); this->returnType.SetBasicType( DEF_DOUBLE ); } else { //戻り値なしのSub定義 this->returnType.SetNull(); } } //リアルパラメータ領域を取得(_System_LocalThisを考慮して2つだけ多く確保する場合がある) if( this->pParentClass && isStatic == false ){ //オブジェクトメンバの場合は、第一パラメータを_System_LocalThis引き渡し用として利用 std::string name = "_System_LocalThis"; Type type( DEF_PTR_VOID ); this->realParams.push_back( new Parameter( name, type ) ); } if( this->returnType.IsStruct() ){ //構造体を戻り値として持つ場合 //※第一パラメータ(Thisポインタありの場合は第二パラメータ)を戻り値用の参照宣言にする std::string name = this->GetName(); if(name[0]==1&&name[1]==ESC_OPERATOR){ name="_System_ReturnValue"; } Type type( DEF_STRUCT, this->returnType.GetIndex() ); this->realParams.push_back( new Parameter( name, type, true ) ); } //パラメータをコピー BOOST_FOREACH( Parameter *pParam, params ){ this->realParams.push_back( new Parameter( *pParam ) ); } return true; } const UserProc *UserProc::pCompilingUserProc = NULL; const UserProc *UserProc::pGlobalProc = NULL; bool UserProcs::Insert( UserProc *pUserProc, int nowLine ) { ///////////////////////////////// // ハッシュデータに追加 ///////////////////////////////// if( !Put( pUserProc ) ) { // 重複しているため、失敗 compiler.errorMessenger.Output(15,pUserProc->GetName().c_str(),nowLine); return false; } return true; } void UserProcs::EnumGlobalProcs( const char *simpleName, const char *localName, std::vector &subs ) { /////////////////////////// // グローバル関数を検索 /////////////////////////// // ハッシュ値を取得 UserProc *pUserProc = GetHashArrayElement( simpleName ); while(pUserProc){ if( pUserProc->IsGlobalProcedure() ){ if( pUserProc->IsEqualSymbol( LexicalAnalyzer::FullNameToSymbol( localName ) ) ){ subs.push_back( pUserProc ); } } pUserProc=pUserProc->GetChainNext(); } } bool DllProc::SetParamsAndReturnType( const char *sourceOfParams, int nowLine ){ int i = 0; int i2,i3,sw; char temporary[8192],temp2[VN_SIZE]; //ソースコードの位置 this->codePos = nowLine; //パラメータ if(sourceOfParams[i]!='('){ compiler.errorMessenger.Output(1,NULL,nowLine); return 0; } i++; while(1){ if(sourceOfParams[i]==')') break; //ByRef bool isRef; if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){ isRef = false; i+=2; } else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){ isRef = true; i+=2; } else isRef = false; //パラメータ名 bool isArray = false; Subscripts subscripts; char name[VN_SIZE]; sw=0; for(i2=0;;i++,i2++){ if(sourceOfParams[i]=='('){ if(!sw) sw=1; i3=GetStringInPare(name+i2,sourceOfParams+i); i2+=i3-1; i+=i3-1; continue; } if(sourceOfParams[i]=='['){ if(!sw) sw=1; i3=GetStringInBracket(name+i2,sourceOfParams+i); i2+=i3-1; i+=i3-1; continue; } if(!IsVariableChar(sourceOfParams[i])){ name[i2]=0; break; } name[i2]=sourceOfParams[i]; } if(sw){ //配列パラメータ if( isRef == false ) compiler.errorMessenger.Output(29,NULL,nowLine); isArray = true; if((name[i2-2]=='('&&name[i2-1]==')')|| (name[i2-2]=='['&&name[i2-1]==']')) { subscripts.push_back( LONG_MAX ); name[i2-2]=0; } else{ GetArrange(name,temp2,subscripts); lstrcpy(name,temp2); } i2=lstrlen(name); } //型 Type type( DEF_NON ); if(lstrcmp(name,"...")==0) type.SetBasicType( DEF_ELLIPSE ); else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){ i+=2; i2=0; while(sourceOfParams[i]=='*'){ temporary[i2]=sourceOfParams[i]; i++; i2++; } for(;;i++,i2++){ if(!IsVariableChar(sourceOfParams[i])){ if(sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){ temporary[i2++]=sourceOfParams[i++]; temporary[i2]=sourceOfParams[i]; continue; } temporary[i2]=0; break; } temporary[i2]=sourceOfParams[i]; } compiler.StringToType( temporary, type ); if( type.IsNull() ){ compiler.errorMessenger.Output(3,temporary,nowLine); type.SetBasicType( DEF_PTR_VOID ); } } else{ type.SetBasicType( Type::GetBasicTypeFromSimpleName(temporary) ); compiler.errorMessenger.Output(-103,temporary,nowLine); } Parameter *pParam = new Parameter( name, type, isRef ); if( isArray ){ pParam->SetArray( subscripts ); } //パラメータを追加 this->params.push_back( pParam ); if(sourceOfParams[i]==','){ i++; continue; } else if(sourceOfParams[i]==')') continue; else{ compiler.errorMessenger.Output(1,NULL,nowLine); break; } } i++; if(sourceOfParams[i]){ /////////////////// // 戻り値を取得 /////////////////// i2=lstrlen(sourceOfParams)-2; int sw_as=0; for(;i2>0;i2--){ if(sourceOfParams[i2]==')') break; if(sourceOfParams[i2]==1&&sourceOfParams[i2+1]==ESC_AS){ i2+=2; i3=0; while(sourceOfParams[i2]=='*') temporary[i3++]=sourceOfParams[i2++]; for(;;i2++,i3++){ if(!IsVariableChar(sourceOfParams[i2])){ temporary[i3]=0; break; } temporary[i3]=sourceOfParams[i2]; } compiler.StringToType( temporary, this->returnType ); if( this->returnType.IsNull() ) compiler.errorMessenger.Output(3,temporary,nowLine); sw_as=1; break; } } } else{ //戻り値なしのSub定義 this->returnType.SetNull(); } return true; } void DllProcs::Add(const NamespaceScopes &namespaceScopes, char *buffer,int nowLine){ int i2; int i=0; //Sub/Function Procedure::Kind kind = Procedure::Sub; if(buffer[i]==ESC_SUB){ } else if(buffer[i]==ESC_FUNCTION){ kind = Procedure::Function; } else{ compiler.errorMessenger.Output(1,NULL,nowLine); return; } i++; //プロシージャ名 char procName[VN_SIZE]; bool isCdecl = false; for(i2=0;;i++,i2++){ if(buffer[i]==1&&buffer[i+1]==ESC_CDECL){ isCdecl = true; i+=2; procName[i2]=0; break; } if(buffer[i]==','){ procName[i2]=0; break; } if(buffer[i]=='\0'){ compiler.errorMessenger.Output(1,NULL,nowLine); return; } procName[i2]=buffer[i]; } i++; //ユーザー定義関数との重複チェック if(GetSubHash(procName)){ compiler.errorMessenger.Output(15,procName,nowLine); return; } //ライブラリ char dllFileName[MAX_PATH]; i = GetOneParameter( buffer, i, dllFileName ); Type resultType; _int64 i64data; if( !StaticCalculation( true, dllFileName, 0, &i64data, resultType ) ){ return; } if( resultType.GetBasicType() != typeOfPtrChar ){ compiler.errorMessenger.Output(1,NULL,nowLine); return; } lstrcpy( dllFileName, (char *)i64data ); CharUpper(dllFileName); if(!strstr(dllFileName,".")){ lstrcat(dllFileName,".DLL"); if(lstrlen(dllFileName)>=16){ compiler.errorMessenger.Output(7,NULL,nowLine); return; } } //エイリアス char alias[VN_SIZE]; i = GetOneParameter( buffer, i, alias ); if( alias[0] ){ if( !StaticCalculation( true, alias, 0, &i64data, resultType ) ){ return; } if( resultType.GetBasicType() != typeOfPtrChar ){ compiler.errorMessenger.Output(1,NULL,nowLine); return; } lstrcpy( alias, (char *)i64data ); } else{ //省略されたときは関数名 lstrcpy( alias, procName ); } // オブジェクトを生成 DllProc *pDllProc = new DllProc( namespaceScopes, procName, kind, isCdecl, dllFileName, alias ); // パラメータを解析 // ※第1パラメータにに指定するデータの例:"( s As String ) As String" pDllProc->SetParamsAndReturnType( buffer + i, nowLine ); // パラメータのエラーチェック BOOST_FOREACH( const Parameter *pParam, pDllProc->Params() ){ if( pParam->IsObject() ){ compiler.errorMessenger.Output(25,pParam->GetVarName(),nowLine); } if( !pParam->IsRef() ){ if( pParam->IsStruct() ){ compiler.errorMessenger.Output(28,pParam->GetVarName(),nowLine); } } } //戻り値のエラーチェック if( pDllProc->IsFunction() ){ // Function定義 if( pDllProc->ReturnType().IsObject() ){ // DLL関数ではオブジェクトを戻り値にできない compiler.errorMessenger.Output(40,pDllProc->GetName(),nowLine); } } // ハッシュマップに追加 this->Put( pDllProc ); } bool ProcPointer::SetParamsAndReturnType( const char *sourceOfParams, int nowLine ){ int i = 0; int i2,i3,sw; char temporary[8192],temp2[VN_SIZE]; //ソースコードの位置 this->codePos = nowLine; //パラメータ if(sourceOfParams[i]!='('){ compiler.errorMessenger.Output(1,NULL,nowLine); return 0; } i++; while(1){ if(sourceOfParams[i]==')') break; //ByRef bool isRef; if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){ isRef = false; i+=2; } else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){ isRef = true; i+=2; } else isRef = false; //パラメータ名 bool isArray = false; Subscripts subscripts; char name[VN_SIZE]; sw=0; for(i2=0;;i++,i2++){ if(sourceOfParams[i]=='('){ if(!sw) sw=1; i3=GetStringInPare(name+i2,sourceOfParams+i); i2+=i3-1; i+=i3-1; continue; } if(sourceOfParams[i]=='['){ if(!sw) sw=1; i3=GetStringInBracket(name+i2,sourceOfParams+i); i2+=i3-1; i+=i3-1; continue; } if(!IsVariableChar(sourceOfParams[i])){ name[i2]=0; break; } name[i2]=sourceOfParams[i]; } if(sw){ //配列パラメータ if( isRef == false ) compiler.errorMessenger.Output(29,NULL,nowLine); isArray = true; if((name[i2-2]=='('&&name[i2-1]==')')|| (name[i2-2]=='['&&name[i2-1]==']')) { subscripts.push_back( LONG_MAX ); name[i2-2]=0; } else{ GetArrange(name,temp2,subscripts); lstrcpy(name,temp2); } i2=lstrlen(name); } //型 Type type( DEF_NON ); if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){ i+=2; i2=0; while(sourceOfParams[i]=='*'){ temporary[i2]=sourceOfParams[i]; i++; i2++; } for(;;i++,i2++){ if(!IsVariableChar(sourceOfParams[i])){ if(sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){ temporary[i2++]=sourceOfParams[i++]; temporary[i2]=sourceOfParams[i]; continue; } temporary[i2]=0; break; } temporary[i2]=sourceOfParams[i]; } compiler.StringToType( temporary, type ); if( type.IsNull() ){ compiler.errorMessenger.Output(3,temporary,nowLine); type.SetBasicType( DEF_PTR_VOID ); } } else{ type.SetBasicType( Type::GetBasicTypeFromSimpleName(temporary) ); compiler.errorMessenger.Output(-103,temporary,nowLine); } Parameter *pParam = new Parameter( name, type, isRef ); if( isArray ){ pParam->SetArray( subscripts ); } //パラメータを追加 this->params.push_back( pParam ); if(sourceOfParams[i]==','){ i++; continue; } else if(sourceOfParams[i]==')') continue; else{ compiler.errorMessenger.Output(1,NULL,nowLine); break; } } i++; if(sourceOfParams[i]){ /////////////////// // 戻り値を取得 /////////////////// i2=lstrlen(sourceOfParams)-2; int sw_as=0; for(;i2>0;i2--){ if(sourceOfParams[i2]==')') break; if(sourceOfParams[i2]==1&&sourceOfParams[i2+1]==ESC_AS){ i2+=2; i3=0; while(sourceOfParams[i2]=='*') temporary[i3++]=sourceOfParams[i2++]; for(;;i2++,i3++){ if(!IsVariableChar(sourceOfParams[i2])){ temporary[i3]=0; break; } temporary[i3]=sourceOfParams[i2]; } compiler.StringToType( temporary, this->returnType ); if( this->returnType.IsNull() ) compiler.errorMessenger.Output(3,temporary,nowLine); sw_as=1; break; } } } else{ //戻り値なしのSub定義 this->returnType.SetNull(); } //戻り値のエラーチェック if( IsFunction() ){ // Function定義 if( this->ReturnType().IsNull() ){ // 戻り値がない compiler.errorMessenger.Output(26,this->GetName(),nowLine); } } else{ if( !this->ReturnType().IsNull() ){ // Sub定義なのに、戻り値がある compiler.errorMessenger.Output(38,this->GetName(),nowLine); } } return true; } int ProcPointers::Add( const std::string &typeExpression ) { DWORD dwProcType = (DWORD)typeExpression[2]; const std::string ¶mStr = typeExpression.substr( 3 ); Procedure::Kind kind = Procedure::Sub; if( dwProcType == ESC_FUNCTION ){ kind = Procedure::Function; } ProcPointer *pProcPointer = new ProcPointer( kind ); //buffer[0]は'('となっている extern int cp; pProcPointer->SetParamsAndReturnType( paramStr.c_str(), cp ); this->push_back( pProcPointer ); return (int)this->size()-1; } void ProcPointers::Clear() { ProcPointers &procPointers = *this; BOOST_FOREACH( ProcPointer *pProcPointer, procPointers ){ delete pProcPointer; } this->clear(); }