TweetFollow Us on Twitter

cdev Debugging
Volume Number:6
Issue Number:2
Column Tag:Pascal Procedures

Related Info: Control Panel Dialog Manager

CDEV Debugging

By J. Peter Hoddie, Palo Alto, CA

A cdev Shell

This article describes a shell program created to simplify the process of writing, testing, and debugging Control Panel devices. The shell is written in MPW Pascal (actually it was developed in TML Pascal II, but the two are compatible) and so is appropriate for use with cdev’s written in the MPW environment. The cdev shell has been tested with Apple’s SADE debugger. This article does not describe how to write a cdev. For the details on writing a cdev, including a working example, see Inside Macintosh Volume 5.

Without a cdev shell, the process of testing a cdev is less then simple. You must compile and link the cdev, place it in the system folder, and select the Control Panel. Under these circumstances you cannot use a source level debugger, only MacsBug. Using the cdev shell, you simply link your cdev with the shell code and run it as a normal application which gives you access to a source level debugger. The cdev shell has several features designed specifically for testing. The shell itself does not appear graphically identical to the Control Panel, however as far as the cdev itself is concerned there is no difference.

The cdev shell was designed not only to allow the use of a source level debugger, but also to provide a collection of features for easily testing the many messages to which a cdev is expected to respond. Further, because as you are developing a cdev you may not have written code to handle each messages, a dialog presented from the “Message Masks...” menu item allows you to filter out any combination of cdev messages. Your message mask settings are stored as a resource type ‘msks’ so that you don’t have to reset them each time you use the shell.

An option to force the cdev to update its entire window to test your drawing code is available as the “Force Update” menu item.

A small window named “Other Window” appears above and to the right of the Control Panel window. This window allows you to test the activate and deactivate messages by making the “Other Window” the active window. By covering areas of your cdev’s panel with the “Other Window” you can further test the screen updating capabilities of your cdev.

All of the options on the standard Edit menu are passed to the cdev as the corresponding cdev messages.

When you start up the cdev shell, the test cdev is not selected. Either click on its icon or select Open from the file menu. To close the cdev, select Close from the file menu or click on the stop sign icon. This allows you to test the open and close cdev messages multiple times without having to relaunch the cdev shell. By not immediately selecting the test cdev in the shell, you have the opportunity to set break points, modify the message masks, and perform any other required actions.

Tech Note #215 - “New” cdev Messages - describes a cdev message, cursorDev, that is not documented in Inside Macintosh. It states that if a ‘CURS’ -4064 (cursor) resource is present in the cdev file, that the cdev will receive a cursorDev message (number 14) whenever the cursor is inside the cdev’s window. This allows the cdev to have its own cursor as appropriate. The shell fully supports this new message.

The shell also checks that certain required resources are present. If a required resource is missing, an error message is generated and the shell aborts. The cdev resources that the shell must have to run are ‘DITL’, ‘mach’, ‘nrct’, and ‘ICN#’ all with ID -4064. The only required resources that the shell does not check for are the ‘cdev’ code, ‘BNDL’ and ‘FREF’ resources.

The shell does other error checking as appropriate. For example, the macDev message is only allowed to return one of two values. If any other value is returned, the shell issues a warning alert.

The shell will only send the cdev the macDev message if the values of the hard and soft masks in the ‘mach’ -4064 resource are set as documented in Inside Macintosh. Otherwise the shell compares these to HwCfgFlags and ROM85 in low memory as described in Inside Macintosh. While Inside Macintosh claims that HwCfgFlags is a low memory global, its location is never given. I had to fish it out of one the “private” MPW Assembler equates files.

This article does not include a sample cdev to use with the shell. It is currently set up to work with the Sample provide in Inside Macintosh Volume 5. The only call the cdev shell makes to code outside itself is to the entry point of the cdev unit that is being tested. The name of the unit that the cdev shell expects to find is “cdev” and the name of the main cdev routine (really its entry point) is “Sample” - exactly as the sample unit in Inside Macintosh.

There is one minor bug in the Sample cdev from Inside Macintosh. In the function EnoughRoomToRun the call to GetResource should be replaced with a call to RGetResource or the cdev will not run.

The shell is not a great example of how to write a Macintosh application. It clearly demonstrates what Tech Note #203 - Don’t Abuse the Managers - tries to drive home: the Dialog Manager is not a user interface! Unfortunately, since the Control Panel relies on the Dialog Manager, there was no choice for the cdev shell. Also, the shell was originally written in THINK C, and then translated to Pascal when I found out that a cdev shell was shipping with THINK C Version 4. Anyone who is interested in the C version may contact me directly for a copy. Converting the code presented in this article to run under THINK Pascal should be an easy task.

File: cdevShell.make

# Commands to build cdev Shell using MPW Pascal
#
# put the name of your cdev files in place of cdev.p, 
# cdev.p.o, and cdev.r below
#
    Pascal cdev.p -sym on
    Pascal cdevShell.p -sym on
    Link -w -t ‘APPL’ -c ‘????’ -sym on 
 cdev.p.o 
   cdevShell.p.o 
 “{Libraries}”Runtime.o 
 “{Libraries}”Interface.o 
 “{PLibraries}”PasLib.o 
 “{PLibraries}”SANELib.o
 -o cdevShell
    Rez -append -o cdevShell cdev.r
    Rez -append -o cdevShell cdevShell.r
