void TRop::over(const TRasterP &rout, const TRasterP &rup, const TPoint &pos) { TRect outRect(rout->getBounds()); TRect upRect(rup->getBounds() + pos); TRect intersection = outRect * upRect; if (intersection.isEmpty()) return; TRasterP cRout = rout->extract(intersection); TRect r = intersection - pos; TRasterP cRup = rup->extract(r); TRaster32P rout32 = cRout, rup32 = cRup; TRaster64P rout64 = cRout, rup64 = cRup; TRasterGR8P rout8 = cRout, rup8 = cRup; TRasterCM32P routCM32 = cRout, rupCM32 = cRup; rout->lock(); rup->lock(); // TRaster64P rout64 = rout, rin64 = rin; if (rout32 && rup32) { #ifdef _WIN32 if (TSystem::getCPUExtensions() & TSystem::CpuSupportsSse2) do_over_SSE2(rout32, rup32); else #endif do_overT2<TPixel32, UCHAR>(rout32, rup32); } else if (rout64) { if (!rup64) { TRaster64P raux(cRup->getSize()); TRop::convert(raux, cRup); rup64 = raux; } do_overT2<TPixel64, USHORT>(rout64, rup64); } else if (rout32 && rup8) do_over(rout32, rup8); else if (rout8 && rup32) do_over(rout8, rup32); else if (rout8 && rup8) TRop::copy(rout8, rup8); else if (routCM32 && rupCM32) do_over(routCM32, rupCM32); else { rout->unlock(); rup->unlock(); throw TRopException("unsupported pixel type"); } rout->unlock(); rup->unlock(); }
void createChild(int r_cnt) { int fd; pid_t pid; pid=fork(); if(pid==0) { srandom(getpid()); while(r_cnt>0) { do_request(); if((fd=open("/tmp/vmm.temp",O_WRONLY))<0) printf("req open fifo failed\n"); if(write(fd,ptr_memAccReq,sizeof(MemoryAccessRequest))<0) printf("Req write failed\n"); close(fd); r_cnt--; int t; t=random()%2000; usleep(t); } do_over(); if((fd=open("/tmp/vmm.temp",O_WRONLY))<0) printf("req open fifo failed\n"); if(write(fd,ptr_memAccReq,sizeof(MemoryAccessRequest))<0) printf("Req write failed\n"); close(fd); exit(0); } return; }
/* The :insert, :append and :change command */ void do_ins_chg(PTR start, char *arg, int mode) { int base; off_t buffer = BUFFER; off_t count = 0L; size_t len; long val; char *tempbuf = NULL; char *poi, *epoi; if((mode == U_EDIT) && (current - mem >= filesize)) { beep(); return; } len = strlen(arg); if(!strncmp("ascii", arg, len) && CMDLNG(5, 1)) { base = 1; } else if(!strncmp("binary", arg, len) && CMDLNG(6, 1)) { base = 2; } else if(!strncmp("octal", arg, len) && CMDLNG(5, 1)) { base = 8; } else if(!strncmp("decimal", arg, len) && CMDLNG(7, 1)) { base = 10; } else if(!strncmp("hexadecimal", arg, len) && CMDLNG(11, 1)) { base = 16; } else { emsg("No such option"); return; } addch('\n'); if(getcmdstr(cmdstr, 0) == 1) { repaint(); return; } if(alloc_buf(buffer, &tempbuf) == 0L) { return; } while(strcmp(cmdstr, ".")) { poi = cmdstr; if(base == 1) { /* ASCII */ while(*poi != '\0') { if(*poi == '\\') { switch(*(++poi)) { case 'n': val = '\n'; break; case 'r': val = '\r'; break; case 't': val = '\t'; break; case '0': val = '\0'; break; case '\\': val = '\\'; break; default : val = '\\'; poi--; } poi++; } else { val = *poi++; } *(tempbuf + count++) = val; } } else { while(isspace(cmdstr[strlen(cmdstr) - 1])) { cmdstr[strlen(cmdstr) - 1] = '\0'; } while(*poi != '\0') { val = strtol(poi, &epoi, base); if(val > 255 || val < 0 || poi == epoi) { repaint(); emsg("Invalid value"); goto mfree; } poi = epoi; *(tempbuf + count++) = val; } } addch('\n'); if(getcmdstr(cmdstr, 0) == 1) { repaint(); goto mfree; } } if(count == 0) { repaint(); goto mfree; } switch(mode) { case U_INSERT: do_put(start, count, tempbuf); break; case U_EDIT: do_over(start, count, tempbuf); break; case U_APPEND: if((undo_count = alloc_buf(count, &undo_buf)) == 0L) { repaint(); goto mfree; } do_append((off_t)count, tempbuf); memcpy(undo_buf, tempbuf, count); repaint(); break; } mfree: #if defined(__MSDOS__) && !defined(DJGPP) farfree(tempbuf); #else free(tempbuf); #endif }
void TRop::over(TRaster32P rout, const TRasterGR8P &rup, const TPixel32 &color) { rout->lock(); do_over(rout, rup, color); rout->unlock(); }
static void do_gcd(void) /* implements the FORTH word: : gcd ( n1 n2 | n) begin over mod swap over 0= until nip ; */ { do { do_over(); do_mod(); do_swap(); do_over(); do_zero_not_equals(); } while (sf_pop()); do_nip(); }