19
Porting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99

Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Porting to the Carbon API

for Macintosh DevelopersJonathan HoyleEastman Kodak

5/20/99

Page 2: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Mac OS 8.6today

Sonata Fall ‘99

Early ‘00

OS Release TimeLine

MacOS X DR/1

MacOS X DR/2

Page 3: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Mac OS X Architecture

Classic(formerly Blue Box)

Cocoa(formerly

Yellow Box)Java

Common Services

Core OS

Carbon

Page 4: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Mac OS 8.x Architecture

Classic App

Carbon Lib

MacOS 8.x

Carbon App

Page 5: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Carbon Delivery◆  Built into MacOS X◆  Built into Sonata◆  CarbonLib shared library for MacOS 8.1+◆  PowerPC only◆  Carbon apps will look like any Classic app

on MacOS 8.x◆  “Lite CarbonLib” available now◆  CodeWarrior 5 supports Carbon (June ‘99)

Page 6: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

WWDC ‘99 ToolsMacOS X DR/1◆  Carbon SDK ◆  LiteCarbonLib◆  Sample code & utilities

CW for MacOS X & Carbon◆  CW 4->4.1 Updater◆  Carbonated PP & MSL◆  CFM & Mach-O Carbon compilers◆  samples & other goodies

Page 7: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Carbon Technical Issues◆  Carbon apps use new exe format◆  Two flavors of apps: CFM and Mach-O◆  PowerPlant apps must use Carbonized PP◆  Carbon apps can assume 8.1 as baseline◆  Carbon apps still must check OS version

for later calls. (For example, CarbonLib on 8.1 doesn’t support new 8.5 calls.)

◆  Carbon apps can print to Classic drivers

Page 8: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Carbon Technical Issues

All Carbon apps have access to:◆ Everything in 8.1◆ Navigation Services◆ CoreFoundation “classes”:

CFString, CFBoolean, CFArray, CFSet,CFPreferences, CFPlugin, etc.

◆ Carbon Events

Page 9: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Classic Applications◆  No longer inside a “box”◆  Receive little benefit from MacOS X◆  Not preemptive, share same memory◆  All 68K apps are classic◆  Apps compiled in the older binary format

are classic, even if the source code is Carbon compliant.

◆  A “fat” format (if any) is TBD.

Page 10: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

What About Cocoa?◆  Mac OS X only◆  Not available for Sonata◆  No CocoaLib for MacOS 8.x◆  No longer committing to Windows support◆  OpenStep API◆  No CFM, Mach-O executable type only◆  Requires Objective C or Java

Page 11: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Carbon API’s

8200 Mac ToolBox Calls

Carbon:3/4 of the ToolBox

A typical app uses > 90% Carbon API’s

Page 12: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Gone for Carbon◆  Standard File (use Nav Services)

◆  Appletalk (exists only at the Core OS)

◆  QuickDraw GX◆  QuickDraw 3D (use OpenGL)

◆  Balloon Help (use new Carbon Help)

◆  MFS File System, Working Directories◆  Edition Manager, themes, sundry others◆  Low Memory, Segment Loader, 68K-isms

Page 13: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Support in Carbon◆  Common Managers: QuickDraw, Window, etc.

◆  Apple Events◆  Open Transport◆  Printing API (modified)

◆  Game Sprockets◆  Dictionary Manager (partially supported)

◆  SCSI Manager (partially supported)

◆  Other HW: Use Dev Mgr on 8.x, IOKit for Mac OS X

Page 14: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Not Available in DR/1◆  QuickTime◆  Sound Manager◆  Speech Manager◆  Display Manager◆  AppleScript◆  ColorSync◆  TextServices Manager◆  Text Encoding

Page 15: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Steps in Porting◆  Carbon Overview video from WWDC ‘99◆  Use CarbonDater on current PPC app◆  Use Carbonized Universal Headers◆  #define TARGET_CARBON 1◆  Link with CarbonLib◆  Make sure all other lib’s are Carbonized◆  Replace Low Memory accesses ◆  Handle Opaque Data Structures

Page 16: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

What structs are opaque?◆  WindowRecords, DialogRecords, etc.◆  Menus◆  Controls◆  Ports◆  Regions◆  Lists◆  See Table 2-2 in Carbon Porting Guide

Page 17: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Opaque Data StructuresIn MacOS 8, Regions are transparent:

short getLeftCorner(RgnHandle inRgnHdl){

return (**inRgnHdl).rgnBBox.left;}

In MacOS X, Regions are opaque:short getLeftCorner(RgnHandle inRgnHdl){

Rect rgnRect;GetRegionBounds(inRgnHdl, &rgnRect);return rgnRect.left;

}

Page 18: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

Opaque Data StructuresIn MacOS 8, GrafPtr = WindowPtr = DialogPtr:

void DrawLine(WindowPtr inWindowPtr){

SetPort(inWindowPtr);LineTo(100, 100);

}

In MacOS X, you must use accessors:void DrawLine(WindowPtr inWindowPtr){

GrafPtr theGrafPtr = GetWindowPort(inWindowPtr);SetPort(theGrafPtr);LineTo(100, 100);

}

Page 19: Porting to the Carbon APIPorting to the Carbon API for Macintosh Developers Jonathan Hoyle Eastman Kodak 5/20/99 Mac OS 8.6 today Sonata Fall ‘99 Early ‘00 OS Release TimeLine

XQ & A