← All posts tagged macOS

Mac macOS программы под старые маки были вот такими:

{$X-, $0-} {turn off Lisa libraries}
{ The OSES clause brings in the units containing the Pascal interfaces. }
OSES {$0 Obj/MemTypes } MemTypes, {basic Memory Manager data types}
{$0 Obj/QuickDraw} QuickDraw, {interface to QuickDraw}
{$0 Obj/OSIntf } OSIntf, {interface to the Operating System}
{$0 Obj/Toollntf } Toollntf; {interface to the Toolbox}
CONST applelD = 128 {resource IDs/menu IDs for Apple, File, and Edit menus}
filelD = 129
editID = 130
appleM =1 ; {index for each menu in myMenus (array of menu handles)}
fileM = 2;
editM = 3;
menuCount = 3; {total number of menus}
windowID = 128; {resource ID for application's window}
undoCommand '= 1 {menu item numbers identifying commands in Edit menu}
cutCommand = 3
copyCommand = 4
pasteCommand = 5
clearCommand = 6
VAR myMenus: ARRAY[1..menuCpunt] OF MenuHandle; {array of handles to the menus}

{ Read menu descriptions from resource file into memory and store handles }
{ in myMenus array }
myMenus[appleM] := GetMenu(applelD) , {read Apple menu from resource file}
AddResMenu(myMenus[appleM],'DRVR'); {add desk accessory names to Apple menu}
myMenus[fileM] := GetMenu(filelD); {read File menu from resource file}
myMenus[editM] := GetMenu(editID); {read Edit menu from resource file}
FOR i:=l TO menuCount DO InsertMenu(myMenus[i],0); {install menus in menu bar }
DrawMenuBar; { and draw menu bar}
END; {of SetOpMenus}
ROCEDURE DoCommand (mResult: LONGINT); Execute command specified by mResult, the result of MenuSelect }
VAR theltem: INTEGER; {menu item number from mResult low-order word}
theMenu: INTEGER; {menu number from mResult high-order word}
name: Str255; {desk accessory name}
temp: INTEGER;
theltem := LoWord(mResult); {call Toolbox Utility routines to set }
theMenu := HiWord(mResult); { menu item number and menu number}
CASE theMenu OF {case on menu ID}
BEGIN {call Menu Manager to get desk accessory }
Getltem(myMenus[appleM],theltem,name) . { name, and call Desk Manager to open }
temp := OpenDeskAcc(name); { accessory (OpenDeskAcc result not used)
SetPort(myWindow); {call QuickDraw to restore application }
END; {of applelD} { window as grafPort to draw in (may have

да, паскакаль..