File: cdevShell.p

PROGRAM cdevShell;

USES  MemTypes, QuickDraw, OSIntf, ToolIntf, PackIntf,
 cdev;

CONST
 cursorDev = 14;
 HwCfgFlgs = $0B22;
 ROM85 = $028E;

TYPE
 IntPtr = ^integer;
 IntHandle = ^IntPtr;
 RectPtr = ^rect;
 EventPtr = ^EventRecord;

PROCEDURE doMenu(l: longInt); FORWARD;
PROCEDURE updateDial;FORWARD;
PROCEDURE drawIcon(ih: Handle; selected: Boolean;
 r: Rect);FORWARD;
PROCEDURE startupCdev;  FORWARD;
PROCEDURE shutDownCdev; FORWARD;
PROCEDURE cdevInitDev;  FORWARD;
PROCEDURE cdevHitDev(item: integer; e: EventPtr);
 FORWARD;
PROCEDURE cdevUpdateDev;  FORWARD;
PROCEDURE cdevNulDev(e: EventPtr); FORWARD;
PROCEDURE cdevCloseDev; FORWARD;
PROCEDURE cdevEdit(c: integer);  FORWARD;
PROCEDURE cdevKeyEvtDev(e: EventPtr);FORWARD;
PROCEDURE cdevActivate(e: EventPtr); FORWARD;
PROCEDURE cdevMacDev;FORWARD;
PROCEDURE cdevCursorDev;  FORWARD;
PROCEDURE fatalError(s : Str255);  FORWARD;
PROCEDURE warningError(s : Str255);FORWARD;
PROCEDURE doMsgDialog;  FORWARD;
FUNCTION callCdev( msgCode : integer; item : integer;
 e : EventPtr; st : longInt) :longInt; FORWARD;
PROCEDURE doNRCTs; FORWARD;
PROCEDURE getNRCTrgn;FORWARD;
PROCEDURE HiliteDefault(d: DialogPtr); FORWARD;

VAR
 cdevDial:DialogPtr;
 dP:    DialogPeek;
 cdevItems: integer;
 userItems: integer;
 teWas: integer;
 cdevStorage:  longInt;

 nrctRgn: RgnHandle;
 greyRgn: RgnHandle;
 userArea:Rect;

 stopRect,
 startRect: Rect;
 myStopIcon,
 myStartIcon:  Handle;

 cursorIsArrow:  Boolean;
 cdevMsgOff:array[0 .. 16] of Boolean;
 selected:Boolean;
 running: Boolean;

 env:   SysEnvRec;
 entryVref: integer;
 otherWindow:  WindowPtr;
 error: integer;

 i,j:   integer;
 temp, cdevDITL: Handle;
 e:EventRecord;
 rH:    RgnHandle;
 whichWindow:  WindowPtr;
 key:   char;
 p:Point;
 s:Str255;
 hasCursor: Boolean;
 teH:   TEHandle;
 trashB:Boolean;

PROCEDURE doMenu(l: longInt);
VARmenu, choice, i:integer;
 daName:Str255;
 d:DialogPtr;
BEGIN
 menu := HiWord(l);
 choice := LoWord(l);
 
 case menu of
 1:BEGIN
 if choice = 1 then BEGIN
 d := GetNewDialog(132, nil, WindowPtr(-1));
 HiliteDefault(d);
 repeat
 ModalDialog(nil, i)
 until i = 1;
 DisposDialog(d);
 END;
 if choice > 1 then BEGIN
 GetItem(GetMHandle(1), choice, daName);
 error := OpenDeskAcc(daName);
 END;
 END;
 2:case choice of
 1: startupCdev;
 2: shutDownCdev;
 4: running := false;
 END;
 3:if FrontWindow = cdevDial then
 cdevEdit(choice)
 else
 trashB := SystemEdit(choice - 1);
 4:case choice of
 1: doMsgDialog;
 2: 
 InvalRect(GrafPtr(cdevDial)^.portRect);
 END; { of case }
 END; { of case }
 HiliteMenu(0);
END;

PROCEDURE updateDial;
VAR
 r:Rect;
 patHand: PatHandle;
 i:integer;
 h:Handle;
BEGIN
 SetPort(cdevDial);
 TextSize(9);
 
 PenSize(2,2);
 
 patHand := GetPattern(-16000);
 PenPat(patHand^^);
 PaintRgn(nrctRgn);
 PenPat(black);

 doNRCTs;
 r := cdevDial^.portRect;
 InsetRect(r, -2, -2);
 r.top := r.top + 1;
 FrameRect(r);

 GetDItem(cdevDial, 2, i, h, r);
 r.top := r.top - 2;
 r.bottom := r.bottom -1;
 r.left := r.left - 2;
 r.right := r.right + 1;
 FrameRect(r);

 GetDItem(cdevDial, 1, i, h, r);
 r.top := r.top - 2;
 r.bottom := r.bottom + 2;
 r.left := r.left - 2;
 r.right := r.right + 2;
 FrameRect(r);

 PenSize(1,1);

 drawIcon(myStopIcon, not selected, stopRect);
 drawIcon(myStartIcon, selected, startRect);
