home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / ConversionScripts / DOConversion.tops < prev    next >
Encoding:
Text File  |  1996-05-03  |  8.0 KB  |  139 lines

  1. /* NXConnection stuff */
  2.  
  3. replace "[NXConnection connectToName:<exp cstr>]" with "[[NSConnection rootProxyForConnectionWithRegisteredName:<exp cstr> host:nil] retain]"
  4. replace "[NXConnection connectToName:<exp cstr> fromZone:<exp zone>]" with "[[NSConnection rootProxyForConnectionWithRegisteredName:<exp cstr> host:nil] retain]"
  5. replace "[NXConnection connectToName:<exp cstr> onHost:<exp hcstr>]" with "[[NSConnection rootProxyForConnectionWithRegisteredName:<exp cstr> host:<exp hcstr>] retain]"
  6. replace "[NXConnection connectToName:<exp cstr> onHost:<exp hcstr> fromZone:<exp zone>]" with "[[NSConnection rootProxyForConnectionWithRegisteredName:<exp cstr> host:<exp hcstr>] retain]"
  7.  
  8. replace "[NXConnection connectToPort:<port>]" with
  9.     "[[[NSConnection connectionWithReceivePort:[NSPort port] sendPort:<port>] rootProxy] retain]"
  10. replace "[NXConnection connectToPort:<port> fromZone:<exp zone>]" with
  11.     "[[[NSConnection connectionWithReceivePort:[NSPort port] sendPort:<port>] rootProxy] retain]"
  12. replace "[NXConnection connectToPort:<sndport> withInPort:<rcvport>]" with
  13.     "[[[NSConnection connectionWithReceivePort:<rcvport> sendPort:<sndport>] rootProxy] retain]"
  14. replace "[NXConnection connectToPort:<exp sndport> withInPort:<exp rcvport> fromZone:<exp zone>]" with
  15.     "[[[NSConnection connectionWithReceivePort:<rcvport> sendPort:<sndport>] rootProxy] retain]"
  16.  
  17. replace "[NXConnection registerRoot:<root>]" with "({id conn = [[NSConnection alloc] init]; [conn setRootObject:<root>]; conn;})"
  18. replace "[NXConnection registerRoot:<root> withName:<name>]" with "({id conn = [[NSConnection alloc] init]; [conn setRootObject:<root>]; [conn registerName:<name>]; conn;})"
  19. replace "[NXConnection registerRoot:<root> fromZone:<exp zone>]" with "({id conn = [[NSConnection alloc] init]; [conn setRootObject:<root>]; conn;})"
  20. replace "[NXConnection registerRoot:<root> withName:<name> fromZone:<exp zone>]" with "({id conn = [[NSConnection alloc] init]; [conn setRootObject:<root>]; [conn registerName:<name>]; conn;})"
  21.  
  22. replace "[NXConnection removeObject:<exp obj>]" with same
  23.     error "DO Conversion: there is no way to unexport an object"
  24. replace "[NXConnection messagesReceived]" with same
  25.     error "DO Conversion: there is no direct way to report this information, try -statistics instead"
  26.  
  27. replace "\<NXSenderIsInvalid>" with ""
  28. replace "NXSenderIsInvalid" with "NXSenderIsInvalid"
  29.     warning "DO Conversion: NXSenderIsInvalid protocol has no equivalent - please remove"
  30. replace "[<conn> registerForInvalidationNotification:<target>]" with "[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(senderIsInvalid:) name:NSConnectionDidDieNotification  object:<conn>]"
  31. replace "[NXConnection unregisterForInvalidationNotification:<exp obj>]" with "[[NSNotificationCenter defaultCenter] removeObserver:<exp obj> name:NSConnectionDidDieNotification]"
  32. replacemethod "senderIsInvalid:<conn>" with same {
  33.    replace "<conn_type>" with "(NSNotification *)"
  34.    }
  35.    within ("<implementation>") {
  36.        replace "<conn_param>" with "[<conn_param> object]"
  37.    }
  38.  
  39. replace "[NXConnection connections:<list>]" with "([<list> release], <list> = [NSConnection allConnections])"
  40.     warning "DO Conversion: zapping earlier contents of list."
  41.  
  42. replace "[NXConnection setDefaultTimeout:<milliseconds>];" with "{ id conn = [NSConnection defaultConnection]; [conn setRequestTimeout:((<milliseconds>)/1000.0)]; [conn setReplyTimeout:((<milliseconds>)/1000.0)];}"
  43. replace "[NXConnection defaultTimeout]" with "((int)([[NSConnection defaultConnection] requestTimeout]*1000.0))"
  44. replace "[NXConnection setDefaultZone:<zone>]" with "[NXConnection setDefaultZone:<zone>]"
  45.     warning "DO Conversion: there is no NSConnection equivalent"
  46. replace "[NXConnection defaultZone]" with "NULL"
  47.  
  48. replace "[<conn> <a nxmethod>]" with "[<conn> <a nsmethod>]"
  49.     where ("<nxmethod>", "<nsmethod>") isOneOf {
  50.         ("setRoot:<exp obj>", "setRootObject:<exp obj>"),
  51.     ("setInTimeout:<timeout>", "setReplyTimeout:((<timeout>)/1000.0)"),
  52.     ("setOutTimeout:<timeout>", "setRequestTimeout:((<timeout>)/1000.0)"),
  53.     ("inPort", "receivePort"),
  54.     ("outPort", "sendPort"),
  55.     }
  56.  
  57. replace "[<conn> inTimeout]" with "((int)[<conn> requestTimeout]/1000.0)"
  58. replace "[<conn> outTimeout]" with "((int)[<conn> replyTimeout]/1000.0)"
  59. replace "[<conn> newRemote:<name> withProtocol:<prot>]" with "({id res = [[NSDistantObject alloc] initWithTarget:<name> connection:<conn>]; [res setProtocolForProxy:<prot>]; res })"
  60. replace "[<conn> getLocal:<b obj>]" with "[NSDistantObject proxyWithLocal:<b obj> connection:<conn>]"
  61.  
  62. replace "[NSApp run]" with "[NSAppSAFErun]"
  63. replace "[<conn> run]" with same
  64.     warning "DO Conversion: The run method of NSConnection is obsolete. Use '[[NSRunLoop currentRunLoop] run]' instead.  If this run message is being sent to an Application object, do not change it."
  65. replace "[NSAppSAFErun]" with "[NSApp run]"
  66.  
  67. replace "[<b conn> runWithTimeout:<b tim>]" with "[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:(<b tim>/1000.0]]"
  68.  
  69. replace "[<conn> runFromAppKit]" with ""
  70. replace "[<conn> runFromAppKitWithPriority:<prio>]" with ""
  71.  
  72. /* NXEncoding, NXDecoding */
  73.  
  74. replacemethod "encodeUsing:<coder>" with "encodeWithCoder:<coder>" {
  75.     replace "<rettype>" with "(void)"
  76.     replace "<coder_type>" with "(NSPortCoder *)"
  77.     replace "<coder_param>" with "aPortCoder"
  78.     }
  79.     within ("<implementation>") {
  80.         replace "<coder_param>" with "aPortCoder"
  81.     replace "return <exp>" with "return"
  82.     }
  83. replacemethod "decodeUsing:<coder>" with "initWithCoder:<coder>" {
  84.     replace "<rettype>" with "(id)"
  85.     replace "<coder_type>" with "(NSPortCoder *)"
  86.     replace "<coder_param>" with "aPortCoder"
  87.     }
  88.     within ("<implementation>") {
  89.         replace "<coder_param>" with "aPortCoder"
  90.     }
  91.  
  92. replacemethod "encodeRemotelyFor:<conn> freeAfterEncoding:<freeit> isBycopy:<isBycopy>"
  93.  with "replacementObjectForPortCoder:<conn>" {
  94.     replace "<conn_type>" with "(NSPortCoder *)"
  95.     replace "<conn_param>" with "aPortCoder"
  96.     }
  97.     within ("<implementation>") {
  98.     replace "<isBycopy_param>" with "[aPortCoder isBycopy]"
  99.         replace "<conn_param>" with "[aPortCoder connection]"
  100.    }
  101.    warning "DO Conversion: if freeAfterEncoding was true use autorelease instead."
  102.    
  103. replace "[<coder> encodeData:<data> ofType:<type>]" with "[<coder> encodeValueOfObjCType:<type> at:<data>]"
  104. replace "[<coder> encodeBytes:<data> count:<count>]" with "[<coder> encodeBytes:<data> length:<count>]"
  105. replace "[<coder> encodeVM:<data> count:<count>]" with "[<coder> encodeBytes:<data> length:<count>]"
  106. replace "[<coder> encodeMachPort:<port>]" with "[<coder> encodePortObject:[NSPort portWithMachPort:<port>]"
  107.   warning "DO Conversion: raw mach port will get deallocated if the NSPort is not retained elsewhere."
  108. replace "[<coder> encodeObjectBycopy:<obj>]" with "[<coder> encodeObject:<obj> isBycopy:YES]"
  109.  
  110. replace "[<coder> decodeData:<data> ofType:<type>]" with "[<coder> decodeValueOfObjCType:<type> at:<data>]"
  111.  
  112. replace "[<coder> decodeBytes:<bytes> count:<count>]" with "{unsigned length; bcopy([<coder> decodeBytesWithReturnedLength:&length], <bytes>, <count>);}"
  113. replace "[<coder> decodeVM:<bytes> count:<count>]" with "{unsigned length; bcopy([<coder> decodeBytesWithReturnedLength:&length], <bytes>, <count>);}"
  114.  
  115. replace "[<coder> decodeMachPort:<portp>]" with "*(<portp>) = [<coder> decodePortObject]"
  116.     warning "DO Conversion: underlying mach port will be deallocated if NSPort instance is not retained elsewhere."
  117.  
  118. /* NXPort */
  119.  
  120. replace "[NXPort newWithMachPort:<port>]" with "[[NSPort alloc] initWithMachPort:<port>]"
  121. replace "[NXPort newWithMachPort:<port> dealloc:<flag>]" with "[[NSPort alloc] initWithMachPort:<port>]"
  122. replace "[NXPort worryAboutPortInvalidation]" with ""
  123.  
  124. /* NXData */
  125.  
  126.  
  127. /* Overall */
  128.  
  129. replace "remote/NXConnection.h" with "Foundation/NSConnection.h"
  130. replace "remote/NXProxy.h" with "Foundation/NSDistantObject.h"
  131. replace "remote/transport.h" with "Foundation/NSPortCoder.h"
  132. replace "machkit/NXPort.h" with "Foundation/NSPort.h"
  133.  
  134. replace "NXProxy" with "NSDistantObject"
  135. replace "NXConnection" with "NSConnection"
  136. replace "NXPort" with "NSPort"
  137. replace "NXTransport" with "NSCoding"
  138.  
  139.