/**************主函数**************************/ void main(void) { disp(); //上电显示1、2、3、4 delay(1); while(1) { // keya=TM1650_read(); // delay(50); // if (keya!=0) // { // switch(keya) //控制数码管显示数字 // { // case 0x44:TM1650_send(0X68,display[5]); break; //K11与DIG1 // case 0x4D:TM1650_send(0X68,display[6]); break; //K12与DIG2 // case 0x56:TM1650_send(0X68,display[7]); break; //K13与DIG3 // default: break; // } // } } }
void myApplication::send (void) { cout << NL << "Enter text to write - press <ENTER> when done\n:"; myLine L; cin >> L; int l = strlen(L); if (!l) cerr << "Nothing entered." << endl; else { cout << "Writing '" << L << char('\'') << endl; stream() << L << NL; // Send the entered data, NL terminated cout << "Chrs written to Myio object = " << (l + 1) << NL; disp (); } }
int OPS_GetNodeDisp(int *nodeTag, int *sizeData, double *data) { Node *theNode = theDomain->getNode(*nodeTag); if (theNode == 0) { opserr << "OPS_GetNodeDisp - no node with tag " << *nodeTag << endln; return -1; } int size = *sizeData; const Vector &disp = theNode->getTrialDisp(); if (disp.Size() != size) { opserr << "OPS_GetNodeDisp - crd size mismatch\n"; return -1; } for (int i=0; i < size; i++) data[i] = disp(i); return 0; }
void bubblesort(int list[] , int n ) { int i = 0; for( i = 0 ; i < n - 1 ; i++) { printf("pass %d \n " , i); for(int j = 0 ; j < (n-1)-i ; j++) { if( list[j] > list[j+1] ) { swap(list , j , j+1 ); disp(list , n); } } printf("\n"); } }
/*! */ void DispHolder::doHandleShowInfo( const rcss::rcg::ShowInfoT & show ) { DispPtr disp( new rcss::rcg::DispInfoT ); disp->pmode_ = M_playmode; disp->team_[0] = M_teams[0]; disp->team_[1] = M_teams[1]; disp->show_ = show; M_disp = disp; if ( Options::instance().bufferingMode() ) { if ( (int)M_disp_cont.size() <= Options::instance().maxDispBuffer() ) { M_disp_cont.push_back( disp ); } } }
int main() { int ch; while(1) { printf("\nChoices:\n\t1-Insert\n\t2-Insert left\n\t3-Delete node\n\t4-Display\n\t5-Exit\nEnter your choice: "); scanf("%d",&ch); switch(ch) { case 1: ins(); break; case 2: insl(); break; case 3: del(); break; case 4: disp(); break; default:return 0; } } }
void disp(_Node_t_* node) { _Node_t_* pN = node->next; _Node_t_* pCN = NULL; printf("{"); while (pN) { if ( TYPE_NUM == pN->type) { printf("%d,", pN->nValue); } else { pCN = pN->aValue; disp(pCN); } pN = pN->next; } printf("},"); }
void DOF_Group::setNodeDisp(const Vector &u) { if (myNode == 0) { opserr << "DOF_Group::setNodeDisp: no associated Node\n"; return; } Vector &disp = *unbalance; disp = myNode->getTrialDisp(); int i; // get disp for my dof out of vector u for (i=0; i<numDOF; i++) { int loc = myID(i); if (loc >= 0) disp(i) = u(loc); } myNode->setTrialDisp(disp); }
void main() { uchar k; P0=0xFF; P2=0xFF; while(1) { for(j=0;j<17;j++) { for(k=0;k<125;k++) disp(); } } }
void main() { int ch; clrscr(); while(1) { printf(" 1.Creating a new node\n 2.Display nodes\n"); printf(" 3.Inserting a node before position \n"); printf(" 4.Inserting a node after position entered \n"); printf(" 5.Deleting a node on nth position \n"); printf(" 6.Deleting duplicate nodes\n 7.Exit\n"); scanf("%d",&ch); switch(ch) { case 1: create(); break; case 2: disp(); break; case 3: insonnoccurb(); break; case 4: insonnoccura(); break; case 5: delonnoccur(); break; case 6: delallsameoccur(); break; case 7: return; } } }
size_t listen(dht::DhtRunner& node, std::string chain, map_type& map) { std::future<size_t> token = node.listen(chain, [&map](const std::vector<std::shared_ptr<dht::Value>>& values) { // For every value found... for (const auto& value : values) { // Unpack then register and display it, if it's a new value. std::string content = value->unpack<std::string>(); if(!map.count(content)) { map.insert(std::make_pair(content, get_timestamp())); disp(content); } } // Continue lookup until no values are left. return true; }); if(token.wait_for(std::chrono::seconds(1)) != std::future_status::ready) { verbose("Warning: Could not create a listener since 1000ms."); verbose(" Trying again for 30s..."); if(token.wait_for(std::chrono::seconds(30)) != std::future_status::ready) verbose("Error: Failure."); else verbose(" Done."); } auto v = token.get(); verbose("Starting listening to " + chain + " with token " + std::to_string(v) + "."); return v; }
void Run() { Graphics::Display disp(WIDTH, HEIGHT, TITLE); Application application; application.Start(); timespec ts; current_utc_time(&ts); long previousTime = ts.tv_nsec; float delta = 0; while (!disp.IsClosed()) { current_utc_time(&ts); long currentTime = ts.tv_nsec; float prev_delta = delta; delta = (float)((currentTime - previousTime)/1000000000.0); if(delta < 0) delta = prev_delta; Time::setDetlaTime(delta); previousTime = currentTime; /* Logic */ application.PreUpdate(); application.Update(); application.PostUpdate(); /* End Logic */ /* Rendering */ disp.PreUpdate(); application.PreRender(); application.Render(); application.PostRender(); disp.Update(); disp.PostUpdate(); /* End Rendering */ Input::CleanUp(); // This should be one of the last things to be called because it is a form of cleanup. } }
int keypress(struct s3d_evt *event) { struct s3d_key_event *keys = (struct s3d_key_event *)event->buf; int key=keys->keysym; int mod=keys->modifier; switch (key) { case S3DK_LEFT: pos--; break; case S3DK_RIGHT: pos++; break; case S3DK_UP: aim--; break; case S3DK_DOWN: aim++; break; case S3DK_RETURN: savel2(); break; case S3DK_DELETE: del(); break; case S3DK_INSERT: // ins(); break; case S3DK_c: clr(); break; case S3DK_SPACE: spc(); break; case S3DK_F8: ll2(); break; } disp(); }
SEXP Muste_Edtgoto(SEXP gotoparm) { int newfirst,newcur; // ,mousewheel; char *gprm[5]; extern int op_goto2(); extern int disp(); char eka[256]; char toka[256]; char kolmas[256]; char neljas[256]; /* mousewheel=muste_get_R_int(".muste$mousewheeltime"); Rprintf("\neventpeek: %d, mousewheel: %d",muste_eventpeek,mousewheel); if (muste_eventpeek==FALSE && mousewheel!=9999) return(gotoparm); */ if (muste_mousewheel==FALSE || muste_no_selection) return(gotoparm); newfirst=muste_get_R_int(".muste$edty.newfirst"); newcur=muste_get_R_int(".muste$edty.newcur"); sprintf(eka,"%d",newfirst); gprm[1]=eka; sprintf(toka,"%d",newcur); gprm[2]=toka; newfirst=muste_get_R_int(".muste$edtx.newfirst"); newcur=muste_get_R_int(".muste$edtx.newcur"); sprintf(kolmas,"%d",newfirst); gprm[3]=kolmas; sprintf(neljas,"%d",newcur); gprm[4]=neljas; op_goto2(5,gprm); // muste_edt_dim(); disp(); return(gotoparm); }
// 代价转成 视差(代价小的对应点的坐标差值为视差) Mat StereoProcessor::cost2disparity(int imageNo) { Mat disp(imgSize, CV_32S); Mat lowCost(imgSize, COST_MAP_TYPE, Scalar(std::numeric_limits<costType>::max())); for(int d = 0; d <= dMax - dMin; d++) { for(size_t h = 0; h < imgSize.height; h++) { for(size_t w = 0; w < imgSize.width; w++) { if (lowCost.at<costType>(h, w) > costMaps[imageNo][d].at<costType>(h, w))//代价较小 { lowCost.at<costType>(h, w) = costMaps[imageNo][d].at<costType>(h, w); disp.at<int>(h, w) = d + dMin;//保存该代价对应的视差 } } } } return disp; }
void ModelDisp::SaveDisp(gui::Base * obj,gui::Event * event) { // Create the result svt... real32 dispIni = 0.0; bit maskIni = false; svt::Var * result = new svt::Var(cyclops.Core()); result->Setup2D(makeDisp.Width(),makeDisp.Height()); result->Add("disp",dispIni); result->Add("mask",maskIni); result->Commit(); // Fill the result svt... svt::Field<real32> disp(result,"disp"); svt::Field<bit> mask(result,"mask"); makeDisp.GetDisp(disp); makeDisp.GetMask(mask); // Get the filename... str::String fn(""); if (cyclops.App().SaveFileDialog("Save Disparity Image",fn)) { if (!fn.EndsWith(".dis")) fn << ".dis"; cstr ts = fn.ToStr(); if (!svt::Save(ts,result,true)) { cyclops.App().MessageDialog(gui::App::MsgErr,"Error saving svt file."); } mem::Free(ts); } // Clean up... delete result; }
/************************************************************************* 主函数 **************************************************************************/ void main() { uchar key; Init_Com();//串口初始化 count=0; P0=0xbf; fmq=0; while(1) { P1=0x0f; if(P1!=0x0f) { delay(400); key=getkey(); Getch(key); delay(400); } disp(); if(cesi==0){{pwflag = pwcmp();if(pwflag==1){fmq=1;}}} xianshi(); if(QX==1) { mbuf[count]=0; count++; mbuf[count]=0; count++; mbuf[count]=0; count++; mbuf[count]=0; count++; mbuf[count]=0; count++; mbuf[count]=0; xianshi(); QX=0; count=0; } } }
/* グラフの初期化 */ void init_graph(void) { CELL *p; CELL *q; int i , j ; for( i = 0; i < MAX_SIZE; i++ ) { p = (CELL *)malloc(sizeof(CELL)); p->no = i; p->name = 'A' + i; p->next_addr = NULL; adjacent[i] = p; } for( i = 0; i < MAX_SIZE; i++ ) { q = adjacent[i]; for( j = 0; graph_data[i][j] != '\0'; j++ ){ add( i, graph_data[i][j]-'A' ); } } disp(); }
GPU_PERF_TEST_1(DisparityBilateralFilter, cv::gpu::DeviceInfo) { cv::gpu::DeviceInfo devInfo = GetParam(); cv::gpu::setDevice(devInfo.deviceID()); cv::Mat img_host = readImage("gpu/stereobm/aloe-L.png", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(img_host.empty()); cv::Mat disp_host = readImage("gpu/stereobm/aloe-disp.png", cv::IMREAD_GRAYSCALE); ASSERT_FALSE(disp_host.empty()); cv::gpu::DisparityBilateralFilter f(128); cv::gpu::GpuMat img(img_host); cv::gpu::GpuMat disp(disp_host); cv::gpu::GpuMat dst; f(disp, img, dst); TEST_CYCLE() { f(disp, img, dst); } }
static Node *idxaddr(Simp *s, Node *seq, Node *idx) { Node *a, *t, *u, *v; /* temps */ Node *r; /* result */ Type *ty; size_t sz; a = rval(s, seq, NULL); ty = exprtype(seq)->sub[0]; if (exprtype(seq)->type == Tyarray) t = addr(s, a, ty); else if (seq->expr.type->type == Tyslice) t = load(addr(s, a, mktyptr(seq->line, ty))); else die("Can't index type %s\n", tystr(seq->expr.type)); assert(t->expr.type->type == Typtr); u = rval(s, idx, NULL); u = ptrsized(s, u); sz = tysize(ty); v = mul(u, disp(seq->line, sz)); r = add(t, v); return r; }
void myApplication::read (void) { cout << NL << "Reading a line from object:" << NL; myLine L; mio.stream().clear(); mio.stream() >> L; int l = strlen(L); if (!l) { cout << "Nothing read." << endl; mio.stream().clear(); // Clear EOF status } else { cout << "Read '" << L << char('\'') << endl; cout << "Chrs read from Myio object = " << (l + 1) << NL; disp (); } }
int main() { int n = 6; void **list; for( int i = 0 ; i < n ; i++ ) { int *x=(int*) malloc (sizeof( int ) ) ; scanf("%d" , x ); *(list + i ) = x ; } insertionsort(list , n ); printf("x"); disp(list , n ); printf("x"); getch(); }
Real InteractionIntegralBenchmarkBC::computeQpValue() { Point p(*_current_node); _crack_front_definition->calculateRThetaToCrackFront(p,_crack_front_point_index,_r,_theta); if (_r == 0) _theta = 0; Real st2 = std::sin(_theta/2); Real ct2 = std::cos(_theta/2); Real disp(0.0); if (_component == 0) disp = 1/(2*_mu) * std::sqrt(_r/(2*libMesh::pi)) * (_ki * ct2 * (_kappa - 1 + 2*st2*st2) + _kii * st2 * (_kappa + 1 + 2*ct2*ct2)); else if (_component == 1) disp = 1/(2*_mu) * std::sqrt(_r/(2*libMesh::pi)) * (_ki * st2 * (_kappa + 1 - 2*ct2*ct2) - _kii * ct2 * (_kappa - 1 - 2*st2*st2)); else if (_component == 2) disp = 1/_mu * std::sqrt(2*_r/libMesh::pi) * _kiii * st2; return disp; }
XVisualInfo * screen::IMPL::get_visual_info() { if (_vi.visual /* TODO: check _vi.visualid */ ) return &_vi; display::pointer disp( _display.lock() ); dsI( disp ); Display * xdisp = disp->_p->_xdisplay; dsI( xdisp); VisualID vid = 0; if (vid) { XVisualInfo *vi, temp; int n; std::memset( &temp, 0, sizeof(temp) ); temp.visualid = vid; if (vi = XGetVisualInfo(xdisp, VisualIDMask, &temp, &n)) { _vi = *vi; XFree(vi); return NULL; } } int screen = this->number(); int depth = this->depth(); dsL("screen depth: "<<depth); bool useDirectColorVisual = false; if ((useDirectColorVisual && XMatchVisualInfo(xdisp, screen, depth, DirectColor, &_vi)) || XMatchVisualInfo(xdisp, screen, depth, TrueColor, &_vi) || XMatchVisualInfo(xdisp, screen, depth, PseudoColor, &_vi) || XMatchVisualInfo(xdisp, screen, depth, StaticColor, &_vi) ) return &_vi; std::memset( &_vi, 0, sizeof(_vi) ); return NULL; }
int main() { frame f[10]; int prs[20],pl,fs,i,j,pf=0; int ifpresent(frame f[],int ,int ); int lru(frame f[],int ); void dec(frame f[],int ,int ); void disp(frame f[],int ); printf("Enter the length of page reference string\n"); scanf("%d",&pl); printf("Enter the elements of page reference string\n"); for(i=0;i<pl;i++) scanf("%d",&prs[i]); printf("Enter the frame size\n"); scanf("%d",&fs); for(i=0;i<fs;i++) { f[i].pid=0; f[i].pr=3; } printf("Allocating using LRU policy\n"); for(i=0;i<pl;i++) { if(!(ifpresent(f,fs,prs[i]))) { j=lru(f,fs); f[j].pid=prs[i]; dec(f,fs,f[j].pid); pf++; } else dec(f,fs,prs[i]); disp(f,fs); } printf("Number of page faults : %d\n",pf); return 0; }
//*********************************************************************** // Function : Test - Loop Size // Caller : display_structures() // Purpose : make sure number of nucleotides inside any helix is large enough // Input : seq - sequence // : crik - crick // Return : none // Display : Error message, if necessary //*********************************************************************** int test_loop_size(config* seq, global* crik) { disp(seq,DISP_ALL,"Enterng Test 2: 'testLupSze'\n"); int16_t lupSze = 0; int16_t opnBrsFlag = 0; int16_t inLupFlag = 0; int16_t i; for(i = 0 ; i < seq->strLen ; i++){ if (seq->dotNParen[i] == '('){ opnBrsFlag = 1; inLupFlag = 0; lupSze = 0; } else if ( ((seq->dotNParen[i] == '.') || (seq->dotNParen[i] == '#') || (seq->dotNParen[i] == '/')) && opnBrsFlag ){ opnBrsFlag = 0; inLupFlag = 1; lupSze = 1; } else if ( ((seq->dotNParen[i] == '.') || (seq->dotNParen[i] == '#') || (seq->dotNParen[i] == '/')) && inLupFlag ) { // . is normal dot, # is bundle mark lupSze++; } else if ( (seq->dotNParen[i] == ')') && inLupFlag ) { if(lupSze < seq->minPairngDist){ fprintf(stdout, "$$$$$$$$$$$$$$$$$$$$$$$$$ Insufficient loop size 1 found: #%ld %s\n", crik->numStru, seq->dotNParen); crik->test2ErrTotal++; return 0; } // end inner if opnBrsFlag = 0; inLupFlag = 0; lupSze = 0; } else if ( (seq->dotNParen[i] == ')') && (seq->dotNParen[i-1] == '(') ) { fprintf(stdout, "$$$$$$$$$$$$$$$$$$$$$$$$$ Insufficient loop size 2 found: #%ld %s\n", crik->numStru, seq->dotNParen); crik->test2ErrTotal++; return 0; } // end if } // end for return 0; } // end test_parentheses_balance
//-------- Begin of function TxtList::back_history -----------// //! //! Backward to previous topic in the history //! void TxtList::back_history() { /* history_array[history_pos]=0; // the history just added is useless if((history_pos-1) < 0 ) history_pos = HISTORY_SIZE; int topicId = history_array[--history_pos]; if( topicId>0 ) // if topicId==0, means no history { history_array[history_pos] = 0; can_back=(history_array[(((history_pos-1)<0)?HISTORY_SIZE-1:history_pos-1)]>0); disp( INFO_UPDATE, topicId ); if( init_list_flag ) topic_browse.refresh( topicId ); } */ int prev_pos=history_pos; do { prev_pos--; prev_pos=(prev_pos<0)?HISTORY_SIZE-1:prev_pos; } while(history_array[prev_pos]==topic_id && history_array[prev_pos]!=0); int topicId = history_array[prev_pos]; if( topicId>0 ) { // if topicId==0, means no history history_array[prev_pos] = 0; history_pos = prev_pos; disp( INFO_UPDATE, topicId ); if( init_list_flag ) topic_browse.refresh( topicId ); can_back=(history_array[(((prev_pos-1)<0)?HISTORY_SIZE-1:prev_pos-1)]>0); } }
//***************************************************************************** // Function : Initialize Crick // Caller : main() // Purpose : initialize 'global* crik' // Input : seq // Return : crik // Display : none //***************************************************************************** global* initialize_crik(config* seq) { disp(seq,DISP_ALL,"################################################################################################ Enterng 'initialize_crik'\n"); global* crik = malloc(sizeof(global)); // Crick the Book-keeper, our handy right-hand man #1 crik->linkedmms = 0; crik->rstoCounter = 0; crik->rstoErrCounter = 0; crik->skippedStru = 0; crik->lvlOfRecur = 0; crik->numCmpnt = 0; crik->numHP = 1; crik->numHlix = 1; crik->numStru = 0; crik->numBundles = 0; crik->numUnbundledStru = 0; crik->specialRstoFlag = 0; crik->intrvlCntr = 0; // it's like batch number, used to distinguish one batch from another crik->intrvlCntr = 0; crik->opnBrsStop = seq->strLen - ((seq->minLenOfHlix - 1) << 1) - seq->minPairngDist; // farthest location the opnBrsOutIndx may reach crik->numCmpntTyp = seq->strLen; crik->numCmpntTypOcupid = 0; crik->test1ErrTotal = 0; crik->test2ErrTotal = 0; crik->test3ErrTotal = 0; crik->test4ErrTotal = 0; crik->interval = NULL; crik->hlixInStru = NULL; if(seq->constraintActive) crik->struMustPairFlag = calloc((seq->numCovari + seq->numV1Pairng), sizeof(int16_t)); // used to track the covariance pairs the current structure contains crik->mustPairLength = seq->numCovari + seq->numV1Pairng; crik->numStru = 0; return crik; } // end initialize_crik
int main() { int user=0; while(user!=4) { printf("1-INSERT\n2-DELETE\n3-DISPLAY\n4-EXIT\n"); scanf("%d",&user); switch(user) { case 1: insert(); break; case 2: del(); break; case 3: disp(); break; case 4: exit(0); } } getch(); }
void ray_query::compute_inverses() // Compute m_inv_dir and m_inv_displacement { vec3 disp(m_end); disp -= m_start; // Threshold, below which we don't want to compute 1/x. static const float DANGER_LIMIT_MIN = 1e-25f; for (int i = 0; i < 3; i++) { // m_inv_dir float comp = m_dir[i]; if (fabsf(comp) <= DANGER_LIMIT_MIN) { m_inv_dir[i] = -FLT_MAX; // arbitrary crap m_dir[i] = 0; // don't tolerate tiny tiny component. Client code will know not to use this axis. } else { m_inv_dir[i] = 1.0f / comp; } // m_inv_displacement comp = disp[i]; if (fabsf(comp) <= DANGER_LIMIT_MIN) { m_inv_displacement[i] = -FLT_MAX; // arbitrary crap m_dir[i] = 0; // don't tolerate tiny tiny component. Client code will know not to use this axis. } else { m_inv_displacement[i] = 1.0f / comp; } } }