END;

PROCEDURE drawIcon(ih: Handle; selected: Boolean; r: Rect);
VAR
 iconBitMap:BitMap;
 fromR: Rect;
BEGIN
 SetRect(fromR, 0, 0, 32, 32);
 iconBitMap.rowBytes := 4;
 iconBitMap.bounds := fromR;
 HLock(iH);
 if (selected) then BEGIN
 iconBitMap.baseAddr := Ptr(ORD4(iH^) + longInt(128));
 CopyBits(iconBitMap, GrafPtr(cdevDial)^.portBits, fromR, r,
 srcCopy, nil);

 iconBitMap.baseAddr := ih^;
 CopyBits(iconBitMap, GrafPtr(cdevDial)^.portBits, fromR, r,
 srcXor, nil);
 END
 else BEGIN
 iconBitMap.baseAddr := ih^;
 CopyBits(iconBitMap, GrafPtr(cdevDial)^.portBits, fromR, r,
 srcCopy, nil);
 END;
 HUnlock(iH);
END;

PROCEDURE startupCdev;
VAR
 temp:  Handle;
 i,j,totalItems: integer;
 hardMask, softMask: integer;
 p:Ptr;
 c:ControlHandle;
 tempD: DialogPtr;
 r:Rect;
BEGIN
 selected := true;
 
 getNRCTrgn;
 
 temp := GetResource(‘mach’, -4064);
 if temp = nil then
 fatalError(‘mach -4064 resource not found’);
 softMask := IntHandle(temp)^^;
 hardMask := IntPtr(2+ORD4(temp^))^;
 if (softMask = 0) and (hardMask = $ffff) then BEGIN
 cdevMacDev;
 if cdevStorage = 0 then
 fatalError(‘cdev refuses to run on this machine’);
 if cdevStorage <> 1 then
 fatalError(‘Invalid result returned from macDev call’);
 END
 else BEGIN
 if integer(BitAnd(softMask, IntPtr(ROM85)^))
 <> Intptr(ROM85)^ then
 fatalError(‘cdev failed SoftMask test’);
 if integer(BitAnd(hardMask, IntPtr(HwCfgFlgs)^))
 <> hardMask then
 fatalError(‘cdev failed HardMask test’);
 END;
 ReleaseResource(temp);

 IntHandle(dP^.items)^^ := cdevItems + userItems;
 dP^.editField := teWas;
 if teWas <> -1 then
 TEActivate( dP^.textH);
 SetPort(cdevDial);
 TextSize(9);
 for i:= cdevItems + 1 to cdevItems + userItems do
 ShowDItem(cdevDial,i);

 doNRCTs;
 
 DisableItem(GetMHandle(2),1);
 EnableItem(GetMHandle(2), 2);

 cdevInitDev;

 InvalRect(GrafPtr(cdevDial)^.portRect);
END;

PROCEDURE shutDownCdev;
VARi: integer;
BEGIN
 cdevCloseDev;

 SetCursor(arrow);
 cursorIsArrow := true;

 if cdevStorage <> 0 then
 warningError(‘Close call did not return zero’);

 for i := cdevItems + 1 to cdevItems + userItems do
 HideDItem(cdevDial, i);
 
 IntHandle(dP^.items)^^ := cdevItems;
 dP^.editField := -1;
 if teWas <> -1 then
 TEDeactivate(dP^.textH);

 selected := false;

 getNRCTrgn;

 EnableItem(GetMHandle(2), 1);
 DisableItem(GetMHandle(2), 2);

 InvalRect(GrafPtr(cdevDial)^.portRect);
END;

PROCEDURE cdevInitDev;
BEGIN
 cdevStorage := callCdev(initDev, 0, nil, cdevUnset);
END;

PROCEDURE cdevHitDev(item: integer; e: EventPtr);
BEGIN
 cdevStorage := callCdev(hitDev, item, e, cdevStorage);
END;

PROCEDURE cdevUpdateDev;
BEGIN
 cdevStorage := callCdev(updateDev, 0, nil, cdevStorage);
END;

PROCEDURE cdevNulDev(e: EventPtr);
BEGIN
 cdevStorage := callCdev(nulDev, 0, e, cdevStorage);
END;

PROCEDURE cdevCloseDev;
BEGIN
 cdevStorage := callCdev(closeDev, 0, nil, cdevStorage);
END;

PROCEDURE cdevEdit(c: integer);
BEGIN
 case c of
 1:i := undoDev;
 3:   i := cutDev;
 4:i := copyDev;
 5:i := pasteDev;
 6:i := clearDev;
 END;
 cdevStorage := callCdev(i, 0, nil, cdevStorage);
END;

PROCEDURE cdevKeyEvtDev(e: EventPtr);
BEGIN
 cdevStorage := callCdev(keyEvtDev, 0, e, cdevStorage);
END;

PROCEDURE cdevActivate(e: EventPtr);
VARi:   integer;
BEGIN
 if BitAnd(e^.modifiers, activeFlag) <> 0 then
 i := activDev
 else
 i := deactivDev;
 cdevStorage := callCdev(i, 0, e, cdevStorage);
