Skip to content

Carbon: one Apple Event Manager, CoreServices', for every Mac program - #464

Merged
colemancda merged 6 commits into
masterfrom
feature/carbon-apple-events
Nov 26, 2026
Merged

colemancda merged 6 commits into
masterfrom
feature/carbon-apple-events

Conversation

@colemancda

Copy link
Copy Markdown
Member

Phase 2 of Documentation/Plans/graphite.md, third of three PRs, against master. It removes the last 20 exports Carbon and CoreServices both provided.

Before: Carbon's C (appleevents.c) had its own Apple Event Manager, with its own descriptor storage and handler table, for 32-bit programs. CoreServices' Swift (AppleEvents.swift, AEBuild.swift, AEStream.swift) had a fuller one, but only on x86_64 and arm64. Twenty names were exported by both, and which one a program got depended on the loader's re-export order.

After:

  • CoreServices' Apple Event Manager builds for every Mac architecture: i386, ppc, x86_64 and arm64. Carbon programs bind to it through the loader's re-exports, as with Gestalt in phase 1.
  • Its coercions, text and number conversions and AEPrintDescToHandle use GraphiteAppleEvents (GraphiteAppleEvents: descriptors, coercions and handlers PureSwift/Graphite#14) instead of a copy of their own.
  • Event handlers, AEResumeTheCurrentEvent's dispatcher and object accessors are called through darwinCallable, so ppc programs' callbacks get Darwin's frame.
  • appleevents.c keeps AEProcessAppleEvent. Carbon's event loop sends oapp and quit through perry_apple_event_send_core, CoreServices' entry for it, found with carbon_function as files.c finds _FSPathMakeRef. A quit with no handler still quits.
  • exports.txt: 588 → 568.

That completes phase 2's removal of the 26 duplicates: the 6 file calls went in #462, and these 20.

Checks

  • Built natively on Debian arm64 with Swift 6.4.2: PerryCarbon and PerryUniformTypeIdentifiers, no warnings in the changed files.
  • Scripts/check-carbon-exports.sh libPerryCarbon.so libPerryUniformTypeIdentifiers.so passes for the SwiftPM library and the C-only one: 568 exports, as listed, and none of them exported by CoreServices too.
  • Not run: the i386 and ppc builds of CoreServices' Swift (perry-dev image) and the Carbon fixtures. CI's i386 and ppc jobs build only the C.

@colemancda
colemancda merged commit 912e7e9 into master Nov 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant