int main() { printf("Hello"); unsigned char b; for(lset(b,1);lget(b)<=(grid*grid);lset(b,(lget(b)+1))) for(rset(b,1);rget(b)<=(grid*grid);rset(b,(rget(b)+1))) if(lget(b)%grid != rget(b)%grid) printf("A=%d, B=%d\n", lget(b),rget(b)); return 0; }
/* * print the registers */ void printregs(int c) { Regdesc *rp; int i; ADDR u; if(correg == nil){ dprint("registers not mapped\n"); return; } for (i = 1, rp = mach->reglist; rp->name; rp++, i++) { if ((rp->flags & RFLT)) { if (c != 'R') continue; if (rp->format == '8' || rp->format == '3') continue; } rget(correg, rp->name, &u); if(rp->format == 'Y') dprint("%-8s %-20#llux", rp->name, (uvlong)u); else dprint("%-8s %-12#lux", rp->name, (ulong)u); if ((i % 3) == 0) { dprint("\n"); i = 0; } } if (i != 1) dprint("\n"); dprint ("%s\n", mach->exc(cormap, correg)); printpc(); }
void DetectWithOF5::History::push(const cv::Mat &img) { // fifo,删除过时的 .. if (frames.size() > N) { frames.pop_front(); diff.pop_front(); frame_idx_++; } // XXX: 保存的总是 gray cv::Mat gray; cv::cvtColor(img, gray, CV_RGB2GRAY); frames.push_back(gray); if (frames.size() == 1) { // 第一帧,diff 全零 .. diff.push_back(cv::Mat::zeros(img.rows, img.cols, CV_8UC1)); frame_idx_ = parent->frame_idx_; } else { cv::Mat d; // 计算最后两帧 frames 的 diff cv::Mat m = rget(1); // 倒数第二帧 .. cv::absdiff(m, gray, d); cv::threshold(d, d, parent->threshold_diff_, 255, cv::THRESH_BINARY); // FIXME: 总是对 diff 进行open操作 .. cv::morphologyEx(d, d, cv::MORPH_OPEN, parent->ker_open_); diff.push_back(d); } assert(diff.size() == frames.size()); }
void test1() { Fixed f{1,2,3,4}; Printf(Con,"len = #;\n",SaveLen(f).value); uint8 buf[100]; BufPutDev putdev(buf); putdev(f,f,f); Fixed f1; BufGetDev getdev(buf); getdev(f1); Printf(Con,"#;\n",f1); getdev(f1); Printf(Con,"#;\n",f1); getdev(f1); Printf(Con,"#;\n",f1); RangeGetDev rget(Range_const(buf)); Fixed f2[3]; rget(f2[0],f2[1],f2[2]); Printf(Con,"#; #; #;\n",f2[0],f2[1],f2[2]); }
void test2() { Variable v{1,2,3}; Printf(Con,"len = #;\n",SaveLen(v).value); uint8 buf[100]; BufPutDev putdev(buf); putdev(v,v,v); Variable v1; BufGetDev getdev(buf); getdev(v1); Printf(Con,"#;\n",v1); getdev(v1); Printf(Con,"#;\n",v1); getdev(v1); Printf(Con,"#;\n",v1); RangeGetDev rget(Range_const(buf)); Variable v2[3]; LoadRange(v2,3,rget); Printf(Con,"#; #; #;\n",v2[0],v2[1],v2[2]); }
int main(int argc, char *argv[]){ if (argc != 4){ printf("You must enter: ./rget remote-host remote-filename local-filename \n"); exit(1); } if(strlen(argv[2]) > MAXNAME || strlen(argv[3]) > MAXNAME ){ exit(1); } CLIENT *client; client = clnt_create(argv[1], FRPC_PROG, FRPC_VERS, "udp"); if (client == (CLIENT *) NULL) { clnt_pcreateerror(argv[1]); exit(1); } int fileCount=rget(client,argv[2],argv[3]); if(fileCount>=10){ fprintf(stderr,"Maximum Number File Opened\n"); exit(1); } return 0; }
int main(int argc, char *argv[]){ char buff[N], *param; //1024 int j = 0, nb; if( argc != 2){ printf("Usage: %s <server host>\n", argv[0]); exit(1); } printf("commands\n"); do{ memset(buff, '\0', N); prompt(); gets(buff); param = strchr(buff,' '); // param <- commands if (param) { *param=0; param++; } for(j = 0; j < NB_CMDS; j++) if( !strcmp(buff, commandes[j])) break; switch(j){ case(OPEN): if(connection) printf("already connected\n"); else myconnect(argv[1]); break; case(GET): if(!connection) printf("Not connected!\n"); else get(param); break; case(PUT): if(!connection) printf("Not connected!\n"); else put(param); break; case(MGET): if(!connection) printf("Not connected!\n"); else mget(param); break; case(MPUT): if(!connection) printf("Not connected!\n"); else mput(param); break; case(CD): if(!connection) printf("NoT connecteD!\n"); else cd(param); break; case(LCD): lcd(param); break; case(MGET_): if(!connection) printf("Not connected!\n"); else mget_(param); break; case(MPUT_): if(!connection) printf("Not connected!\n"); else mput_(param); break; case(DIR): if(!connection) printf("Not connecte!\n"); else dir(); break; case(LDIR): ldir(); break; case(RGET): if(!connection) printf("Not connected!\n"); else rget(param); break; case(RPUT): if(!connection) printf("Not connected!\n"); else rput(param); break; //case (HELP): aide(); // break; default: printf("%s command invalid\n", buff); printf("Commands are as follows\n"); printf(" get : To Get A file from Server\n"); printf(" put : To Put A file to Server\n"); printf(" cd : change Server's Current Directory\n"); printf(" lcd : Change Client's current Directory\n"); printf(" mget : To Get multiple files from Server\n"); printf(" mput : To put multiple files from Server\n"); printf(" dir : List the Server's current Directory\n"); printf(" ldir : List the Client's current Directory\n"); printf(" mget_ : Put files with wildcard support\n"); printf("mput_ : get files with wildcard support\n"); printf("rget : Get a directory recursively\n"); printf("rput : Put a Directory recursiovely\n"); break; } } while(1); return(0); }
item(int a) { /* name [ . local ] | number | . | ^ | <register | 'x | | */ char *base; char savc; uvlong e; Symbol s; char gsym[MAXSYM], lsym[MAXSYM]; readchar(); if (isfileref()) { readfname(gsym); rdc(); /* skip white space */ if (lastc == ':') { /* it better be */ rdc(); /* skip white space */ if (!getnum(readchar)) error("bad number"); if (expv == 0) expv = 1; /* file begins at line 1 */ expv = file2pc(gsym, expv); if (expv == -1) error("%r"); return 1; } error("bad file location"); } else if (symchar(0)) { readsym(gsym); if (lastc=='.') { readchar(); /* ugh */ if (lastc == '.') { lsym[0] = '.'; readchar(); readsym(lsym+1); } else if (symchar(0)) { readsym(lsym); } else lsym[0] = 0; if (localaddr(cormap, gsym, lsym, &e, rget) < 0) error("%r"); expv = e; } else { if (lookup(0, gsym, &s) == 0) error("symbol not found"); expv = s.value; } reread(); } else if (getnum(readchar)) { ; } else if (lastc=='.') { readchar(); if (!symchar(0) && lastc != '.') { expv = dot; } else { if (findsym(rget(cormap, mach->pc), CTEXT, &s) == 0) error("no current function"); if (lastc == '.') { lsym[0] = '.'; readchar(); readsym(lsym+1); } else readsym(lsym); if (localaddr(cormap, s.name, lsym, &e, rget) < 0) error("%r"); expv = e; } reread(); } else if (lastc=='"') { expv=ditto; } else if (lastc=='+') { expv=inkdot(dotinc); } else if (lastc=='^') { expv=inkdot(-dotinc); } else if (lastc=='<') { savc=rdc(); base = regname(savc); expv = rget(cormap, base); } else if (lastc=='\'') expv = ascval(); else if (a) error("address expected"); else { reread(); return(0); } return(1); }
runpcs(int runmode, int keepnote) { int rc; BKPT *bkpt; rc = 0; if (adrflg) rput(cormap, mach->pc, dot); dot = rget(cormap, mach->pc); flush(); while (loopcnt-- > 0) { if(loopcnt != 0) printpc(); if (runmode == SINGLE) { bkpt = scanbkpt(dot); if (bkpt) { switch(bkpt->flag){ case BKPTTMP: bkpt->flag = BKPTCLR; break; case BKPTSKIP: bkpt->flag = BKPTSET; break; } } runstep(dot, keepnote); } else { if ((bkpt = scanbkpt(rget(cormap, mach->pc))) != 0) { execbkpt(bkpt, keepnote); keepnote = 0; } setbp(); runrun(keepnote); } keepnote = 0; delbp(); dot = rget(cormap, mach->pc); /* real note? */ if (nnote > 0) { keepnote = 1; rc = 0; continue; } bkpt = scanbkpt(dot); if(bkpt == 0){ keepnote = 0; rc = 0; continue; } /* breakpoint */ if (bkpt->flag == BKPTTMP) bkpt->flag = BKPTCLR; else if (bkpt->flag == BKPTSKIP) { execbkpt(bkpt, keepnote); keepnote = 0; loopcnt++; /* we didn't really stop */ continue; } else { bkpt->flag = BKPTSKIP; --bkpt->count; if ((bkpt->comm[0] == EOR || command(bkpt->comm, ':') != 0) && bkpt->count != 0) { execbkpt(bkpt, keepnote); keepnote = 0; loopcnt++; continue; } bkpt->count = bkpt->initcnt; } rc = 1; } return(rc); }
/** * \brief Select format and frame. * * This method negotiates format and frame with the device. This also * implies a frame interval setting, and the bandwith depends on this * setting as well. However, selecting the format and frame a priori * does not yet fix the bandwidth, this is a consideration only for * isochronous transfers. Therefore this method does not do any bandwidth * negotiation, but leaves this to the getFrame method. * * \param interface video streaming interface number, not the index in * the videostreaming array. * \param format format number, one larger than the format index * \param frame frame number, equal to the bFrameIndex field of the * frame descriptor */ void UVCCamera::selectFormatAndFrame(uint8_t interface, uint8_t format, uint8_t frame) throw(USBError) { debug(LOG_DEBUG, DEBUG_LOG, 0, "select interface %d, format %d, frame %d", interface, format, frame); // We want to negotiate use of the a given format and frame. // To do this, we send a SET probe vs_control_request_t control_request; memset(&control_request, 0, sizeof(control_request)); control_request.bFormatIndex = format; control_request.bFrameIndex = frame; control_request.dwFrameInterval = minFrameInterval(interface, format, frame); // do we have to claim the interface? InterfacePtr interfaceptr = (*device.activeConfig())[interface]; debug(LOG_DEBUG, DEBUG_LOG, 0, "interface %d with %d alt settings", interfaceptr->interfaceNumber(), interfaceptr->numAltsettings()); #if 1 interfaceptr->claim(); #endif VideoStreamingProbeControlRequest rset(interfaceptr, SET_CUR, &control_request); device.controlRequest(&rset); // now probe the same thing, this should return a recommended // setting VideoStreamingProbeControlRequest rget(interfaceptr, GET_CUR); device.controlRequest(&rget); if (rget.data()->bFormatIndex != format) { throw USBError("cannot negotiate format index"); } if (rget.data()->bFrameIndex != frame) { throw USBError("cannot negotiate frame index"); } // if we get to this point, then negotiating the format and frame // was successful, and we can commit the negotiated paramters VideoStreamingCommitControlRequest rcommit(interfaceptr, SET_CUR, rget.data()); device.controlRequest(&rcommit); // we now also have to find out how many bits per pixel we can // expect USBDescriptorPtr formatptr = getFormatDescriptor(interface, format); FormatFrameBasedDescriptor *fd = dynamic_cast<FormatFrameBasedDescriptor *>(&*formatptr); if (NULL == fd) { debug(LOG_DEBUG, DEBUG_LOG, 0, "unknown pixel size"); bitsPerPixel = 1; } else { bitsPerPixel = fd->bBitsPerPixel(); debug(LOG_DEBUG, DEBUG_LOG, 0, "bits per pixel: %d", bitsPerPixel); } // just to be on the safe side, we should ask again what the // current settings are getCur(interface); }