home *** CD-ROM | disk | FTP | other *** search
Wrap
/*********** TextConversion: NSCell name change *************/ replacemethod "setTextAttributes:" with "setUpFieldEditorAttributes:" /*********** TextConversion: monoFont *************/ replacemethod "isMonoFont" with "isRichText" { replace "<call>" with "(!<call>)" } within ("<implementation>") { replace "return <isMonoFont>;" with "return !(<isMonoFont>);" } replacemethod "setMonoFont:<flag>" with "setRichText:<flag>" { replace "<flag_arg>" with "!(<flag_arg>)" } within ("<implementation>") { replace "<flag_param>" with "!(<flag_param>)" } replace "!(YES)" with "NO" replace "!(NO)" with "YES" replace "!!" with "" replace "!YES" with "NO" replace "!NO" with "YES" /*********** TextConversion: Text length methods *************/ replace "[<text> charLength]" with "[[<text> text] length]" replace "[<text> textLength]" with "[[<text> text] length]" replace "[<text> byteLength]" with "[[<text> text] cStringLength]" warning "TextConversion: [[<text> text] cStringLength] was [<text> byteLength]. Use of 'cStringLength' to replace 'byteLength' may be wrong" replacemethod "charLength" with same error "TextConversion: 'charLength:' is obsolete. If you subclass Text, remove this method." replacemethod "textLength" with same error "TextConversion: 'textLength:' is obsolete. If you subclass Text, remove this method." replacemethod "byteLength" with same error "TextConversion: 'byteLength:' is obsolete. If you subclass Text, remove this method." /*********** TextConversion: Text contents methods *************/ replace "[<text> <b method>]" with "<stream> = [<text> <b newMethodSel><b newMethodArgs>]" error "TextConversion: <newMethodSel> (used to be <method>) returns an NSData instance (used to write contents to <steeam>). <stream> must be converted to NSData" where ("<method>", "<newMethodSel>", "<newMethodArgs>") isOneOf { ("writeRTFDTo:<stream>", "RTFDFromRange:", "NSMakeRange(0, [[<text> text] length])"), ("writeRichText:<stream>", "RTFFromRange:", "NSMakeRange(0, [[<text> text] length])"), ("writeRichText:<stream> from:<from> to:<to>", "RTFFromRange:", "NSMakeRange(<from>, (<to>) - (<from>))"), ("writeRTFDSelectionTo:<stream>", "RTFDFromRange:", "[<text> selectedRange]") } replace "[<text> <b methodsel><b methodargs>]" with "<newMethodCall>" error "TextConversion: 'replaceCharactersInRange:withRTF...' (used to be <methodsel>) takes an NSData instance as its second argument. <stream> must be converted to NSData" where ("<methodsel>", "<methodargs>", "<newMethodCall>") isOneOf { ("readRTFDFrom:", "<stream>", "[<text> replaceCharactersInRange:NSMakeRange(0, [[<text> text] length]) withRTFD:<stream>]"), ("readRichText:", "<stream>", "[<text> replaceCharactersInRange:NSMakeRange(0, [[<text> text] length]) withRTF:<stream>]"), ("replaceSelWithRTFD:", "<stream>", "[<text> replaceCharactersInRange:[<text> selectedRange] withRTFD:<stream>]"), ("replaceSelWithRichText:", "<stream>", "[<text> replaceCharactersInRange:[<text> selectedRange] withRTF:<stream>]") } replace "[<text> readText:<stream>]" with "[<text> setString:<stream>]" error "TextConversion: 'setString:' used to be 'readText' takes an NSString instance (used to take NXStream) ; <stream> must be converted to NSString" replacemethod "<sel>" with same error "TextConversion: <sel> is obsolete" where "<sel>" isOneOf { "writeRTFDTo:", "writeRichText:", "writeRichText:from:to:", "readRTFDFrom:", "readRichText:", "readRichText:atPosition:", "readText:", "replaceSelWithRTFD:", "replaceSelWithRichText:", "writeRTFDSelectionTo:", "writeRichText:forRun:atPosition:emitDefaultRichText:" } /*********** TextConversion: selected range methods *************/ replace "[<text> setSelectionStart:<t startLoc> end:<endLoc>]" with "[<text> setSelectedRange:NSMakeRange(<t startLoc>, <endLoc> - (<t startLoc>))]" replace "[<text> setSelectionStart:<startLoc> end:<endLoc>]" with "[<text> setSelectedRange:NSMakeRange(<startLoc>, <endLoc> - (<startLoc>))]" warning "TextConversion: Please make sure that executing <startLoc> twice has no bad side effects." replace "[<text> getSelectionStart:<startLoc> end:<endLoc>]" with same warning "TextConversion: If sent to a NSText, please replace with range = [<text> selectedRange]; start is range.location, end is NSMaxRange(range);" /*********** TextConversion: delegate methods *************/ replacemethod "<old>" with "<new>" { replace "<call>" with "(!<call>)" } within ("<implementation>") { replace "return <retval>;" with "return !(<retval>);" } where ("<old>", "<new>") isOneOf { ("textWillChange:" , "textShouldBeginEditing:"), ("textWillEnd:" , "textShouldEndEditing:"), } /*********** TextConversion: name changes *************/ replacemethod "<old>" with "<new>" where ("<old>", "<new>") isOneOf { ("alignSelCenter:", "alignCenter:"), ("alignSelLeft:", "alignLeft:"), ("alignSelRight:", "alignRight:"), ("calcParagraphStyle::", "paragraphStyleForFont:alignment:"), ("defaultParaStyle", "defaultParagraphStyle"), ("getSel::", "getSelectionStart:end:"), ("initFrame:text:alignment:", "initWithFrame:text:alignment:"), ("isFontPanelEnabled", "usesFontPanel"), ("isHorizResizeable", "isHorizontallyResizable"), ("isVertResizable", "isVerticallyResizable"), ("resizeText::", "resizeTextWithOldBounds:maxRect:"), ("setFont:paraStyle:", "setFont:paragraphStyle:"), ("setFontPanelEnabled:", "setUsesFontPanel:") ("setHorizResizable:", "setHorizontallyResizable:"), ("setParaStyle:", "setParagraphStyle:"), ("setSel::", "setSelectionStart:end:"), ("setSelFont:paraStyle:", "setSelFont:paragraphStyle:"), ("setText:", "setString:"), ("setVertResizable:", "setVerticallyResizable:"), } /*********** TextConversion: default font *************/ replace "[<isKindOf(NSText) text> getDefaultFont]" with "[NSCStringText defaultFont]" replace "= [<isKindOf(NSText) text> setDefaultFont:<font>];" with same error "TextConversion: 'setDefaultFont' now returns void" replace "[<isKindOf(NSText) text> setDefaultFont:<font>]" with "[NSCStringText setDefaultFont:<font>]" /*********** TextConversion: opening and saving *************/ replacemethod "<old>" with "<new>" { replace "<flag_arg>" with "YES" } where ("<old>", "<new>") isOneOf { ("openRTFDFrom:","readRTFDFromFile:"), ("saveRTFDTo:saveRTFDTo:saveRTFDTo:","writeRTFDToFile:atomically:<flag>") } replace "([<text> readRTFDFromFile:<file>] == NSRTFDErrorNone)" with "([<text> readRTFDFromFile:<file>])" replace "([<text> readRTFDFromFile:<file>] != NSRTFDErrorNone)" with "(![<text> readRTFDFromFile:<file>])" replace "([<text> readRTFDFromFile:<file> atomically:<flag>] == NSRTFDErrorNone)" with "([<text> readRTFDFromFile:<file> atomically:<flag>])" replace "([<text> writeRTFDToFile:<file> atomically:<flag>] != NSRTFDErrorNone)" with "(![<text> writeRTFDToFile:<file> atomically:<flag>])" /*********** TextConversion: obsolete methods *************/ replacemethod "<sel>" with same error "TextConversion: <sel> is obsolete" where "<sel>" isOneOf { "replaceSelWithView:", "locationOfView:", "offsetFromPosition:", "positionFromOffset:" } replacemethod "getSubstring:<buf> start:<start> length:<length>" with "substringFromRange:<range>" { replace "<rettype>" with "(NSString *)" replace "<call>" with "<buf_arg> = [<call> cString]" replace "<range_type>" with "(NSRange)" replace "<range_param>" with "range" replace "<range_arg>" with "NSMakeRange(<start_arg>, <length_arg>)" } within ("<implementation>") { replace "<start_param>" with "range.location" replace "<length_param>" with "range.length" } warning "TextConversion: 'substringFromRange:' used to be 'getSubstring:start:length:'; make sure the range is valid." /*********** TextConversion: other streams *************/ replacemethod "readRichText:forView:" with same error "TextConversion: 'readRichText:forView:' takes an NSString instance as its first argument (used to take NXStream)" replacemethod "writeRichText:<stream>forView:<view>" with "richTextForView:<view>" { replace "<rettype>" with "(NSString *)" replace "<call>" with "<stream_arg> = <call>" } error "TextConversion: 'richTextForView:' (used to be 'writeRichText:forView') now returns the rich text as an NSString instance (used to write to an NXStream)" /*********** TextConversion: word tables *************/ replace "NXWriteWordTable(<stream>, <b args>)" with "<stream> = NSDataWithWordTable(<b args>)" error "TextConversion: NSDataWithWordTable() (used to be NXWriteWordTable()) returns an NSData instance (used to receive NSStream: <stream>)" replace "NXReadWordTable(<b args>)" with "NSReadWordTable(<b args>)" error "TextConversion: NSReadWordTable() (used to be NXReadWordTable()) takes an NSData instance for its second argument (used to take NSStream)" /*********** TextConversion: string cleanup *************/ replace "[NSString stringWithCString:[NSString stringWithCString:<aString>]]" with "[NSString stringWithCString:<aString>]" replace "[[NSString stringWithCString:<aString>] cString]" with "<aString>" replace "[[<aString> cString] cString]" with "[<aString> cString]" replace "[NSString stringWithCString:[<aString> cString]]" with "<aString>" replace "[NSString stringWithCString:@<string stringconst>]" with "@<string stringconst>" replace "[NSString stringWithCString:<string stringconst>]" with "@<string stringconst>" replace "[<aString> cString] = [<anotherString> cString]" with "<aString> = <anotherString>" replace "[@<string stringconst> cString]" with "<string stringconst>"