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

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom 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
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.