home *** CD-ROM | disk | FTP | other *** search
- /*********** HashToDictConversion: declaration, creation ***********/
- replace "\<objc/HashTable.h>" with "<Foundation/NSDictionary.h>"
-
- replace "\<objc/NXStringTable.h>" with "<Foundation/NSDictionary.h>"
-
- replace "[[HashTable <alloc>] <hashinit>]" with "[[NSMutableDictionary <alloc>] <dictinit>]"
- where ("<hashinit>", "<dictinit>") isOneOf {
- ("init", "init"),
- ("initKeyDesc:", "init"),
- ("initKeyDesc:valueDesc:", "init"),
- ("initKeyDesc:valueDesc:capacity:<cap>", "initWithCapacity:<cap>"),
- }
-
- replace "HashTable" with "NSMutableDictionary"
-
- /*********** HashToDictConversion: inserting ***********/
-
- replace "{ <w w> <obj> = [<hash> insertKey:<key> value:<value>]" with "{<w w><obj> = [<hash> valueForKey:<key>]; [<hash> insertKey:<key> value:<value>]"
-
- replace "; <w w> <obj> = [<hash> insertKey:<key> value:<value>]" with ";<w w><obj> = [<hash> valueForKey:<key>];<w w>[<hash> insertKey:<key> value:<value>]"
-
- replace ") <w w> <obj> = [<hash> insertKey:<key> value:<value>];" with ") {<w w><obj> = [<hash> valueForKey:<key>];<w w>[<hash> insertKey:<key> value:<value>];<w w>}"
-
- replace "} <w w> <obj> = [<hash> insertKey:<key> value:<value>]" with "}<w w><obj> = [<hash> valueForKey:<key>];<w w>[<hash> insertKey:<key> value:<value>]"
-
- replace "<obj> = [<hash> insertKey:<key> value:<value>];" with "<obj> = [<hash> valueForKey:<key>];<w w>[<hash> insertKey:<key> value:<value>];<w w>}"
-
- replacemethod "insertKey:<key> value:<value>" with "setObject:<value> forKey:<key>" {
- replace "<key_arg>" with "[NSString stringWithCString:<key_arg>]"
- }
-
- /*********** HashToDictConversion: accessing ***********/
-
- replace "![<hash> isKey:<key>]" with "([<hash> objectForKey:[NSString stringWithCString:<key>]] == nil)"
-
- replace "[<hash> isKey:<key>]" with "([<hash> objectForKey:[NSString stringWithCString:<key>]] != nil)"
-
- replacemethod "valueForKey:<key>" with "objectForKey:<key>" {
- replace "<key_arg>" with "[NSString stringWithCString:<key_arg>]"
- }
-
- /*********** HashToDictConversion: removing ***********/
-
- replacemethod "removeKey:" with "removeObjectForKey:"
-
- /*********** HashToDictConversion: enumerating ***********/
-
- replace "NXInitHashState" with same
- warning "HashAndStringTableConversion: If converting to NSDictionary, you want to use an enumerator here. See [NSDictionary keyEnumerator]."
-
- replace "NXNextHashState" with same
- warning "HashAndStringTableConversion: If converting to NSDictionary, you want to use an enumerator here. See [NSDictionary keyEnumerator]."
-
- replace "initState" with same
- warning "HashAndStringTableConversion: If converting to NSDictionary, you want to use an enumerator here. See [NSDictionary keyEnumerator]."
-
- replace "nextState:" with same
- warning "HashAndStringTableConversion: If converting to NSDictionary, you want to use an enumerator here. See [NSDictionary keyEnumerator]."
-
-
- /*********** HashToDictConversion: freeing ***********/
-
- replacemethod "freeObjects" with "removeAllObjects"
-
- replacemethod "freeKeys:values:" with same
- error "HashAndStringTableConversion: the HashTable method 'freeKeys:values:' must be converted to an NSMutableDictionary method"
-
- /*********** StringTableConversion: allocation ***********/
-
- replace "[NXStringTable alloc]" with "[NSDictionary alloc]"
- replace "[NXStringTable allocWithZone:<zone>]" with "[NSDictionary allocWithZone:<zone>]"
- replace "[NXStringTable newFromFile:<file>]" with "[[NSDictionary alloc] initWithDictionary:[[NSString stringWithContentsOfFile:[NSString stringWithCString:<file>]] propertyListFromStringsFileFormat]]"
- replace "NXStringTable" with "NSDictionary"
-
- /*********** StringTableConversion: reading ***********/
-
- replace "[<stringTable> readFromFile:<file>]" with "[<stringTable> addEntriesFromDictionary:[[NSString stringWithContentsOfFile:[NSString stringWithCString:<file>]] propertyListFromStringsFileFormat]]"
-
- /*********** StringTableConversion: writing ***********/
-
- replace "[<stringTable> writeToFile:<file>]" with "[[<stringTable> descriptionInStringsFileFormat] writeToFile:[NSString stringWithCString:<file>] atomically:NO]"
-
- /*********** StringTableConversion: accessing ***********/
-
- replace "[<stringTable> valueForStringKey:<file>]" with "[<stringTable> objectForKey:[NSString stringWithCString:<file>]]"
-
- /*********** Fix up sub-optimal conversions ***********/
-
- replace "[NSString stringWithCString:<string stringconst>]" with "@<string stringconst>"
-
-