int main(){ switch (rr) { case 1 : opa(); break; case 3 : opa(); default : opc(); } opb(); return 1; }
int main(){ if (rr<5000) opa(rr,300); rr=opb(); return 1; }
int main(){ /*@ loop invariant 0<=rr<=50; */ while (rr<50) { opa(); } opb(); //@ ghost int tmp = 1; //@ ghost tmp=0; return 1; }
//--------------------------------------------------------------------- void CqImagersource::Initialise( const CqRegion& DRegion, IqChannelBuffer* buffer ) { AQSIS_TIME_SCOPE(Imager_shading); // We use one less than the bucket width and height here, since these // resolutions really represent one less than the number of shaded points // in each direction. (Usually they describe the number of micropolygons // on a grid which is one less than the number of shaded vertices. This // concept has no real analogue in context of an imager shader.) TqInt uGridRes = DRegion.width()-1; TqInt vGridRes = DRegion.height()-1; TqInt x = DRegion.xMin(); TqInt y = DRegion.yMin(); m_uYOrigin = static_cast<TqInt>( y ); m_uXOrigin = static_cast<TqInt>( x ); m_uGridRes = uGridRes; m_vGridRes = vGridRes; TqInt mode = QGetRenderContext() ->poptCurrent()->GetIntegerOption( "System", "DisplayMode" ) [ 0 ]; TqFloat components; TqInt j, i; TqFloat shuttertime = QGetRenderContext() ->poptCurrent()->GetFloatOption( "System", "Shutter" ) [ 0 ]; components = mode & DMode_RGB ? 3 : 0; components += mode & DMode_A ? 1 : 0; components = mode & DMode_Z ? 1 : components; TqInt Uses = ( 1 << EnvVars_P ) | ( 1 << EnvVars_Ci ) | ( 1 << EnvVars_Oi | ( 1 << EnvVars_ncomps ) | ( 1 << EnvVars_time ) | ( 1 << EnvVars_alpha ) | ( 1 << EnvVars_s ) | ( 1 << EnvVars_t ) ); m_pShaderExecEnv->Initialise( uGridRes, vGridRes, uGridRes * vGridRes, (uGridRes+1)*(vGridRes+1), true, IqAttributesPtr(), IqTransformPtr(), m_pShader.get(), Uses ); // Initialise the geometric parameters in the shader exec env. TqInt numShadingPoints = (uGridRes+1) * (vGridRes+1); P() ->Initialise( numShadingPoints ); Ci() ->Initialise( numShadingPoints ); Oi() ->Initialise( numShadingPoints ); alpha() ->Initialise( numShadingPoints ); s() ->Initialise( numShadingPoints ); t() ->Initialise( numShadingPoints ); //TODO dtime is not initialised yet //dtime().Initialise(uGridRes, vGridRes, i); ncomps() ->SetFloat( components ); time() ->SetFloat( shuttertime ); m_pShader->Initialise( uGridRes, vGridRes, (uGridRes+1)*(vGridRes+1), m_pShaderExecEnv.get() ); TqUint CiIndex = buffer->getChannelIndex("Ci"); TqUint OiIndex = buffer->getChannelIndex("Oi"); TqUint coverageIndex = buffer->getChannelIndex("coverage"); for ( j = 0; j < vGridRes+1; j++ ) { for ( i = 0; i < uGridRes+1; i++ ) { TqInt off = j * ( uGridRes + 1 ) + i; P() ->SetPoint( CqVector3D( x + i, y + j, 0.0 ), off ); Ci() ->SetColor( CqColor((*buffer)(i, j, CiIndex)[0], (*buffer)(i, j, CiIndex)[1], (*buffer)(i, j, CiIndex)[2]), off ); CqColor opa((*buffer)(i, j, OiIndex)[0], (*buffer)(i, j, OiIndex)[1], (*buffer)(i, j, OiIndex)[2]); Oi() ->SetColor( opa, off ); TqFloat avopa = ( opa.r() + opa.g() + opa.b() ) /3.0f; alpha() ->SetFloat( (*buffer)(i, j, coverageIndex)[0] * avopa, off ); s() ->SetFloat( x + i + 0.5, off ); t() ->SetFloat( y + j + 0.5, off ); } } // Execute the Shader VM if ( m_pShader ) { m_pShader->Evaluate( m_pShaderExecEnv.get() ); alpha() ->SetFloat( 1.0f ); /* by default 3delight/bmrt set it to 1.0 */ } }
V gnop(ST s,OTF*ft,I e){ I c;O a,b,x,r;b=pop(s);if(b->t==TA){if(e){O ad,bd;a=pop(s);if(a->t!=TA)TE;ad=newod(len(a->a));bd=newod(len(b->a));psh(s,ft[TD](ad,bd));dlo(ad);dlo(bd);dlo(a);dlo(b);R;}else{psh(s,opa(b,ft,e));dlo(b);R;}} a=pop(s);if(a->t==TA){r=newoa(newst(BZ));while(len(a->a)){psh(s,pop(a->a));psh(s,dup(b));gnop(s,ft,e);psh(r->a,pop(s));}dlo(a);dlo(b);rev(r->a);psh(s,r);R;} c=a->t==TCB||b->t==TCB;/*two different types added together==str*/if(a->t!=b->t){O ao=a,bo=b;a=tosocb(ao);b=tosocb(bo);dlo(ao);dlo(bo);}r=ft[a->t==TCB?TS:a->t](a,b);if(c&&r->t==TS){x=r;r=newocb(x->s.s,x->s.z);dlo(x);} psh(s,r);dlo(a);dlo(b); } //generic op
void cb_trace_files::cb_renumber(void) { /* Openファイルのフルパスを得る */ const std::string filepath = this->get_open_path( 1 ); if (filepath.empty()) { fl_alert( "Not set Open Folder or File name" ); return; } /* 連番ファイルの存在チェックして必要な情報に変える */ std::string dpath , head , num , ext; int number=-1; std::vector<int> nums; ids::path::level_from_files( filepath ,dpath ,head ,num ,number ,ext ,nums ); if (head.empty() || nums.size() <= 0) { fl_alert( "Not exist files" ); return; } /* ユーザーから新しいStart番号を得る */ const char* new_start_num_ptr = fl_input( "Enter New Start Number" ,std::to_string(nums.at(0)).c_str() ); if (new_start_num_ptr == nullptr || std::stoi(std::string(new_start_num_ptr))==nums.at(0)) { return; /* Cancel or 同じ名前なら何もしない */ } const std::string new_start_num( new_start_num_ptr ); /* 新しいStart番号との差 */ const int diff_num = std::stoi(new_start_num) - nums.at(0); /* エラー数値をチェックしつつ番号を文字列に入れる */ std::ostringstream numost; bool error_sw = false; for (auto nu : nums) { numost << nu + diff_num; numost << " "; if ( nu + diff_num < 0 || 9999 < nu + diff_num ) { error_sw = true; } } /* ゼロ以下数値があるとエラーメッセージダイオローグを出して終わる */ if (error_sw) { std::string opa( this->get_open_path( nums.at(0) ) ); std::string npa( this->get_open_path( nums.at(0) + diff_num ) ); fl_alert( "Error : Number need 0...9999 range\nFrom\n %s\nTo\n %s\nNumber List\n %s\n" ,opa.c_str() ,npa.c_str() ,numost.str().c_str() ); return; } /* ファイル毎名前を変更する */ for (size_t ii=0; ii<nums.size() ; ++ii) { std::string opa( this->get_open_path( nums.at(ii) ) ); std::string npa( this->get_open_path( nums.at(ii) + diff_num ) ); /* 最初にこれでいいかユーザーに確認する */ if (ii==0) { if (fl_ask( "Renumber\nFrom\n %s\nTo\n %s\nNumber List\n %s\nOK?" ,opa.c_str() ,npa.c_str() ,numost.str().c_str() ) != 1) { return; // Cancel } } #ifdef _WIN32 std::string opa2( osapi::cp932_from_utf8( opa ) ); std::string npa2( osapi::cp932_from_utf8( npa ) ); if (opa2.empty() || npa2.empty()) { fl_alert("Error:rename \"%s\" \"%s\"" ,opa.c_str() ,npa.c_str() ); return; } std::rename( opa2.c_str() ,npa2.c_str() ); #else std::rename( opa.c_str() ,npa.c_str() ); #endif } /* renumber成功したら、新しいStart,End,Numberに表示変更 */ this->cb_set_number(); this->cb_check_existing_saved_file(); }
/* rename/renumber処理実行 */ void cb_trace_files::cb_rename(void) { /* Openファイルのフルパスを得る */ const std::string filepath = this->get_open_path( 1 ); if (filepath.empty()) { fl_alert( "Not set Open Folder or File name" ); return; } /* 連番ファイルの存在チェックして必要な情報に変える */ std::string dpath , head , num , ext; int number=-1; std::vector<int> nums; ids::path::level_from_files( filepath ,dpath ,head ,num ,number ,ext ,nums ); if (head.empty() || nums.size() <= 0) { fl_alert( "Not exist files" ); return; } std::ostringstream numost; for (auto nu : nums) { numost << nu; numost << " "; } /* ユーザーから新しい名前を得る */ const char* new_head_ptr = fl_input( "Enter New Level Name" ,head.c_str() ); if (new_head_ptr == nullptr || head == new_head_ptr ) { return; /* Cancel or 同じ名前なら何もしない */ } const std::string new_head(new_head_ptr); /* ファイル毎名前を変更する */ for (size_t ii=0; ii<nums.size() ; ++ii) { std::string opa( this->get_open_path( nums.at(ii) ) ); std::string npa( this->get_open_path_from_head_and_number_( new_head.c_str() ,nums.at(ii) )); /* 最初にこれでいいかユーザーに確認する */ if (ii==0) { if (fl_ask( "Rename\nFrom\n %s\nTo\n %s\nNumber List\n %s\nOK?" ,opa.c_str() ,npa.c_str() ,numost.str().c_str() ) != 1) { return; // Cancel } } #ifdef _WIN32 std::string opa2( osapi::cp932_from_utf8( opa ) ); std::string npa2( osapi::cp932_from_utf8( npa ) ); if (opa2.empty() || npa2.empty()) { fl_alert("Error:rename \"%s\" \"%s\"" ,opa.c_str() ,npa.c_str() ); return; } std::rename( opa2.c_str() ,npa2.c_str() ); #else std::rename( opa.c_str() ,npa.c_str() ); #endif } /* rename成功したら、新しい名前に表示変更 */ cl_gts_gui.strinp_trace_open_file_head->value( new_head.c_str() ); }