END;

PROCEDURE cdevMacDev;
BEGIN
 cdevStorage := callCdev(macDev, 0, nil, cdevStorage);
END;

PROCEDURE cdevCursorDev;
BEGIN
 cdevStorage := callCdev(cursorDev, 0, nil, cdevStorage);
END;

FUNCTION callCdev( msgCode : integer; item : integer; 
 e : EventPtr; st : longInt) :longInt;
 var  rValue:  longInt;
 error :integer;
BEGIN
 if (not selected) or (cdevMsgOff[msgCode]) 
 then BEGIN
 callCdev := st;
 exit(callCdev);
 END;

 SetPort(cdevDial);
 TextSize(9);
 error := SetVol(nil, env.sysVRefNum);
 rValue := Sample(msgCode, item, cdevItems, 0, e^,
 st, cdevDial);
 error := SetVol(nil, entryVref);

 if (msgCode <> macDev) and 
 (msgCode <> closeDev) then
 case rValue of
 cdevGenErr:fatalError(‘General cdev error’);
 cdevMemErr: fatalError(‘cdev insufficient memory error’);
 cdevResErr: fatalError
 (‘cdev could not locate needed resource’);
 END; { of case }
 callCdev := rValue;
END;

PROCEDURE fatalError(s : Str255);
BEGIN
 ParamText(s, ‘’, ‘’, ‘’);
 error := Alert(130, nil);
 ExitToShell;
END;

PROCEDURE warningError(s : Str255);
BEGIN
 ParamText(s, ‘’, ‘’, ‘’);
 error := Alert(131, nil);
END;

PROCEDURE doMsgDialog;
VARd:   DialogPtr;
 i,kind:integer;
 r:Rect;
 h:Handle;
BEGIN
 d := GetNewDialog(128, nil, WindowPtr(-1));
 HiliteDefault(d);

 for i:= initDev + 3 to cursorDev + 3 do BEGIN
 GetDItem(d, i, kind, h, r);
 kind := integer(cdevMsgOff[i-3]);
 if kind <> 0 then
 kind := 1;
 SetCtlValue(ControlHandle(h), kind);
 END;
 
 repeat
 ModalDialog(nil, i);
 if i > 2 then BEGIN
 GetDItem(d, i, kind, h, r);
 SetCtlValue(ControlHandle(h),
 ABS(GetCtlValue(ControlHandle(h)) - 1));
 END
 until i <= 2;

 if i = 1 then BEGIN
 for i:= initDev + 3 to cursorDev + 3 do BEGIN
 GetDItem(d, i, kind, h, r);
 cdevMsgOff[i-3] :=
 Boolean(GetCtlValue(ControlHandle(h)));
 END;
 h := GetResource(‘msks’, 128);
 if h <> nil then BEGIN
 BlockMove(Ptr(@cdevMsgOff), h^, 16);
 ChangedResource(h);
 WriteResource(h);
 END;
 END;

 DisposDialog(d);
END;

PROCEDURE doNRCTs;
VARh:   Handle;
 r:RectPtr;
 i:integer;
BEGIN
 if not selected then
 exit(doNRCTs);

 h := GetResource(‘nrct’, -4064);
 r := RectPtr(2 + ORD4(h^));
 for i:= 1 to IntHandle(h)^^ do BEGIN
 EraseRect(r^);
 FrameRect(r^);
 r := RectPtr(ORD4(r) + sizeof(Rect));
 END; { of loop }
 ReleaseResource(h);
END;

PROCEDURE getNRCTrgn;
VAR
 h:Handle;
 r:RectPtr;
 rct: Rect;
 i:integer;
 rRgn:  RgnHandle;
BEGIN
 if not selected then
 BEGIN
 SetRect(rct, 86, -1, 322, 255);
 nrctRgn := NewRgn;
 RectRgn(nrctRgn, rct);
 exit(getNRCTrgn);
 END;

 h := GetResource(‘nrct’, -4064);
 if h = nil then
 fatalError(‘nrct -4064 resource is missing’);
 nrctRgn := NewRgn;
 HLock(h);
 r := RectPtr(2+ORD4(h^));
 for i:= 1 to IntHandle(h)^^ do BEGIN
 rRgn := NewRgn;
 RectRgn(rRgn, r^);
 r := RectPtr(ORD4(r) + sizeof(Rect));
 UnionRgn(nrctRgn, rRgn, nrctRgn);
 DisposeRgn(rRgn);
 END; { of loop }
 HUnlock(h);
 ReleaseResource(h);

 SetRect(rct, 86, -1, 322, 255);
 rRgn := NewRgn;
 RectRgn(rRgn, rct);
 DiffRgn(rRgn, nrctRgn, nrctRgn);
 DisposeRgn(rRgn);
END;

PROCEDURE mvWindow(w: WindowPtr; p: Point);
VARtrashR:Rect;
BEGIN
 trashR := screenBits.bounds;
 InsetRect(trashR, 6, 6);
 DragWindow(w, p, trashR);
END;

