void DPI::ScaleRect(CRect &r) // // // { r.left = SX(r.left); r.right = SX(r.right); r.top = SY(r.top); r.bottom = SY(r.bottom); }
void do_alignment(FILE *file, int p0_beg, int p1_beg) { char line[MAX_STR], *bp; int score, s0_beg, s0_end, s1_beg, s1_end, percent; int have_line = 0; double bits; while (fgets(line, sizeof(line), file)!=NULL) { if ( strchr(line,'}') != NULL) { clsline(); return; } if ((bp=strchr(line,'s')) != NULL) sscanf(bp+1, "%d %lf", &score, &bits); else if ((bp=strchr(line,'b')) != NULL) sscanf(bp+1, "%d %d", &s0_beg, &s1_beg); else if ((bp=strchr(line, 'e')) != NULL) sscanf(bp+1, "%d %d", &s0_end, &s1_end); else if ((bp=strchr(line, 'l')) != NULL) { sscanf(bp+1, "%d %d %d %d %d", &s0_beg, &s1_beg, &s0_end, &s1_end, &percent); if (have_line) { draw(SX(s0_beg-p0_beg+1), SY(s1_beg-p1_beg+1)); draw(SX(s0_end-p0_beg+1), SY(s1_end-p1_beg+1)); } else { opnline(score, bits); move(SX(s0_beg - p0_beg + 1), SY(s1_beg - p1_beg + 1)); draw(SX(s0_end - p0_beg + 1), SY(s1_end - p1_beg + 1)); have_line = 1; } } } }
static gmx_bool xrCallBack(struct t_x11 *x11, XEvent *event, Window w, void *data) { t_app *app; t_xrama *xr; char buf[256]; int i; (void)XTextHeight(x11->font); app = (t_app *)data; xr = app->xr; scx = app->xrwd.width/(2.0*M_PI); scy = app->xrwd.height/(2.0*M_PI); switch (event->type) { case Expose: XClearWindow(x11->disp, app->xrwd.self); XDrawLine(x11->disp, app->xrwd.self, x11->gc, SX(0), SY(-M_PI)+1, SX(0), SY(M_PI)-1); XDrawLine(x11->disp, app->xrwd.self, x11->gc, SX(-M_PI)+1, SY(0), SX(M_PI)-1, SY(0)); TextInRect(x11, app->xrwd.self, "Phi", SX(M_PI)-50, SY(0)+4, 46, 20, eXRight, eYTop); TextInRect(x11, app->xrwd.self, "Psi", SX(0)+4, 4, 46, 20, eXLeft, eYTop); for (i = 0; (i < xr->npp); i++) { if (app->bShowGly || !app->bIsGly[i]) { plot_pp(x11, app->xrwd.self, &(xr->pp[i]), xr->dih); } } break; case ButtonPress: if (label_pp(x11, app->xrwd.self, xr->npp, xr->pp, xr->dih, event->xbutton.x, event->xbutton.y)) { ExposeWin(x11->disp, app->xrwd.self); } break; case ConfigureNotify: app->xrwd.width = event->xconfigure.width; app->xrwd.height = event->xconfigure.height; break; } if (app->status == esGo) { if (!new_data(app->xr)) { app->status = ebStop; } else { ExposeWin(x11->disp, app->xrwd.self); sprintf(buf, "Rama: t=%.2f", app->xr->t); XSetStandardProperties(x11->disp, app->wd.self, buf, "Rama", 0, NULL, 0, NULL); } } return FALSE; }
static void dw_gt_round(vd_trace_interface *I, double x, double y, int r) { HPEN h; get_window(); if (host.tw == NULL) return; h = (HPEN)SelectObject(I->host->hdc, GetStockObject(NULL_PEN)); Ellipse(I->host->hdc, SX(x)-r, SY(y)-r, SX(x)+r, SY(y)+r); SelectObject(I->host->hdc, h); }
void vd_impl_bar(double x0, double y0, double x1, double y1, int w, unsigned long c) { NullRET; vd_trace1->setcolor(vd_trace1, c); vd_trace1->setlinewidth(vd_trace1, w); vd_trace1->beg_path(vd_trace1); vd_trace1->moveto(vd_trace1, SX(x0), SY(y0)); vd_trace1->lineto(vd_trace1, SX(x1), SY(y1)); vd_trace1->end_path(vd_trace1); vd_trace1->stroke(vd_trace1); }
static void dw_gt_curveto(vd_trace_interface *I, double x0, double y0, double x1, double y1, double x2, double y2) { POINT p[3]; get_window(); if (host.tw == NULL) return; p[0].x = SX(x0), p[0].y = SY(y0); p[1].x = SX(x1), p[1].y = SY(y1); p[2].x = SX(x2), p[2].y = SY(y2); PolyBezierTo(I->host->hdc, p, 3); }
static void dw_gt_moveto(vd_trace_interface *I, double x, double y) { POINT p; get_window(); if (host.tw == NULL) return; #ifdef __WIN32__ MoveToEx(I->host->hdc, SX(x), SY(y), &p); #else MoveTo(I->host->hdc, SX(x), SY(y)); #endif I->host->bx = x; I->host->by = y; }
void vd_impl_quad(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, int w, unsigned int c) { NullRET; vd_trace1->setcolor(vd_trace1, c); vd_trace1->setlinewidth(vd_trace1, w); vd_trace1->beg_path(vd_trace1); vd_trace1->moveto(vd_trace1, SX(x0), SY(y0)); vd_trace1->lineto(vd_trace1, SX(x1), SY(y1)); vd_trace1->lineto(vd_trace1, SX(x2), SY(y2)); vd_trace1->lineto(vd_trace1, SX(x3), SY(y3)); vd_trace1->lineto(vd_trace1, SX(x0), SY(y0)); vd_trace1->end_path(vd_trace1); vd_trace1->stroke(vd_trace1); }
void vd_impl_curveto(double x1, double y1, double x2, double y2, double x3, double y3) { double p1x, p1y, p2x, p2y, p3x, p3y; NullRET; p1x = SX(x1), p1y = SY(y1); p2x = SX(x2), p2y = SY(y2); p3x = SX(x3), p3y = SY(y3); if (vd_trace1->curveto != NULL) vd_trace1->curveto(vd_trace1, p1x, p1y, p2x, p2y, p3x, p3y); else vd_flatten(px, py, p1x, p1y, p2x, p2y, p3x, p3y); px = p3x, py = p3y; }
void vd_impl_square(double x, double y, int w, unsigned int c) { NullRET; vd_trace1->setcolor(vd_trace1, c); vd_trace1->setlinewidth(vd_trace1, 1); vd_trace1->beg_path(vd_trace1); vd_trace1->moveto(vd_trace1, SX(x) - w, SY(y) - w); vd_trace1->lineto(vd_trace1, SX(x) + w, SY(y) - w); vd_trace1->lineto(vd_trace1, SX(x) + w, SY(y) + w); vd_trace1->lineto(vd_trace1, SX(x) - w, SY(y) + w); vd_trace1->lineto(vd_trace1, SX(x) - w, SY(y) - w); vd_trace1->end_path(vd_trace1); vd_trace1->stroke(vd_trace1); }
/*----------------------------------------------------------------------------- Name : primRectSolid2 Description : Draw a solid 2d rectangle. Inputs : rect - pointer to rectangle structure containing coordinates. c - color to draw it in, xb - x offset, yb - y offset Outputs : .. Return : void ----------------------------------------------------------------------------*/ void primBeveledRectSolid(rectangle *rect, color c, uword xb, uword yb) { bool cull; if (glcActive()) { glcBeveledRectSolid2(rect, c, (sdword)xb, (sdword)yb); return; } cull = glIsEnabled(GL_CULL_FACE) ? TRUE : FALSE; glDisable(GL_CULL_FACE); glBegin(GL_POLYGON); glColor3ub(colRed(c), colGreen(c), colBlue(c)); glVertex2f(SX(X0+xb), SY(Y0)); glVertex2f(SX(X1-xb), SY(Y0)); glVertex2f(SX(X1), SY(Y0+yb)); glVertex2f(SX(X1), SY(Y1-yb)); glVertex2f(SX(X1-xb), SY(Y1)); glVertex2f(SX(X0+xb), SY(Y1)); glVertex2f(SX(X0), SY(Y1-yb)); glVertex2f(SX(X0), SY(Y0+yb)); glEnd(); if (cull) { glEnable(GL_CULL_FACE); } }
void openplt(long n0, long n1, int sq0off, int sq1off, char *xtitle, char *ytitle) { char *sptr; time_t tt; int tick = 6; tt = time(NULL); if (strlen(lvstr)>0) { sscanf(lvstr,"%lg %lg %lg",&elinval[0],&elinval[1],&elinval[2]); } else if ((sptr=getenv("LINEVAL"))!=NULL && strlen(sptr)>0) { sscanf(sptr,"%lg %lg %lg",&elinval[0],&elinval[1],&elinval[2]); } printf("<?xml version=\"1.0\" standalone=\"no\"?>\n"); printf("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n"); printf("\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n\n"); printf("<svg width=\"564\" height=\"612\" version=\"1.1\"\n"); printf("xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n\n"); pmaxx = n0; pmaxy = n1; fxscal = (double)(max_x-1)/(double)(n1); fyscal = (double)(max_y-1)/(double)(n0); if (fxscal > fyscal) fxscal = fyscal; else fyscal = fxscal; if (fyscal * n0 < (double)max_y/5.0) fyscal = (double)(max_y-1)/((double)(n0)*5.0); fxscal *= 0.9; fxoff = (double)(max_x-1)/11.0; fyscal *= 0.9; fyoff = (double)(max_y-1)/11.0; /* printf("currentlinewidth 1.5 mul setlinewidth\n"); */ printf("<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\"\n", SX(0),SY(n1+1), SX(n0+1)-SX(0), SY(0) - SY(n1+1)); printf("stroke=\"black\" stroke-width=\"2.0\" fill=\"none\" />\n"); xaxis(n0,sq1off, xtitle); yaxis(n1,sq0off, ytitle); legend(); }
static void dw_gt_closepath(vd_trace_interface *I) { get_window(); if (host.tw == NULL) return; LineTo(I->host->hdc, SX(I->host->bx), SY(I->host->by)); CloseFigure(I->host->hdc); }
static gmx_bool label_pp(t_x11 *x11, Window w, int npp, t_phipsi pp[], t_dih dih[], int mx, int my) { int d, md, x0, y0; int i, imin; imin = -1; md = 16; for (i = 0; (i < npp); i++) { x0 = SX(dih[pp[i].iphi].ang); y0 = SY(dih[pp[i].ipsi].ang); d = (mx-x0)*(mx-x0)+(my-y0)*(my-y0); if (d < md) { md = d; imin = i; } } if (imin != -1) { pp[imin].bShow = !pp[imin].bShow; return TRUE; } return FALSE; }
static void sys_zone2(void) { uint_t numzones = x0 + 1; GO(SYS_zone, "(ZONE_LIST_DEFUNCT) 2s 1m"); SY(SYS_zone, x0 + ZONE_LIST_DEFUNCT, x0 + 1, &numzones); SUCC; }
void NewsScreenInterface::Update () { CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" ); UplinkAssert ( cu ); int newnummessages = cu->news.Size (); if ( newnummessages != previousnummessages ) { int numRows = SY(260) / 40; for ( int i = 0; i < numRows; ++ i ) { char name [128]; UplinkSnprintf ( name, sizeof ( name ), "news_story %d", i ); EclDirtyButton ( name ); } ScrollBox::GetScrollBox( "news_scroll" )->SetNumItems( newnummessages ); previousnummessages = newnummessages; } }
void NewsScreenInterface::Remove () { if ( IsVisible () ) { int numRows = SY(260) / 40; for ( int i = 0; i < numRows; ++ i ) { char name [128]; UplinkSnprintf ( name, sizeof ( name ), "news_story %d", i ); EclRemoveButton ( name ); } remove_stextbox ( "news_details" ); EclRemoveButton ( "news_date" ); EclRemoveButton ( "news_subject" ); EclRemoveButton ( "news_exit" ); ScrollBox::RemoveScrollBox ( "news_scroll" ); } }
void BBSScreenInterface::Create ( ComputerScreen *newcs ) { if ( !IsVisible () ) { UplinkAssert ( newcs ); cs = newcs; EclRegisterButton ( 20, 30, 100, 15, "Date", "This column shows the date the message was submitted", "bbs_date" ); EclRegisterButton ( 125, 30, 22 + SY(388) - 125 + 15, 15, "Subject", "This column shows the subject of the message", "bbs_subject" ); for ( int i = 0; i < NumItemsOnScreen(); ++i ) { char name [128]; UplinkSnprintf ( name, sizeof ( name ), "BBmessage %d", i ); EclRegisterButton ( 20, i * 20 + 50, SY(388), 17, "", "Read this Bulletin Board message", name ); EclRegisterButtonCallbacks ( name, DrawBBSButton, ClickBBSButton, MousedownBBSButton, HighlightBBSButton ); } int baseX = 23 + SY(388) - 55; int baseY = 50 + NumItemsOnScreen() * 20; EclRegisterButton ( 20, baseY, SY(388) - 55, 110, "", "", "bbs_details" ); EclRegisterButtonCallbacks ( "bbs_details", DrawDetails, NULL, NULL, NULL ); EclRegisterButton ( baseX, baseY, 70, 15, "Accept", "Accept this mission", "bbs_accept" ); EclRegisterButtonCallback ( "bbs_accept", AcceptClick ); EclRegisterButton ( baseX, baseY + 20, 70, 15, "Contact", "Contact the employer of this mission", "bbs_contact" ); EclRegisterButtonCallback ( "bbs_contact", ContactClick ); EclRegisterButton ( baseX, baseY + 110 - 15, 70, 15, "Exit BBS", "Close the BBS screen and return to the main menu", "bbs_exit" ); EclRegisterButtonCallback ( "bbs_exit", ExitClick ); CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" ); UplinkAssert ( cu ); ScrollBox::CreateScrollBox ( "bbs_scroll", 22 + SY(388), 47, 15, NumItemsOnScreen() * 20, cu->missions.Size(), 12, 0, ScrollChange ); baseoffset = 0; currentselect = -1; } }
void vd_impl_lineto_multi(const struct gs_fixed_point_s *p, int n) { int i; NullRET; for (i = 0; i < n; i++) { px = SX(p[i].x), py = SY(p[i].y); vd_trace1->lineto(vd_trace1, px, py); } }
int main(void) { int res; GO(__NR_fork, 2, "0e"); SY(__NR_fork); return(0); }
void vd_impl_curve(double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, int w, unsigned long c) { NullRET; vd_trace1->setcolor(vd_trace1, c); vd_trace1->setlinewidth(vd_trace1, w); vd_trace1->beg_path(vd_trace1); vd_trace1->moveto(vd_trace1, SX(x0), SY(y0)); vd_impl_curveto(x1, y1, x2, y2, x3, y3); vd_trace1->end_path(vd_trace1); vd_trace1->stroke(vd_trace1); }
int main(void) { /* Uninitialised, but we know px[0] is 0x0. */ long *px = malloc(sizeof(long)); x0 = px[0]; /* SYS_lwp_sigqueue 163 */ GO(SYS_lwp_sigqueue, "5s 1m"); SY(SYS_lwp_sigqueue, x0 - 1, x0, x0 + 1, x0, x0 - 1); FAIL; return 0; }
static void plot_pp(t_x11 *x11,Window w,t_phipsi *pp,t_dih dih[]) { int x0,y0; int th=(XTextHeight(x11->font)+6)/2; x0=SX(dih[pp->iphi].ang); y0=SY(dih[pp->ipsi].ang); XFillRectangle(x11->disp,w,x11->gc,x0-1,y0-1,4,4); /* Draw Label ? */ if (pp->bShow) TextInRect(x11,w,pp->label,x0+6,y0-th,30,2*th,eXLeft,eYCenter); }
void NewsScreenInterface::Create ( ComputerScreen *newcs ) { if ( !IsVisible () ) { UplinkAssert ( newcs ); cs = newcs; int numRows = SY(260) / 40; int itemWidth = SX(390); EclRegisterButton ( 20, 34, 104, 15, "Date", "This column shows the date the story was posted", "news_date" ); EclRegisterButton ( 125, 34, itemWidth - 105 + 15, 15, "Subject", "This column shows the subject of the story", "news_subject" ); for ( int i = 0; i < numRows; ++i ) { char name [128]; UplinkSnprintf ( name, sizeof ( name ), "news_story %d", i ); EclRegisterButton ( 20, i * 40 + 50, itemWidth, 39, "", "Read this News story", name ); EclRegisterButtonCallbacks ( name, DrawNewsButton, ClickNewsButton, MousedownNewsButton, HighlightNewsButton ); } create_stextbox ( 20, 50 + numRows * 40, itemWidth + 16, SY(105), "", "news_details" ); EclRegisterButtonCallbacks ( "news_details box", DrawDetails, NULL, NULL, NULL); EclRegisterButton ( 20 + itemWidth + 16 - SX(70), 51 + numRows * 40 + SY(105), SX(70), 15, "Exit News", "Close the News screen and return to the main menu", "news_exit" ); EclRegisterButtonCallback ( "news_exit", ExitClick ); CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" ); UplinkAssert ( cu ); ScrollBox::CreateScrollBox( "news_scroll", itemWidth + 21, 50, 15, numRows * 40, cu->news.Size(), numRows, 0, ScrollChange ); baseoffset = 0; currentselect = -1; } }
int main(void) { /* Uninitialised, but we know px[0] is 0x0. */ long *px = malloc(sizeof(long)); x0 = px[0]; /* SYS_stat64 215 */ GO(SYS_stat64, "2s 2m"); SY(SYS_stat64, x0, x0); FAIL; /* SYS_lstat64 216 */ GO(SYS_lstat64, "2s 2m"); SY(SYS_lstat64, x0, x0); FAIL; /* SYS_fstat64 217 */ GO(SYS_fstat64, "2s 1m"); SY(SYS_fstat64, x0, x0); FAIL; /* SYS_open64 225 */ sys_open64(); sys_open642(); return 0; }
void CInstrumentEditDlg::InsertPane(CInstrumentEditPanel *pPanel, bool Show) { CRect Rect, ParentRect; CTabCtrl *pTabControl = static_cast<CTabCtrl*>(GetDlgItem(IDC_INST_TAB)); pTabControl->GetWindowRect(&ParentRect); pTabControl->InsertItem(m_iPanels, pPanel->GetTitle()); pPanel->Create(pPanel->GetIDD(), this); pPanel->GetWindowRect(&Rect); Rect.MoveToXY(ParentRect.left - Rect.left + SX(1), ParentRect.top - Rect.top + SY(21)); Rect.bottom -= SY(2); Rect.right += SX(1); pPanel->MoveWindow(Rect); pPanel->ShowWindow(Show ? SW_SHOW : SW_HIDE); if (Show) { pTabControl->SetCurSel(m_iPanels); pPanel->SetFocus(); m_pFocusPanel = pPanel; } m_pPanels[m_iPanels++] = pPanel; }
void NewsScreenInterface::ScrollChange ( char *scrollname, int newValue ) { baseoffset = newValue; int numRows = SY(260) / 40; for ( int i = 0; i < numRows; ++i ) { char name [128]; UplinkSnprintf ( name, sizeof ( name ), "news_story %d", i ); EclDirtyButton ( name ); } }
/*----------------------------------------------------------------------------- Name : primBeveledRectOutline Description : Draw an outline 2d beveled rectangle. Inputs : rect - pointer to rectangle structure containing coordinates. thickness - thickness of the lines c - color to draw it in, xb - x offset, yb - y offset Outputs : .. Return : void ----------------------------------------------------------------------------*/ void primBeveledRectOutline(rectangle *rect, sdword thickness, color c, uword xb, uword yb) { glColor3ub(colRed(c), colGreen(c), colBlue(c)); glPushAttrib(GL_LINE_BIT); glLineWidth((GLfloat)thickness); glBegin(GL_LINE_LOOP); glVertex2f(SX(X0+xb), SY(Y0)); glVertex2f(SX(X1-xb), SY(Y0)); glVertex2f(SX(X1), SY(Y0+yb)); glVertex2f(SX(X1), SY(Y1-yb)); glVertex2f(SX(X1-xb), SY(Y1)); glVertex2f(SX(X0+xb), SY(Y1)); glVertex2f(SX(X0), SY(Y1-yb)); glVertex2f(SX(X0), SY(Y0+yb)); glEnd(); glPopAttrib(); }
static int sys_statvfs642(void) { const char path[] = "/"; struct statvfs64 stats; GO(SYS_statvfs64, "4s 0m"); SY(SYS_statvfs64, x0 + path, x0 + &stats); SUCC; size_t basetype_len = strlen(stats.f_basetype); size_t fstr_len = strlen(stats.f_fstr); /* Now check that memory after the strings is reported uninitialized. */ int x = 0; if (stats.f_basetype[basetype_len + 2] != ' ') x = -1; else x = -2; if (stats.f_fstr[fstr_len + 2] != ' ') x = -3; else x = -4; return x; }
/*----------------------------------------------------------------------------- Name : primRoundRectOutline Description : Draw an outline 2d rounded rectangle. Inputs : rect - pointer to rectangle structure containing coordinates. thickness - thickness of the lines c - color to draw it in, xb - x offset, yb - y offset Outputs : .. Return : void ----------------------------------------------------------------------------*/ void primRoundRectOutline(rectangle *rect, sdword thickness, color c, uword xb, uword yb) { oval o; sdword segs = SEGS; glColor3ub(colRed(c), colGreen(c), colBlue(c)); glPushAttrib(GL_LINE_BIT); glLineWidth((GLfloat)thickness); glBegin(GL_LINES); glVertex2f(SX(X0+xb), SY(Y0)); glVertex2f(SX(X1-xb), SY(Y0)); glVertex2f(SX(X1), SY(Y0+yb)); glVertex2f(SX(X1), SY(Y1-yb)); glVertex2f(SX(X1-xb), SY(Y1)); glVertex2f(SX(X0+xb), SY(Y1)); glVertex2f(SX(X0), SY(Y1-yb)); glVertex2f(SX(X0), SY(Y0+yb)); glEnd(); glPopAttrib(); // if (xb > 4 || yb > 4) // segs *= 2; // upper left o.centreX = X0+xb; o.centreY = Y0+yb; o.radiusX = xb; o.radiusY = yb; primOvalArcOutline2(&o, 3*PI/2, TWOPI, 2, segs, c); // upper right o.centreX = X1-xb; primOvalArcOutline2(&o, (real32)0, PI/2, 2, segs, c); // lower right o.centreY = Y1-yb; primOvalArcOutline2(&o, PI/2, PI, 2, segs, c); // lower left o.centreX = X0+xb; primOvalArcOutline2(&o, PI, 3*PI/2, 2, segs, c); }