home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / ConversionScripts / ListToMutableArray.tops < prev    next >
Text File  |  1996-05-02  |  3KB  |  104 lines

  1. /*********** ListToMutableArray: declarations ***********/
  2.  
  3. replace "\<objc/List.h>" with "<Foundation/NSArray.h>"
  4.  
  5. replace "[List new]" with "[[NSMutableArray alloc] init]"
  6. replace "List" with "NSMutableArray"
  7.  
  8. /*********** ListToMutableArray: simple renaming ***********/
  9.  
  10. replacemethod "<old>" with "<new>"
  11.     where ("<old>", "<new>") isOneOf {
  12.     ("initCount:", "initWithCapacity:"),
  13.     ("appendList:", "addObjectsFromArray:"),
  14.     ("empty", "removeAllObjects"),
  15.     ("freeObjects", "removeAllObjects"),
  16.     ("indexOf:", "indexOfObject:"),
  17.     ("insertObject:at:", "insertObject:atIndex:"),
  18.     ("makeObjectsPerform:with:", "makeObjectsPerform:withObject:")
  19.     ("objectAt:", "objectAtIndex:"),
  20.     ("removeObjectAt:", "removeObjectAtIndex:"),
  21.     ("replaceObjectAt:with:", "replaceObjectAtIndex:withObject:"),
  22.     }
  23.  
  24. /* a common case of nesting */
  25. replace "[[<obj> removeAllObjects] free]" "[<obj> free]"
  26.  
  27. replace "NX_NOT_IN_LIST" with "NSNotFound"
  28.  
  29. /*********** ListToMutableArray: a few exceptions ***********/
  30.  
  31. replace "[<rec> addObjectIfAbsent:<obj>];" with "if (![<rec> containsObject:<obj>]) [<rec> addObject:<obj>];"
  32.  
  33. /*********** ListToMutableArray: raises instead of returning nil ***********/
  34.  
  35. replace "([<rec> <method>]" with same
  36.     error "ListToMutableArray: <method> raises when List equivalent returned nil"
  37.     where "<method>" isOneOf {
  38.     "lastObject",
  39.     "objectAtIndex:<index>",
  40.     "removeLastObject",
  41.     "removeObject:<obj>",
  42.     "removeObjectAtIndex:<index>",
  43.     "replaceObject:<obj1> withObject:<obj2>",
  44.     "replaceObjectAtIndex:<index> withObject:<obj2>",
  45.     }
  46.  
  47. replace "(<t list> = [<rec> <method>]" with same
  48.     error "ListToMutableArray: <method> raises when List equivalent returned nil"
  49.     where "<method>" isOneOf {
  50.     "lastObject",
  51.     "objectAtIndex:<index>",
  52.     "removeLastObject",
  53.     "removeObject:<obj>",
  54.     "removeObjectAtIndex:<index>",
  55.     "replaceObject:<obj1> withObject:<obj2>",
  56.     "replaceObjectAtIndex:<index> withObject:<obj2>",
  57.     }
  58.  
  59. replace "&& [<rec> <method>]" with same
  60.     error "ListToMutableArray: <method> raises when List equivalent returned nil"
  61.     where "<method>" isOneOf {
  62.     "lastObject",
  63.     "objectAtIndex:<index>",
  64.     }
  65.  
  66. replace "&& [<rec> <method>]" with same
  67.     error "ListToMutableArray: <method> raises when List equivalent returned nil"
  68.     where "<method>" isOneOf {
  69.     "lastObject",
  70.     "objectAtIndex:<index>",
  71.     "removeLastObject",
  72.     "removeObject:<obj>",
  73.     "removeObjectAtIndex:<index>",
  74.     "replaceObject:<obj1> withObject:<obj2>",
  75.     "replaceObjectAtIndex:<index> withObject:<obj2>",
  76.     }
  77.  
  78. replace "![<rec> <method>]" with same
  79.     error "ListToMutableArray: <method> raises when List equivalent returned nil"
  80.     where "<method>" isOneOf {
  81.     "lastObject",
  82.     "objectAtIndex:<index>",
  83.     "removeLastObject",
  84.     "removeObject:<obj>",
  85.     "removeObjectAtIndex:<index>",
  86.     "replaceObject:<obj1> withObject:<obj2>",
  87.     "replaceObjectAtIndex:<index> withObject:<obj2>",
  88.     }
  89.  
  90. /*********** ListToMutableArray: functionality no longer avaliable ***********/
  91.  
  92. replacemethod "<sel>" with same
  93.     error "ListToMutableArray: NSArray contains no functionality for altering or inspecting the capacity"
  94.     where "<sel>" isOneOf {
  95.     "capacity",
  96.     "setAvailableCapacity:"
  97.     }
  98.  
  99. /*********** ListToMutableArray: obsolete macro ***********/
  100.  
  101. replace "NX_ADDRESS(<b list>)" with same
  102.     error "ListToMutableArray: NX_ADDRESS is obsolete"
  103.     
  104.