Repository navigation
Apple Event descriptor identities, byte order and guest handler delivery - #46
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Starts section 4 of the BlueBox requirements: Apple Event descriptors and handler invocation that a Classic guest can use.
Descriptor byte order
Descriptor.fromBigEndian()/toBigEndian()(andconverted(from:to:layouts:)) reverse the scalar fields of known types through lists, records, parameters and attributes, so a host needs no rule for individual events or attributes.QDpt/qdrt/cRGB, UTF-16 text, and the numeric headers of FSSpecs and alias handles are converted.ScalarLayouts.Descriptor identities
DescriptorTableholds descriptors behind aDescriptorID(slot and generation).AEDisposeDescof a borrowed descriptor reports noErr and leaves it, and only the lender ends the loan.removeAll()invalidates every identity, for cleanup at quit.Guest handler delivery
Entry(eventClass:eventID:isSystem:guestProcedure:referenceConstant:)installs a guest handler as an opaque UPP and refcon.beginDeliverylends the event and reply from a table and returns either.invoke(Invocation)(procedure, refcon, borrowed IDs, depth) or.finished(Outcome).complete(_:result:)takes the guest's signed OSErr.keyErrorNumberunless the handler set one.abandonends a delivery and every one inside it, for guest faults and instruction limits.Behaviour changes
dispatchandsendCoreEventconsider only host handlers; guest handlers run throughbeginDelivery.Not in this PR
The launch-event lifecycle through
EventAvail/GetNextEvent/WaitNextEvent, and checking the other special event masks.Tests
New suites:
DescriptorByteOrderTests,DescriptorTableTestsandAppleEventDeliveryTests. The full suite passes.