home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / ConversionScripts / ApplicationConversion.tops next >
Encoding:
Text File  |  1996-03-28  |  13.3 KB  |  292 lines

  1. /*********** ApplicationConversion: user aborted *************/
  2.  
  3. replace "NXUserAborted()" with same 
  4.     error "ApplicationConversion: NSUserAborted() is obsolete"
  5.  
  6. replace "NXResetUserAbort()" with same 
  7.     error "ApplicationConversion: NSResetUserAbort() is obsolete"
  8.  
  9. /*********** ApplicationConversion: run from appkit *************/
  10.  
  11. replacemethod "runFromAppkit" with same
  12.     error "ApplicationConversion: 'runFromAppkit' is obsolete (no longer needed with new DO and NSRunLoop)"
  13.  
  14. replacemethod "runFromAppkitWithPriority:" with same
  15.     error "ApplicationConversion: 'runFromAppkitWithPriority:' is obsolete (no longer needed with new DO and NSRunLoop))"
  16.  
  17. /*********** ApplicationConversion: modal sessions *************/
  18.  
  19. replace "<token var> = [<obj> beginModalSession:<session> for:<win>]" with "<token var> = [<obj> beginModalSessionForWindow:<win>]"
  20.  
  21. replace "[<obj> beginModalSession:<session> for:<win>]" with "*<session> = [<obj> beginModalSessionForWindow:<win>]"
  22.  
  23. replacemethod "beginModalSession:<1> for:<2>" with "beginModalSessionForWindow:<2>" {
  24.     replace "<rettype>" with "(NSModalSession)"
  25.     }
  26.  
  27. replacemethod "endModalSession:<session>" with same {
  28.     replace "<session_type>" with "(NSModalSession)"
  29.     replace "<session_arg>" with "*<session_arg>"
  30.     }
  31.     within ("<implementation>") {
  32.     replace "<session_param>->" with "*<session_param>."
  33.     replace "<session_param>" with "&<session_param>"
  34.     }
  35.  
  36. replacemethod "runModalSession:<session>" with same {
  37.     replace "<session_type>" with "(NSModalSession)"
  38.     replace "<session_arg>" with "*<session_arg>"
  39.     }
  40.     within ("<implementation>") {
  41.     replace "<session_param>->" with "*<session_param>."
  42.     replace "<session_param>" with "&<session_param>"
  43.     }
  44.  
  45. replace    "NXModalSession <b variables>;" with "NSModalSession <variables>;"
  46.     within ("<variables>"){
  47.     replace    "*<t modalSession>" with "<modalSession>"
  48.     }
  49.  
  50. replace "NXModalSession" with "NSModalSession"
  51.  
  52. replace "*&" with ""
  53.  
  54. replace "&*" with ""
  55.  
  56. /*********** ApplicationConversion: appName, hostName *************/
  57.  
  58. replace "[<obj> appName]"
  59. with     "[[NSProcessInfo processInfo] processName]"
  60.  
  61. replacemethod "appName" with "processName"
  62.     error "ApplicationConversion: 'processName' (used to be Applications 'appName') is now an NSProcessInfo method"
  63.  
  64. replace "[<obj> hostName]"
  65. with    "[(NSDPSServerContext *)[NSDPSContext currentContext] CONVERSIONhostName]"
  66.  
  67. replacemethod "hostName" with same
  68.     error "ApplicationConversion: Applications 'hostName' has been moved to NSDPSContext"
  69.     
  70. replace "CONVERSIONhostName" with "hostName"
  71.  
  72. /*********** ApplicationConversion: obsolete methods *************/
  73.  
  74. replacemethod "<sel>" with same
  75.     error "ApplicationConversion: <sel> is obsolete (the NXJournal class is obsolete)."
  76.     where "<sel>" isOneOf {
  77.     "slaveJournaler",
  78.     "masterJournaler",
  79.     "isJournalable",
  80.     "setJournalable:"
  81.     }
  82.  
  83. replacemethod "unhide" with same
  84.     error "ApplicationConversion: 'unhide' is obsolete"
  85.  
  86. replacemethod "setAppListener:" with same
  87.     error "ApplicationConversion: 'setAppListener:' is obsolete (the Listener class is obsolete)"
  88.     
  89. replacemethod "replyPort" with same
  90.     error "ApplicationConversion: 'replyPort' is obsolete (the Speaker class is obsolete)"
  91.     
  92. replacemethod "appListenerPortName" with same
  93.     error "ApplicationConversion: 'appListenerPortName' is obsolete (the Listener class is obsolete)"
  94.     
  95. replacemethod "appListener" with same
  96.     error "ApplicationConversion: 'appListener' is obsolete (the Listener class is obsolete)"
  97.     
  98. replacemethod "setAppSpeaker:" with same
  99.     error "ApplicationConversion: 'setAppSpeaker:' is obsolete (the Listener class is obsolete)"
  100.     
  101. replacemethod "appSpeaker" with same
  102.     error "ApplicationConversion: 'appSpeaker' is obsolete (the Listener class is obsolete)"
  103.     
  104. replacemethod "activeApp" with same
  105.     error "ApplicationConversion: 'activeApp' is obsolete"
  106.  
  107. replacemethod "activate:" with same
  108.     error "ApplicationConversion: 'activate:' is obsolete"
  109.  
  110. replacemethod "autoupdate" with same
  111.     error "ApplicationConversion: 'autoupdate' is obsolete ; autoupdate is always on at the application level"
  112.  
  113. replacemethod "setAutoupdate:" with same
  114.     error "ApplicationConversion: 'setAutoupdate:' is obsolete ; autoupdate is always on at the application level"
  115.  
  116. replacemethod "getWindowNumbers:count:" with same
  117.     error "ApplicationConversion: 'getWindowNumbers:count:' is obsolete. Use NSCountWindows() and NSWindowList()"
  118.  
  119. replacemethod "appIcon" with "applicationIconImage"
  120.  
  121. replacemethod "windowList" with "windows"
  122.  
  123. replacemethod "applicationDefined:" with same
  124.     error "Application Conversion: 'applicationDefined:' is obsolete. Override sendEvent to catch this event"
  125.  
  126. replacemethod "powerOff:" with same
  127.     error "Application Conversion: 'powerOff:' is obsolete. Instead observe NSWorkspaceWillPowerOffNotification from NSWorkspace.  You could also override sendEvent to catch this event"
  128.  
  129. replace "[<obj> systemLanguages]" with "[[NSUserDefaults standardUserDefaults] objectForKey:@\"NSLanguages\"]"
  130.  
  131. replacemethod "systemLanguages" with same
  132.     error "ApplicationConversion: 'systemLanguages' is obsolete. Use [[NSUserDefaults standardUserDefaults] objectForKey:@\"NSLanguages\"]"
  133.     
  134. /*********** ApplicationConversion: name changes *************/
  135.  
  136. replace "[<app> delayedFree:<obj>]" with "[<obj> autorelease]"
  137.  
  138. replace "[NSApp context]" with "[[NSApp context] DPSContext]"
  139.  
  140. replacemethod "unhideWithoutActivation:" with "unhideWithoutActivation"
  141.  
  142. replacemethod "appAcceptsAnotherFile:" with same
  143.     error "Application Conversion: 'appAcceptsAnotherFile:' is obsolete"
  144.  
  145. replacemethod "<old>" with "<new>" 
  146.     where ("<old>", "<new>") isOneOf {
  147.     ("findWindow:", "windowWithWindowNumber:"),
  148.     ("deactivateSelf", "deactivate"),
  149.     ("showHelpPanel:", "showHelp:"),
  150.     ("activateSelf:", "activateIgnoringOtherApps:"),
  151.     ("stopModal:", "stopModalWithCode:")
  152.     }
  153.  
  154. replace "[<rec> setImportAlpha:<flag>]" with "[NSColor setIgnoresAlpha:!<flag>]"
  155.  
  156. replace "([<rec> doesImportAlpha])" with "(![NSColor ignoresAlpha])"
  157.  
  158. replace "[<rec> doesImportAlpha]" with "(![NSColor ignoresAlpha])"
  159.  
  160. replace "!!" with ""
  161.  
  162. replace "!YES" with "NO"
  163.  
  164. replace "!NO" with "YES"
  165.  
  166. /*********** ApplicationConversion: nib loading *************/
  167.  
  168. replace    "[<app> loadNibFile:<file> owner:<owner> withNames:<flag> fromZone:<zone>]" with "[NSBundle loadNibFile:<file> externalNameTable:[NSDictionary dictionaryWithObjectsAndKeys:<owner>, @\"NSOwner\", nil] withZone:<zone>]"
  169.  
  170. replace    "[<app> loadNibFile:<file> owner:<owner> withNames:<flag>]" with "[NSBundle loadNibFile:<file> externalNameTable:[NSDictionary dictionaryWithObjectsAndKeys:<owner>, @\"NSOwner\", nil] withZone:[<owner> zone]]"
  171.  
  172. replace    "[<app> loadNibFile:<file> owner:<owner>]" with "[NSBundle loadNibFile:<file> externalNameTable:[NSDictionary dictionaryWithObjectsAndKeys:<owner>, @\"NSOwner\", nil] withZone:[<owner> zone]]"
  173.  
  174. replace    "[<app> loadNibSection:<name> owner:<owner> withNames:<flag> fromHeader:<header> fromZone:[<owner> zone]]" with "[NSBundle loadNibNamed:<name> owner:<owner>]"
  175.  
  176. replace    "[<app> loadNibSection:<name> owner:<owner> withNames:<flag> fromHeader:<header> fromZone:<zone>]" with "{
  177.     NSString *path = [[NSBundle bundleForClass:[<owner> class]] pathForResource:<name> ofType:@\"nib\"];
  178.     [NSBundle loadNibFile:path externalNameTable:[NSDictionary dictionaryWithObjectsAndKeys:<owner>, @\"NSOwner\", nil] withZone:<zone>];
  179.     }"
  180.     
  181. replace    "[<app> loadNibSection:<name> owner:<owner> withNames:<flag> fromHeader:<header>]" with "[NSBundle loadNibNamed:<name> owner:<owner>]"
  182.  
  183. replace    "[<app> loadNibSection:<name> owner:<owner> withNames:<flag> fromZone:[<owner> zone]]" with "[NSBundle loadNibNamed:<name> owner:<owner>]"
  184.  
  185. replace    "[<app> loadNibSection:<name> owner:<owner> withNames:<flag> fromZone:<zone>]" with "{
  186.     NSString *path = [[NSBundle bundleForClass:[<owner> class]] pathForResource:<name> ofType:@\"nib\"];
  187.     [NSBundle loadNibFile:path externalNameTable:[NSDictionary dictionaryWithObjectsAndKeys:<owner>, @\"NSOwner\", nil] withZone:<zone>];
  188.     }"
  189.  
  190. replace    "[<app> loadNibSection:<name> owner:<owner> withNames:<flag>]" with "[NSBundle loadNibNamed:<name> owner:<owner>]"
  191.  
  192. replace    "[<app> loadNibSection:<file> owner:<owner>]" with "[NSBundle loadNibNamed:<file> owner:<owner>]"
  193.  
  194. /*********** ApplicationConversion: named object functions *************/
  195.  
  196. replace    "NXGetNamedObject(<b args>)" with same
  197.     error "ApplicationConversion:  NXGetNamedObject() is obsolete. Replace with nib file outlets."
  198.     
  199. replace    "NXGetObjectName(<b args>)" with same
  200.     error "ApplicationConversion:  NXGetNamedObject() is obsolete. Replace with nib file outlets."
  201.     
  202. replace    "NXNamedObject(<b args>)" with same
  203.     error "ApplicationConversion:  NXGetNamedObject() is obsolete. Replace with nib file outlets."
  204.     
  205. replace    "NXUnnameObject(<b args>)" with same
  206.     error "ApplicationConversion:  NXGetNamedObject() is obsolete. Replace with nib file outlets."
  207.     
  208. /*********** ApplicationConversion: workspace creation *************/
  209.  
  210. replace    "<t id> \<NXWorkspaceRequestProtocol> <t workspace>" with "NSWorkspace *<workspace>"
  211.  
  212. replace    "NXWorkspaceRequestProtocol" with same
  213.     error "ApplicationConversion: 'NXWorkspaceRequestProtocol' protocol converted to NSWorkspace class"
  214.  
  215. replace    "[<app> workspace]" with "[NSWorkspace sharedWorkspace]"
  216.  
  217. /*********** ApplicationConversion: new workspace notifications *************/
  218.  
  219. replacemethod "unmounted:" with same
  220.     error "ApplicationConversion: 'unmounted:' is obsolete ; observe NSWorkspace 'NSWorkspaceDidUnmountNotification' notification"
  221.     
  222. replacemethod "mounted:" with same
  223.     error "ApplicationConversion: 'mounted:' is obsolete ; observe NSWorkspace 'NSWorkspaceDidMountNotification' notification"
  224.     
  225. replacemethod "applicationWillLaunch:" with same
  226.     error "ApplicationConversion: 'applicationWillLaunch:' is obsolete ; observe NSWorkspace 'NSWorkspaceWillLaunchApplicationNotification' notification"
  227.     
  228. replacemethod "applicationDidLaunch:" with same
  229.     error "ApplicationConversion: 'applicationDidLaunch:' is obsolete ; observe NSWorkspace 'NSWorkspaceDidLaunchApplicationNotification' notification"
  230.     
  231. replacemethod "applicationDidTerminate:" with same
  232.     error "ApplicationConversion: 'applicationDidTerminate:' is obsolete ; observe NSWorkspace 'NSWorkspaceDidTerminateApplicationNotification' notification"
  233.     
  234. replacemethod "unmount:ok:" with same
  235.     error "ApplicationConversion: 'unmount:ok:' is obsolete ; observe NSWorkspace 'NSWorkspaceWillUnmountNotification' notification"
  236.         
  237. replacemethod "powerOffIn:andSave:" with same
  238.     error "ApplicationConversion: 'powerOffIn:andSave:' is obsolete ; observe NSWorkspace 'NSWorkspaceWillPowerOffNotification' notification"
  239.     
  240. replacemethod "fileOperationCompleted:" with same
  241.     error "ApplicationConversion: 'fileOperationCompleted:' is obsolete.  Observe the NSWorkspace 'NSWorkspaceDidPerformFileOperationNotification' notification"
  242.     
  243. replacemethod "performFileOperation:source:destination:files:<files> options:" with "performFileOperation:source:destination:files:<files> tag:<tag>" {
  244.     replace "<tag_type>" with "(int *)"
  245.     replace "<tag_param>" with "tag"
  246.     replace "<tag_arg>" with "nil"
  247.     replace "<rettype>" with "(BOOL)"
  248.     }
  249.     error "ApplicationConversion:  'performFileOperation:source:destination:files:tag:' (from NXWorkspaceRequestProtocol, now in NSWorkspace) (used to be 'performFileOperation:source:destination:files:options:') now returns BOOL indicating success. Operation tag is now returned in tag. Files should be an NSArray of NSString (used to be tab separated string)"
  250.     
  251. replacemethod "findString:inFile:" with same
  252.     error "ApplicationConversion: NXWorkspaceRequestProtocols 'findString:inFile:' is obsolete."
  253.     
  254. replacemethod "<sel>" with same
  255.     error "ApplicationConversion: NXWorkspaceRequestProtocols <sel> is obsolete. The NSWorkspace NSNotificationCenter (notificationCenter) manages this behavior automatically"
  256.     where "<sel>" isOneOf {
  257.     "beginListeningForDeviceStatusChanges",
  258.     "endListeningForDeviceStatusChanges",
  259.     "beginListeningForApplicationStatusChanges",
  260.     "endListeningForApplicationStatusChanges"
  261.     }
  262.     
  263. /*********** ApplicationConversion: workspace renaming *************/
  264.  
  265. replace    "[<obj> getIconForFile:<file>]"
  266.  with    "[[<obj> iconForFile:<file>] retain]"
  267.  
  268. replacemethod "<old>" with "<new>" 
  269.     where ("<old>", "<new>") isOneOf {
  270.     ("defaultsChanged", "noteUserDefaultsChanged"),
  271.     ("didDefaultsChange", "userDefaultsChanged"),
  272.     ("didFileSystemChange", "fileSystemChanged"),
  273.     ("fileSystemChanged", "noteFileSystemChanged"),
  274.     ("getFullPathForApplication:", "fullPathForApplication:"),
  275.     ("getIconForFile:",  "iconForFile:"),
  276.     ("getInfoForFileSystemAt:", "getFileSystemInfoForPath:"),
  277.     ("launchApplication:showTile:autolaunch:", "launchApplication:showIcon:autolaunch:"),
  278.     ("selectFile:inFileViewerRootedAt:", "selectFile:inFileViewerRootedAtPath:"),
  279.     ("unmountAndEjectDeviceAt:", "unmountAndEjectDeviceAtPath:")
  280.     }
  281.  
  282. /*********** ApplicationConversion: sleep *************/
  283.  
  284. replace "sleep(<b seconds>)" with "[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:(<b seconds>)]]"
  285. replace "usleep(<b seconds>)" with "[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:(<b seconds>)/1000000.0]]"
  286.  
  287. /*********** ApplicationConversion: services delegate *************/
  288.  
  289. replace "[<listener> setServicesDelegate:<obj>]" with "[NSApp setServicesProvider:<obj>]"
  290. replace "[<listener> servicesDelegate]" with "[NSApp servicesProvider]"
  291.  
  292.