home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OpenStep 4.2J (Developer)
/
os42jdev.iso
/
NextDeveloper
/
OpenStepConversion
/
ConversionScripts
/
ListToMutableArray.tops
< prev
next >
Wrap
Text File
|
1996-05-02
|
3KB
|
104 lines
/*********** ListToMutableArray: declarations ***********/
replace "\<objc/List.h>" with "<Foundation/NSArray.h>"
replace "[List new]" with "[[NSMutableArray alloc] init]"
replace "List" with "NSMutableArray"
/*********** ListToMutableArray: simple renaming ***********/
replacemethod "<old>" with "<new>"
where ("<old>", "<new>") isOneOf {
("initCount:", "initWithCapacity:"),
("appendList:", "addObjectsFromArray:"),
("empty", "removeAllObjects"),
("freeObjects", "removeAllObjects"),
("indexOf:", "indexOfObject:"),
("insertObject:at:", "insertObject:atIndex:"),
("makeObjectsPerform:with:", "makeObjectsPerform:withObject:")
("objectAt:", "objectAtIndex:"),
("removeObjectAt:", "removeObjectAtIndex:"),
("replaceObjectAt:with:", "replaceObjectAtIndex:withObject:"),
}
/* a common case of nesting */
replace "[[<obj> removeAllObjects] free]" "[<obj> free]"
replace "NX_NOT_IN_LIST" with "NSNotFound"
/*********** ListToMutableArray: a few exceptions ***********/
replace "[<rec> addObjectIfAbsent:<obj>];" with "if (![<rec> containsObject:<obj>]) [<rec> addObject:<obj>];"
/*********** ListToMutableArray: raises instead of returning nil ***********/
replace "([<rec> <method>]" with same
error "ListToMutableArray: <method> raises when List equivalent returned nil"
where "<method>" isOneOf {
"lastObject",
"objectAtIndex:<index>",
"removeLastObject",
"removeObject:<obj>",
"removeObjectAtIndex:<index>",
"replaceObject:<obj1> withObject:<obj2>",
"replaceObjectAtIndex:<index> withObject:<obj2>",
}
replace "(<t list> = [<rec> <method>]" with same
error "ListToMutableArray: <method> raises when List equivalent returned nil"
where "<method>" isOneOf {
"lastObject",
"objectAtIndex:<index>",
"removeLastObject",
"removeObject:<obj>",
"removeObjectAtIndex:<index>",
"replaceObject:<obj1> withObject:<obj2>",
"replaceObjectAtIndex:<index> withObject:<obj2>",
}
replace "&& [<rec> <method>]" with same
error "ListToMutableArray: <method> raises when List equivalent returned nil"
where "<method>" isOneOf {
"lastObject",
"objectAtIndex:<index>",
}
replace "&& [<rec> <method>]" with same
error "ListToMutableArray: <method> raises when List equivalent returned nil"
where "<method>" isOneOf {
"lastObject",
"objectAtIndex:<index>",
"removeLastObject",
"removeObject:<obj>",
"removeObjectAtIndex:<index>",
"replaceObject:<obj1> withObject:<obj2>",
"replaceObjectAtIndex:<index> withObject:<obj2>",
}
replace "![<rec> <method>]" with same
error "ListToMutableArray: <method> raises when List equivalent returned nil"
where "<method>" isOneOf {
"lastObject",
"objectAtIndex:<index>",
"removeLastObject",
"removeObject:<obj>",
"removeObjectAtIndex:<index>",
"replaceObject:<obj1> withObject:<obj2>",
"replaceObjectAtIndex:<index> withObject:<obj2>",
}
/*********** ListToMutableArray: functionality no longer avaliable ***********/
replacemethod "<sel>" with same
error "ListToMutableArray: NSArray contains no functionality for altering or inspecting the capacity"
where "<sel>" isOneOf {
"capacity",
"setAvailableCapacity:"
}
/*********** ListToMutableArray: obsolete macro ***********/
replace "NX_ADDRESS(<b list>)" with same
error "ListToMutableArray: NX_ADDRESS is obsolete"