home *** CD-ROM | disk | FTP | other *** search
Wrap
/*********** EventConversion: mark events in method imp ***********/ replace "- <b arg1>:<structType><token theStruct><b arg2><w w2>{<scope body>}" with "- <arg1>:(NSEvent *)<theStruct> <arg2><w2>{<body>}" where "<structType>" isOneOf { "(NXEvent)", "(NXEvent *)", "(NXEventPtr)", "(const NXEvent *)", "(const NXEventPtr)", "(NXEvent const *)", "(NXEventPtr const)" } within ("<body>"){ replace "<t theStruct>" with "(TOPS__NSEvent)<theStruct>" } /*********** EventConversion: mark events in method dec ***********/ replace ":<b structType><t theStruct>" with ":(NSEvent *)<theStruct>" where "<structType>" isOneOf { "(NXEvent)", "(NXEvent *)", "(NXEventPtr)", "(const NXEvent *)", "(const NXEventPtr)", "(NXEvent const *)", "(NXEventPtr const)" } /*********** EventConversion: mark method return types ***********/ replace "- <structType><t methodName>" with "- (NSEvent *)<methodName>" where "<structType>" isOneOf { "(NXEvent)", "(NXEvent *)", "(NXEventPtr)", "(const NXEvent *)", "(const NXEventPtr)", "(NXEvent const *)", "(NXEventPtr const)" } /*********** EventConversion: mark events in function imp ***********/ replace "<t fun>(<b arg1><type><t struct><b arg2>)<w w>{<scope body>}" with "<t fun>(<b arg1>NSEvent *<t struct><b arg2>)<w w>{<scope body>}" where "<type>" isOneOf { "NXEvent *", "NXEvent", "NXEventPtr", "const NXEvent *", "const NXEventPtr", "NXEvent const *", "NXEventPtr const" } within ("<body>"){ replace "<struct>" with "(TOPS__NSEvent)<struct>" } /*********** EventConversion: mark events in function dec ***********/ replace "<t function>(<b arg1><structType><t theStruct><b arg2>);" with "<function>(<arg1> NSEvent *<theStruct><arg2>);" where "<structType>" isOneOf { "NXEvent *", "NXEvent", "NXEventPtr", "const NXEvent *", "const NXEventPtr", "NXEvent const *", "NXEventPtr const" } /*********** EventConversion: mark function return types ***********/ replace "<structType><w W1><t function><w W2>(<b argList><w W3>)" with "NSEvent *<function><W2>(<argList><W3>)" where "<structType>" isOneOf { "NXEvent *", "NXEvent", "NXEventPtr", "const NXEvent *", "const NXEventPtr", "NXEvent const *", "NXEventPtr const" } /*********** EventConversion: mark local declarations ***********/ replace "<b structType><b variables>;" with "NSEvent *(TOPSTEMP__NSEvent)<variables>;" where "<structType>" isOneOf { "NXEvent *", "NXEvent", "NXEventPtr", "const NXEvent *" , "const NXEventPtr", "NXEvent const *" , "NXEventPtr const" } within ("<variables>") { replace ", <t theStruct>" with ", *(TOPSTEMP__NSEvent)<theStruct>" replace "**" with "*" replace "*(TOPSTEMP__NSEvent)*" with "*(TOPSTEMP__NSEvent)" } /*********** EventConversion: mark local usage ***********/ replace "(TOPSTEMP__NSEvent)<t theStruct><scope body>}" with same within ("<body>"){ replace "<t theStruct>" with "(TOPS__NSEvent)<t theStruct>" } /*********** EventConversion: preperatory cleanup ***********/ replace "&(TOPS__NSEvent)<t theStruct>" with "(TOPS__NSEvent)<theStruct>" replace "*(TOPS__NSEvent)<t theStruct>" with "(TOPS__NSEvent)<theStruct>" replace "((TOPS__NSEvent)<t theStruct>)." with "(TOPS__NSEvent)<theStruct>." replace "((TOPS__NSEvent)<t theStruct>)->" with "(TOPS__NSEvent)<theStruct>." replace "(TOPS__NSEvent)<t theStruct>->" with "(TOPS__NSEvent)<theStruct>." /*********** EventConversion: convert to methods - simple ***********/ replace "(TOPS__NSEvent)<t theStruct>.<theStructStuff>" with "[(TOPS__NSEvent)<t theStruct> <t accessMethod>]" where ("<theStructStuff>", "<t accessMethod>") isOneOf { ("type", "type"), ("location", "locationInWindow"), ("time", "timestamp"), ("flags", "modifierFlags"), ("window", "windowNumber"), ("ctxt", "context"), ("data.mouse.eventNum", "eventNumber"), ("data.mouse.click", "clickCount"), ("data.mouse.pressure", "float pressure"), ("data.key.repeat", "isARepeat"), ("data.tracking.eventNum", "eventNumber"), ("data.tracking.trackingNum", "trackingNumber"), ("data.traking.userData", "userData"), ("data.compound.subtype", "subtype"), ("data.key.keyCode", "keyCode"), ("data.compound.misc.L[0]", "data1"), ("data.compound.misc.L[1]", "data2"), } /*********** EventConversion: convert to methods - exceptions ***********/ replace "(TOPS__NSEvent)<t theStruct>.data.mouse.pressure" with "([(TOPS__NSEvent)<t theStruct> pressure] * 255.0)" replace "(TOPS__NSEvent)<t theStruct>.data.key.charCode" with "[(TOPS__NSEvent)<t theStruct> characters]" error "EventConversion: the 'characters' method of NSEvent replaces the '.data.key.charCode' field of NXEvent. Use 'charactersIgnoringModifiers' to get the chars that would have been generated regardless of modifier keys (except shift)" replace "(TOPS__NSEvent)<t theStruct>.data.key.charSet" with same error "EventConversion: the '.data.key.charSet' field of NXEvent does not have an exact translation to an NSEvent method. Possibly use [[<theStruct> characters] canBeConvertedToEncoding:...]" /*********** EventConversion: events are immutable ***********/ replace "[(TOPS__NSEvent)<t theStruct> <b method>]<w w><t op>" with same error "EventConversion: NSEvents are immutable." where "<op>" isOneOf { "++", "--", "/=", "*=", "-=", "+=", "%=", "|=", "^=", "&=", "<<=", ">>=", "=" } /*********** EventConversion: performKeyEquivalent: ***********/ replacemethod "commandKey:" with "performKeyEquivalent:" /*********** EventConversion: getting events - guess event source ***********/ replace "[<rec> <method1>]<b code>[<rec> <method2>]" with same where ("<method1>", "<method2>") isOneOf { ("setEventMask:", "setEventMask:"), ("addToEventMask:", "removeFromEventMask:"), ("removeFromEventMask:", "addToEventMask:") } within ("<b code>") { replace "NSGetOrPeekEvent(<context>, <theEvent>, <mask>, <timeout>, <threshold>, <peek>)" with "(<theEvent> = [<rec> nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:(!<peek>)])" replace "[<rec2> getNextEvent:<mask> waitFor:<timeout> threshold:<level>]" with "[<rec> nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:YES]" replace "[<rec2> getNextEvent:<mask>]" with "[<rec> nextEventMatchingMask:<mask>]" replace "[<rec2> peekAndGetNextEvent:<mask>]" with "[<rec> nextEventMatchingMask:<mask> untilDate:[NSDate date] inMode:NSEventTrackingRunLoopMode dequeue:YES]" replace "[<rec2> peekNextEvent:<mask> into:<theEvent> waitFor:<timeout> threshold:<level>]" with "(<theEvent> = [<rec> nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:NO])" replace "[<rec2> peekNextEvent:<mask> into:<theEvent>]" with "(<theEvent> = [<rec> nextEventMatchingMask:<mask> untilDate:[NSDate date] inMode:NSEventTrackingRunLoopMode dequeue:NO])" replace "[<rec2> currentEvent]" with "[<rec> currentEvent]" } /*********** EventConversion: getting events - view subclass ***********/ replace "@implementation <isKindOf(NSView) class><w w1><any code><w w2>@end" with same within ("<code>") { replace "NSGetOrPeekEvent(<context>, <theEvent>, <mask>, <timeout>, <threshold>, <peek>)" with "(<theEvent> = [window nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:(!<peek>)])" replace "[<rec2> getNextEvent:<mask> waitFor:<timeout> threshold:<level>]" with "[window nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:YES]" replace "[<rec2> getNextEvent:<mask>]" with "[window nextEventMatchingMask:<mask>]" replace "[<rec2> peekAndGetNextEvent:<mask>]" with "[window nextEventMatchingMask:<mask> untilDate:[NSDate date] inMode:NSEventTrackingRunLoopMode dequeue:YES]" replace "[<rec2> peekNextEvent:<mask> into:<theEvent> waitFor:<timeout> threshold:<level>]" with "(<theEvent> = [window nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:NO])" replace "[<rec2> peekNextEvent:<mask> into:<theEvent>]" with "(<theEvent> = [window nextEventMatchingMask:<mask> untilDate:[NSDate date] inMode:NSEventTrackingRunLoopMode dequeue:NO])" replace "[<rec2> currentEvent]" with "[window currentEvent]" } /*********** EventConversion: getting events - anything else ***********/ replace "NSGetOrPeekEvent(<context>, <theEvent>, <mask>, <timeout>, <threshold>, <peek>)" with "(<theEvent> = [NSApp nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:(!<peek>)])" replace "[<rec> getNextEvent:<mask> waitFor:<timeout> threshold:<level>]" with "[<rec> nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:YES]" replace "[<rec> getNextEvent:<mask>]" with "[<rec> nextEventMatchingMask:<mask> untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:YES]" replace "[<rec> peekAndGetNextEvent:<mask>]" with "[<rec> nextEventMatchingMask:<mask> untilDate:[NSDate date] inMode:NSEventTrackingRunLoopMode dequeue:YES]" replace "[<rec> peekNextEvent:<mask> into:<theEvent> waitFor:<timeout> threshold:<level>]" with "(<theEvent> = [<rec> nextEventMatchingMask:<mask> untilDate:[NSDate dateWithTimeIntervalSinceNow:<timeout>] inMode:NSEventTrackingRunLoopMode dequeue:NO])" replace "[<rec> peekNextEvent:<mask> into:<theEvent>]" with "(<theEvent> = [<rec> nextEventMatchingMask:<mask> untilDate:[NSDate date] inMode:NSEventTrackingRunLoopMode dequeue:NO])" /****** EventConversion: timed events ******/ replace "<token var> = NXBeginTimer(<timer>, <delay>, <period>)" with "[NSEvent startPeriodicEventsAfterDelay:<delay> withPeriod:<period>]" replace "NXBeginTimer(<timer>, <delay>, <period>)" with "[NSEvent startPeriodicEventsAfterDelay:<delay> withPeriod:<period>]" replace "NXEndTimer(<b timer>)" with "[NSEvent stopPeriodicEvents]" replace "NXTrackingTimer <b vars>;" with same error "EventConversion: NXTrackingTimer is obsolete; use NSEvent 'startPeriodicEventsAfterDelay:withPeriod:' and 'stopPeriodicEvents'. You can probably delete this variable and its uses." /****** setEventMask, addToEventMask, removeFromEventMask, eventMask ******/ replace "[<rec> removeFromEventMask:<mask>]" with "[<rec> CONVERSIONremoveFromEventMask:NX_KEYDOWNMASK]" error "EventConversion: 'removeFromEventMask:' is obsolete; you no longer need to use the eventMask methods; for mouse moved events, see 'setAcceptsMouseMovedEvents:' If this line is used to prevent <rec> from becoming the key window, either make <rec> a subclass of NSPanel and send it 'setBecomesKeyOnlyIfNeeded:YES', or overide the 'canBecomeKeyWindow' method in NSWindow" where "<mask>" isOneOf { "NX_KEYDOWNMASK", "NX_KEYUPMASK", "NX_KEYUPMASK|NX_KEYDOWNMASK", "NX_KEYDOWNMASK|NX_KEYUPMASK", "(NX_KEYUPMASK|NX_KEYDOWNMASK)", "(NX_KEYDOWNMASK|NX_KEYUPMASK)" } replacemethod "<sel>" with same error "EventConversion: <sel>: is obsolete; you no longer need to use the eventMask methods; for mouse moved events, see 'setAcceptsMouseMovedEvents:'" where "<sel>" isOneOf { "setEventMask:", "addToEventMask:", "removeFromEventMask:", "eventMask" } /****** EventConversion: #defines ******/ replace "<t oldEventDefine>" with "<t newEventEnum>" where ("<t oldEventDefine>", "<t newEventEnum>") isOneOf { ("NX_LMOUSEDOWN", "NSLeftMouseDown"), ("NX_LMOUSEUP", "NSLeftMouseUp"), ("NX_RMOUSEDOWN", "NSRightMouseDown"), ("NX_RMOUSEUP", "NSRightMouseUp"), ("NX_MOUSEMOVED", "NSMouseMoved"), ("NX_LMOUSEDRAGGED", "NSLeftMouseDragged"), ("NX_RMOUSEDRAGGED", "NSRightMouseDragged"), ("NX_MOUSEENTERED", "NSMouseEntered"), ("NX_MOUSEEXITED", "NSMouseExited"), ("NX_KEYDOWN", "NSKeyDown"), ("NX_KEYUP", "NSKeyUp"), ("NX_FLAGSCHANGED", "NSFlagsChanged"), ("NX_KITDEFINED", "NSAppKitDefined"), ("NX_SYSDEFINED", "NSSystemDefined"), ("NX_APPDEFINED", "NSApplicationDefined"), ("NX_TIMER", "NSPeriodic"), ("NX_CURSORUPDATE", "NSCursorUpdate"), ("NX_LMOUSEDOWNMASK", "NSLeftMouseDownMask"), ("NX_LMOUSEUPMASK", "NSLeftMouseUpMask"), ("NX_RMOUSEDOWNMASK", "NSRightMouseDownMask"), ("NX_RMOUSEUPMASK", "NSRightMouseUpMask"), ("NX_MOUSEMOVEDMASK", "NSMouseMovedMask"), ("NX_LMOUSEDRAGGEDMASK", "NSLeftMouseDraggedMask"), ("NX_RMOUSEDRAGGEDMASK", "NSRightMouseDraggedMask"), ("NX_MOUSEENTEREDMASK", "NSMouseEnteredMask"), ("NX_MOUSEEXITEDMASK", "NSMouseExitedMask"), ("NX_KEYDOWNMASK", "NSKeyDownMask"), ("NX_KEYUPMASK", "NSKeyUpMask"), ("NX_FLAGSCHANGEDMASK", "NSFlagsChangedMask"), ("NX_KITDEFINEDMASK", "NSAppkitDefinedMask"), ("NX_APPDEFINEDMASK", "NSSystemDefinedMask"), ("NX_SYSDEFINEDMASK", "NSApplicationDefinedMask"), ("NX_TIMERMASK", "NSPeriodicMask"), ("NX_CURSORUPDATEMASK", "NSCursorUpdateMask"), ("NX_ALLEVENTS", "NSAnyEventMask"), ("NX_ALPHASHIFTMASK", "NSAlphaShiftKeyMask"), ("NX_SHIFTMASK", "NSShiftKeyMask"), ("NX_CONTROLMASK", "NSControlKeyMask"), ("NX_ALTERNATEMASK", "NSAlternateKeyMask"), ("NX_COMMANDMASK", "NSCommandKeyMask"), ("NX_NUMERICPADMASK", "NSNumericPadKeyMask"), ("NX_HELPMASK", "NSHelpKeyMask"), ("NX_MOUSEDOWNMASK", "NSLeftMouseDownMask"), ("NX_MOUSEUPMASK", "NSLeftMouseUpMask"), ("NX_MOUSEDRAGGEDMASK", "NSLeftMouseDraggedMask"), ("NX_MOUSEDOWN", "NSLeftMouseDown"), ("NX_MOUSEUP", "NSLeftMouseUp"), ("NX_MOUSEDRAGGED", "NSLeftMouseDragged") ("NX_NEXTCTRLKEYMASK", "NSControlKeyMask"), ("NX_NEXTLSHIFTKEYMASK", "NSShiftKeyMask"), ("NX_NEXTRSHIFTKEYMASK", "NSShiftKeyMask"), ("NX_NEXTLCMDKEYMASK", "NSControlKeyMask"), ("NX_NEXTRCMDKEYMASK", "NSControlKeyMask"), ("NX_NEXTLALTKEYMASK", "NSAlternateKeyMask"), ("NX_NEXTRALTKEYMASK", "NSAlternateKeyMask"), ("NX_EVENTCODEMASK", "NSEventMaskFromType") } replace "<t oldEventDefine>" with same error "EventCoversion: <oldEventDefine> is obsolete." where "<t oldEventDefine>" isOneOf { "NX_NULLEVENT", "NX_FIRSTEVENT", "NX_LASTEVENT", "NX_NULLEVENTMASK", "NX_STYLUSPROXIMITYMASK", "NX_NONCOALSESCEDMASK" } /****** EventConversion: DPS functions ******/ replace "DPSPostEvent(<theEvent>, <atStart>)" with "[window postEvent:<theEvent> atStart:<atStart>]" replace "DPSDiscardEvents(<context>, <mask>)" with "[window discardEventsMatchingMask:<mask> beforeEvent:nil]" error "EventConversion: 'discardEventsMatchingMask:beforeEvent:' used to be 'DPSDiscardEvents(...)'. To avoid a timing bug, you should pass the last event you received. Only events that occurred before that event will be discarded." /****** EventConversion: cleanup ******/ replace "(TOPS__NSEvent)" with "" replace "TOPS__NSEvent" with "" replace "(TOPSTEMP__NSEvent)" with "" replace "TOPSTEMP__NSEvent" with "" replace "[NSDate dateWithTimeIntervalSinceNow:NX_FOREVER]" with "[NSDate distantFuture]"