main() { int gr_mkmx, gr_mkmy; int gr_mkmstate, gr_mkkstate; int tmpx, tmpy; int tmpx1, tmpy1; int tmpx2, tmpy2; int index, rgb_in[3]; int draw; appl_init(); phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox); wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk); open_vwork(); wi_handle = wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk); graf_mouse(3, 0x0L); graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); tmpx = gr_mkmx; tmpy = gr_mkmy; vswr_mode(handle, 3); v_enter_cur(handle); v_exit_cur(handle); graf_mouse(M_OFF, 0x0L); drawicon(gr_mkmx,gr_mkmy); graf_mouse(M_ON, 0x0L); while(!(0x0002&gr_mkmstate)) { graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); tmpx1 = gr_mkmx; tmpy1 = gr_mkmy; graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate); if (((tmpx1 != gr_mkmx) || (tmpy1 != gr_mkmy)) && (0x0001&gr_mkmstate)) { v_enter_cur(handle); v_exit_cur(handle); graf_mouse(M_OFF, 0x0L); drawicon(gr_mkmx,gr_mkmy); graf_mouse(M_ON, 0x0L); } } wind_delete(wi_handle); v_clsvwk(handle); appl_exit(); }
P1(PUBLIC pascal, void, SysError, short, errorcode) { GrafPort alertport; Region viscliprgn; HIDDEN_RgnPtr rp; Rect r; struct adef *ap; char quickbytes[grafSize]; INTEGER offsetx, offsety; Rect main_gd_rect; #if defined (BINCOMPAT) LONGINT tmpa5; #endif /* BINCOMPAT */ main_gd_rect = PIXMAP_BOUNDS (GD_PMAP (MR (MainDevice))); if (!DSAlertTab) { #if defined (CLIFF_CENTERING_ALGORITHM) DSAlertTab = CL((Ptr) &myalerttab); DSAlertRect.top = CWC(64); DSAlertRect.left = CWC(32); DSAlertRect.bottom = CWC(190); DSAlertRect.right = CWC(480); #else INTEGER screen_width = CW (main_gd_rect.right); INTEGER screen_height = CW (main_gd_rect.bottom); DSAlertTab = RM((Ptr) &myalerttab); DSAlertRect.top = CW((screen_height - 126) / 3); DSAlertRect.left = CW((screen_width - 448) / 2); DSAlertRect.bottom = CW(CW(DSAlertRect.top) + 126); DSAlertRect.right = CW(CW(DSAlertRect.left) + 448); #endif offsetx = CW (DSAlertRect.left) - 32; offsety = CW (DSAlertRect.top) - 64; } else { offsetx = offsety = 0; } /* IM-362 */ /* 1. Save registers and Stack Pointer */ /* NOT DONE YET... signal handlers sort of do that anyway */ /* 2. Store errorcode in DSErrCode */ DSErrCode = CW(errorcode); /* 3. If no Cx(DSAlertTab), bitch */ if (!DSAlertTab) { write(2, "This machine thinks its a sadmac\n", sizeof("This machine thinks its a sadmac\n")-1); exit(255); } /* 4. Allocate and re-initialize QuickDraw */ #if defined (BINCOMPAT) a5 = (LONGINT) (long) US_TO_SYN68K (&tmpa5); CurrentA5 = (Ptr) (long) CL(a5); #endif /* BINCOMPAT */ InitGraf((Ptr) quickbytes + sizeof(quickbytes) - 4); ROMlib_initport(&alertport); SetPort(&alertport); InitCursor(); rp.p = RM(&viscliprgn); alertport.visRgn = alertport.clipRgn = RM(&rp); viscliprgn.rgnSize = CWC(10); #if 0 && !defined(MSDOS) viscliprgn.rgnBBox = DSAlertRect; #else viscliprgn.rgnBBox = main_gd_rect; #endif /* 5, 6. Draw alert box if the errorcode is >= 0 */ TRAPBEGIN(); if (errorcode < 0) errorcode = -errorcode; else { r = DSAlertRect; FillRect(&r, white); #if defined (OLDSTYLEALERT) r.right = CW(CW(r.right) - (2)); r.bottom = CW(CW(r.bottom) - (2)); FrameRect(&r); PenSize(2, 2); MoveTo(CW(r.left)+2, CW(r.bottom)); LineTo(CW(r.right), CW(r.bottom)); LineTo(CW(r.right), CW(r.top)+2); PenSize(1, 1); #else /* OLDSTYLEALERT */ FrameRect(&r); InsetRect(&r, 3, 3); PenSize(2, 2); FrameRect(&r); PenSize(1, 1); #endif /* OLDSTYLEALERT */ } /* find appropriate entry */ ap = (struct adef *) findid(errorcode); if (!ap) ap = (struct adef *) ((INTEGER *) MR(DSAlertTab) + 1); /* 7. text strings */ drawtextstring(CW(ap->primetextid), offsetx, offsety); drawtextstring(CW(ap->secondtextid), offsetx, offsety); /* 8. icon */ drawicon(CW(ap->iconid), offsetx, offsety); /* 9. TODO: figure out what to do with the proc ... */ /* 10, 11, 12, 13. check for non-zero button id */ /* #warning We blow off ResumeProc until we can properly handle it */ if (ap->buttonid) dobuttons(/* CL(ResumeProc) ? Cx(ap->buttonid) + 1 : */ Cx(ap->buttonid), offsetx, offsety, false); TRAPEND(); }