PROCEDURE HiliteDefault(d: DialogPtr);
VARi:   integer;
 box:   Rect;
 h:Handle;
BEGIN
 SetPort(d);
 GetDItem(d, 1, i, h, box);
 PenSize(3,3);
 InsetRect(box, -4, -4);
 FrameRoundRect(box, 16, 16);
END;

PROCEDURE Initialize;
BEGIN
 InitGraf(@thePort);
 InitFonts;
 InitWindows;
 TEInit;
 InitDialogs(nil);
 InitCursor;
 cursorIsArrow := true;
 MaxApplZone;
 
 SetMenuBar( GetNewMBar(256) );
 AddResMenu( GetMHandle(1), ‘DRVR’);
 DrawMenuBar;
 DisableItem(GetMHandle(2),2);
 
 error := SysEnvirons(0, env);
 error := GetVol(@s, entryVref);

 getNRCTrgn;
 
 temp := GetResource(‘msks’, 128);
 if temp <> nil then
 BlockMove(temp^, Ptr(@cdevMsgOff), 16);

 hasCursor := ( GetResource(‘CURS’, -4064) <> nil );

 SetRect(userArea, 87, 0, 322, 255);
 SetRect(stopRect, 25, 15, 25+32, 15+32);
 SetRect(startRect, 25, 85, 25+32, 85+32);

 myStartIcon := GetResource(‘ICN#’, -4064);
 if (myStartIcon = nil) then
 fatalError(‘Unable to find cdev ICN# -4064 resource’);
 myStopIcon := GetResource(‘ICN#’, 128);

 selected := false;

 cdevDITL := GetResource(‘DITL’, -16000);
 HNoPurge(cdevDITL);
 temp := GetResource(‘DITL’, -4064);
 if temp = nil then
 fatalError(‘Unable to find cdev DITL -4064 resource’);
 cdevItems := 1 + IntHandle(cdevDITL)^^;
 
 userItems := IntHandle(temp)^^;
 IntHandle(cdevDITL)^^ := cdevItems + userItems;
 i := GetHandleSize( cdevDITL );
 j := GetHandleSize( temp );
 SetHandleSize(cdevDITL, i+j-2);
 BlockMove(Ptr(2 + ORD4(temp^)), 
 Ptr(i + ORD4(cdevDITL^)), j-2);
 
 SetDAFont(1);
 cdevDial := GetNewDialog(-16000, nil, WindowPtr(-1));
 SetDAFont(0);
 dP := DialogPeek(cdevDial);
 SetPort(cdevDial);
 TextSize(9);
 ShowWindow(cdevDial);
 for i:= cdevItems + 1 to cdevItems+userItems do
 HideDItem(cdevDial, i);

 IntHandle(dP^.items)^^ := cdevItems;
 teWas := dP^.editField;
 dP^.editField := -1;
 if teWas >= 0 then BEGIN
 teH := dp^.textH;
 teH^^.txSize := 9;
 END;

 otherWindow := GetNewWindow(128, nil, WindowPtr(0));
END; { of Initialize}

PROCEDURE DoNullEvent;
BEGIN
 cdevNulDev(@e);
 SetPort(cdevDial);
 GetMouse(p);
 if (FrontWindow = cdevDial) and 
 PtInRect(p, userArea) then BEGIN
 if hasCursor then 
 cdevCursorDev
 else 
 if cursorIsArrow then
 SetCursor(GetCursor(crossCursor)^^);
 cursorIsArrow := false;
 END
 else
 if not cursorIsArrow then BEGIN
 SetCursor(arrow);
 cursorIsArrow := true
 END
END; { of doNullEvent }

PROCEDURE DoMouseDown;
BEGIN
 i := FindWindow(e.where, whichWindow);
 case i of
 inMenuBar: doMenu( MenuSelect(e.where) );
 inDrag:BEGIN
 mvWindow(whichWindow, e.where);
 e.what := nullEvent;
 END;
 inGoAway:if TrackGoAway(whichWindow, e.where)                 
 then running := false;
 inSysWindow: SystemClick(e, whichWindow);
 inContent: BEGIN
 if FrontWindow <> whichWindow
 then BEGIN
 SelectWindow(whichWindow);
 e.what := nullEvent
 END
 else if (FrontWindow = cdevDial)
 then BEGIN
 p := e.where;
 GlobalToLocal(p);
 if (not selected) and    PtInRect(p, startRect) then
 startUpCdev;
 if selected and
 PtInRect(p, stopRect) then
 shutDownCdev;
 END; { of if frontWindow}
 END; { of inContent}
 END; { end of case }
END;


BEGIN
 Initialize;

 running := true;
 while running do BEGIN
 SystemTask;
 
 if dp^.editField >= 0 then
 TEIdle( dp^.textH);
 
 if GetNextEvent(everyEvent, e) then BEGIN

 if (e.what = keyDown) or (e.what = autoKey) 
 then BEGIN
 key := char(BitAnd(e.message,charCodeMask));
 if BitAnd(e.modifiers, cmdKey) <> 0 then                      BEGIN
 doMenu(MenuKey(key));
 e.what := nullEvent;
 END;
 END;
 
 if e.what = mouseDown then
 DoMouseDown;

 if (e.what = updateEvt) and
 (e.message=longInt(otherWindow))
 then BEGIN
 BeginUpdate(otherWindow);
 EndUpdate(otherWindow);
 END;
 if IsDialogEvent(e) then BEGIN
 if (e.what = updateEvt) and
 (e.message = longInt(cdevDial))
 then BEGIN
 rH :=
 WindowPeek(cdevDial)^.updateRgn;
 error := HandToHand(Handle(rH));
 BeginUpdate(cdevDial);
 updateDial;
 cdevUpdateDev;
 EndUpdate(cdevDial);
 WindowPeek(cdevDial)^.updateRgn
 := rH;
 END;
 if (e.what = keyDown) or
 (e.what = autoKey) then
 cdevKeyEvtDev(@e);
 if e.what = activateEvt then
 cdevActivate(@e);
 
 SetPort(cdevDial);
 TextSize(9);
 if DialogSelect(e, cdevDial, i) then
 BEGIN
 if e.what = mouseDown then BEGIN
 if i =1 then
 error := 
 Alert(-16000, nil);
 if i > cdevItems then
 cdevHitDev(i, @e);
 END;
 END; { of DialogSelect if }
 END; { of DialogEvent if }
 END; { end of GNE if }
 if e.what = nullEvent then
 doNullEvent;

 END;

 cdevCloseDev;
 DisposDialog(cdevDial);
 DisposeWindow(otherWindow);
END.
File: cdevShell.r

#include “SysTypes.r”
#include “Types.r”

resource ‘PAT ‘ (-16000, purgeable) {
 $”40 00 04 00 40 00 04"
};

resource ‘ICN#’ (128, “Other”) {
 { /* array: 2 elements */
 /* [1] */
 $”00 00 00 00 00 7F FF 80 00 80 00 40 01 00 00 20"
 $”02 00 00 10 04 3C 00 08 08 24 00 04 08 20 00 02"
 $”08 3D F0 02 08 04 40 02 08 24 40 02 08 3C 5E 02"
 $”08 00 52 02 08 00 52 02 08 00 12 02 08 00 12 F2"
 $”08 00 1E 92 08 00 00 92 08 00 00 F2 08 00 00 82"
 $”08 00 00 82 04 00 00 82 02 00 00 02 01 00 00 04"
 $”00 80 00 08 00 40 00 10 00 20 00 20 00 1F FF C0",
 /* [2] */
 $”00 00 00 00 00 7F FF 80 00 FF FF C0 01 FF FF E0"
 $”03 FF FF F0 07 FF FF F8 0F FF FF FC 0F FF FF FE”
 $”0F FF FF FE 0F FF FF FE 0F FF FF FE 0F FF FF FE”
 $”0F FF FF FE 0F FF FF FE 0F FF FF FE 0F FF FF FE”
 $”0F FF FF FE 0F FF FF FE 0F FF FF FE 0F FF FF FE”
 $”0F FF FF FE 07 FF FF FE 03 FF FF FE 01 FF FF FC”
 $”00 FF FF F8 00 7F FF F0 00 3F FF E0 00 1F FF C0"
 }
};

resource ‘DLOG’ (-16000, purgeable) {
 {58, 117, 311, 437},
 documentProc,
 invisible,
 goAway,
 0x0,
 -16000,
 “Control Panel”
};

resource ‘DLOG’ (128, “Msg Masks”) {
 {50, 60, 286, 450},
 dBoxProc,
 visible,
 goAway,
 0x0,
 128,
 “”
};

resource ‘DLOG’ (132, “About...”) {
 {62, 104, 172, 398},
 dBoxProc,
 visible,
 noGoAway,
 0x0,
 132,
 “”
};

resource ‘DITL’ (-15999, purgeable) {
 { {65, 85, 85, 155},
 Button {
 enabled,
 “OK”
 },
 {8, 60, 56, 235},
 StaticText {
 disabled,
 “”
 },
 {61, 81, 89, 159},
 UserItem {
 disabled
 },
 {10, 20, 42, 52},
 Icon {
 enabled,
 0
 }
 }
};

resource ‘DITL’ (-16000, purgeable) {
 { {241, 1, 253, 87},
 StaticText {
 enabled,
 “3.3.1”
 },
 {1, 1, 242, 88},
 UserItem {
 enabled
 }
 }
};

resource ‘DITL’ (-15998, purgeable) {
 { {5, 7, 100, 227},
 StaticText {
 disabled,
 “Contributions by:\n   Steve Horowitz--the “
 “main man\n   scott douglass\n   Kristee Kr”
 “eitman\n   Amy Goldsmith”
 },
 {113, 155, 134, 224},
 Button {
 enabled,
 “Continue”
 }
 }
};

resource ‘DITL’ (130) {
 { {139, 189, 159, 249},
 Button {
 enabled,
 “OK”
 },
 {29, 30, 124, 251},
 StaticText {
 disabled,
 “Fatal Error: ^0”
 }
 }
};

resource ‘DITL’ (128) {
 { {202, 300, 222, 360},
 Button {
 enabled,
 “OK”
 },
 {201, 212, 221, 272},
 Button {
 enabled,
 “Cancel”
 },
 {40, 24, 62, 102},
 CheckBox {
 enabled,
 “initDev”
 },
 {70, 24, 84, 110},
 CheckBox {
 enabled,
 “hitDev”
 },
 {100, 24, 115, 104},
 CheckBox {
 enabled,
 “closeDev”
 },
 {130, 24, 146, 106},
 CheckBox {
 enabled,
 “nulDev”
 },
 {160, 24, 176, 112},
 CheckBox {
 enabled,
 “updateDev”
 },
 {40, 160, 61, 251},
 CheckBox {
 enabled,
 “activDev”
 },
 {70, 160, 92, 276},
 CheckBox {
 enabled,
 “deActiveDev”
 },
 {100, 160, 116, 253},
 CheckBox {
 enabled,
 “keyEvtDev”
 },
 {130, 160, 148, 261},
 CheckBox {
 enabled,
 “macDev”
 },
 {160, 160, 180, 268},
 CheckBox {
 enabled,
 “undoDev”
 },
 {40, 282, 69, 368},
 CheckBox {
 enabled,
 “cutDev”
 },
 {70, 282, 100, 367},
 CheckBox {
 enabled,
 “copyDev”
 },
 {100, 282, 127, 369},
 CheckBox {
 enabled,
 “pasteDev”
 },
 {130, 282, 154, 374},
 CheckBox {
 enabled,
 “clearDev”
 },
 {160, 282, 184, 365},
 CheckBox {
 enabled,
 “cursorDev”
 },
 {8, 8, 33, 278},
 StaticText {
 disabled,
 “Mark Boxes to Disable cdev Messages:”
 }
 }
};

resource ‘DITL’ (131) {
 { {106, 168, 126, 228},
 Button {
 enabled,
 “OK”
 },
 {7, 14, 98, 228},
 StaticText {
 disabled,
 “Warning: ^0”
 }
 }
};

resource ‘DITL’ (132) {
 { {80, 217, 100, 277},
 Button {
 enabled,
 “OK”
 },
 {12, 51, 32, 238},
 StaticText {
 disabled,
 “cdev Shell for Pascal”
 },
 {48, 52, 68, 235},
 StaticText {
 disabled,
 “© 1989 by J. Peter Hoddie”
 }
 }
};

resource ‘CNTL’ (-4048, purgeable) {
 {26, 122, 43, 170},
 0,
 visible,
 1,
 0,
 radioButProcUseWFont,
 0,
 “Show”
};

resource ‘MENU’ (128, “Apple Menu”) {
 1,
 textMenuProc,
 0x7FFFFFFD,
 enabled,
 apple,
 { “About it...”, noIcon, noKey, noMark, plain,
 “-”, noIcon, noKey, noMark, plain
 }
};

resource ‘MENU’ (129, “Files”) {
 2,
 textMenuProc,
 0x7FFFFFFB,
 enabled,
 “File”,
 { “Open”, noIcon, “O”, noMark, plain,
 “Close”, noIcon, “W”, noMark, plain,
 “-”, noIcon, noKey, noMark, plain,
 “Quit”, noIcon, “Q”, noMark, plain
 }
};

resource ‘MENU’ (130, “Edit”, preload) {
 3,
 textMenuProc,
 0x7FFFFFFD,
 enabled,
 “Edit”,
 { “Undo”, noIcon, “Z”, noMark, plain,
 “-”, noIcon, noKey, noMark, plain,
 “Cut”, noIcon, “X”, noMark, plain,
 “Copy”, noIcon, “C”, noMark, plain,
 “Paste”, noIcon, “V”, noMark, plain,
 “Clear”, noIcon, noKey, noMark, plain
 }
};

resource ‘MENU’ (131, “Options”) {
 4,
 textMenuProc,
 allEnabled,
 enabled,
 “Options”,
 { “Msg Masks...”, noIcon, noKey, noMark, plain,
 “Force Update”, noIcon, noKey, noMark, plain
 }
};

resource ‘MBAR’ (256) {
 { 128,
 129,
 130,
 131
 }
};

resource ‘ALRT’ (-16000, purgeable) {
 {48, 128, 188, 368},
 -15998,
 {
 OK, visible, silent,
 OK, visible, silent,
 OK, visible, silent,
 OK, visible, silent
 }
};

resource ‘ALRT’ (130, “Fatal Error”) {
 {56, 126, 238, 410},
 130,
 { OK, visible, sound1,
 OK, visible, sound1,
 OK, visible, sound1,
 OK, visible, sound1
 }
};

resource ‘ALRT’ (131, “Warning Error”) {
 {54, 134, 192, 378},
 131,
 { OK, visible, sound1,
 OK, visible, sound1,
 OK, visible, sound1,
 OK, visible, sound1
 }
};

data ‘msks’ (128) {
 $”00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
 };

resource ‘WIND’ (128, “Other Window”) {
 {38, 388, 80, 510},
 documentProc,
 visible,
 noGoAway,
 0x0,
 “OtherWindow”
};

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Whitethorn Games combines two completely...
If you have ever gone fishing then you know that it is a lesson in patience, sitting around waiting for a bite that may never come. Well, that's because you have been doing it wrong, since as Whitehorn Games now demonstrates in new release Skate... | Read more »
Call of Duty Warzone is a Waiting Simula...
It's always fun when a splashy multiplayer game comes to mobile because they are few and far between, so I was excited to see the notification about Call of Duty: Warzone Mobile (finally) launching last week and wanted to try it out. As someone who... | Read more »
Albion Online introduces some massive ne...
Sandbox Interactive has announced an upcoming update to its flagship MMORPG Albion Online, containing massive updates to its existing guild Vs guild systems. Someone clearly rewatched the Helms Deep battle in Lord of the Rings and spent the next... | Read more »
Chucklefish announces launch date of the...
Chucklefish, the indie London-based team we probably all know from developing Terraria or their stint publishing Stardew Valley, has revealed the mobile release date for roguelike deck-builder Wildfrost. Developed by Gaziter and Deadpan Games, the... | Read more »
Netmarble opens pre-registration for act...
It has been close to three years since Netmarble announced they would be adapting the smash series Solo Leveling into a video game, and at last, they have announced the opening of pre-orders for Solo Leveling: Arise. [Read more] | Read more »
PUBG Mobile celebrates sixth anniversary...
For the past six years, PUBG Mobile has been one of the most popular shooters you can play in the palm of your hand, and Krafton is celebrating this milestone and many years of ups by teaming up with hit music man JVKE to create a special song for... | Read more »
ASTRA: Knights of Veda refuse to pump th...
In perhaps the most recent example of being incredibly eager, ASTRA: Knights of Veda has dropped its second collaboration with South Korean boyband Seventeen, named so as it consists of exactly thirteen members and a video collaboration with Lee... | Read more »
Collect all your cats and caterpillars a...
If you are growing tired of trying to build a town with your phone by using it as a tiny, ineffectual shover then fear no longer, as Independent Arts Software has announced the upcoming release of Construction Simulator 4, from the critically... | Read more »
Backbone complete its lineup of 2nd Gene...
With all the ports of big AAA games that have been coming to mobile, it is becoming more convenient than ever to own a good controller, and to help with this Backbone has announced the completion of their 2nd generation product lineup with their... | Read more »
Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »

Price Scanner via MacPrices.net

B&H has Apple’s 13-inch M2 MacBook Airs o...
B&H Photo has 13″ MacBook Airs with M2 CPUs and 256GB of storage in stock and on sale for up to $150 off Apple’s new MSRP, starting at only $849. Free 1-2 day delivery is available to most US... Read more
M2 Mac minis on sale for $100-$200 off MSRP,...
B&H Photo has Apple’s M2-powered Mac minis back in stock and on sale today for $100-$200 off MSRP. Free 1-2 day shipping is available for most US addresses: – Mac mini M2/256GB SSD: $499, save $... Read more
Mac Studios with M2 Max and M2 Ultra CPUs on...
B&H Photo has standard-configuration Mac Studios with Apple’s M2 Max & Ultra CPUs in stock today and on Easter sale for $200 off MSRP. Their prices are the lowest available for these models... Read more
Deal Alert! B&H Photo has Apple’s 14-inch...
B&H Photo has new Gray and Black 14″ M3, M3 Pro, and M3 Max MacBook Pros on sale for $200-$300 off MSRP, starting at only $1399. B&H offers free 1-2 day delivery to most US addresses: – 14″ 8... Read more
Department Of Justice Sets Sights On Apple In...
NEWS – The ball has finally dropped on the big Apple. The ball (metaphorically speaking) — an antitrust lawsuit filed in the U.S. on March 21 by the Department of Justice (DOJ) — came down following... Read more
New 13-inch M3 MacBook Air on sale for $999,...
Amazon has Apple’s new 13″ M3 MacBook Air on sale for $100 off MSRP for the first time, now just $999 shipped. Shipping is free: – 13″ MacBook Air (8GB RAM/256GB SSD/Space Gray): $999 $100 off MSRP... Read more
Amazon has Apple’s 9th-generation WiFi iPads...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Discounted 14-inch M3 MacBook Pros with 16GB...
Apple retailer Expercom has 14″ MacBook Pros with M3 CPUs and 16GB of standard memory discounted by up to $120 off Apple’s MSRP: – 14″ M3 MacBook Pro (16GB RAM/256GB SSD): $1691.06 $108 off MSRP – 14... Read more
Clearance 15-inch M2 MacBook Airs on sale for...
B&H Photo has Apple’s 15″ MacBook Airs with M2 CPUs (8GB RAM/256GB SSD) in stock today and on clearance sale for $999 in all four colors. Free 1-2 delivery is available to most US addresses.... Read more
Clearance 13-inch M1 MacBook Airs drop to onl...
B&H has Apple’s base 13″ M1 MacBook Air (Space Gray, Silver, & Gold) in stock and on clearance sale today for $300 off MSRP, only $699. Free 1-2 day shipping is available to most addresses in... Read more

Jobs Board

Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Business Analyst | *Apple* Pay - Banco Popu...
Business Analyst | Apple PayApply now " Apply now + Apply Now + Start applying with LinkedIn Start + Please wait Date:Mar 19, 2024 Location: San Juan-Cupey, PR Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.