Adding an interface to the high-level Open Scripting Architecture,
by request of Donovan Preston. In return, he promised to use this to create a Python OSA component, which would turn Python into a first-class OSA scripting language (like AppleScript itself).
This commit is contained in:
parent
8850c8785f
commit
fe3fe4adb5
|
@ -0,0 +1,129 @@
|
||||||
|
# Generated from 'OSA.h'
|
||||||
|
|
||||||
|
def FOUR_CHAR_CODE(x): return x
|
||||||
|
from Carbon.AppleEvents import *
|
||||||
|
kAEUseStandardDispatch = -1
|
||||||
|
kOSAComponentType = FOUR_CHAR_CODE('osa ')
|
||||||
|
kOSAGenericScriptingComponentSubtype = FOUR_CHAR_CODE('scpt')
|
||||||
|
kOSAFileType = FOUR_CHAR_CODE('osas')
|
||||||
|
kOSASuite = FOUR_CHAR_CODE('ascr')
|
||||||
|
kOSARecordedText = FOUR_CHAR_CODE('recd')
|
||||||
|
kOSAScriptIsModified = FOUR_CHAR_CODE('modi')
|
||||||
|
kOSAScriptIsTypeCompiledScript = FOUR_CHAR_CODE('cscr')
|
||||||
|
kOSAScriptIsTypeScriptValue = FOUR_CHAR_CODE('valu')
|
||||||
|
kOSAScriptIsTypeScriptContext = FOUR_CHAR_CODE('cntx')
|
||||||
|
kOSAScriptBestType = FOUR_CHAR_CODE('best')
|
||||||
|
kOSACanGetSource = FOUR_CHAR_CODE('gsrc')
|
||||||
|
typeOSADialectInfo = FOUR_CHAR_CODE('difo')
|
||||||
|
keyOSADialectName = FOUR_CHAR_CODE('dnam')
|
||||||
|
keyOSADialectCode = FOUR_CHAR_CODE('dcod')
|
||||||
|
keyOSADialectLangCode = FOUR_CHAR_CODE('dlcd')
|
||||||
|
keyOSADialectScriptCode = FOUR_CHAR_CODE('dscd')
|
||||||
|
kOSANullScript = 0L
|
||||||
|
kOSANullMode = 0
|
||||||
|
kOSAModeNull = 0
|
||||||
|
kOSASupportsCompiling = 0x0002
|
||||||
|
kOSASupportsGetSource = 0x0004
|
||||||
|
kOSASupportsAECoercion = 0x0008
|
||||||
|
kOSASupportsAESending = 0x0010
|
||||||
|
kOSASupportsRecording = 0x0020
|
||||||
|
kOSASupportsConvenience = 0x0040
|
||||||
|
kOSASupportsDialects = 0x0080
|
||||||
|
kOSASupportsEventHandling = 0x0100
|
||||||
|
kOSASelectLoad = 0x0001
|
||||||
|
kOSASelectStore = 0x0002
|
||||||
|
kOSASelectExecute = 0x0003
|
||||||
|
kOSASelectDisplay = 0x0004
|
||||||
|
kOSASelectScriptError = 0x0005
|
||||||
|
kOSASelectDispose = 0x0006
|
||||||
|
kOSASelectSetScriptInfo = 0x0007
|
||||||
|
kOSASelectGetScriptInfo = 0x0008
|
||||||
|
kOSASelectSetActiveProc = 0x0009
|
||||||
|
kOSASelectGetActiveProc = 0x000A
|
||||||
|
kOSASelectScriptingComponentName = 0x0102
|
||||||
|
kOSASelectCompile = 0x0103
|
||||||
|
kOSASelectCopyID = 0x0104
|
||||||
|
kOSASelectCopyScript = 0x0105
|
||||||
|
kOSASelectGetSource = 0x0201
|
||||||
|
kOSASelectCoerceFromDesc = 0x0301
|
||||||
|
kOSASelectCoerceToDesc = 0x0302
|
||||||
|
kOSASelectSetSendProc = 0x0401
|
||||||
|
kOSASelectGetSendProc = 0x0402
|
||||||
|
kOSASelectSetCreateProc = 0x0403
|
||||||
|
kOSASelectGetCreateProc = 0x0404
|
||||||
|
kOSASelectSetDefaultTarget = 0x0405
|
||||||
|
kOSASelectStartRecording = 0x0501
|
||||||
|
kOSASelectStopRecording = 0x0502
|
||||||
|
kOSASelectLoadExecute = 0x0601
|
||||||
|
kOSASelectCompileExecute = 0x0602
|
||||||
|
kOSASelectDoScript = 0x0603
|
||||||
|
kOSASelectSetCurrentDialect = 0x0701
|
||||||
|
kOSASelectGetCurrentDialect = 0x0702
|
||||||
|
kOSASelectAvailableDialects = 0x0703
|
||||||
|
kOSASelectGetDialectInfo = 0x0704
|
||||||
|
kOSASelectAvailableDialectCodeList = 0x0705
|
||||||
|
kOSASelectSetResumeDispatchProc = 0x0801
|
||||||
|
kOSASelectGetResumeDispatchProc = 0x0802
|
||||||
|
kOSASelectExecuteEvent = 0x0803
|
||||||
|
kOSASelectDoEvent = 0x0804
|
||||||
|
kOSASelectMakeContext = 0x0805
|
||||||
|
kOSADebuggerCreateSession = 0x0901
|
||||||
|
kOSADebuggerGetSessionState = 0x0902
|
||||||
|
kOSADebuggerSessionStep = 0x0903
|
||||||
|
kOSADebuggerDisposeSession = 0x0904
|
||||||
|
kOSADebuggerGetStatementRanges = 0x0905
|
||||||
|
kOSADebuggerGetBreakpoint = 0x0910
|
||||||
|
kOSADebuggerSetBreakpoint = 0x0911
|
||||||
|
kOSADebuggerGetDefaultBreakpoint = 0x0912
|
||||||
|
kOSADebuggerGetCurrentCallFrame = 0x0906
|
||||||
|
kOSADebuggerGetCallFrameState = 0x0907
|
||||||
|
kOSADebuggerGetVariable = 0x0908
|
||||||
|
kOSADebuggerSetVariable = 0x0909
|
||||||
|
kOSADebuggerGetPreviousCallFrame = 0x090A
|
||||||
|
kOSADebuggerDisposeCallFrame = 0x090B
|
||||||
|
kOSASelectComponentSpecificStart = 0x1001
|
||||||
|
kOSAModePreventGetSource = 0x00000001
|
||||||
|
kOSAModeNeverInteract = kAENeverInteract
|
||||||
|
kOSAModeCanInteract = kAECanInteract
|
||||||
|
kOSAModeAlwaysInteract = kAEAlwaysInteract
|
||||||
|
kOSAModeDontReconnect = kAEDontReconnect
|
||||||
|
kOSAModeCantSwitchLayer = 0x00000040
|
||||||
|
kOSAModeDoRecord = 0x00001000
|
||||||
|
kOSAModeCompileIntoContext = 0x00000002
|
||||||
|
kOSAModeAugmentContext = 0x00000004
|
||||||
|
kOSAModeDisplayForHumans = 0x00000008
|
||||||
|
kOSAModeDontStoreParent = 0x00010000
|
||||||
|
kOSAModeDispatchToDirectObject = 0x00020000
|
||||||
|
kOSAModeDontGetDataForArguments = 0x00040000
|
||||||
|
kOSAScriptResourceType = kOSAGenericScriptingComponentSubtype
|
||||||
|
typeOSAGenericStorage = kOSAScriptResourceType
|
||||||
|
kOSAErrorNumber = keyErrorNumber
|
||||||
|
kOSAErrorMessage = keyErrorString
|
||||||
|
kOSAErrorBriefMessage = FOUR_CHAR_CODE('errb')
|
||||||
|
kOSAErrorApp = FOUR_CHAR_CODE('erap')
|
||||||
|
kOSAErrorPartialResult = FOUR_CHAR_CODE('ptlr')
|
||||||
|
kOSAErrorOffendingObject = FOUR_CHAR_CODE('erob')
|
||||||
|
kOSAErrorExpectedType = FOUR_CHAR_CODE('errt')
|
||||||
|
kOSAErrorRange = FOUR_CHAR_CODE('erng')
|
||||||
|
typeOSAErrorRange = FOUR_CHAR_CODE('erng')
|
||||||
|
keyOSASourceStart = FOUR_CHAR_CODE('srcs')
|
||||||
|
keyOSASourceEnd = FOUR_CHAR_CODE('srce')
|
||||||
|
kOSAUseStandardDispatch = kAEUseStandardDispatch
|
||||||
|
kOSANoDispatch = kAENoDispatch
|
||||||
|
kOSADontUsePhac = 0x0001
|
||||||
|
eNotStarted = 0
|
||||||
|
eRunnable = 1
|
||||||
|
eRunning = 2
|
||||||
|
eStopped = 3
|
||||||
|
eTerminated = 4
|
||||||
|
eStepOver = 0
|
||||||
|
eStepIn = 1
|
||||||
|
eStepOut = 2
|
||||||
|
eRun = 3
|
||||||
|
keyProgramState = FOUR_CHAR_CODE('dsps')
|
||||||
|
typeStatementRange = FOUR_CHAR_CODE('srng')
|
||||||
|
keyProcedureName = FOUR_CHAR_CODE('dfnm')
|
||||||
|
keyStatementRange = FOUR_CHAR_CODE('dfsr')
|
||||||
|
keyLocalsNames = FOUR_CHAR_CODE('dfln')
|
||||||
|
keyGlobalsNames = FOUR_CHAR_CODE('dfgn')
|
||||||
|
keyParamsNames = FOUR_CHAR_CODE('dfpn')
|
|
@ -51,6 +51,7 @@ kLeadingEdge = -1
|
||||||
kTrailingEdge = 0
|
kTrailingEdge = 0
|
||||||
kObjectEdge = 2
|
kObjectEdge = 2
|
||||||
weFAutoScroll = 0
|
weFAutoScroll = 0
|
||||||
|
weFAutoIdle = 1
|
||||||
weFOutlineHilite = 2
|
weFOutlineHilite = 2
|
||||||
weFReadOnly = 5
|
weFReadOnly = 5
|
||||||
weFUndo = 6
|
weFUndo = 6
|
||||||
|
@ -62,10 +63,13 @@ weFDrawOffscreen = 11
|
||||||
weFInhibitRedraw = 12
|
weFInhibitRedraw = 12
|
||||||
weFMonoStyled = 13
|
weFMonoStyled = 13
|
||||||
weFMultipleUndo = 14
|
weFMultipleUndo = 14
|
||||||
|
weFLeftMarginClick = 16
|
||||||
|
weFNoAutoTabForHangingIndent = 28
|
||||||
weFNoKeyboardSync = 29
|
weFNoKeyboardSync = 29
|
||||||
weFInhibitICSupport = 30
|
weFInhibitICSupport = 30
|
||||||
weFInhibitColor = 31
|
weFInhibitColor = 31
|
||||||
# weDoAutoScroll = 1UL << weFAutoScroll
|
# weDoAutoScroll = 1UL << weFAutoScroll
|
||||||
|
weDoAutoIdle = 1UL << weFAutoIdle
|
||||||
# weDoOutlineHilite = 1UL << weFOutlineHilite
|
# weDoOutlineHilite = 1UL << weFOutlineHilite
|
||||||
# weDoReadOnly = 1UL << weFReadOnly
|
# weDoReadOnly = 1UL << weFReadOnly
|
||||||
# weDoUndo = 1UL << weFUndo
|
# weDoUndo = 1UL << weFUndo
|
||||||
|
@ -77,6 +81,8 @@ weFInhibitColor = 31
|
||||||
# weDoInhibitRedraw = 1UL << weFInhibitRedraw
|
# weDoInhibitRedraw = 1UL << weFInhibitRedraw
|
||||||
# weDoMonoStyled = 1UL << weFMonoStyled
|
# weDoMonoStyled = 1UL << weFMonoStyled
|
||||||
# weDoMultipleUndo = 1UL << weFMultipleUndo
|
# weDoMultipleUndo = 1UL << weFMultipleUndo
|
||||||
|
weDoLeftMarginClick = 1UL << weFLeftMarginClick
|
||||||
|
weDoNoAutoTabForHangingIndent = 1UL << weFNoAutoTabForHangingIndent
|
||||||
# weDoNoKeyboardSync = 1UL << weFNoKeyboardSync
|
# weDoNoKeyboardSync = 1UL << weFNoKeyboardSync
|
||||||
# weDoInhibitICSupport = 1UL << weFInhibitICSupport
|
# weDoInhibitICSupport = 1UL << weFInhibitICSupport
|
||||||
# weDoInhibitColor = 1UL << weFInhibitColor
|
# weDoInhibitColor = 1UL << weFInhibitColor
|
||||||
|
@ -86,6 +92,9 @@ weBitClear = 0
|
||||||
weBitSet = 1
|
weBitSet = 1
|
||||||
weLowerCase = 0
|
weLowerCase = 0
|
||||||
weUpperCase = 1
|
weUpperCase = 1
|
||||||
|
weRedWigglyUnderline = 29303
|
||||||
|
weGreenWigglyUnderline = 26487
|
||||||
|
weOrangeWigglyUnderline = 28535
|
||||||
weFindWholeWords = 0x00000001
|
weFindWholeWords = 0x00000001
|
||||||
weFindCaseInsensitive = 0x00000002
|
weFindCaseInsensitive = 0x00000002
|
||||||
weFindDiacriticalInsensitive = 0x00000004
|
weFindDiacriticalInsensitive = 0x00000004
|
||||||
|
@ -94,8 +103,13 @@ wePutAddToTypingSequence = 0x00000002
|
||||||
wePutDetectUnicodeBOM = 0x00000200
|
wePutDetectUnicodeBOM = 0x00000200
|
||||||
weStreamDestinationKindMask = 0x000000FF
|
weStreamDestinationKindMask = 0x000000FF
|
||||||
weStreamIncludeObjects = 0x00000100
|
weStreamIncludeObjects = 0x00000100
|
||||||
|
weCopyPromiseFlavors = 0x00000001
|
||||||
weGetAddUnicodeBOM = 0x00000200
|
weGetAddUnicodeBOM = 0x00000200
|
||||||
weGetLittleEndian = 0x00000400
|
weGetLittleEndian = 0x00000400
|
||||||
|
weSaveAddResources = 0x00000001
|
||||||
|
weSaveCompatibilityResources = 0x00000002
|
||||||
|
weSaveLittleEndian = 0x00000004
|
||||||
|
kWASTECreator = FOUR_CHAR_CODE('OEDE')
|
||||||
weTagFontFamily = FOUR_CHAR_CODE('font')
|
weTagFontFamily = FOUR_CHAR_CODE('font')
|
||||||
weTagFontSize = FOUR_CHAR_CODE('ptsz')
|
weTagFontSize = FOUR_CHAR_CODE('ptsz')
|
||||||
weTagPlain = FOUR_CHAR_CODE('plan')
|
weTagPlain = FOUR_CHAR_CODE('plan')
|
||||||
|
@ -107,10 +121,19 @@ weTagShadow = FOUR_CHAR_CODE('shad')
|
||||||
weTagCondensed = FOUR_CHAR_CODE('cond')
|
weTagCondensed = FOUR_CHAR_CODE('cond')
|
||||||
weTagExtended = FOUR_CHAR_CODE('pexp')
|
weTagExtended = FOUR_CHAR_CODE('pexp')
|
||||||
weTagStrikethrough = FOUR_CHAR_CODE('strk')
|
weTagStrikethrough = FOUR_CHAR_CODE('strk')
|
||||||
|
weTagHidden = FOUR_CHAR_CODE('hidn')
|
||||||
|
weTagAllCaps = FOUR_CHAR_CODE('alcp')
|
||||||
|
weTagAllLowercase = FOUR_CHAR_CODE('lowc')
|
||||||
weTagTextColor = FOUR_CHAR_CODE('colr')
|
weTagTextColor = FOUR_CHAR_CODE('colr')
|
||||||
weTagBackgroundColor = FOUR_CHAR_CODE('pbcl')
|
weTagBackgroundColor = FOUR_CHAR_CODE('pbcl')
|
||||||
weTagTransferMode = FOUR_CHAR_CODE('pptm')
|
weTagTransferMode = FOUR_CHAR_CODE('pptm')
|
||||||
weTagVerticalShift = FOUR_CHAR_CODE('xshf')
|
weTagVerticalShift = FOUR_CHAR_CODE('xshf')
|
||||||
|
weTagLanguage = FOUR_CHAR_CODE('lang')
|
||||||
|
weTagUnderlineStyle = FOUR_CHAR_CODE('unds')
|
||||||
|
weTagSmallCaps = FOUR_CHAR_CODE('smcp')
|
||||||
|
weTagDoubleStrikethrough = FOUR_CHAR_CODE('dstr')
|
||||||
|
weTagEmbossed = FOUR_CHAR_CODE('embo')
|
||||||
|
weTagEngraved = FOUR_CHAR_CODE('engr')
|
||||||
weTagAlignment = FOUR_CHAR_CODE('pjst')
|
weTagAlignment = FOUR_CHAR_CODE('pjst')
|
||||||
weTagDirection = FOUR_CHAR_CODE('LDIR')
|
weTagDirection = FOUR_CHAR_CODE('LDIR')
|
||||||
weTagLineSpacing = FOUR_CHAR_CODE('ledg')
|
weTagLineSpacing = FOUR_CHAR_CODE('ledg')
|
||||||
|
@ -119,28 +142,66 @@ weTagRightIndent = FOUR_CHAR_CODE('riin')
|
||||||
weTagFirstLineIndent = FOUR_CHAR_CODE('fidt')
|
weTagFirstLineIndent = FOUR_CHAR_CODE('fidt')
|
||||||
weTagSpaceBefore = FOUR_CHAR_CODE('spbe')
|
weTagSpaceBefore = FOUR_CHAR_CODE('spbe')
|
||||||
weTagSpaceAfter = FOUR_CHAR_CODE('spaf')
|
weTagSpaceAfter = FOUR_CHAR_CODE('spaf')
|
||||||
|
weTagTabList = FOUR_CHAR_CODE('tabs')
|
||||||
weTagBottomBorderStyle = FOUR_CHAR_CODE('BBRD')
|
weTagBottomBorderStyle = FOUR_CHAR_CODE('BBRD')
|
||||||
|
weTagKeepTogether = FOUR_CHAR_CODE('keep')
|
||||||
|
weTagKeepWithNext = FOUR_CHAR_CODE('kepn')
|
||||||
|
weTagPageBreakBefore = FOUR_CHAR_CODE('pbrb')
|
||||||
|
weTagWidowOrphanOverride = FOUR_CHAR_CODE('wdov')
|
||||||
|
weTagWidowOrphanControl = FOUR_CHAR_CODE('wido')
|
||||||
|
weTagNoLineNumbering = FOUR_CHAR_CODE('!ln#')
|
||||||
|
weTagNoHyphenation = FOUR_CHAR_CODE('!hyp')
|
||||||
|
weTagParagraphUserData = FOUR_CHAR_CODE('pusr')
|
||||||
weTagForceFontFamily = FOUR_CHAR_CODE('ffnt')
|
weTagForceFontFamily = FOUR_CHAR_CODE('ffnt')
|
||||||
weTagAddFontSize = FOUR_CHAR_CODE('+siz')
|
weTagAddFontSize = FOUR_CHAR_CODE('+siz')
|
||||||
weTagAddVerticalShift = FOUR_CHAR_CODE('+shf')
|
weTagAddVerticalShift = FOUR_CHAR_CODE('+shf')
|
||||||
|
weTagAddLeftIndent = FOUR_CHAR_CODE('+lei')
|
||||||
|
weTagAddRightIndent = FOUR_CHAR_CODE('+rii')
|
||||||
|
weTagAddFirstLineIndent = FOUR_CHAR_CODE('+fid')
|
||||||
|
weTagAddSpaceBefore = FOUR_CHAR_CODE('+spb')
|
||||||
|
weTagAddSpaceAfter = FOUR_CHAR_CODE('+spa')
|
||||||
|
weTagAddLineSpacing = FOUR_CHAR_CODE('+led')
|
||||||
weTagTextEncoding = FOUR_CHAR_CODE('ptxe')
|
weTagTextEncoding = FOUR_CHAR_CODE('ptxe')
|
||||||
weTagQDStyles = FOUR_CHAR_CODE('qdst')
|
weTagQDStyles = FOUR_CHAR_CODE('qdst')
|
||||||
weTagTETextStyle = FOUR_CHAR_CODE('tets')
|
weTagTETextStyle = FOUR_CHAR_CODE('tets')
|
||||||
|
weTagRunDirection = FOUR_CHAR_CODE('rdir')
|
||||||
|
weTagUnderlineDefault = FOUR_CHAR_CODE('deft')
|
||||||
|
weTagUnderlineWord = FOUR_CHAR_CODE('word')
|
||||||
|
weTagUnderlineDouble = FOUR_CHAR_CODE('dubl')
|
||||||
|
weTagUnderlineThick = FOUR_CHAR_CODE('thck')
|
||||||
|
weTagUnderlineDash = FOUR_CHAR_CODE('- ')
|
||||||
|
weTagUnderlineDot = FOUR_CHAR_CODE('. ')
|
||||||
|
weTagUnderlineDotDash = FOUR_CHAR_CODE('.- ')
|
||||||
|
weTagUnderlineDotDotDash = FOUR_CHAR_CODE('..- ')
|
||||||
|
weTagUnderlineWave = FOUR_CHAR_CODE('wave')
|
||||||
weTagAlignmentDefault = FOUR_CHAR_CODE('deft')
|
weTagAlignmentDefault = FOUR_CHAR_CODE('deft')
|
||||||
weTagAlignmentLeft = FOUR_CHAR_CODE('left')
|
weTagAlignmentLeft = FOUR_CHAR_CODE('left')
|
||||||
weTagAlignmentCenter = FOUR_CHAR_CODE('cent')
|
weTagAlignmentCenter = FOUR_CHAR_CODE('cent')
|
||||||
weTagAlignmentRight = FOUR_CHAR_CODE('rght')
|
weTagAlignmentRight = FOUR_CHAR_CODE('rght')
|
||||||
weTagAlignmentFull = FOUR_CHAR_CODE('full')
|
weTagAlignmentFull = FOUR_CHAR_CODE('full')
|
||||||
|
weTagAlignmentDecimal = FOUR_CHAR_CODE('decm')
|
||||||
weTagDirectionDefault = FOUR_CHAR_CODE('deft')
|
weTagDirectionDefault = FOUR_CHAR_CODE('deft')
|
||||||
weTagDirectionLeftToRight = FOUR_CHAR_CODE('L->R')
|
weTagDirectionLeftToRight = FOUR_CHAR_CODE('L->R')
|
||||||
weTagDirectionRightToLeft = FOUR_CHAR_CODE('R->L')
|
weTagDirectionRightToLeft = FOUR_CHAR_CODE('R->L')
|
||||||
|
weTagLeaderNone = FOUR_CHAR_CODE('NONE')
|
||||||
|
weTagLeaderDots = FOUR_CHAR_CODE('DOTS')
|
||||||
|
weTagLeaderHyphens = FOUR_CHAR_CODE('HYPH')
|
||||||
|
weTagLeaderUnderline = FOUR_CHAR_CODE('UNDL')
|
||||||
|
weTagLeaderThickLine = FOUR_CHAR_CODE('THKL')
|
||||||
|
weTagLeaderEqualSigns = FOUR_CHAR_CODE('= ')
|
||||||
weTagBorderStyleNone = FOUR_CHAR_CODE('NONE')
|
weTagBorderStyleNone = FOUR_CHAR_CODE('NONE')
|
||||||
weTagBorderStyleThin = FOUR_CHAR_CODE('SLDL')
|
weTagBorderStyleThin = FOUR_CHAR_CODE('SLDL')
|
||||||
weTagBorderStyleDotted = FOUR_CHAR_CODE('DTDL')
|
weTagBorderStyleDotted = FOUR_CHAR_CODE('DTDL')
|
||||||
weTagBorderStyleThick = FOUR_CHAR_CODE('THKL')
|
weTagBorderStyleThick = FOUR_CHAR_CODE('THKL')
|
||||||
|
weTagLineSpacingAbsolute = FOUR_CHAR_CODE('abso')
|
||||||
|
weTagLineSpacingAtLeast = FOUR_CHAR_CODE('atle')
|
||||||
|
weTagLineSpacingRelative = FOUR_CHAR_CODE('rele')
|
||||||
weLineSpacingSingle = 0x00000000
|
weLineSpacingSingle = 0x00000000
|
||||||
weLineSpacingOneAndHalf = 0x00008000
|
weLineSpacingOneAndHalf = 0x00008000
|
||||||
weLineSpacingDouble = 0x00010000
|
weLineSpacingDouble = 0x00010000
|
||||||
|
weAutoScrollDelay = FOUR_CHAR_CODE('ausd')
|
||||||
|
weBusyProc = FOUR_CHAR_CODE('busy')
|
||||||
|
weBusyInterval = FOUR_CHAR_CODE('bzin')
|
||||||
weCharByteHook = FOUR_CHAR_CODE('cbyt')
|
weCharByteHook = FOUR_CHAR_CODE('cbyt')
|
||||||
weCharToPixelHook = FOUR_CHAR_CODE('c2p ')
|
weCharToPixelHook = FOUR_CHAR_CODE('c2p ')
|
||||||
weCharTypeHook = FOUR_CHAR_CODE('ctyp')
|
weCharTypeHook = FOUR_CHAR_CODE('ctyp')
|
||||||
|
@ -165,6 +226,7 @@ weTranslucencyThreshold = FOUR_CHAR_CODE('tluc')
|
||||||
weTSMDocumentID = FOUR_CHAR_CODE('tsmd')
|
weTSMDocumentID = FOUR_CHAR_CODE('tsmd')
|
||||||
weTSMPreUpdate = FOUR_CHAR_CODE('pre ')
|
weTSMPreUpdate = FOUR_CHAR_CODE('pre ')
|
||||||
weTSMPostUpdate = FOUR_CHAR_CODE('post')
|
weTSMPostUpdate = FOUR_CHAR_CODE('post')
|
||||||
|
weUndoProc = FOUR_CHAR_CODE('undo')
|
||||||
weURLHint = FOUR_CHAR_CODE('urlh')
|
weURLHint = FOUR_CHAR_CODE('urlh')
|
||||||
weWordBreakHook = FOUR_CHAR_CODE('wbrk')
|
weWordBreakHook = FOUR_CHAR_CODE('wbrk')
|
||||||
weNewHandler = FOUR_CHAR_CODE('new ')
|
weNewHandler = FOUR_CHAR_CODE('new ')
|
||||||
|
@ -184,6 +246,8 @@ kTypeStyleScrap = FOUR_CHAR_CODE('WEst')
|
||||||
kTypeUnicodeText = FOUR_CHAR_CODE('utxt')
|
kTypeUnicodeText = FOUR_CHAR_CODE('utxt')
|
||||||
kTypeUTF8Text = FOUR_CHAR_CODE('UTF8')
|
kTypeUTF8Text = FOUR_CHAR_CODE('UTF8')
|
||||||
kTypeStyledText = FOUR_CHAR_CODE('STXT')
|
kTypeStyledText = FOUR_CHAR_CODE('STXT')
|
||||||
|
kTypeRTF = FOUR_CHAR_CODE('RTF ')
|
||||||
|
kTypeRTFD = FOUR_CHAR_CODE('RTFD')
|
||||||
weAKNone = 0
|
weAKNone = 0
|
||||||
weAKUnspecified = 1
|
weAKUnspecified = 1
|
||||||
weAKTyping = 2
|
weAKTyping = 2
|
||||||
|
@ -197,11 +261,30 @@ weAKBackspace = 9
|
||||||
weAKFwdDelete = 10
|
weAKFwdDelete = 10
|
||||||
weAKCaseChange = 11
|
weAKCaseChange = 11
|
||||||
weAKObjectChange = 12
|
weAKObjectChange = 12
|
||||||
|
weUndoNewAction = 0
|
||||||
|
weUndoNewSubAction = 1
|
||||||
|
weUndoBeginSequence = 2
|
||||||
weToScrap = 0
|
weToScrap = 0
|
||||||
weToDrag = 1
|
weToDrag = 1
|
||||||
weToSoup = 2
|
weToSoup = 2
|
||||||
weMouseEnter = 0
|
weMouseEnter = 0
|
||||||
weMouseWithin = 1
|
weMouseWithin = 1
|
||||||
weMouseLeave = 2
|
weMouseLeave = 2
|
||||||
|
weBusyRecalBreaks = 0
|
||||||
|
weCreatorDocumentInfo = FOUR_CHAR_CODE('Info')
|
||||||
|
weTagDocumentTitle = FOUR_CHAR_CODE('Titl')
|
||||||
|
weTagDocumentSubject = FOUR_CHAR_CODE('Subj')
|
||||||
|
weTagDocumentAuthor = FOUR_CHAR_CODE('Auth')
|
||||||
|
weTagDocumentManager = FOUR_CHAR_CODE('Mngr')
|
||||||
|
weTagDocumentCompany = FOUR_CHAR_CODE('Cmpy')
|
||||||
|
weTagDocumentCategory = FOUR_CHAR_CODE('Ctgy')
|
||||||
|
weTagDocumentKeywords = FOUR_CHAR_CODE('Keyw')
|
||||||
|
weTagDocumentComments = FOUR_CHAR_CODE('Cmnt')
|
||||||
|
weTagDocumentOperator = FOUR_CHAR_CODE('Oper')
|
||||||
|
weTagDocumentBaseAddress = FOUR_CHAR_CODE('Hlnk')
|
||||||
|
weTagPageInfo = FOUR_CHAR_CODE('Page')
|
||||||
|
weTagMacPrintRecord = FOUR_CHAR_CODE('PRec')
|
||||||
kCurrentSelection = -1
|
kCurrentSelection = -1
|
||||||
kNullStyle = -2
|
kNullStyle = -2
|
||||||
|
kMaxTabCount = 20
|
||||||
|
kMaxLanguageTagSize = 32
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,61 @@
|
||||||
|
# Scan an Apple header file, generating a Python file of generator calls.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from bgenlocations import TOOLBOXDIR, BGENDIR
|
||||||
|
sys.path.append(BGENDIR)
|
||||||
|
from scantools import Scanner
|
||||||
|
|
||||||
|
LONG = "OSAconst"
|
||||||
|
SHORT = "osa"
|
||||||
|
|
||||||
|
def main():
|
||||||
|
input = "OSA.h"
|
||||||
|
output = SHORT + "gen.py"
|
||||||
|
defsoutput = TOOLBOXDIR + LONG + ".py"
|
||||||
|
scanner = MyScanner(input, output, defsoutput)
|
||||||
|
scanner.scan()
|
||||||
|
scanner.close()
|
||||||
|
scanner.gentypetest(SHORT+"typetest.py")
|
||||||
|
print "=== Testing definitions output code ==="
|
||||||
|
execfile(defsoutput, {}, {})
|
||||||
|
print "=== Done scanning and generating, now importing the generated code... ==="
|
||||||
|
exec "import " + SHORT + "support"
|
||||||
|
print "=== Done. It's up to you to compile it now! ==="
|
||||||
|
|
||||||
|
class MyScanner(Scanner):
|
||||||
|
|
||||||
|
def destination(self, type, name, arglist):
|
||||||
|
classname = "Function"
|
||||||
|
listname = "functions"
|
||||||
|
if arglist:
|
||||||
|
t, n, m = arglist[0]
|
||||||
|
if t == "ComponentInstance" and m == "InMode":
|
||||||
|
classname = "Method"
|
||||||
|
listname = "methods"
|
||||||
|
return classname, listname
|
||||||
|
|
||||||
|
def writeinitialdefs(self):
|
||||||
|
self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
|
||||||
|
self.defsfile.write("from Carbon.AppleEvents import *\n")
|
||||||
|
self.defsfile.write("kAEUseStandardDispatch = -1\n")
|
||||||
|
|
||||||
|
def makeblacklistnames(self):
|
||||||
|
return [
|
||||||
|
"OSACopyScript",
|
||||||
|
]
|
||||||
|
|
||||||
|
def makeblacklisttypes(self):
|
||||||
|
return [
|
||||||
|
"OSACreateAppleEventUPP",
|
||||||
|
"OSAActiveUPP",
|
||||||
|
"AEEventHandlerUPP",
|
||||||
|
"OSASendUPP",
|
||||||
|
]
|
||||||
|
|
||||||
|
def makerepairinstructions(self):
|
||||||
|
return [
|
||||||
|
]
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -0,0 +1,94 @@
|
||||||
|
# This script generates a Python interface for an Apple Macintosh Manager.
|
||||||
|
# It uses the "bgen" package to generate C code.
|
||||||
|
# The function specifications are generated by scanning the mamager's header file,
|
||||||
|
# using the "scantools" package (customized for this particular manager).
|
||||||
|
|
||||||
|
import string
|
||||||
|
|
||||||
|
# Declarations that change for each manager
|
||||||
|
MACHEADERFILE = 'OSA.h' # The Apple header file
|
||||||
|
MODNAME = '_OSA' # The name of the module
|
||||||
|
|
||||||
|
# The following is *usually* unchanged but may still require tuning
|
||||||
|
MODPREFIX = 'OSA' # The prefix for module-wide routines
|
||||||
|
OBJECTPREFIX = 'OSAObj' # The prefix for object methods
|
||||||
|
INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
|
||||||
|
OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
|
||||||
|
|
||||||
|
from macsupport import *
|
||||||
|
|
||||||
|
# Create the type objects
|
||||||
|
|
||||||
|
includestuff = includestuff + """
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
#ifdef USE_TOOLBOX_OBJECT_GLUE
|
||||||
|
extern PyObject *_OSAObj_New(ComponentInstance);
|
||||||
|
extern int _OSAObj_Convert(PyObject *, ComponentInstance *);
|
||||||
|
|
||||||
|
#define OSAObj_New _OSAObj_New
|
||||||
|
#define OSAObj_Convert _OSAObj_Convert
|
||||||
|
#endif
|
||||||
|
"""
|
||||||
|
|
||||||
|
initstuff = initstuff + """
|
||||||
|
/*
|
||||||
|
PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, OSAObj_New);
|
||||||
|
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, OSAObj_Convert);
|
||||||
|
*/
|
||||||
|
"""
|
||||||
|
|
||||||
|
ComponentInstance = OpaqueByValueType('ComponentInstance', OBJECTPREFIX)
|
||||||
|
OSAError = OSErrType("OSAError", "l")
|
||||||
|
OSAID = Type("OSAID", "l")
|
||||||
|
OSADebugCallFrameRef = Type("OSADebugCallFrameRef", "l")
|
||||||
|
OSADebugSessionRef = Type("OSADebugSessionRef", "l")
|
||||||
|
OSADebugStepKind = Type("OSADebugStepKind", "l")
|
||||||
|
DescType = OSTypeType("DescType")
|
||||||
|
AEDesc = OpaqueType('AEDesc')
|
||||||
|
AEDesc_ptr = OpaqueType('AEDesc')
|
||||||
|
AEAddressDesc = OpaqueType('AEAddressDesc', 'AEDesc')
|
||||||
|
AEAddressDesc_ptr = OpaqueType('AEAddressDesc', 'AEDesc')
|
||||||
|
AEDescList = OpaqueType('AEDescList', 'AEDesc')
|
||||||
|
AEDescList_ptr = OpaqueType('AEDescList', 'AEDesc')
|
||||||
|
AERecord = OpaqueType('AERecord', 'AEDesc')
|
||||||
|
AERecord_ptr = OpaqueType('AERecord', 'AEDesc')
|
||||||
|
AppleEvent = OpaqueType('AppleEvent', 'AEDesc')
|
||||||
|
AppleEvent_ptr = OpaqueType('AppleEvent', 'AEDesc')
|
||||||
|
|
||||||
|
# NOTE: at the moment OSA.ComponentInstance is not a subclass
|
||||||
|
# of Cm.ComponentInstance. If this is a problem it can be fixed.
|
||||||
|
class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
|
||||||
|
def outputCheckNewArg(self):
|
||||||
|
Output("""if (itself == NULL) {
|
||||||
|
PyErr_SetString(OSA_Error,"NULL ComponentInstance");
|
||||||
|
return NULL;
|
||||||
|
}""")
|
||||||
|
|
||||||
|
# Create the generator groups and link them
|
||||||
|
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
|
||||||
|
object = MyObjectDefinition('ComponentInstance', OBJECTPREFIX,
|
||||||
|
'ComponentInstance')
|
||||||
|
module.addobject(object)
|
||||||
|
|
||||||
|
# Create the generator classes used to populate the lists
|
||||||
|
Function = OSErrWeakLinkFunctionGenerator
|
||||||
|
Method = OSErrWeakLinkMethodGenerator
|
||||||
|
|
||||||
|
# Test which types we are still missing.
|
||||||
|
execfile(string.lower(MODPREFIX) + 'typetest.py')
|
||||||
|
|
||||||
|
# Create and populate the lists
|
||||||
|
functions = []
|
||||||
|
methods = []
|
||||||
|
execfile(INPUTFILE)
|
||||||
|
|
||||||
|
# add the populated lists to the generator groups
|
||||||
|
# (in a different wordl the scan program would generate this)
|
||||||
|
for f in functions: module.add(f)
|
||||||
|
for f in methods: object.add(f)
|
||||||
|
|
||||||
|
# generate output (open the output file as late as possible)
|
||||||
|
SetOutputFileName(OUTPUTFILE)
|
||||||
|
module.generate()
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -836,6 +836,8 @@ class PyBuildExt(build_ext):
|
||||||
extra_link_args=['-framework', 'Carbon']) )
|
extra_link_args=['-framework', 'Carbon']) )
|
||||||
exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'],
|
exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'],
|
||||||
extra_link_args=['-framework', 'Carbon']) )
|
extra_link_args=['-framework', 'Carbon']) )
|
||||||
|
exts.append( Extension('_OSA', ['osa/_OSAmodule.c'],
|
||||||
|
extra_link_args=['-framework', 'Carbon']) )
|
||||||
exts.append( Extension('_Qd', ['qd/_Qdmodule.c'],
|
exts.append( Extension('_Qd', ['qd/_Qdmodule.c'],
|
||||||
extra_link_args=['-framework', 'Carbon']) )
|
extra_link_args=['-framework', 'Carbon']) )
|
||||||
exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'],
|
exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'],
|
||||||
|
|
Loading…
Reference in New Issue