diff --git a/19.01 CarParts Error/.DS_Store b/19.01 CarParts Error/.DS_Store new file mode 100644 index 0000000..c48e13d Binary files /dev/null and b/19.01 CarParts Error/.DS_Store differ diff --git a/19.01 CarParts Error/CarParts Error.xcodeproj/project.pbxproj b/19.01 CarParts Error/CarParts Error.xcodeproj/project.pbxproj new file mode 100644 index 0000000..12d9c56 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error.xcodeproj/project.pbxproj @@ -0,0 +1,271 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8466552A1537E5DC004C0137 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 846655291537E5DC004C0137 /* Foundation.framework */; }; + 8466552D1537E5DC004C0137 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8466552C1537E5DC004C0137 /* main.m */; }; + 846655311537E5DC004C0137 /* CarParts_Error.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 846655301537E5DC004C0137 /* CarParts_Error.1 */; }; + 846655471537E638004C0137 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 8466553C1537E638004C0137 /* AllWeatherRadial.m */; }; + 846655481537E638004C0137 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 8466553E1537E638004C0137 /* Car.m */; }; + 846655491537E638004C0137 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 846655401537E638004C0137 /* Engine.m */; }; + 8466554A1537E638004C0137 /* Garage.m in Sources */ = {isa = PBXBuildFile; fileRef = 846655421537E638004C0137 /* Garage.m */; }; + 8466554B1537E638004C0137 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 846655441537E638004C0137 /* Slant6.m */; }; + 8466554C1537E638004C0137 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 846655461537E638004C0137 /* Tire.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 846655231537E5DC004C0137 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 846655311537E5DC004C0137 /* CarParts_Error.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 846655251537E5DC004C0137 /* CarParts Error */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "CarParts Error"; sourceTree = BUILT_PRODUCTS_DIR; }; + 846655291537E5DC004C0137 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 8466552C1537E5DC004C0137 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 8466552F1537E5DC004C0137 /* CarParts Error-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CarParts Error-Prefix.pch"; sourceTree = ""; }; + 846655301537E5DC004C0137 /* CarParts_Error.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = CarParts_Error.1; sourceTree = ""; }; + 8466553B1537E638004C0137 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 8466553C1537E638004C0137 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 8466553D1537E638004C0137 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 8466553E1537E638004C0137 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 8466553F1537E638004C0137 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 846655401537E638004C0137 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 846655411537E638004C0137 /* Garage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Garage.h; sourceTree = ""; }; + 846655421537E638004C0137 /* Garage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Garage.m; sourceTree = ""; }; + 846655431537E638004C0137 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 846655441537E638004C0137 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 846655451537E638004C0137 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 846655461537E638004C0137 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 846655221537E5DC004C0137 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8466552A1537E5DC004C0137 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 8466551A1537E5DC004C0137 = { + isa = PBXGroup; + children = ( + 8466552B1537E5DC004C0137 /* CarParts Error */, + 846655281537E5DC004C0137 /* Frameworks */, + 846655261537E5DC004C0137 /* Products */, + ); + sourceTree = ""; + }; + 846655261537E5DC004C0137 /* Products */ = { + isa = PBXGroup; + children = ( + 846655251537E5DC004C0137 /* CarParts Error */, + ); + name = Products; + sourceTree = ""; + }; + 846655281537E5DC004C0137 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 846655291537E5DC004C0137 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 8466552B1537E5DC004C0137 /* CarParts Error */ = { + isa = PBXGroup; + children = ( + 8466552C1537E5DC004C0137 /* main.m */, + 8466553B1537E638004C0137 /* AllWeatherRadial.h */, + 8466553C1537E638004C0137 /* AllWeatherRadial.m */, + 8466553D1537E638004C0137 /* Car.h */, + 8466553E1537E638004C0137 /* Car.m */, + 8466553F1537E638004C0137 /* Engine.h */, + 846655401537E638004C0137 /* Engine.m */, + 846655411537E638004C0137 /* Garage.h */, + 846655421537E638004C0137 /* Garage.m */, + 846655431537E638004C0137 /* Slant6.h */, + 846655441537E638004C0137 /* Slant6.m */, + 846655451537E638004C0137 /* Tire.h */, + 846655461537E638004C0137 /* Tire.m */, + 846655301537E5DC004C0137 /* CarParts_Error.1 */, + 8466552E1537E5DC004C0137 /* Supporting Files */, + ); + path = "CarParts Error"; + sourceTree = ""; + }; + 8466552E1537E5DC004C0137 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 8466552F1537E5DC004C0137 /* CarParts Error-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 846655241537E5DC004C0137 /* CarParts Error */ = { + isa = PBXNativeTarget; + buildConfigurationList = 846655341537E5DC004C0137 /* Build configuration list for PBXNativeTarget "CarParts Error" */; + buildPhases = ( + 846655211537E5DC004C0137 /* Sources */, + 846655221537E5DC004C0137 /* Frameworks */, + 846655231537E5DC004C0137 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "CarParts Error"; + productName = "CarParts Error"; + productReference = 846655251537E5DC004C0137 /* CarParts Error */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8466551C1537E5DC004C0137 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; + buildConfigurationList = 8466551F1537E5DC004C0137 /* Build configuration list for PBXProject "CarParts Error" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 8466551A1537E5DC004C0137; + productRefGroup = 846655261537E5DC004C0137 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 846655241537E5DC004C0137 /* CarParts Error */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 846655211537E5DC004C0137 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8466552D1537E5DC004C0137 /* main.m in Sources */, + 846655471537E638004C0137 /* AllWeatherRadial.m in Sources */, + 846655481537E638004C0137 /* Car.m in Sources */, + 846655491537E638004C0137 /* Engine.m in Sources */, + 8466554A1537E638004C0137 /* Garage.m in Sources */, + 8466554B1537E638004C0137 /* Slant6.m in Sources */, + 8466554C1537E638004C0137 /* Tire.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 846655321537E5DC004C0137 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 846655331537E5DC004C0137 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + SDKROOT = macosx; + }; + name = Release; + }; + 846655351537E5DC004C0137 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "CarParts Error/CarParts Error-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 846655361537E5DC004C0137 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "CarParts Error/CarParts Error-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8466551F1537E5DC004C0137 /* Build configuration list for PBXProject "CarParts Error" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 846655321537E5DC004C0137 /* Debug */, + 846655331537E5DC004C0137 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 846655341537E5DC004C0137 /* Build configuration list for PBXNativeTarget "CarParts Error" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 846655351537E5DC004C0137 /* Debug */, + 846655361537E5DC004C0137 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 8466551C1537E5DC004C0137 /* Project object */; +} diff --git a/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..18970d6 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate b/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..f771b96 Binary files /dev/null and b/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarParts Error.xcscheme b/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarParts Error.xcscheme new file mode 100644 index 0000000..efa0434 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarParts Error.xcscheme @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..5b9534b --- /dev/null +++ b/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + CarParts Error.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 846655241537E5DC004C0137 + + primary + + + + + diff --git a/19.01 CarParts Error/CarParts Error/AllWeatherRadial.h b/19.01 CarParts Error/CarParts Error/AllWeatherRadial.h new file mode 100644 index 0000000..5b3eaa8 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/AllWeatherRadial.h @@ -0,0 +1,12 @@ +#import +#import "Tire.h" + +@interface AllWeatherRadial : Tire { + float rainHandling; + float snowHandling; +} + +@property float rainHandling; +@property float snowHandling; + +@end // AllWeatherRadial diff --git a/19.01 CarParts Error/CarParts Error/AllWeatherRadial.m b/19.01 CarParts Error/CarParts Error/AllWeatherRadial.m new file mode 100644 index 0000000..ed138a1 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/AllWeatherRadial.m @@ -0,0 +1,49 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +@synthesize rainHandling; +@synthesize snowHandling; + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super initWithPressure: p treadDepth: td]) + { + rainHandling = 23.7; + snowHandling = 42.5; + } + + return (self); + +} // initWithPressure:treadDepth + + +- (id) copyWithZone: (NSZone *) zone +{ + AllWeatherRadial *tireCopy; + tireCopy = [super copyWithZone: zone]; + + [tireCopy setRainHandling: rainHandling]; + [tireCopy setSnowHandling: snowHandling]; + + return (tireCopy); + +} // copyWithZone + + +- (NSString *) description +{ + NSString *desc; + desc = [[NSString alloc] initWithFormat: + @"AllWeatherRadial: %.1f / %.1f / %.1f / %.1f", + [self pressure], [self treadDepth], + [self rainHandling], + [self snowHandling]]; + + return (desc); + +} // description + +@end // AllWeatherRadial + diff --git a/19.01 CarParts Error/CarParts Error/Car.h b/19.01 CarParts Error/CarParts Error/Car.h new file mode 100644 index 0000000..dbd8ce5 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Car.h @@ -0,0 +1,31 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +{ + NSString *name; + NSMutableArray *tires; + Engine *engine; + + NSString *make; + NSString *model; + int modelYear; + int numberOfDoors; + float mileage; +} + +@property (readwrite, copy) NSString *name; +@property (readwrite, retain) Engine *engine; +@property (readwrite, copy) NSString *make; +@property (readwrite, copy) NSString *model; +@property (readwrite) int modelYear; +@property (readwrite) int numberOfDoors; +@property (readwrite) float mileage; + +- (void) setTire: (Tire *) tire atIndex: (int) index; +- (Tire *) tireAtIndex: (int) index; +- (void) print; + +@end // Car diff --git a/19.01 CarParts Error/CarParts Error/Car.m b/19.01 CarParts Error/CarParts Error/Car.m new file mode 100644 index 0000000..827b4d5 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Car.m @@ -0,0 +1,127 @@ +#import "Car.h" + +#import "Engine.h" + +@implementation Car + +@synthesize name; +@synthesize engine; +@synthesize make; +@synthesize model; +@synthesize modelYear; +@synthesize numberOfDoors; +@synthesize mileage; + +- (id) init +{ + if (self = [super init]) { + + self.name = @"Car"; + tires = [[NSMutableArray alloc] init]; + + for (int i = 0; i < 4; i++) { + [tires addObject: [NSNull null]]; + } + } + + return (self); + +} // init + + +- (id) copyWithZone: (NSZone *) zone +{ + Car *carCopy; + carCopy = [[[self class] + allocWithZone: zone] + init]; + + carCopy.name = name; + carCopy.make = make; + carCopy.model = model; + carCopy.numberOfDoors = numberOfDoors; + carCopy.mileage = mileage; + + Engine *engineCopy; + engineCopy = [[engine copy] autorelease]; + carCopy.engine = engineCopy; + + for (int i = 0; i < 4; i++) + { + Tire *tireCopy; + + tireCopy = [[self tireAtIndex: i] copy]; + [tireCopy autorelease]; + + [carCopy setTire: tireCopy + atIndex: i]; + } + + return (carCopy); + +} // copyWithZone + + +- (void) dealloc +{ + self.name = nil; + [tires release]; + [engine release]; + + [super dealloc]; + +} // dealloc + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + [tires replaceObjectAtIndex: index + withObject: tire]; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + Tire *tire; + tire = [tires objectAtIndex: index]; + + return (tire); + +} // tireAtIndex: + + +- (void) print +{ + NSString *desc = [self description]; + NSLog (@"%@", desc); + +} // print + + +- (NSString *) description { + NSString *desc; + desc = [NSString stringWithFormat: + @"%@, a %d %@ %@, has %d doors, %.1f miles, %d hp and %d tires", + name, modelYear, make, model, numberOfDoors, mileage, [engine horsepower], + [tires count]]; + + return desc; + +} // description + + +- (void) setNilValueForKey: (NSString *) key { + if ([key isEqualToString: @"mileage"]) { + mileage = 0; + } else { + [super setNilValueForKey: key]; + } +} // setNilValueForKey + +- (void)processMyObject:(id)object error:(NSError **)error +{ +} +@end // Car + diff --git a/19.01 CarParts Error/CarParts Error/CarParts Error-Prefix.pch b/19.01 CarParts Error/CarParts Error/CarParts Error-Prefix.pch new file mode 100644 index 0000000..58cb85d --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/CarParts Error-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'CarParts Error' target in the 'CarParts Error' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/19.01 CarParts Error/CarParts Error/CarParts_Error.1 b/19.01 CarParts Error/CarParts Error/CarParts_Error.1 new file mode 100644 index 0000000..39f4f4d --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/CarParts_Error.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 4/12/12 \" DATE +.Dt CarParts Error 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm CarParts Error, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/19.01 CarParts Error/CarParts Error/Engine.h b/19.01 CarParts Error/CarParts Error/Engine.h new file mode 100644 index 0000000..80b4a1f --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Engine.h @@ -0,0 +1,9 @@ +#import + +@interface Engine : NSObject { + int horsepower; +} +@property (readwrite) int horsepower; + +@end // Engine + diff --git a/19.01 CarParts Error/CarParts Error/Engine.m b/19.01 CarParts Error/CarParts Error/Engine.m new file mode 100644 index 0000000..cc8a467 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Engine.m @@ -0,0 +1,40 @@ +#import "Engine.h" + +@implementation Engine +@synthesize horsepower; + +- (id) init { + if (self = [super init]) { + horsepower = 145; + } + + return (self); + +} // init + + +- (id) copyWithZone: (NSZone *) zone +{ + Engine *engineCopy; + engineCopy = [[[self class] + allocWithZone: zone] + init]; + [engineCopy setValue: [NSNumber numberWithInt: horsepower] + forKey: @"horsepower"]; + + return (engineCopy); + +} // copyWithZone + + +- (NSString *) description +{ + NSString *description; + description = [NSString stringWithFormat: + @"I am an engine. Vrooom! %d HP", horsepower]; + return (description); + +} // description + +@end // Engine + diff --git a/19.01 CarParts Error/CarParts Error/Garage.h b/19.01 CarParts Error/CarParts Error/Garage.h new file mode 100644 index 0000000..92104b8 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Garage.h @@ -0,0 +1,26 @@ +// +// Garage.h +// 15.01 Car-Value-Coding +// +// Created by markd on 8/16/08. +// Copyright 2008 Length-O-Words.com. All rights reserved. +// + +#import + +@class Car; + +@interface Garage : NSObject { + NSString *name; + NSMutableArray *cars; + NSMutableDictionary *stuff; +} +@property (readonly, retain) NSMutableArray *cars; + +@property (readwrite, copy) NSString *name; + +- (void) addCar: (Car *) car; + +- (void) print; + +@end // Garage diff --git a/19.01 CarParts Error/CarParts Error/Garage.m b/19.01 CarParts Error/CarParts Error/Garage.m new file mode 100644 index 0000000..192e0cd --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Garage.m @@ -0,0 +1,61 @@ +// +// Garage.m +// 15.01 Car-Value-Coding +// +// Created by markd on 8/16/08. +// Copyright 2008 Length-O-Words.com. All rights reserved. +// + +#import "Garage.h" + +@implementation Garage + +@synthesize name; +@synthesize cars; + +- (void) addCar: (Car *) car { + if (cars == nil) { + cars = [[NSMutableArray alloc] init]; + } + [cars addObject: car]; + +} // addCar + + +- (void) dealloc +{ + [name release]; + [cars release]; + [stuff release]; + [super dealloc]; +} // dealloc + + +- (void) print { + NSLog (@"%@:", name); + + for (Car *car in cars) + { + NSLog (@" %@", car); + } + +} // print + + +- (void) setValue: (id) value forUndefinedKey: (NSString *) key +{ + if (stuff == nil) { + stuff = [[NSMutableDictionary alloc] init]; + } + [stuff setValue: value forKey: key]; +} // setValueForUndefinedKey + + +- (id) valueForUndefinedKey:(NSString *)key +{ + id value = [stuff valueForKey: key]; + return (value); +} // valueForUndefinedKey + + +@end // Car diff --git a/19.01 CarParts Error/CarParts Error/Slant6.h b/19.01 CarParts Error/CarParts Error/Slant6.h new file mode 100644 index 0000000..22716ed --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Slant6.h @@ -0,0 +1,6 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + + diff --git a/19.01 CarParts Error/CarParts Error/Slant6.m b/19.01 CarParts Error/CarParts Error/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/19.01 CarParts Error/CarParts Error/Tire.h b/19.01 CarParts Error/CarParts Error/Tire.h new file mode 100644 index 0000000..27552c8 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Tire.h @@ -0,0 +1,16 @@ +#import + +@interface Tire : NSObject { + float pressure; + float treadDepth; +} +@property float pressure; +@property float treadDepth; + +- (id) initWithPressure: (float) pressure; +- (id) initWithTreadDepth: (float) treadDepth; + +- (id) initWithPressure: (float) pressure + treadDepth: (float) treadDepth; + +@end // Tire diff --git a/19.01 CarParts Error/CarParts Error/Tire.m b/19.01 CarParts Error/CarParts Error/Tire.m new file mode 100644 index 0000000..6132de6 --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/Tire.m @@ -0,0 +1,78 @@ +#import "Tire.h" + + +@implementation Tire + +@synthesize pressure; +@synthesize treadDepth; + +- (id) init +{ + if (self = [self initWithPressure: 34 + treadDepth: 20]) { + } + + return (self); + +} // init + + +- (id) copyWithZone: (NSZone *) zone +{ + Tire *tireCopy; + tireCopy = [[[self class] allocWithZone: zone] + initWithPressure: pressure + treadDepth: treadDepth]; + + return (tireCopy); + +} // copyWithZone + + +- (id) initWithPressure: (float) p +{ + if (self = [self initWithPressure: p + treadDepth: 20.0]) { + } + + return (self); + +} // initWithPressure + + +- (id) initWithTreadDepth: (float) td +{ + if (self = [self initWithPressure: 34.0 + treadDepth: td]) { + } + + return (self); + +} // initWithTreadDepth + + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super init]) { + pressure = p; + treadDepth = td; + } + + return (self); + +} // initWithPressure:treadDepth: + + +- (NSString *) description +{ + NSString *desc; + desc = [NSString stringWithFormat: + @"Tire: Pressure: %.1f TreadDepth: %.1f", + pressure, treadDepth]; + return (desc); + +} // description + +@end // Tire + diff --git a/19.01 CarParts Error/CarParts Error/main.m b/19.01 CarParts Error/CarParts Error/main.m new file mode 100644 index 0000000..966822e --- /dev/null +++ b/19.01 CarParts Error/CarParts Error/main.m @@ -0,0 +1,292 @@ +// +// main.m +// CarPartsPredicate +// +// Created by Waqar Malik on 2/1/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import +#import "Car.h" +#import "Engine.h" +#import "Garage.h" +#import "Slant6.h" +#import "Tire.h" + +Car *makeCar (NSString *name, NSString *make, NSString *model, + int modelYear, int numberOfDoors, float mileage, + int horsepower); + +int main (int argc, const char * argv[]) +{ + NSAutoreleasePool *pool; + pool = [[NSAutoreleasePool alloc] init]; + + Garage *garage = [[Garage alloc] init]; + garage.name = @"Joe's Garage"; + + Car *car; + car = makeCar (@"Herbie", @"Honda", @"CRX", 1984, 2, 34000, 58); + [garage addCar: car]; + + NSPredicate *predicate; + predicate = [NSPredicate predicateWithFormat: @"name == 'Herbie'"]; + BOOL match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > 150"]; + match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + predicate = [NSPredicate predicateWithFormat: @"name == %@", @"Herbie"]; + match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + predicate = [NSPredicate predicateWithFormat: @"%K == %@", @"name", @"Herbie"]; + match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + NSPredicate *predicateTemplate = [NSPredicate predicateWithFormat:@"name == $NAME"]; + NSDictionary *varDict; + varDict = [NSDictionary dictionaryWithObjectsAndKeys: + @"Herbie", @"NAME", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables: varDict]; + NSLog(@"SNORGLE: %@", predicate); + match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + + car = makeCar (@"Badger", @"Acura", @"Integra", 1987, 5, 217036.7, 130); + [garage addCar: car]; + + car = makeCar (@"Elvis", @"Acura", @"Legend", 1989, 4, 28123.4, 151); + [garage addCar: car]; + + car = makeCar (@"Phoenix", @"Pontiac", @"Firebird", 1969, 2, 85128.3, 345); + [garage addCar: car]; + + car = makeCar (@"Streaker", @"Pontiac", @"Silver Streak", 1950, 2, 39100.0, 36); + [garage addCar: car]; + + car = makeCar (@"Judge", @"Pontiac", @"GTO", 1969, 2, 45132.2, 370); + [garage addCar: car]; + + car = makeCar (@"Paper Car", @"Plymouth", @"Valiant", 1965, 2, 76800, 105); + [garage addCar: car]; + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > 150"]; + NSArray *cars = [garage cars]; + for (Car *car in [garage cars]) + { + if ([predicate evaluateWithObject: car]) + { + NSLog (@"%@", car.name); + } + } + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > 150"]; + NSArray *results; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + NSArray *names; + names = [results valueForKey:@"name"]; + NSLog (@"%@", names); + + NSMutableArray *carsCopy = [cars mutableCopy]; + [carsCopy filterUsingPredicate: predicate]; + NSLog (@"%@", carsCopy); + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > %d", 50]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"engine.horsepower > $POWER"]; + varDict = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt: 150], @"POWER", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables: varDict]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: + @"(engine.horsepower > 50) AND (engine.horsepower < 200)"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"oop %@", results); + + predicate = [NSPredicate predicateWithFormat: @"name < 'Newton'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", [results valueForKey: @"name"]); + + predicate = [NSPredicate predicateWithFormat: + @"engine.horsepower BETWEEN { 50, 200 }"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + NSArray *betweens = [NSArray arrayWithObjects: + [NSNumber numberWithInt: 50], [NSNumber numberWithInt: 200], nil]; + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower BETWEEN %@", betweens]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"engine.horsepower BETWEEN $POWERS"]; + varDict = [NSDictionary dictionaryWithObjectsAndKeys: betweens, @"POWERS", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables: varDict]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name IN { 'Herbie', 'Snugs', 'Badger', 'Flap' }"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", [results valueForKey: @"name"]); + + predicate = [NSPredicate predicateWithFormat: @"SELF.name IN { 'Herbie', 'Snugs', 'Badger', 'Flap' }"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", [results valueForKey: @"name"]); + + names = [cars valueForKey: @"name"]; + predicate = [NSPredicate predicateWithFormat: @"SELF IN { 'Herbie', 'Snugs', 'Badger', 'Flap' }"]; + results = [names filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name BEGINSWITH 'Bad'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name BEGINSWITH 'HERB'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name BEGINSWITH[cd] 'HERB'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name LIKE[cd] '*er*'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name LIKE[cd] '???er*'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + NSArray *names1 = [NSArray arrayWithObjects: @"Herbie", @"Badger", @"Judge", @"Elvis", nil]; + NSArray *names2 = [NSArray arrayWithObjects: @"Judge", @"Paper Car", @"Badger", @"Phoenix", nil]; + + predicate = [NSPredicate predicateWithFormat: @"SELF IN %@", names1]; + results = [names2 filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", predicate); + NSLog (@"%@", results); + + return 0; + + predicate = [NSPredicate predicateWithFormat: @"modelYear > 1970"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name contains[cd] 'er'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name beginswith 'B'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"%K beginswith %@", + @"name", @"B"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"with args : %@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"name beginswith $NAME"]; + NSDictionary *dict = [NSDictionary + dictionaryWithObjectsAndKeys: @"Bad", @"NAME", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables:dict]; + NSLog (@"SNORGLE: %@", predicate); + + predicate = [NSPredicate predicateWithFormat: @"name in { 'Badger', 'Judge', 'Elvis' }"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"name in $NAME_LIST"]; + names = [NSArray arrayWithObjects:@"Badger", @"Judge", @"Elvis", nil]; + dict = [NSDictionary + dictionaryWithObjectsAndKeys: names, @"NAME_LIST", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables:dict]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"%K in $NAME_LIST", @"name"]; + dict = [NSDictionary + dictionaryWithObjectsAndKeys: names, @"NAME_LIST", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables:dict]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + NSLog (@"xSNORGLE: %@", predicate); + + // SELF is optional here. + predicate = [NSPredicate predicateWithFormat:@"SELF.name in { 'Badger', 'Judge', 'Elvis' }"]; + + for(Car *car in cars) + { + if ([predicate evaluateWithObject: car]) + { + NSLog (@"SNORK : %@ matches", car.name); + } + } + + +#if 0 + predicate = [NSPredicate predicateWithFormat: @"ANY engine.horsepower > 200"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"SNORGLE: %@", predicate); +#endif + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > 200"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"tires.@sum.pressure > 10"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + +#if 0 + predicate = [NSPredicate predicateWithFormat: @"ALL engine.horsepower > 30"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); +#endif + + + [garage release]; + + [pool release]; + + return (0); + +} // main + +Car *makeCar (NSString *name, NSString *make, NSString *model, + int modelYear, int numberOfDoors, float mileage, + int horsepower) { + Car *car = [[[Car alloc] init] autorelease]; + + car.name = name; + car.make = make; + car.model = model; + car.modelYear = modelYear; + car.numberOfDoors = numberOfDoors; + car.mileage = mileage; + + Slant6 *engine = [[[Slant6 alloc] init] autorelease]; + [engine setValue: [NSNumber numberWithInt: horsepower] + forKey: @"horsepower"]; + car.engine = engine; + + + // Make some tires. + // int i; + for (int i = 0; i < 4; i++) + { + Tire * tire= [[[Tire alloc] init] autorelease]; + [car setTire: tire atIndex: i]; + } + + return (car); + +} // makeCar diff --git a/19.02 CarPartsPredicate Fixed/.DS_Store b/19.02 CarPartsPredicate Fixed/.DS_Store new file mode 100644 index 0000000..f8f81bc Binary files /dev/null and b/19.02 CarPartsPredicate Fixed/.DS_Store differ diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.pbxproj b/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.pbxproj new file mode 100644 index 0000000..3af4a45 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.pbxproj @@ -0,0 +1,271 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8406BB8814DA50A200288C55 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8406BB8714DA50A200288C55 /* Foundation.framework */; }; + 8406BB8B14DA50A200288C55 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8406BB8A14DA50A200288C55 /* main.m */; }; + 8406BB8F14DA50A200288C55 /* CarPartsPredicate.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8406BB8E14DA50A200288C55 /* CarPartsPredicate.1 */; }; + 8413964E14DA511100190063 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 8413964314DA511100190063 /* AllWeatherRadial.m */; }; + 8413964F14DA511100190063 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 8413964514DA511100190063 /* Car.m */; }; + 8413965014DA511100190063 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 8413964714DA511100190063 /* Engine.m */; }; + 8413965114DA511100190063 /* Garage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8413964914DA511100190063 /* Garage.m */; }; + 8413965214DA511100190063 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 8413964B14DA511100190063 /* Slant6.m */; }; + 8413965314DA511100190063 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 8413964D14DA511100190063 /* Tire.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8406BB8114DA50A200288C55 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8406BB8F14DA50A200288C55 /* CarPartsPredicate.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 8406BB8314DA50A200288C55 /* CarPartsPredicate */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CarPartsPredicate; sourceTree = BUILT_PRODUCTS_DIR; }; + 8406BB8714DA50A200288C55 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 8406BB8A14DA50A200288C55 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 8406BB8D14DA50A200288C55 /* CarPartsPredicate-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CarPartsPredicate-Prefix.pch"; sourceTree = ""; }; + 8406BB8E14DA50A200288C55 /* CarPartsPredicate.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = CarPartsPredicate.1; sourceTree = ""; }; + 8413964214DA511100190063 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 8413964314DA511100190063 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 8413964414DA511100190063 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 8413964514DA511100190063 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 8413964614DA511100190063 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 8413964714DA511100190063 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 8413964814DA511100190063 /* Garage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Garage.h; sourceTree = ""; }; + 8413964914DA511100190063 /* Garage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Garage.m; sourceTree = ""; }; + 8413964A14DA511100190063 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 8413964B14DA511100190063 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 8413964C14DA511100190063 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 8413964D14DA511100190063 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8406BB8014DA50A200288C55 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8406BB8814DA50A200288C55 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 8406BB7814DA50A200288C55 = { + isa = PBXGroup; + children = ( + 8406BB8914DA50A200288C55 /* CarPartsPredicate */, + 8406BB8614DA50A200288C55 /* Frameworks */, + 8406BB8414DA50A200288C55 /* Products */, + ); + sourceTree = ""; + }; + 8406BB8414DA50A200288C55 /* Products */ = { + isa = PBXGroup; + children = ( + 8406BB8314DA50A200288C55 /* CarPartsPredicate */, + ); + name = Products; + sourceTree = ""; + }; + 8406BB8614DA50A200288C55 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 8406BB8714DA50A200288C55 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 8406BB8914DA50A200288C55 /* CarPartsPredicate */ = { + isa = PBXGroup; + children = ( + 8406BB8A14DA50A200288C55 /* main.m */, + 8406BB8E14DA50A200288C55 /* CarPartsPredicate.1 */, + 8413964214DA511100190063 /* AllWeatherRadial.h */, + 8413964314DA511100190063 /* AllWeatherRadial.m */, + 8413964414DA511100190063 /* Car.h */, + 8413964514DA511100190063 /* Car.m */, + 8413964614DA511100190063 /* Engine.h */, + 8413964714DA511100190063 /* Engine.m */, + 8413964814DA511100190063 /* Garage.h */, + 8413964914DA511100190063 /* Garage.m */, + 8413964A14DA511100190063 /* Slant6.h */, + 8413964B14DA511100190063 /* Slant6.m */, + 8413964C14DA511100190063 /* Tire.h */, + 8413964D14DA511100190063 /* Tire.m */, + 8406BB8C14DA50A200288C55 /* Supporting Files */, + ); + path = CarPartsPredicate; + sourceTree = ""; + }; + 8406BB8C14DA50A200288C55 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 8406BB8D14DA50A200288C55 /* CarPartsPredicate-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8406BB8214DA50A200288C55 /* CarPartsPredicate */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8406BB9214DA50A200288C55 /* Build configuration list for PBXNativeTarget "CarPartsPredicate" */; + buildPhases = ( + 8406BB7F14DA50A200288C55 /* Sources */, + 8406BB8014DA50A200288C55 /* Frameworks */, + 8406BB8114DA50A200288C55 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CarPartsPredicate; + productName = CarPartsPredicate; + productReference = 8406BB8314DA50A200288C55 /* CarPartsPredicate */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8406BB7A14DA50A200288C55 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 8406BB7D14DA50A200288C55 /* Build configuration list for PBXProject "CarPartsPredicate" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 8406BB7814DA50A200288C55; + productRefGroup = 8406BB8414DA50A200288C55 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8406BB8214DA50A200288C55 /* CarPartsPredicate */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8406BB7F14DA50A200288C55 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8406BB8B14DA50A200288C55 /* main.m in Sources */, + 8413964E14DA511100190063 /* AllWeatherRadial.m in Sources */, + 8413964F14DA511100190063 /* Car.m in Sources */, + 8413965014DA511100190063 /* Engine.m in Sources */, + 8413965114DA511100190063 /* Garage.m in Sources */, + 8413965214DA511100190063 /* Slant6.m in Sources */, + 8413965314DA511100190063 /* Tire.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 8406BB9014DA50A200288C55 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 8406BB9114DA50A200288C55 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + SDKROOT = macosx; + }; + name = Release; + }; + 8406BB9314DA50A200288C55 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "CarPartsPredicate/CarPartsPredicate-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 8406BB9414DA50A200288C55 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "CarPartsPredicate/CarPartsPredicate-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8406BB7D14DA50A200288C55 /* Build configuration list for PBXProject "CarPartsPredicate" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8406BB9014DA50A200288C55 /* Debug */, + 8406BB9114DA50A200288C55 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8406BB9214DA50A200288C55 /* Build configuration list for PBXNativeTarget "CarPartsPredicate" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8406BB9314DA50A200288C55 /* Debug */, + 8406BB9414DA50A200288C55 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 8406BB7A14DA50A200288C55 /* Project object */; +} diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..ebd382d --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/AllWeatherRadial.h b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/AllWeatherRadial.h new file mode 100644 index 0000000..5b3eaa8 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/AllWeatherRadial.h @@ -0,0 +1,12 @@ +#import +#import "Tire.h" + +@interface AllWeatherRadial : Tire { + float rainHandling; + float snowHandling; +} + +@property float rainHandling; +@property float snowHandling; + +@end // AllWeatherRadial diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/AllWeatherRadial.m b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/AllWeatherRadial.m new file mode 100644 index 0000000..2898c6a --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/AllWeatherRadial.m @@ -0,0 +1,49 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +@synthesize rainHandling; +@synthesize snowHandling; + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super initWithPressure: p + treadDepth: td]) { + rainHandling = 23.7; + snowHandling = 42.5; + } + + return (self); + +} // initWithPressure:treadDepth + + +- (id) copyWithZone: (NSZone *) zone +{ + AllWeatherRadial *tireCopy; + tireCopy = [super copyWithZone: zone]; + + [tireCopy setRainHandling: rainHandling]; + [tireCopy setSnowHandling: snowHandling]; + + return (tireCopy); + +} // copyWithZone + + +- (NSString *) description +{ + NSString *desc; + desc = [[NSString alloc] initWithFormat: + @"AllWeatherRadial: %.1f / %.1f / %.1f / %.1f", + [self pressure], [self treadDepth], + [self rainHandling], + [self snowHandling]]; + + return [desc autorelease]; + +} // description + +@end // AllWeatherRadial + diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Car.h b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Car.h new file mode 100644 index 0000000..667e2ef --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Car.h @@ -0,0 +1,32 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject { + NSString *name; + NSMutableArray *tires; + Engine *engine; + + NSString *make; + NSString *model; + int modelYear; + int numberOfDoors; + float mileage; +} + +@property (readwrite, copy) NSString *name; +@property (readwrite, retain) Engine *engine; +@property (readwrite, copy) NSString *make; +@property (readwrite, copy) NSString *model; +@property (readwrite) int modelYear; +@property (readwrite) int numberOfDoors; +@property (readwrite) float mileage; + +- (void) setTire: (Tire *) tire + atIndex: (int) index; +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Car.m b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Car.m new file mode 100644 index 0000000..4c93bae --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Car.m @@ -0,0 +1,126 @@ +#import "Car.h" + +#import "Engine.h" + +@implementation Car + +@synthesize name; +@synthesize engine; +@synthesize make; +@synthesize model; +@synthesize modelYear; +@synthesize numberOfDoors; +@synthesize mileage; + +- (id) init +{ + if (self = [super init]) { + + self.name = @"Car"; + tires = [[NSMutableArray alloc] init]; + + int i; + for (i = 0; i < 4; i++) { + [tires addObject: [NSNull null]]; + } + } + + return (self); + +} // init + + +- (id) copyWithZone: (NSZone *) zone +{ + Car *carCopy; + carCopy = [[[self class] + allocWithZone: zone] + init]; + + carCopy.name = name; + carCopy.make = make; + carCopy.model = model; + carCopy.numberOfDoors = numberOfDoors; + carCopy.mileage = mileage; + + Engine *engineCopy; + engineCopy = [[engine copy] autorelease]; + carCopy.engine = engineCopy; + + int i; + for (i = 0; i < 4; i++) { + Tire *tireCopy; + + tireCopy = [[self tireAtIndex: i] copy]; + [tireCopy autorelease]; + + [carCopy setTire: tireCopy + atIndex: i]; + } + + return (carCopy); + +} // copyWithZone + + +- (void) dealloc +{ + self.name = nil; + [tires release]; + [engine release]; + + [super dealloc]; + +} // dealloc + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + [tires replaceObjectAtIndex: index + withObject: tire]; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + Tire *tire; + tire = [tires objectAtIndex: index]; + + return (tire); + +} // tireAtIndex: + + +- (void) print +{ + NSString *desc = [self description]; + NSLog (@"%@", desc); + +} // print + + +- (NSString *) description { + NSString *desc; + desc = [NSString stringWithFormat: + @"%@, a %d %@ %@, has %d doors, %.1f miles, %d hp and %d tires", + name, modelYear, make, model, numberOfDoors, mileage, [engine horsepower], + [tires count]]; + + return desc; + +} // description + + +- (void) setNilValueForKey: (NSString *) key { + if ([key isEqualToString: @"mileage"]) { + mileage = 0; + } else { + [super setNilValueForKey: key]; + } +} // setNilValueForKey + + +@end // Car + diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/CarPartsPredicate-Prefix.pch b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/CarPartsPredicate-Prefix.pch new file mode 100644 index 0000000..fd4b735 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/CarPartsPredicate-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'CarPartsPredicate' target in the 'CarPartsPredicate' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/CarPartsPredicate.1 b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/CarPartsPredicate.1 new file mode 100644 index 0000000..b015df3 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/CarPartsPredicate.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 2/1/12 \" DATE +.Dt CarPartsPredicate 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm CarPartsPredicate, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Engine.h b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Engine.h new file mode 100644 index 0000000..80b4a1f --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Engine.h @@ -0,0 +1,9 @@ +#import + +@interface Engine : NSObject { + int horsepower; +} +@property (readwrite) int horsepower; + +@end // Engine + diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Engine.m b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Engine.m new file mode 100644 index 0000000..cc8a467 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Engine.m @@ -0,0 +1,40 @@ +#import "Engine.h" + +@implementation Engine +@synthesize horsepower; + +- (id) init { + if (self = [super init]) { + horsepower = 145; + } + + return (self); + +} // init + + +- (id) copyWithZone: (NSZone *) zone +{ + Engine *engineCopy; + engineCopy = [[[self class] + allocWithZone: zone] + init]; + [engineCopy setValue: [NSNumber numberWithInt: horsepower] + forKey: @"horsepower"]; + + return (engineCopy); + +} // copyWithZone + + +- (NSString *) description +{ + NSString *description; + description = [NSString stringWithFormat: + @"I am an engine. Vrooom! %d HP", horsepower]; + return (description); + +} // description + +@end // Engine + diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Garage.h b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Garage.h new file mode 100644 index 0000000..92104b8 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Garage.h @@ -0,0 +1,26 @@ +// +// Garage.h +// 15.01 Car-Value-Coding +// +// Created by markd on 8/16/08. +// Copyright 2008 Length-O-Words.com. All rights reserved. +// + +#import + +@class Car; + +@interface Garage : NSObject { + NSString *name; + NSMutableArray *cars; + NSMutableDictionary *stuff; +} +@property (readonly, retain) NSMutableArray *cars; + +@property (readwrite, copy) NSString *name; + +- (void) addCar: (Car *) car; + +- (void) print; + +@end // Garage diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Garage.m b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Garage.m new file mode 100644 index 0000000..100f1c9 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Garage.m @@ -0,0 +1,57 @@ +// +// Garage.m +// 15.01 Car-Value-Coding +// +// Created by markd on 8/16/08. +// Copyright 2008 Length-O-Words.com. All rights reserved. +// + +#import "Garage.h" + +@implementation Garage + +@synthesize name; +@synthesize cars; + +- (void) addCar: (Car *) car { + if (cars == nil) { + cars = [[NSMutableArray alloc] init]; + } + [cars addObject: car]; + +} // addCar + + +- (void) dealloc { + [name release]; + [cars release]; + [stuff release]; + [super dealloc]; +} // dealloc + + +- (void) print { + NSLog (@"%@:", name); + + for (Car *car in cars) { + NSLog (@" %@", car); + } + +} // print + + +- (void) setValue: (id) value forUndefinedKey: (NSString *) key { + if (stuff == nil) { + stuff = [[NSMutableDictionary alloc] init]; + } + [stuff setValue: value forKey: key]; +} // setValueForUndefinedKey + + +- (id) valueForUndefinedKey:(NSString *)key { + id value = [stuff valueForKey: key]; + return (value); +} // valueForUndefinedKey + + +@end // Car diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Slant6.h b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Slant6.h new file mode 100644 index 0000000..22716ed --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Slant6.h @@ -0,0 +1,6 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + + diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Slant6.m b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Tire.h b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Tire.h new file mode 100644 index 0000000..27552c8 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Tire.h @@ -0,0 +1,16 @@ +#import + +@interface Tire : NSObject { + float pressure; + float treadDepth; +} +@property float pressure; +@property float treadDepth; + +- (id) initWithPressure: (float) pressure; +- (id) initWithTreadDepth: (float) treadDepth; + +- (id) initWithPressure: (float) pressure + treadDepth: (float) treadDepth; + +@end // Tire diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Tire.m b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Tire.m new file mode 100644 index 0000000..91b396d --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/Tire.m @@ -0,0 +1,77 @@ +#import "Tire.h" + + +@implementation Tire + +@synthesize pressure; +@synthesize treadDepth; + +- (id) init +{ + if (self = [self initWithPressure: 34 + treadDepth: 20]) { + } + + return (self); + +} // init + + +- (id) copyWithZone: (NSZone *) zone +{ + Tire *tireCopy; + tireCopy = [[[self class] allocWithZone: zone] + initWithPressure: pressure + treadDepth: treadDepth]; + + return (tireCopy); + +} // copyWithZone + + +- (id) initWithPressure: (float) p +{ + if (self = [self initWithPressure: p + treadDepth: 20.0]) { + } + + return (self); + +} // initWithPressure + + +- (id) initWithTreadDepth: (float) td +{ + if (self = [self initWithPressure: 34.0 + treadDepth: td]) { + } + + return (self); + +} // initWithTreadDepth + + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super init]) { + pressure = p; + treadDepth = td; + } + + return (self); + +} // initWithPressure:treadDepth: + + +- (NSString *) description +{ + NSString *desc; + desc = [NSString stringWithFormat: + @"Tire: Pressure: %.1f TreadDepth: %.1f", + pressure, treadDepth]; + return (desc); + +} // description +@end // Tire + diff --git a/19.02 CarPartsPredicate Fixed/CarPartsPredicate/main.m b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/main.m new file mode 100644 index 0000000..4d1f9d7 --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/CarPartsPredicate/main.m @@ -0,0 +1,288 @@ +// +// main.m +// CarPartsPredicate +// +// Created by Waqar Malik on 2/1/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import +#import "Car.h" +#import "Engine.h" +#import "Garage.h" +#import "Slant6.h" +#import "Tire.h" + +Car *makeCar (NSString *name, NSString *make, NSString *model, + int modelYear, int numberOfDoors, float mileage, + int horsepower) NS_RETURNS_NOT_RETAINED; + +int main (int argc, const char * argv[]) +{ + NSAutoreleasePool *pool; + pool = [[NSAutoreleasePool alloc] init]; + + Garage *garage = [[Garage alloc] init]; + garage.name = @"Joe's Garage"; + + Car *car; + car = makeCar (@"Herbie", @"Honda", @"CRX", 1984, 2, 34000, 58); + [garage addCar: car]; + + NSPredicate *predicate; + predicate = [NSPredicate predicateWithFormat: @"name == 'Herbie'"]; + BOOL match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > 150"]; + match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + predicate = [NSPredicate predicateWithFormat: @"name == %@", @"Herbie"]; + match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + predicate = [NSPredicate predicateWithFormat: @"%K == %@", @"name", @"Herbie"]; + match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + NSPredicate *predicateTemplate = [NSPredicate predicateWithFormat:@"name == $NAME"]; + NSDictionary *varDict; + varDict = [NSDictionary dictionaryWithObjectsAndKeys: + @"Herbie", @"NAME", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables: varDict]; + NSLog(@"SNORGLE: %@", predicate); + match = [predicate evaluateWithObject: car]; + NSLog (@"%s", (match) ? "YES" : "NO"); + + + car = makeCar (@"Badger", @"Acura", @"Integra", 1987, 5, 217036.7, 130); + [garage addCar: car]; + + car = makeCar (@"Elvis", @"Acura", @"Legend", 1989, 4, 28123.4, 151); + [garage addCar: car]; + + car = makeCar (@"Phoenix", @"Pontiac", @"Firebird", 1969, 2, 85128.3, 345); + [garage addCar: car]; + + car = makeCar (@"Streaker", @"Pontiac", @"Silver Streak", 1950, 2, 39100.0, 36); + [garage addCar: car]; + + car = makeCar (@"Judge", @"Pontiac", @"GTO", 1969, 2, 45132.2, 370); + [garage addCar: car]; + + car = makeCar (@"Paper Car", @"Plymouth", @"Valiant", 1965, 2, 76800, 105); + [garage addCar: car]; + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > 150"]; + NSArray *cars = [garage cars]; + for (Car *car in [garage cars]) { + if ([predicate evaluateWithObject: car]) { + NSLog (@"%@", car.name); + } + } + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > 150"]; + NSArray *results; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + NSArray *names; + names = [results valueForKey:@"name"]; + NSLog (@"%@", names); + + NSMutableArray *carsCopy = [cars mutableCopy]; + [carsCopy filterUsingPredicate: predicate]; + NSLog (@"%@", carsCopy); + [carsCopy release]; + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > %d", 50]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"engine.horsepower > $POWER"]; + varDict = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt: 150], @"POWER", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables: varDict]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: + @"(engine.horsepower > 50) AND (engine.horsepower < 200)"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"oop %@", results); + + predicate = [NSPredicate predicateWithFormat: @"name < 'Newton'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", [results valueForKey: @"name"]); + + predicate = [NSPredicate predicateWithFormat: + @"engine.horsepower BETWEEN { 50, 200 }"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + NSArray *betweens = [NSArray arrayWithObjects: + [NSNumber numberWithInt: 50], [NSNumber numberWithInt: 200], nil]; + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower BETWEEN %@", betweens]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"engine.horsepower BETWEEN $POWERS"]; + varDict = [NSDictionary dictionaryWithObjectsAndKeys: betweens, @"POWERS", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables: varDict]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name IN { 'Herbie', 'Snugs', 'Badger', 'Flap' }"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", [results valueForKey: @"name"]); + + predicate = [NSPredicate predicateWithFormat: @"SELF.name IN { 'Herbie', 'Snugs', 'Badger', 'Flap' }"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", [results valueForKey: @"name"]); + + names = [cars valueForKey: @"name"]; + predicate = [NSPredicate predicateWithFormat: @"SELF IN { 'Herbie', 'Snugs', 'Badger', 'Flap' }"]; + results = [names filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name BEGINSWITH 'Bad'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name BEGINSWITH 'HERB'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name BEGINSWITH[cd] 'HERB'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name LIKE[cd] '*er*'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name LIKE[cd] '???er*'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + NSArray *names1 = [NSArray arrayWithObjects: @"Herbie", @"Badger", @"Judge", @"Elvis", nil]; + NSArray *names2 = [NSArray arrayWithObjects: @"Judge", @"Paper Car", @"Badger", @"Phoenix", nil]; + + predicate = [NSPredicate predicateWithFormat: @"SELF IN %@", names1]; + results = [names2 filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", predicate); + NSLog (@"%@", results); + + //return 0; + + predicate = [NSPredicate predicateWithFormat: @"modelYear > 1970"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name contains[cd] 'er'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"name beginswith 'B'"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"%K beginswith %@", + @"name", @"B"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"with args : %@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"name beginswith $NAME"]; + NSDictionary *dict = [NSDictionary + dictionaryWithObjectsAndKeys: @"Bad", @"NAME", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables:dict]; + NSLog (@"SNORGLE: %@", predicate); + + predicate = [NSPredicate predicateWithFormat: @"name in { 'Badger', 'Judge', 'Elvis' }"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"name in $NAME_LIST"]; + names = [NSArray arrayWithObjects:@"Badger", @"Judge", @"Elvis", nil]; + dict = [NSDictionary + dictionaryWithObjectsAndKeys: names, @"NAME_LIST", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables:dict]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicateTemplate = [NSPredicate predicateWithFormat: @"%K in $NAME_LIST", @"name"]; + dict = [NSDictionary + dictionaryWithObjectsAndKeys: names, @"NAME_LIST", nil]; + predicate = [predicateTemplate predicateWithSubstitutionVariables:dict]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + NSLog (@"xSNORGLE: %@", predicate); + + // SELF is optional here. + predicate = [NSPredicate predicateWithFormat:@"SELF.name in { 'Badger', 'Judge', 'Elvis' }"]; + + for (Car *car in cars) { + if ([predicate evaluateWithObject: car]) { + NSLog (@"SNORK : %@ matches", car.name); + } + } + + +#if 0 + predicate = [NSPredicate predicateWithFormat: @"ANY engine.horsepower > 200"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"SNORGLE: %@", predicate); +#endif + + predicate = [NSPredicate predicateWithFormat: @"engine.horsepower > 200"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + + predicate = [NSPredicate predicateWithFormat: @"tires.@sum.pressure > 10"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); + +#if 0 + predicate = [NSPredicate predicateWithFormat: @"ALL engine.horsepower > 30"]; + results = [cars filteredArrayUsingPredicate: predicate]; + NSLog (@"%@", results); +#endif + + [garage release]; + + [pool release]; + + return (0); + +} // main + +Car *makeCar (NSString *name, NSString *make, NSString *model, + int modelYear, int numberOfDoors, float mileage, + int horsepower) +{ + Car *car = [[[Car alloc] init] autorelease]; + + car.name = name; + car.make = make; + car.model = model; + car.modelYear = modelYear; + car.numberOfDoors = numberOfDoors; + car.mileage = mileage; + + Slant6 *engine = [[[Slant6 alloc] init] autorelease]; + [engine setValue: [NSNumber numberWithInt: horsepower] + forKey: @"horsepower"]; + car.engine = engine; + + // Make some tires. + // int i; + for (int i = 0; i < 4; i++) + { + Tire * tire= [[[Tire alloc] init] autorelease]; + [car setTire: tire atIndex: i]; + } + + return (car); + +} // makeCar \ No newline at end of file diff --git a/19.02 CarPartsPredicate Fixed/SourceAnnotations.h b/19.02 CarPartsPredicate Fixed/SourceAnnotations.h new file mode 100644 index 0000000..09725db --- /dev/null +++ b/19.02 CarPartsPredicate Fixed/SourceAnnotations.h @@ -0,0 +1,83 @@ +// +// SourceAnnotations.h +// +// Created by Waqar Malik on 11/22/10. +// Copyright 2010 Crimson Research, Inc. All rights reserved. +// + +#ifndef __SOURCEANNOTATIONS_H__ +#define __SOURCEANNOTATIONS_H__ + +/* __attribute__((nonnull(1,3))) */ +/* __attribute__((__noreturn__)) */ + +/* Compatibility with non-clang compilers. */ +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + +#ifndef NS_RETURNS_RETAINED +#if __has_feature(attribute_ns_returns_retained) +#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) +#else +#define NS_RETURNS_RETAINED +#endif +#endif + +#ifndef NS_RETURNS_NOT_RETAINED +#if __has_feature(attribute_ns_returns_not_retained) +#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) +#else +#define NS_RETURNS_NOT_RETAINED +#endif +#endif + +#ifndef CF_RETURNS_RETAINED +#if __has_feature(attribute_cf_returns_retained) +#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) +#else +#define CF_RETURNS_RETAINED +#endif +#endif + +#ifndef CF_RETURNS_NOT_RETAINED +#if __has_feature(attribute_cf_returns_not_retained) +#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained)) +#else +#define CF_RETURNS_NOT_RETAINED +#endif +#endif + +#ifndef NS_CONSUMED +#if __has_feature(attribute_ns_consumed) +#define NS_CONSUMED __attribute__((ns_consumed)) +#else +#define NS_CONSUMED +#endif +#endif + +#ifndef CF_CONSUMED +#if __has_feature(attribute_cf_consumed) +#define CF_CONSUMED __attribute__((cf_consumed)) +#else +#define CF_CONSUMED +#endif +#endif + +#ifndef NS_CONSUMES_SELF +#if __has_feature((attribute_ns_consumes_self)) +#define NS_CONSUMES_SELF __attribute__((ns_consumes_self)) +#else +#define NS_CONSUMES_SELF +#endif +#endif + +#ifndef CLANG_ANALYZER_NORETURN +#if __has_feature(attribute_analyzer_noreturn) +#define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) +#else +#define CLANG_ANALYZER_NORETURN +#endif +#endif + +#endif /* __SOURCEANNOTATIONS_H__ */ diff --git a/978-1-4302-4188-1_ch06/.DS_Store b/978-1-4302-4188-1_ch06/.DS_Store new file mode 100644 index 0000000..9ccab36 Binary files /dev/null and b/978-1-4302-4188-1_ch06/.DS_Store differ diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.1 b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.1 new file mode 100644 index 0000000..a182995 --- /dev/null +++ b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 7/21/08 \" DATE +.Dt 06.01 CarParts-Split 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 06.01 CarParts-Split, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.m b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.m new file mode 100644 index 0000000..eb1ec85 --- /dev/null +++ b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.m @@ -0,0 +1,29 @@ +#import + +#import "Tire.h" // don't really have to #import this or the next header file. +#import "Engine.h" // since they're brought in by Slant6.h and AllWeatherRadial.h +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + Car *car = [Car new]; + + int i; + for (i = 0; i < 4; i++) { + Tire *tire = [AllWeatherRadial new]; + + [car setTire: tire + atIndex: i]; + } + + Engine *engine = [Slant6 new]; + [car setEngine: engine]; + + [car print]; + + return (0); + +} // main + diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/TemplateIcon.icns b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/TemplateIcon.icns differ diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.pbxproj b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.pbxproj new file mode 100644 index 0000000..defa42b --- /dev/null +++ b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.pbxproj @@ -0,0 +1,263 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D64953C0E3572CE00C90222 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D6495380E3572CE00C90222 /* Car.m */; }; + 7D64953D0E3572CE00C90222 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D6495390E3572CE00C90222 /* Tire.m */; }; + 7D64953E0E3572CE00C90222 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64953A0E3572CE00C90222 /* Slant6.m */; }; + 7D6495480E3572F200C90222 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D6495460E3572F200C90222 /* AllWeatherRadial.m */; }; + 84DADF431473818D0002406A /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DADF421473818D0002406A /* Engine.m */; }; + 8DD76F9A0486AA7600D96B5E /* 06.01 CarParts-Split.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 06.01 CarParts-Split.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 06.01 CarParts-Split.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 06.01 CarParts-Split.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 06.01 CarParts-Split.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 06.01 CarParts-Split.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "06.01 CarParts-Split.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 06.01 CarParts-Split_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "06.01 CarParts-Split_Prefix.pch"; sourceTree = ""; }; + 7D6495350E3572CE00C90222 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D6495360E3572CE00C90222 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D6495370E3572CE00C90222 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 7D6495380E3572CE00C90222 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D6495390E3572CE00C90222 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 7D64953A0E3572CE00C90222 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 7D6495460E3572F200C90222 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 7D6495470E3572F200C90222 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 84DADF411473818D0002406A /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 84DADF421473818D0002406A /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 06.01 CarParts-Split */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "06.01 CarParts-Split"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 06.01 CarParts-Split.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "06.01 CarParts-Split.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 06.01 CarParts-Split */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "06.01 CarParts-Split"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 06.01 CarParts-Split_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 06.01 CarParts-Split.m */, + 7D6495470E3572F200C90222 /* AllWeatherRadial.h */, + 7D6495460E3572F200C90222 /* AllWeatherRadial.m */, + 7D6495370E3572CE00C90222 /* Car.h */, + 7D6495380E3572CE00C90222 /* Car.m */, + 7D6495350E3572CE00C90222 /* Slant6.h */, + 7D64953A0E3572CE00C90222 /* Slant6.m */, + 84DADF411473818D0002406A /* Engine.h */, + 84DADF421473818D0002406A /* Engine.m */, + 7D6495360E3572CE00C90222 /* Tire.h */, + 7D6495390E3572CE00C90222 /* Tire.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 06.01 CarParts-Split */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 06.01 CarParts-Split.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 06.01 CarParts-Split */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "06.01 CarParts-Split" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "06.01 CarParts-Split"; + productInstallPath = "$(HOME)/bin"; + productName = "06.01 CarParts-Split"; + productReference = 8DD76FA10486AA7600D96B5E /* 06.01 CarParts-Split */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "06.01 CarParts-Split" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 06.01 CarParts-Split */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 06.01 CarParts-Split */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 06.01 CarParts-Split.m in Sources */, + 7D64953C0E3572CE00C90222 /* Car.m in Sources */, + 7D64953D0E3572CE00C90222 /* Tire.m in Sources */, + 7D64953E0E3572CE00C90222 /* Slant6.m in Sources */, + 7D6495480E3572F200C90222 /* AllWeatherRadial.m in Sources */, + 84DADF431473818D0002406A /* Engine.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "06.01 CarParts-Split_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "06.01 CarParts-Split"; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "06.01 CarParts-Split_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "06.01 CarParts-Split"; + SDKROOT = macosx; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "06.01 CarParts-Split" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "06.01 CarParts-Split" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..dc81f12 --- /dev/null +++ b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..3c3bcd4 Binary files /dev/null and b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/WorkspaceSettings.xcsettings b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..6ff33e6 --- /dev/null +++ b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges + + IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges + + + diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/06.01 CarParts-Split.xcscheme b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/06.01 CarParts-Split.xcscheme new file mode 100644 index 0000000..dbc1542 --- /dev/null +++ b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/06.01 CarParts-Split.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..be57537 --- /dev/null +++ b/978-1-4302-4188-1_ch06/06.01 CarParts-Split.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 06.01 CarParts-Split.xcscheme + + orderHint + 18 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/978-1-4302-4188-1_ch06/06.01 CarParts-Split_Prefix.pch b/978-1-4302-4188-1_ch06/06.01 CarParts-Split_Prefix.pch new file mode 100644 index 0000000..79024da --- /dev/null +++ b/978-1-4302-4188-1_ch06/06.01 CarParts-Split_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '06.01 CarParts-Split' target in the '06.01 CarParts-Split' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/978-1-4302-4188-1_ch06/AllWeatherRadial.h b/978-1-4302-4188-1_ch06/AllWeatherRadial.h new file mode 100644 index 0000000..a9f4ebf --- /dev/null +++ b/978-1-4302-4188-1_ch06/AllWeatherRadial.h @@ -0,0 +1,5 @@ +#import "Tire.h" + +@interface AllWeatherRadial : Tire +@end // AllWeatherRadial + diff --git a/978-1-4302-4188-1_ch06/AllWeatherRadial.m b/978-1-4302-4188-1_ch06/AllWeatherRadial.m new file mode 100644 index 0000000..fa72c64 --- /dev/null +++ b/978-1-4302-4188-1_ch06/AllWeatherRadial.m @@ -0,0 +1,11 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +- (NSString *) description +{ + return (@"I am a tire for rain or shine."); +} // description + +@end // AllWeatherRadial + diff --git a/978-1-4302-4188-1_ch06/Car.h b/978-1-4302-4188-1_ch06/Car.h new file mode 100644 index 0000000..744330d --- /dev/null +++ b/978-1-4302-4188-1_ch06/Car.h @@ -0,0 +1,20 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject + +- (void) setEngine: (Engine *) newEngine; + +- (Engine *) engine; + + +- (void) setTire: (Tire *) tire + atIndex: (int) index; + +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/978-1-4302-4188-1_ch06/Car.m b/978-1-4302-4188-1_ch06/Car.m new file mode 100644 index 0000000..fddf5ff --- /dev/null +++ b/978-1-4302-4188-1_ch06/Car.m @@ -0,0 +1,87 @@ +// +// Car.m +// 06.01 CarParts-Split +// +// Created by markd on 2/25/06. +// Copyright 2006 __MyCompanyName__. All rights reserved. +// + +#import "Car.h" +#import "Engine.h" +#import "Tire.h" + +@implementation Car +{ + Tire *tires[4]; + Engine *engine; +} + +- (id) init +{ + if (self = [super init]) { + engine = [Engine new]; + + tires[0] = [Tire new]; + tires[1] = [Tire new]; + tires[2] = [Tire new]; + tires[3] = [Tire new]; + } + + return (self); + +} // init + + +- (Engine *) engine +{ + return (engine); +} // engine + + +- (void) setEngine: (Engine *) newEngine +{ + engine = newEngine; +} // setEngine + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in setTire:atIndex:", + index); + exit (1); + } + + tires[index] = tire; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in tireAtIndex:", + index); + exit (1); + } + + return (tires[index]); + +} // tireAtIndex: + + + +- (void) print +{ + NSLog (@"%@", engine); + + NSLog (@"%@", tires[0]); + NSLog (@"%@", tires[1]); + NSLog (@"%@", tires[2]); + NSLog (@"%@", tires[3]); + +} // print + +@end // Car + diff --git a/978-1-4302-4188-1_ch06/Engine.h b/978-1-4302-4188-1_ch06/Engine.h new file mode 100644 index 0000000..661a1f2 --- /dev/null +++ b/978-1-4302-4188-1_ch06/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/978-1-4302-4188-1_ch06/Engine.m b/978-1-4302-4188-1_ch06/Engine.m new file mode 100644 index 0000000..83b1d4c --- /dev/null +++ b/978-1-4302-4188-1_ch06/Engine.m @@ -0,0 +1,11 @@ +#import "Engine.h" + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/978-1-4302-4188-1_ch06/Slant6.h b/978-1-4302-4188-1_ch06/Slant6.h new file mode 100644 index 0000000..76199c8 --- /dev/null +++ b/978-1-4302-4188-1_ch06/Slant6.h @@ -0,0 +1,5 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + diff --git a/978-1-4302-4188-1_ch06/Slant6.m b/978-1-4302-4188-1_ch06/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/978-1-4302-4188-1_ch06/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/978-1-4302-4188-1_ch06/Tire.h b/978-1-4302-4188-1_ch06/Tire.h new file mode 100644 index 0000000..fbfa492 --- /dev/null +++ b/978-1-4302-4188-1_ch06/Tire.h @@ -0,0 +1,4 @@ +#import + +@interface Tire : NSObject +@end // Tire diff --git a/978-1-4302-4188-1_ch06/Tire.m b/978-1-4302-4188-1_ch06/Tire.m new file mode 100644 index 0000000..9aba39b --- /dev/null +++ b/978-1-4302-4188-1_ch06/Tire.m @@ -0,0 +1,12 @@ +#import "Tire.h" + + +@implementation Tire + +- (NSString *) description +{ + return (@"I am a tire. I last a while"); +} // description + +@end // Tire + diff --git a/9781430241881.jpg b/9781430241881.jpg new file mode 100644 index 0000000..ca40495 Binary files /dev/null and b/9781430241881.jpg differ diff --git a/9781430241881.zip b/9781430241881.zip new file mode 100644 index 0000000..24a3bdb Binary files /dev/null and b/9781430241881.zip differ diff --git a/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.1 b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.1 new file mode 100644 index 0000000..b5844d1 --- /dev/null +++ b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 7/19/08 \" DATE +.Dt 04.01 Shapes-Inheritance 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 04.01 Shapes-Inheritance, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.m b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.m new file mode 100644 index 0000000..e3f0d57 --- /dev/null +++ b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.m @@ -0,0 +1,218 @@ +#import + +// -------------------------------------------------- +// constants for the different kinds of shapes and their colors + +typedef enum { + kRedColor, + kGreenColor, + kBlueColor +} ShapeColor; + + +// -------------------------------------------------- +// Shape bounding rectangle + + +typedef struct { + int x, y, width, height; +} ShapeRect; + + +// -------------------------------------------------- +// convert from the ShapeColor enum value to a human-readable name + +NSString *colorName (ShapeColor color) +{ + NSString *colorName; + + switch (color) { + case kRedColor: + colorName = @"red"; + break; + case kGreenColor: + colorName = @"green"; + break; + case kBlueColor: + colorName = @"blue"; + break; + default: + colorName = @"oops! Unexpected color"; + break; + } + + return (colorName); + +} // colorName + + +// -------------------------------------------------- +// Shapes base class + +@interface Shape : NSObject +{ + ShapeColor fillColor; + ShapeRect bounds; +} + +- (void) setFillColor: (ShapeColor) fillColor; +- (void) setBounds: (ShapeRect) bounds; +- (void) draw; + +@end // Shape + + +@implementation Shape + +- (void) setFillColor: (ShapeColor) c +{ + fillColor = c; +} // setFillColor + +- (void) setBounds: (ShapeRect) b +{ + bounds = b; +} // setBounds + +- (void) draw +{ +} // draw + +@end // Shape + + + + +// -------------------------------------------------- +// All about Triangles + +@interface Triangle : Shape +@end // Triangle + + +@implementation Triangle + +- (void) draw +{ + NSLog (@"drawing a triangle at (%d %d %d %d) in %@", + bounds.x, bounds.y, + bounds.width, bounds.height, + colorName(fillColor)); +} // draw + +@end // Triangle + + + + +// -------------------------------------------------- +// All about Circles + +@interface Circle : Shape +@end // Circle + + +@implementation Circle + +- (void) draw +{ + NSLog (@"drawing a circle at (%d %d %d %d) in %@", + bounds.x, bounds.y, + bounds.width, bounds.height, + colorName(fillColor)); +} // draw + +@end // Circle + + + + +// -------------------------------------------------- +// All about Rectangles + +@interface Rectangle : Shape +@end // Rectangle + + +@implementation Rectangle + +- (void) draw +{ + NSLog (@"drawing a rectangle at (%d %d %d %d) in %@", + bounds.x, bounds.y, + bounds.width, bounds.height, + colorName(fillColor)); +} // draw + +@end // Rectangle + + +// -------------------------------------------------- +// All about OblateSphereoids + +@interface OblateSphereoid : Shape +@end // OblateSphereoid + + +@implementation OblateSphereoid + +- (void) draw +{ + NSLog (@"drawing an egg at (%d %d %d %d) in %@", + bounds.x, bounds.y, + bounds.width, bounds.height, + colorName(fillColor)); +} // draw + +@end // OblateSphereoid + + + +// -------------------------------------------------- +// Draw the shapes + +void drawShapes (id shapes[], int count) +{ + for (int i = 0; i < count; i++) + { + id shape = shapes[i]; + [shape draw]; + } + +} // drawShapes + + + +// -------------------------------------------------- +// The main function. Make the shapes and draw them + +int main (int argc, const char * argv[]) +{ + id shapes[4]; // I'm different! + + ShapeRect rect0 = { 0, 0, 10, 30 }; + shapes[0] = [Circle new]; + [shapes[0] setBounds: rect0]; + [shapes[0] setFillColor: kRedColor]; + + ShapeRect rect1 = { 30, 40, 50, 60 }; + shapes[1] = [Rectangle new]; + [shapes[1] setBounds: rect1]; + [shapes[1] setFillColor: kGreenColor]; + + ShapeRect rect2 = { 15, 19, 37, 29 }; + shapes[2] = [OblateSphereoid new]; + [shapes[2] setBounds: rect2]; + [shapes[2] setFillColor: kBlueColor]; + + ShapeRect rect3 = { 47, 32, 80, 50 }; // I'm new! + shapes[3] = [Triangle new]; + [shapes[3] setBounds: rect3]; + [shapes[3] setFillColor: kRedColor]; + + drawShapes (shapes, 4); // I'm different! + + return (0); + +} // main + diff --git a/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/TemplateIcon.icns b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/project.pbxproj b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1737975 --- /dev/null +++ b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/project.pbxproj @@ -0,0 +1,227 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 04.01 Shapes-Inheritance.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 04.01 Shapes-Inheritance.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 04.01 Shapes-Inheritance.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 04.01 Shapes-Inheritance.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 04.01 Shapes-Inheritance.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 04.01 Shapes-Inheritance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "04.01 Shapes-Inheritance.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 04.01 Shapes-Inheritance_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "04.01 Shapes-Inheritance_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 04.01 Shapes-Inheritance */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "04.01 Shapes-Inheritance"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 04.01 Shapes-Inheritance.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "04.01 Shapes-Inheritance.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 04.01 Shapes-Inheritance */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "04.01 Shapes-Inheritance"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 04.01 Shapes-Inheritance_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 04.01 Shapes-Inheritance.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 04.01 Shapes-Inheritance */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 04.01 Shapes-Inheritance.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 04.01 Shapes-Inheritance */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "04.01 Shapes-Inheritance" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "04.01 Shapes-Inheritance"; + productInstallPath = "$(HOME)/bin"; + productName = "04.01 Shapes-Inheritance"; + productReference = 8DD76FA10486AA7600D96B5E /* 04.01 Shapes-Inheritance */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "04.01 Shapes-Inheritance" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 04.01 Shapes-Inheritance */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 04.01 Shapes-Inheritance */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 04.01 Shapes-Inheritance.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "04.01 Shapes-Inheritance_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "04.01 Shapes-Inheritance"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "04.01 Shapes-Inheritance_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "04.01 Shapes-Inheritance"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "04.01 Shapes-Inheritance" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "04.01 Shapes-Inheritance" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/04.01 Shapes-Inheritance.xcscheme b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/04.01 Shapes-Inheritance.xcscheme new file mode 100644 index 0000000..ae268bc --- /dev/null +++ b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/04.01 Shapes-Inheritance.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..030066b --- /dev/null +++ b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 04.01 Shapes-Inheritance.xcscheme + + orderHint + 11 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance_Prefix.pch b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance_Prefix.pch new file mode 100644 index 0000000..60d5397 --- /dev/null +++ b/9781430241881_ch04/04.01 Shapes-Inheritance/04.01 Shapes-Inheritance_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '04.01 Shapes-Inheritance' target in the '04.01 Shapes-Inheritance' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.1 b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.1 new file mode 100644 index 0000000..2acfe9f --- /dev/null +++ b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 7/19/08 \" DATE +.Dt 04.02 Shapes-Green-Circles 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 04.02 Shapes-Green-Circles, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.m b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.m new file mode 100644 index 0000000..6f4e8b4 --- /dev/null +++ b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.m @@ -0,0 +1,230 @@ +#import + +// -------------------------------------------------- +// constants for the different kinds of shapes and their colors + +typedef enum { + kRedColor, + kGreenColor, + kBlueColor +} ShapeColor; + + +// -------------------------------------------------- +// Shape bounding rectangle + + +typedef struct { + int x, y, width, height; +} ShapeRect; + + +// -------------------------------------------------- +// convert from the ShapeColor enum value to a human-readable name + +NSString *colorName (ShapeColor color) +{ + NSString *colorName; + + switch (color) { + case kRedColor: + colorName = @"red"; + break; + case kGreenColor: + colorName = @"green"; + break; + case kBlueColor: + colorName = @"blue"; + break; + default: + colorName = @"oops! Unexpected color"; + break; + } + + return (colorName); + +} // colorName + + +// -------------------------------------------------- +// Shapes base class + +@interface Shape : NSObject +{ + ShapeColor fillColor; + ShapeRect bounds; +} + +- (void) setFillColor: (ShapeColor) fillColor; +- (void) setBounds: (ShapeRect) bounds; +- (void) draw; + +@end // Shape + + +@implementation Shape + +- (void) setFillColor: (ShapeColor) c +{ + fillColor = c; +} // setFillColor + +- (void) setBounds: (ShapeRect) b +{ + bounds = b; +} // setBounds + +- (void) draw +{ +} // draw + +@end // Shape + + + + +// -------------------------------------------------- +// All about Triangles + +@interface Triangle : Shape +@end // Triangle + + +@implementation Triangle + +- (void) draw +{ + NSLog (@"drawing a triangle at (%d %d %d %d) in %@", + bounds.x, bounds.y, + bounds.width, bounds.height, + colorName(fillColor)); +} // draw + +@end // Triangle + + + + +// -------------------------------------------------- +// All about Circles + +@interface Circle : Shape +@end // Circle + + +@implementation Circle + +// I'm new! +- (void) setFillColor: (ShapeColor) c +{ + if (c == kRedColor) { + c = kGreenColor; + } + + [super setFillColor: c]; + +} // setFillColor + + +- (void) draw +{ + NSLog (@"drawing a circle at (%d %d %d %d) in %@", + bounds.x, bounds.y, + bounds.width, bounds.height, + colorName(fillColor)); +} // draw + +@end // Circle + + + + +// -------------------------------------------------- +// All about Rectangles + +@interface Rectangle : Shape +@end // Rectangle + + +@implementation Rectangle + +- (void) draw +{ + NSLog (@"drawing a rectangle at (%d %d %d %d) in %@", + bounds.x, bounds.y, + bounds.width, bounds.height, + colorName(fillColor)); +} // draw + +@end // Rectangle + + +// -------------------------------------------------- +// All about OblateSphereoids + +@interface OblateSphereoid : Shape +@end // OblateSphereoid + + +@implementation OblateSphereoid + +- (void) draw +{ + NSLog (@"drawing an egg at (%d %d %d %d) in %@", + bounds.x, bounds.y, + bounds.width, bounds.height, + colorName(fillColor)); +} // draw + +@end // OblateSphereoid + + + +// -------------------------------------------------- +// Draw the shapes + +void drawShapes (id shapes[], int count) +{ + for (int i = 0; i < count; i++) + { + id shape = shapes[i]; + [shape draw]; + } + +} // drawShapes + + + +// -------------------------------------------------- +// The main function. Make the shapes and draw them + +int main (int argc, const char * argv[]) +{ + id shapes[4]; // I'm different! + + ShapeRect rect0 = { 0, 0, 10, 30 }; + shapes[0] = [Circle new]; + [shapes[0] setBounds: rect0]; + [shapes[0] setFillColor: kRedColor]; + + ShapeRect rect1 = { 30, 40, 50, 60 }; + shapes[1] = [Rectangle new]; + [shapes[1] setBounds: rect1]; + [shapes[1] setFillColor: kGreenColor]; + + ShapeRect rect2 = { 15, 19, 37, 29 }; + shapes[2] = [OblateSphereoid new]; + [shapes[2] setBounds: rect2]; + [shapes[2] setFillColor: kBlueColor]; + + ShapeRect rect3 = { 47, 32, 80, 50 }; // I'm new! + shapes[3] = [Triangle new]; + [shapes[3] setBounds: rect3]; + [shapes[3] setFillColor: kRedColor]; + + drawShapes (shapes, 4); // I'm different! + + return (0); + +} // main + diff --git a/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/TemplateIcon.icns b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/project.pbxproj b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/project.pbxproj new file mode 100644 index 0000000..fa3a303 --- /dev/null +++ b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/project.pbxproj @@ -0,0 +1,227 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 04.02 Shapes-Green-Circles.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 04.02 Shapes-Green-Circles.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 04.02 Shapes-Green-Circles.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 04.02 Shapes-Green-Circles.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 04.02 Shapes-Green-Circles.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 04.02 Shapes-Green-Circles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "04.02 Shapes-Green-Circles.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 04.02 Shapes-Green-Circles_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "04.02 Shapes-Green-Circles_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 04.02 Shapes-Green-Circles */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "04.02 Shapes-Green-Circles"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 04.02 Shapes-Green-Circles.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "04.02 Shapes-Green-Circles.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 04.02 Shapes-Green-Circles */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "04.02 Shapes-Green-Circles"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 04.02 Shapes-Green-Circles_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 04.02 Shapes-Green-Circles.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 04.02 Shapes-Green-Circles */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 04.02 Shapes-Green-Circles.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 04.02 Shapes-Green-Circles */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "04.02 Shapes-Green-Circles" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "04.02 Shapes-Green-Circles"; + productInstallPath = "$(HOME)/bin"; + productName = "04.02 Shapes-Green-Circles"; + productReference = 8DD76FA10486AA7600D96B5E /* 04.02 Shapes-Green-Circles */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "04.02 Shapes-Green-Circles" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 04.02 Shapes-Green-Circles */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 04.02 Shapes-Green-Circles */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 04.02 Shapes-Green-Circles.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "04.02 Shapes-Green-Circles_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "04.02 Shapes-Green-Circles"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "04.02 Shapes-Green-Circles_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "04.02 Shapes-Green-Circles"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "04.02 Shapes-Green-Circles" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "04.02 Shapes-Green-Circles" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/04.02 Shapes-Green-Circles.xcscheme b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/04.02 Shapes-Green-Circles.xcscheme new file mode 100644 index 0000000..63197dc --- /dev/null +++ b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/04.02 Shapes-Green-Circles.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..93cc7fe --- /dev/null +++ b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 04.02 Shapes-Green-Circles.xcscheme + + orderHint + 19 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles_Prefix.pch b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles_Prefix.pch new file mode 100644 index 0000000..0f5f6d4 --- /dev/null +++ b/9781430241881_ch04/04.02 Shapes-Green-Circles/04.02 Shapes-Green-Circles_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '04.02 Shapes-Green-Circles' target in the '04.02 Shapes-Green-Circles' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch04/__MACOSX/chapter04/._8159ch04final.doc b/9781430241881_ch04/__MACOSX/chapter04/._8159ch04final.doc new file mode 100644 index 0000000..6cc2c89 Binary files /dev/null and b/9781430241881_ch04/__MACOSX/chapter04/._8159ch04final.doc differ diff --git a/9781430241881_ch04/__MACOSX/chapter04/04.01 Shapes-Inheritance/._04.01 Shapes-Inheritance.m b/9781430241881_ch04/__MACOSX/chapter04/04.01 Shapes-Inheritance/._04.01 Shapes-Inheritance.m new file mode 100644 index 0000000..14f037e Binary files /dev/null and b/9781430241881_ch04/__MACOSX/chapter04/04.01 Shapes-Inheritance/._04.01 Shapes-Inheritance.m differ diff --git a/9781430241881_ch04/__MACOSX/chapter04/04.02 Shapes-Green-Circles/._04.02 Shapes-Green-Circles.m b/9781430241881_ch04/__MACOSX/chapter04/04.02 Shapes-Green-Circles/._04.02 Shapes-Green-Circles.m new file mode 100644 index 0000000..14f037e Binary files /dev/null and b/9781430241881_ch04/__MACOSX/chapter04/04.02 Shapes-Green-Circles/._04.02 Shapes-Green-Circles.m differ diff --git a/9781430241881_ch05/05.01 CarParts/05.01 CarParts.1 b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.1 new file mode 100644 index 0000000..f5c51ba --- /dev/null +++ b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 7/21/08 \" DATE +.Dt 05.01 CarParts 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 05.01 CarParts, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch05/05.01 CarParts/05.01 CarParts.m b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.m new file mode 100644 index 0000000..46735b4 --- /dev/null +++ b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.m @@ -0,0 +1,95 @@ +#import + + +// -------------------------------------------------- + +@interface Tire : NSObject +@end // Tire + + +@implementation Tire + +- (NSString *) description +{ + return (@"I am a tire. I last a while"); +} // description + +@end // Tire + + + +// -------------------------------------------------- + +@interface Engine : NSObject +@end // Engine + + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + + +// -------------------------------------------------- + +@interface Car : NSObject +{ + Engine *engine; + Tire *tires[4]; +} + +- (void) print; + +@end // Car + + +@implementation Car + +- (id) init +{ + if (self = [super init]) { + engine = [Engine new]; + + tires[0] = [Tire new]; + tires[1] = [Tire new]; + tires[2] = [Tire new]; + tires[3] = [Tire new]; + } + + return (self); + +} // init + +- (void) print +{ + NSLog (@"%@", engine); + + NSLog (@"%@", tires[0]); + NSLog (@"%@", tires[1]); + NSLog (@"%@", tires[2]); + NSLog (@"%@", tires[3]); + +} // print + +@end // Car + + +// -------------------------------------------------- + +int main (int argc, const char * argv[]) +{ + Car *car; + + car = [Car new]; + [car print]; + + return (0); + +} // main + + + diff --git a/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/TemplateIcon.icns b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/project.pbxproj b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/project.pbxproj new file mode 100644 index 0000000..0411cab --- /dev/null +++ b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/project.pbxproj @@ -0,0 +1,227 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 05.01 CarParts.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 05.01 CarParts.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 05.01 CarParts.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 05.01 CarParts.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 05.01 CarParts.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 05.01 CarParts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "05.01 CarParts.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 05.01 CarParts_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "05.01 CarParts_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 05.01 CarParts */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "05.01 CarParts"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 05.01 CarParts.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "05.01 CarParts.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 05.01 CarParts */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "05.01 CarParts"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 05.01 CarParts_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 05.01 CarParts.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 05.01 CarParts */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 05.01 CarParts.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 05.01 CarParts */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "05.01 CarParts" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "05.01 CarParts"; + productInstallPath = "$(HOME)/bin"; + productName = "05.01 CarParts"; + productReference = 8DD76FA10486AA7600D96B5E /* 05.01 CarParts */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "05.01 CarParts" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 05.01 CarParts */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 05.01 CarParts */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 05.01 CarParts.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "05.01 CarParts_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "05.01 CarParts"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "05.01 CarParts_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "05.01 CarParts"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "05.01 CarParts" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "05.01 CarParts" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.01 CarParts.xcscheme b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.01 CarParts.xcscheme new file mode 100644 index 0000000..c7714f3 --- /dev/null +++ b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.01 CarParts.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..e81be0c --- /dev/null +++ b/9781430241881_ch05/05.01 CarParts/05.01 CarParts.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 05.01 CarParts.xcscheme + + orderHint + 22 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch05/05.01 CarParts/05.01 CarParts_Prefix.pch b/9781430241881_ch05/05.01 CarParts/05.01 CarParts_Prefix.pch new file mode 100644 index 0000000..dd3dddd --- /dev/null +++ b/9781430241881_ch05/05.01 CarParts/05.01 CarParts_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '05.01 CarParts' target in the '05.01 CarParts' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.1 b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.1 new file mode 100644 index 0000000..6c2b5ad --- /dev/null +++ b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 7/21/08 \" DATE +.Dt 05.02 CarParts-Accessors 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 05.02 CarParts-Accessors, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.m b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.m new file mode 100644 index 0000000..fdc115b --- /dev/null +++ b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.m @@ -0,0 +1,153 @@ +#import + + +// -------------------------------------------------- + +@interface Tire : NSObject +@end // Tire + + +@implementation Tire + +- (NSString *) description +{ + return (@"I am a tire. I last a while"); +} // description + +@end // Tire + + + +// -------------------------------------------------- + +@interface Engine : NSObject +@end // Engine + + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + + +// -------------------------------------------------- + +@interface Car : NSObject +{ + Engine *engine; + Tire *tires[4]; +} + +- (Engine *) engine; + +- (void) setEngine: (Engine *) newEngine; + +- (Tire *) tireAtIndex: (int) index; + +- (void) setTire: (Tire *) tire + atIndex: (int) index; + +- (void) print; + +@end // Car + + +@implementation Car + +- (id) init +{ + if (self = [super init]) { + engine = [Engine new]; + + tires[0] = [Tire new]; + tires[1] = [Tire new]; + tires[2] = [Tire new]; + tires[3] = [Tire new]; + } + + return (self); + +} // init + + +- (Engine *) engine +{ + return (engine); +} // engine + + +- (void) setEngine: (Engine *) newEngine +{ + engine = newEngine; +} // setEngine + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in setTire:atIndex:", + index); + exit (1); + } + + tires[index] = tire; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in tireAtIndex:", + index); + exit (1); + } + + return (tires[index]); + +} // tireAtIndex: + + + +- (void) print +{ + NSLog (@"%@", engine); + + NSLog (@"%@", tires[0]); + NSLog (@"%@", tires[1]); + NSLog (@"%@", tires[2]); + NSLog (@"%@", tires[3]); + +} // print + +@end // Car + + +// -------------------------------------------------- + +int main (int argc, const char * argv[]) +{ + Car *car = [Car new]; + + Engine *engine = [Engine new]; + [car setEngine: engine]; + + for (int i = 0; i < 4; i++) { + Tire *tire = [Tire new]; + + [car setTire: tire atIndex: i]; + } + + [car print]; + + return (0); + +} // main + + + diff --git a/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/TemplateIcon.icns b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/project.pbxproj b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5466f9e --- /dev/null +++ b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/project.pbxproj @@ -0,0 +1,227 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 05.02 CarParts-Accessors.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 05.02 CarParts-Accessors.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 05.02 CarParts-Accessors.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 05.02 CarParts-Accessors.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 05.02 CarParts-Accessors.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 05.02 CarParts-Accessors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "05.02 CarParts-Accessors.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 05.02 CarParts-Accessors_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "05.02 CarParts-Accessors_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 05.02 CarParts-Accessors */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "05.02 CarParts-Accessors"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 05.02 CarParts-Accessors.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "05.02 CarParts-Accessors.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 05.02 CarParts-Accessors */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "05.02 CarParts-Accessors"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 05.02 CarParts-Accessors_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 05.02 CarParts-Accessors.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 05.02 CarParts-Accessors */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 05.02 CarParts-Accessors.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 05.02 CarParts-Accessors */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "05.02 CarParts-Accessors" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "05.02 CarParts-Accessors"; + productInstallPath = "$(HOME)/bin"; + productName = "05.02 CarParts-Accessors"; + productReference = 8DD76FA10486AA7600D96B5E /* 05.02 CarParts-Accessors */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "05.02 CarParts-Accessors" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 05.02 CarParts-Accessors */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 05.02 CarParts-Accessors */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 05.02 CarParts-Accessors.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "05.02 CarParts-Accessors_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "05.02 CarParts-Accessors"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "05.02 CarParts-Accessors_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "05.02 CarParts-Accessors"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "05.02 CarParts-Accessors" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "05.02 CarParts-Accessors" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.02 CarParts-Accessors.xcscheme b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.02 CarParts-Accessors.xcscheme new file mode 100644 index 0000000..ca91f89 --- /dev/null +++ b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.02 CarParts-Accessors.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..3697453 --- /dev/null +++ b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 05.02 CarParts-Accessors.xcscheme + + orderHint + 14 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors_Prefix.pch b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors_Prefix.pch new file mode 100644 index 0000000..7796376 --- /dev/null +++ b/9781430241881_ch05/05.02 CarParts-Accessors/05.02 CarParts-Accessors_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '05.02 CarParts-Accessors' target in the '05.02 CarParts-Accessors' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.1 b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.1 new file mode 100644 index 0000000..6697897 --- /dev/null +++ b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 7/21/08 \" DATE +.Dt 05.03 CarParts-2 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 05.03 CarParts-2, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.m b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.m new file mode 100644 index 0000000..0fb796b --- /dev/null +++ b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.m @@ -0,0 +1,183 @@ +#import + + +// -------------------------------------------------- + +@interface Tire : NSObject +@end // Tire + + +@implementation Tire + +- (NSString *) description +{ + return (@"I am a tire. I last a while"); +} // description + +@end // Tire + + +// -------------------------------------------------- + +@interface AllWeatherRadial : Tire +@end // AllWeatherRadial + + +@implementation AllWeatherRadial + +- (NSString *) description +{ + return (@"I am a tire for rain or shine."); +} // description + +@end // AllWeatherRadial + + +// -------------------------------------------------- + +@interface Engine : NSObject +@end // Engine + + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + + +// -------------------------------------------------- + +@interface Slant6 : Engine +@end // Slant6 + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + + + + +// -------------------------------------------------- + +@interface Car : NSObject +{ + Engine *engine; + Tire *tires[4]; +} + +- (Engine *) engine; + +- (void) setEngine: (Engine *) newEngine; + +- (Tire *) tireAtIndex: (int) index; + +- (void) setTire: (Tire *) tire atIndex: (int) index; + +- (void) print; + +@end // Car + + +@implementation Car + +- (id) init +{ + if (self = [super init]) { + engine = [Engine new]; + + tires[0] = [Tire new]; + tires[1] = [Tire new]; + tires[2] = [Tire new]; + tires[3] = [Tire new]; + } + + return (self); + +} // init + + +- (Engine *) engine +{ + return (engine); +} // engine + + +- (void) setEngine: (Engine *) newEngine +{ + engine = newEngine; +} // setEngine + + +- (void) setTire: (Tire *) tire atIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in setTire:atIndex:", index); + exit (1); + } + + tires[index] = tire; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in tireAtIndex:", index); + exit (1); + } + + return (tires[index]); + +} // tireAtIndex: + + + +- (void) print +{ + NSLog (@"%@", engine); + + NSLog (@"%@", tires[0]); + NSLog (@"%@", tires[1]); + NSLog (@"%@", tires[2]); + NSLog (@"%@", tires[3]); + +} // print + +@end // Car + + +// -------------------------------------------------- + +int main (int argc, const char * argv[]) +{ + Car *car = [Car new]; + + for (int i = 0; i < 4; i++) { + Tire *tire = [AllWeatherRadial new]; + + [car setTire: tire + atIndex: i]; + } + + Engine *engine = [Slant6 new]; + [car setEngine: engine]; + + [car print]; + + return (0); + +} // main + + + diff --git a/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/TemplateIcon.icns b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/project.pbxproj b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/project.pbxproj new file mode 100644 index 0000000..611a87d --- /dev/null +++ b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/project.pbxproj @@ -0,0 +1,227 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 05.03 CarParts-2.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 05.03 CarParts-2.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 05.03 CarParts-2.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 05.03 CarParts-2.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 05.03 CarParts-2.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 05.03 CarParts-2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "05.03 CarParts-2.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 05.03 CarParts-2_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "05.03 CarParts-2_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 05.03 CarParts-2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "05.03 CarParts-2"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 05.03 CarParts-2.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "05.03 CarParts-2.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 05.03 CarParts-2 */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "05.03 CarParts-2"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 05.03 CarParts-2_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 05.03 CarParts-2.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 05.03 CarParts-2 */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 05.03 CarParts-2.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 05.03 CarParts-2 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "05.03 CarParts-2" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "05.03 CarParts-2"; + productInstallPath = "$(HOME)/bin"; + productName = "05.03 CarParts-2"; + productReference = 8DD76FA10486AA7600D96B5E /* 05.03 CarParts-2 */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "05.03 CarParts-2" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 05.03 CarParts-2 */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 05.03 CarParts-2 */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 05.03 CarParts-2.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "05.03 CarParts-2_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "05.03 CarParts-2"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "05.03 CarParts-2_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "05.03 CarParts-2"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "05.03 CarParts-2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "05.03 CarParts-2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.03 CarParts-2.xcscheme b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.03 CarParts-2.xcscheme new file mode 100644 index 0000000..22c3ce2 --- /dev/null +++ b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/05.03 CarParts-2.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..8ad706f --- /dev/null +++ b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 05.03 CarParts-2.xcscheme + + orderHint + 20 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2_Prefix.pch b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2_Prefix.pch new file mode 100644 index 0000000..e4a5dbd --- /dev/null +++ b/9781430241881_ch05/05.03 CarParts-2/05.03 CarParts-2_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '05.03 CarParts-2' target in the '05.03 CarParts-2' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch05/__MACOSX/chapter05/._8159ch05final.doc b/9781430241881_ch05/__MACOSX/chapter05/._8159ch05final.doc new file mode 100644 index 0000000..6cc2c89 Binary files /dev/null and b/9781430241881_ch05/__MACOSX/chapter05/._8159ch05final.doc differ diff --git a/9781430241881_ch05/__MACOSX/chapter05/05.02 CarParts-Accessors/._05.02 CarParts-Accessors.m b/9781430241881_ch05/__MACOSX/chapter05/05.02 CarParts-Accessors/._05.02 CarParts-Accessors.m new file mode 100644 index 0000000..14f037e Binary files /dev/null and b/9781430241881_ch05/__MACOSX/chapter05/05.02 CarParts-Accessors/._05.02 CarParts-Accessors.m differ diff --git a/9781430241881_ch05/__MACOSX/chapter05/05.03 CarParts-2/._05.03 CarParts-2.m b/9781430241881_ch05/__MACOSX/chapter05/05.03 CarParts-2/._05.03 CarParts-2.m new file mode 100644 index 0000000..14f037e Binary files /dev/null and b/9781430241881_ch05/__MACOSX/chapter05/05.03 CarParts-2/._05.03 CarParts-2.m differ diff --git a/9781430241881_ch07_MoreAboutXcode.zip b/9781430241881_ch07_MoreAboutXcode.zip new file mode 100644 index 0000000..cf6f3ea Binary files /dev/null and b/9781430241881_ch07_MoreAboutXcode.zip differ diff --git a/9781430241881_ch08/.DS_Store b/9781430241881_ch08/.DS_Store new file mode 100644 index 0000000..6d1df1f Binary files /dev/null and b/9781430241881_ch08/.DS_Store differ diff --git a/9781430241881_ch08/08.01 FileWalker/.DS_Store b/9781430241881_ch08/08.01 FileWalker/.DS_Store new file mode 100644 index 0000000..66c8d6b Binary files /dev/null and b/9781430241881_ch08/08.01 FileWalker/.DS_Store differ diff --git a/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.1 b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.1 new file mode 100644 index 0000000..96535ae --- /dev/null +++ b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 7/28/08 \" DATE +.Dt 08.01 FileWalker 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 08.01 FileWalker, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.m b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.m new file mode 100644 index 0000000..2f5bd0a --- /dev/null +++ b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.m @@ -0,0 +1,36 @@ +#import + +int main (int argc, const char * argv[]) +{ + @autoreleasepool + { + NSFileManager *manager; + manager = [NSFileManager defaultManager]; + + NSString *home; + home = [@"~" stringByExpandingTildeInPath]; + + NSDirectoryEnumerator *direnum; + direnum = [manager enumeratorAtPath:home]; + + NSMutableArray *files; + files = [NSMutableArray arrayWithCapacity:42]; + + NSString *filename; + while (filename = [direnum nextObject]) + { + if ([[filename pathExtension] isEqualTo: @"jpg"]) { + [files addObject: filename]; + } + } + + NSEnumerator *fileenum; + fileenum = [files objectEnumerator]; + + while (filename = [fileenum nextObject]) + { + NSLog (@"%@", filename); + } + } + return 0; +} diff --git a/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/TemplateIcon.icns b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/project.pbxproj b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/project.pbxproj new file mode 100644 index 0000000..ed845b9 --- /dev/null +++ b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/project.pbxproj @@ -0,0 +1,229 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 08.01 FileWalker.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 08.01 FileWalker.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 08.01 FileWalker.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 08.01 FileWalker.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 08.01 FileWalker.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 08.01 FileWalker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "08.01 FileWalker.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 08.01 FileWalker_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "08.01 FileWalker_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 08.01 FileWalker */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "08.01 FileWalker"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 08.01 FileWalker.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "08.01 FileWalker.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 08.01 FileWalker */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "08.01 FileWalker"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 08.01 FileWalker_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 08.01 FileWalker.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 08.01 FileWalker */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 08.01 FileWalker.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 08.01 FileWalker */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "08.01 FileWalker" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "08.01 FileWalker"; + productInstallPath = "$(HOME)/bin"; + productName = "08.01 FileWalker"; + productReference = 8DD76FA10486AA7600D96B5E /* 08.01 FileWalker */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "08.01 FileWalker" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 08.01 FileWalker */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 08.01 FileWalker */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 08.01 FileWalker.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "08.01 FileWalker_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "08.01 FileWalker"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "08.01 FileWalker_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "08.01 FileWalker"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "08.01 FileWalker" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "08.01 FileWalker" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/08.01 FileWalker.xcscheme b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/08.01 FileWalker.xcscheme new file mode 100644 index 0000000..7a8dc52 --- /dev/null +++ b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/08.01 FileWalker.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..8553125 --- /dev/null +++ b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 08.01 FileWalker.xcscheme + + orderHint + 19 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker_Prefix.pch b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker_Prefix.pch new file mode 100644 index 0000000..ba9e95b --- /dev/null +++ b/9781430241881_ch08/08.01 FileWalker/08.01 FileWalker_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '08.01 FileWalker' target in the '08.01 FileWalker' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.1 b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.1 new file mode 100644 index 0000000..7eeced3 --- /dev/null +++ b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 7/28/08 \" DATE +.Dt 08.02 FileWalkerPro 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 08.02 FileWalkerPro, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.m b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.m new file mode 100644 index 0000000..a3d3633 --- /dev/null +++ b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.m @@ -0,0 +1,30 @@ +#import + +int main (int argc, const char * argv[]) +{ + @autoreleasepool + { + NSFileManager *manager; + manager = [NSFileManager defaultManager]; + + NSString *home; + home = [@"~" stringByExpandingTildeInPath]; + + NSMutableArray *files; + files = [NSMutableArray arrayWithCapacity: 42]; + + for(NSString *filename in [manager enumeratorAtPath:home]) + { + if([[filename pathExtension] isEqualTo:@"jpg"]) + { + [files addObject:filename]; + } + } + + for(NSString *filename in files) + { + NSLog (@"%@", filename); + } + } + return 0; +} diff --git a/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/TemplateIcon.icns b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/project.pbxproj b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2ef2420 --- /dev/null +++ b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/project.pbxproj @@ -0,0 +1,229 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 08.02 FileWalkerPro.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 08.02 FileWalkerPro.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 08.02 FileWalkerPro.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 08.02 FileWalkerPro.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 08.02 FileWalkerPro.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 08.02 FileWalkerPro.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "08.02 FileWalkerPro.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 08.02 FileWalkerPro_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "08.02 FileWalkerPro_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 08.02 FileWalkerPro */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "08.02 FileWalkerPro"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 08.02 FileWalkerPro.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "08.02 FileWalkerPro.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 08.02 FileWalkerPro */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "08.02 FileWalkerPro"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 08.02 FileWalkerPro_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 08.02 FileWalkerPro.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 08.02 FileWalkerPro */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 08.02 FileWalkerPro.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 08.02 FileWalkerPro */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "08.02 FileWalkerPro" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "08.02 FileWalkerPro"; + productInstallPath = "$(HOME)/bin"; + productName = "08.02 FileWalkerPro"; + productReference = 8DD76FA10486AA7600D96B5E /* 08.02 FileWalkerPro */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "08.02 FileWalkerPro" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 08.02 FileWalkerPro */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 08.02 FileWalkerPro */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 08.02 FileWalkerPro.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "08.02 FileWalkerPro_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "08.02 FileWalkerPro"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "08.02 FileWalkerPro_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "08.02 FileWalkerPro"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "08.02 FileWalkerPro" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "08.02 FileWalkerPro" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/08.02 FileWalkerPro.xcscheme b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/08.02 FileWalkerPro.xcscheme new file mode 100644 index 0000000..364f90c --- /dev/null +++ b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/08.02 FileWalkerPro.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..932d6fd --- /dev/null +++ b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 08.02 FileWalkerPro.xcscheme + + orderHint + 20 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro_Prefix.pch b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro_Prefix.pch new file mode 100644 index 0000000..fa47421 --- /dev/null +++ b/9781430241881_ch08/08.02 FileWalkerPro/08.02 FileWalkerPro_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '08.02 FileWalkerPro' target in the '08.02 FileWalkerPro' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/project.pbxproj b/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/project.pbxproj new file mode 100644 index 0000000..d3c2506 --- /dev/null +++ b/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/project.pbxproj @@ -0,0 +1,238 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 84D1396A1475B66A00AC4610 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D139691475B66A00AC4610 /* Foundation.framework */; }; + 84D1396D1475B66A00AC4610 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D1396C1475B66A00AC4610 /* main.m */; }; + 84D139711475B66A00AC4610 /* Iterators.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D139701475B66A00AC4610 /* Iterators.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 84D139631475B66A00AC4610 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 84D139711475B66A00AC4610 /* Iterators.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 84D139651475B66A00AC4610 /* Iterators */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Iterators; sourceTree = BUILT_PRODUCTS_DIR; }; + 84D139691475B66A00AC4610 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 84D1396C1475B66A00AC4610 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 84D1396F1475B66A00AC4610 /* Iterators-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Iterators-Prefix.pch"; sourceTree = ""; }; + 84D139701475B66A00AC4610 /* Iterators.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Iterators.1; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 84D139621475B66A00AC4610 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 84D1396A1475B66A00AC4610 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 84D1395A1475B66A00AC4610 = { + isa = PBXGroup; + children = ( + 84D1396B1475B66A00AC4610 /* Iterators */, + 84D139681475B66A00AC4610 /* Frameworks */, + 84D139661475B66A00AC4610 /* Products */, + ); + sourceTree = ""; + }; + 84D139661475B66A00AC4610 /* Products */ = { + isa = PBXGroup; + children = ( + 84D139651475B66A00AC4610 /* Iterators */, + ); + name = Products; + sourceTree = ""; + }; + 84D139681475B66A00AC4610 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 84D139691475B66A00AC4610 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 84D1396B1475B66A00AC4610 /* Iterators */ = { + isa = PBXGroup; + children = ( + 84D1396C1475B66A00AC4610 /* main.m */, + 84D139701475B66A00AC4610 /* Iterators.1 */, + 84D1396E1475B66A00AC4610 /* Supporting Files */, + ); + path = Iterators; + sourceTree = ""; + }; + 84D1396E1475B66A00AC4610 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 84D1396F1475B66A00AC4610 /* Iterators-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 84D139641475B66A00AC4610 /* Iterators */ = { + isa = PBXNativeTarget; + buildConfigurationList = 84D139741475B66A00AC4610 /* Build configuration list for PBXNativeTarget "Iterators" */; + buildPhases = ( + 84D139611475B66A00AC4610 /* Sources */, + 84D139621475B66A00AC4610 /* Frameworks */, + 84D139631475B66A00AC4610 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Iterators; + productName = Iterators; + productReference = 84D139651475B66A00AC4610 /* Iterators */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 84D1395C1475B66A00AC4610 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + ORGANIZATIONNAME = "Crimson Research, Inc."; + }; + buildConfigurationList = 84D1395F1475B66A00AC4610 /* Build configuration list for PBXProject "08.03 Iterators" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 84D1395A1475B66A00AC4610; + productRefGroup = 84D139661475B66A00AC4610 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 84D139641475B66A00AC4610 /* Iterators */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 84D139611475B66A00AC4610 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 84D1396D1475B66A00AC4610 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 84D139721475B66A00AC4610 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 84D139731475B66A00AC4610 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + SDKROOT = macosx; + }; + name = Release; + }; + 84D139751475B66A00AC4610 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Iterators/Iterators-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 84D139761475B66A00AC4610 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Iterators/Iterators-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 84D1395F1475B66A00AC4610 /* Build configuration list for PBXProject "08.03 Iterators" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 84D139721475B66A00AC4610 /* Debug */, + 84D139731475B66A00AC4610 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 84D139741475B66A00AC4610 /* Build configuration list for PBXNativeTarget "Iterators" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 84D139751475B66A00AC4610 /* Debug */, + 84D139761475B66A00AC4610 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 84D1395C1475B66A00AC4610 /* Project object */; +} diff --git a/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/Iterators.xcscheme b/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/Iterators.xcscheme new file mode 100644 index 0000000..656ccf5 --- /dev/null +++ b/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/Iterators.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..3d4d580 --- /dev/null +++ b/9781430241881_ch08/08.03 Iterators/08.03 Iterators.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + Iterators.xcscheme + + orderHint + 21 + + + SuppressBuildableAutocreation + + 84D139641475B66A00AC4610 + + primary + + + + + diff --git a/9781430241881_ch08/08.03 Iterators/Iterators/Iterators-Prefix.pch b/9781430241881_ch08/08.03 Iterators/Iterators/Iterators-Prefix.pch new file mode 100644 index 0000000..8321270 --- /dev/null +++ b/9781430241881_ch08/08.03 Iterators/Iterators/Iterators-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'Iterators' target in the 'Iterators' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch08/08.03 Iterators/Iterators/Iterators.1 b/9781430241881_ch08/08.03 Iterators/Iterators/Iterators.1 new file mode 100644 index 0000000..16bd8fa --- /dev/null +++ b/9781430241881_ch08/08.03 Iterators/Iterators/Iterators.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 11/17/11 \" DATE +.Dt Iterators 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm Iterators, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch08/08.03 Iterators/Iterators/main.m b/9781430241881_ch08/08.03 Iterators/Iterators/main.m new file mode 100644 index 0000000..93912b1 --- /dev/null +++ b/9781430241881_ch08/08.03 Iterators/Iterators/main.m @@ -0,0 +1,48 @@ +// +// main.m +// Iterators +// +// Created by Waqar Malik on 11/17/11. +// Copyright (c) 2011 Crimson Research, Inc. All rights reserved. +// + +#import + +int main (int argc, const char * argv[]) +{ + @autoreleasepool + { + NSLog(@"Using Index"); + NSArray *array = [NSArray arrayWithObjects:@"one", @"two", @"three", @"four", nil]; + NSUInteger i = 0; + for(i = 0; i < [array count]; i++) + { + NSLog (@"index %lu has %@.", i, [array objectAtIndex:i]); + } + + NSLog(@"Using Object Enumerator"); + i = 0; + NSEnumerator *enumerator = [array objectEnumerator]; + NSString *value = nil; + while(value = [enumerator nextObject]) + { + NSLog (@"index %lu has %@.", i, value); + i++; + } + + NSLog(@"Using Fast Enumeration"); + i = 0; + for(NSString *value in array) + { + NSLog (@"index %lu has %@.", i, value); + i++; + } + + NSLog(@"Using Blocks"); + [array enumerateObjectsUsingBlock:^(NSString *value, NSUInteger index, BOOL *stop) { + NSLog (@"index %lu has %@.", index, value); + }]; + } + return 0; +} + diff --git a/9781430241881_ch09_MemoryManagement.zip b/9781430241881_ch09_MemoryManagement.zip new file mode 100644 index 0000000..7757c04 Binary files /dev/null and b/9781430241881_ch09_MemoryManagement.zip differ diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/.DS_Store b/9781430241881_ch10/10.01 CarPartsInit-ARC/.DS_Store new file mode 100644 index 0000000..c70b77d Binary files /dev/null and b/9781430241881_ch10/10.01 CarPartsInit-ARC/.DS_Store differ diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.1 b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.1 new file mode 100644 index 0000000..965363d --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/2/08 \" DATE +.Dt 10.01 CarPartsInit-GC 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 10.01 CarPartsInit-GC, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.m b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.m new file mode 100644 index 0000000..a27a0cf --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.m @@ -0,0 +1,30 @@ +#import +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + @autoreleasepool + { + Car *car = [[Car alloc] init]; + + for (int i = 0; i < 4; i++) + { + AllWeatherRadial *tire; + + tire = [[AllWeatherRadial alloc] init]; + + [car setTire: tire + atIndex: i]; + } + + Engine *engine = [[Slant6 alloc] init]; + [car setEngine: engine]; + + [car print]; + } + return (0); + +} // main + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/TemplateIcon.icns b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/project.pbxproj b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/project.pbxproj new file mode 100644 index 0000000..19082d5 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/project.pbxproj @@ -0,0 +1,261 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D7C37130E452C48001B1F50 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C37090E452C48001B1F50 /* Engine.m */; }; + 7D7C37140E452C48001B1F50 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C370B0E452C48001B1F50 /* Car.m */; }; + 7D7C37150E452C48001B1F50 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C370E0E452C48001B1F50 /* Tire.m */; }; + 7D7C37160E452C48001B1F50 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C37110E452C48001B1F50 /* AllWeatherRadial.m */; }; + 7D7C37170E452C48001B1F50 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C37120E452C48001B1F50 /* Slant6.m */; }; + 8DD76F9A0486AA7600D96B5E /* 10.01 CarPartsInit-ARC.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit-ARC.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 10.01 CarPartsInit-ARC.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 10.01 CarPartsInit-ARC.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 10.01 CarPartsInit-ARC.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit-ARC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "10.01 CarPartsInit-ARC.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 10.01 CarPartsInit-ARC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "10.01 CarPartsInit-ARC_Prefix.pch"; sourceTree = ""; }; + 7D7C37090E452C48001B1F50 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 7D7C370A0E452C48001B1F50 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D7C370B0E452C48001B1F50 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D7C370C0E452C48001B1F50 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 7D7C370D0E452C48001B1F50 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D7C370E0E452C48001B1F50 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 7D7C370F0E452C48001B1F50 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 7D7C37100E452C48001B1F50 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 7D7C37110E452C48001B1F50 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 7D7C37120E452C48001B1F50 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit-ARC */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "10.01 CarPartsInit-ARC"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 10.01 CarPartsInit-ARC.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "10.01 CarPartsInit-ARC.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 10.01 CarPartsInit-GC */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "10.01 CarPartsInit-GC"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit-ARC.m */, + 32A70AAB03705E1F00C91783 /* 10.01 CarPartsInit-ARC_Prefix.pch */, + 7D7C370F0E452C48001B1F50 /* AllWeatherRadial.h */, + 7D7C37110E452C48001B1F50 /* AllWeatherRadial.m */, + 7D7C370C0E452C48001B1F50 /* Car.h */, + 7D7C370B0E452C48001B1F50 /* Car.m */, + 7D7C37100E452C48001B1F50 /* Engine.h */, + 7D7C37090E452C48001B1F50 /* Engine.m */, + 7D7C370A0E452C48001B1F50 /* Slant6.h */, + 7D7C37120E452C48001B1F50 /* Slant6.m */, + 7D7C370D0E452C48001B1F50 /* Tire.h */, + 7D7C370E0E452C48001B1F50 /* Tire.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit-ARC */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 10.01 CarPartsInit-ARC.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 10.01 CarPartsInit-ARC */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "10.01 CarPartsInit-ARC" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "10.01 CarPartsInit-ARC"; + productInstallPath = "$(HOME)/bin"; + productName = "10.01 CarPartsInit-GC"; + productReference = 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit-ARC */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "10.01 CarPartsInit-ARC" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 10.01 CarPartsInit-GC */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 10.01 CarPartsInit-ARC */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 10.01 CarPartsInit-ARC.m in Sources */, + 7D7C37130E452C48001B1F50 /* Engine.m in Sources */, + 7D7C37140E452C48001B1F50 /* Car.m in Sources */, + 7D7C37150E452C48001B1F50 /* Tire.m in Sources */, + 7D7C37160E452C48001B1F50 /* AllWeatherRadial.m in Sources */, + 7D7C37170E452C48001B1F50 /* Slant6.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "10.01 CarPartsInit-ARC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "10.01 CarPartsInit-ARC"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "10.01 CarPartsInit-ARC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "10.01 CarPartsInit-ARC"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = unsupported; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = unsupported; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "10.01 CarPartsInit-ARC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "10.01 CarPartsInit-ARC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit-ARC.xcscheme b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit-ARC.xcscheme new file mode 100644 index 0000000..2a6fcf1 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit-ARC.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..26af484 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 10.01 CarPartsInit-ARC.xcscheme + + orderHint + 27 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC_Prefix.pch b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC_Prefix.pch new file mode 100644 index 0000000..b64647f --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/10.01 CarPartsInit-ARC_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '10.01 CarPartsInit-GC' target in the '10.01 CarPartsInit-GC' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/AllWeatherRadial.h b/9781430241881_ch10/10.01 CarPartsInit-ARC/AllWeatherRadial.h new file mode 100644 index 0000000..214abef --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/AllWeatherRadial.h @@ -0,0 +1,15 @@ +#import +#import "Tire.h" + +@interface AllWeatherRadial : Tire { + float rainHandling; + float snowHandling; +} + +- (void) setRainHandling: (float) rainHanding; +- (float) rainHandling; + +- (void) setSnowHandling: (float) snowHandling; +- (float) snowHandling; + +@end // AllWeatherRadial diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/AllWeatherRadial.m b/9781430241881_ch10/10.01 CarPartsInit-ARC/AllWeatherRadial.m new file mode 100644 index 0000000..8c0bd15 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/AllWeatherRadial.m @@ -0,0 +1,57 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super initWithPressure: p + treadDepth: td]) { + rainHandling = 23.7; + snowHandling = 42.5; + } + + return (self); + +} // initWithPressure:treadDepth + + +- (void) setRainHandling: (float) rh +{ + rainHandling = rh; +} // setRainHandling + + +- (float) rainHandling +{ + return (rainHandling); +} // rainHandling + + +- (void) setSnowHandling: (float) sh +{ + snowHandling = sh; +} // setSnowHandling + + +- (float) snowHandling +{ + return (snowHandling); +} // snowHandling + + +- (NSString *) description +{ + NSString *desc; + desc = [[NSString alloc] initWithFormat: + @"AllWeatherRadial: %.1f / %.1f / %.1f / %.1f", + [self pressure], [self treadDepth], + [self rainHandling], + [self snowHandling]]; + + return (desc); + +} // description + +@end // AllWeatherRadial + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/Car.h b/9781430241881_ch10/10.01 CarPartsInit-ARC/Car.h new file mode 100644 index 0000000..a10337a --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/Car.h @@ -0,0 +1,24 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +{ + NSMutableArray *tires; + Engine *engine; +} + +- (void) setEngine: (Engine *) newEngine; + +- (Engine *) engine; + + +- (void) setTire: (Tire *) tire + atIndex: (int) index; + +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/Car.m b/9781430241881_ch10/10.01 CarPartsInit-ARC/Car.m new file mode 100644 index 0000000..4eeccc6 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/Car.m @@ -0,0 +1,66 @@ +#import "Car.h" + +@implementation Car + +- (id) init +{ + if (self = [super init]) + { + tires = [[NSMutableArray alloc] init]; + + for (int i = 0; i < 4; i++) + { + [tires addObject: [NSNull null]]; + } + } + + return (self); + +} // init + + +- (Engine *) engine +{ + return (engine); +} // engine + + +- (void) setEngine: (Engine *) newEngine +{ + engine = newEngine; + +} // setEngine + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + [tires replaceObjectAtIndex: index + withObject: tire]; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + Tire *tire; + tire = [tires objectAtIndex: index]; + + return (tire); + +} // tireAtIndex: + + +- (void) print +{ + for (int i = 0; i < 4; i++) + { + NSLog (@"%@", [self tireAtIndex: i]); + } + + NSLog (@"%@", engine); + +} // print + +@end // Car + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/Engine.h b/9781430241881_ch10/10.01 CarPartsInit-ARC/Engine.h new file mode 100644 index 0000000..661a1f2 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/Engine.m b/9781430241881_ch10/10.01 CarPartsInit-ARC/Engine.m new file mode 100644 index 0000000..83b1d4c --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/Engine.m @@ -0,0 +1,11 @@ +#import "Engine.h" + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/Slant6.h b/9781430241881_ch10/10.01 CarPartsInit-ARC/Slant6.h new file mode 100644 index 0000000..22716ed --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/Slant6.h @@ -0,0 +1,6 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/Slant6.m b/9781430241881_ch10/10.01 CarPartsInit-ARC/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/Tire.h b/9781430241881_ch10/10.01 CarPartsInit-ARC/Tire.h new file mode 100644 index 0000000..18692cf --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/Tire.h @@ -0,0 +1,20 @@ +#import + +@interface Tire : NSObject { + float pressure; + float treadDepth; +} + +- (id) initWithPressure: (float) pressure; +- (id) initWithTreadDepth: (float) treadDepth; + +- (id) initWithPressure: (float) pressure + treadDepth: (float) treadDepth; + +- (void) setPressure: (float) pressure; +- (float) pressure; + +- (void) setTreadDepth: (float) treadDepth; +- (float) treadDepth; + +@end // Tire diff --git a/9781430241881_ch10/10.01 CarPartsInit-ARC/Tire.m b/9781430241881_ch10/10.01 CarPartsInit-ARC/Tire.m new file mode 100644 index 0000000..7b9c658 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-ARC/Tire.m @@ -0,0 +1,88 @@ +#import "Tire.h" + + +@implementation Tire + +- (id) init +{ + if (self = [self initWithPressure: 34 + treadDepth: 20]) { + } + + return (self); + +} // init + + +- (id) initWithPressure: (float) p +{ + if (self = [self initWithPressure: p + treadDepth: 20.0]) { + } + + return (self); + +} // initWithPressure + + +- (id) initWithTreadDepth: (float) td +{ + if (self = [self initWithPressure: 34.0 + treadDepth: td]) { + } + + return (self); + +} // initWithTreadDepth + + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super init]) { + pressure = p; + treadDepth = td; + } + + return (self); + +} // initWithPressure:treadDepth: + + + +- (void) setPressure: (float) p +{ + pressure = p; +} // setPressure + + +- (float) pressure +{ + return (pressure); +} // pressure + + +- (void) setTreadDepth: (float) td +{ + treadDepth = td; +} // setTreadDepth + + +- (float) treadDepth +{ + return (treadDepth); +} // treadDepth + + +- (NSString *) description +{ + NSString *desc; + desc = [NSString stringWithFormat: + @"Tire: Pressure: %.1f TreadDepth: %.1f", + pressure, treadDepth]; + return (desc); + +} // description + +@end // Tire + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/.DS_Store b/9781430241881_ch10/10.01 CarPartsInit-GC/.DS_Store new file mode 100644 index 0000000..6ec64d5 Binary files /dev/null and b/9781430241881_ch10/10.01 CarPartsInit-GC/.DS_Store differ diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.1 b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.1 new file mode 100644 index 0000000..965363d --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/2/08 \" DATE +.Dt 10.01 CarPartsInit-GC 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 10.01 CarPartsInit-GC, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.m b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.m new file mode 100644 index 0000000..0ff3f74 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.m @@ -0,0 +1,28 @@ +#import +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + Car *car = [[Car alloc] init]; + + for (int i = 0; i < 4; i++) + { + AllWeatherRadial *tire; + + tire = [[AllWeatherRadial alloc] init]; + + [car setTire: tire + atIndex: i]; + } + + Engine *engine = [[Slant6 alloc] init]; + [car setEngine: engine]; + + [car print]; + + return (0); + +} // main + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/TemplateIcon.icns b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/project.pbxproj b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e4465f8 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/project.pbxproj @@ -0,0 +1,259 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D7C37130E452C48001B1F50 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C37090E452C48001B1F50 /* Engine.m */; }; + 7D7C37140E452C48001B1F50 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C370B0E452C48001B1F50 /* Car.m */; }; + 7D7C37150E452C48001B1F50 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C370E0E452C48001B1F50 /* Tire.m */; }; + 7D7C37160E452C48001B1F50 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C37110E452C48001B1F50 /* AllWeatherRadial.m */; }; + 7D7C37170E452C48001B1F50 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C37120E452C48001B1F50 /* Slant6.m */; }; + 8DD76F9A0486AA7600D96B5E /* 10.01 CarPartsInit-GC.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit-GC.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 10.01 CarPartsInit-GC.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 10.01 CarPartsInit-GC.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 10.01 CarPartsInit-GC.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit-GC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "10.01 CarPartsInit-GC.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 10.01 CarPartsInit-GC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "10.01 CarPartsInit-GC_Prefix.pch"; sourceTree = ""; }; + 7D7C37090E452C48001B1F50 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 7D7C370A0E452C48001B1F50 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D7C370B0E452C48001B1F50 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D7C370C0E452C48001B1F50 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 7D7C370D0E452C48001B1F50 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D7C370E0E452C48001B1F50 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 7D7C370F0E452C48001B1F50 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 7D7C37100E452C48001B1F50 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 7D7C37110E452C48001B1F50 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 7D7C37120E452C48001B1F50 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit-GC */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "10.01 CarPartsInit-GC"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 10.01 CarPartsInit-GC.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "10.01 CarPartsInit-GC.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 10.01 CarPartsInit-GC */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "10.01 CarPartsInit-GC"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit-GC.m */, + 32A70AAB03705E1F00C91783 /* 10.01 CarPartsInit-GC_Prefix.pch */, + 7D7C370F0E452C48001B1F50 /* AllWeatherRadial.h */, + 7D7C37110E452C48001B1F50 /* AllWeatherRadial.m */, + 7D7C370C0E452C48001B1F50 /* Car.h */, + 7D7C370B0E452C48001B1F50 /* Car.m */, + 7D7C37100E452C48001B1F50 /* Engine.h */, + 7D7C37090E452C48001B1F50 /* Engine.m */, + 7D7C370A0E452C48001B1F50 /* Slant6.h */, + 7D7C37120E452C48001B1F50 /* Slant6.m */, + 7D7C370D0E452C48001B1F50 /* Tire.h */, + 7D7C370E0E452C48001B1F50 /* Tire.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit-GC */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 10.01 CarPartsInit-GC.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 10.01 CarPartsInit-GC */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "10.01 CarPartsInit-GC" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "10.01 CarPartsInit-GC"; + productInstallPath = "$(HOME)/bin"; + productName = "10.01 CarPartsInit-GC"; + productReference = 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit-GC */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "10.01 CarPartsInit-GC" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 10.01 CarPartsInit-GC */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 10.01 CarPartsInit-GC */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 10.01 CarPartsInit-GC.m in Sources */, + 7D7C37130E452C48001B1F50 /* Engine.m in Sources */, + 7D7C37140E452C48001B1F50 /* Car.m in Sources */, + 7D7C37150E452C48001B1F50 /* Tire.m in Sources */, + 7D7C37160E452C48001B1F50 /* AllWeatherRadial.m in Sources */, + 7D7C37170E452C48001B1F50 /* Slant6.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "10.01 CarPartsInit-GC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "10.01 CarPartsInit-GC"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "10.01 CarPartsInit-GC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "10.01 CarPartsInit-GC"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = required; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_ENABLE_OBJC_GC = required; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "10.01 CarPartsInit-GC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "10.01 CarPartsInit-GC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit-GC.xcscheme b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit-GC.xcscheme new file mode 100644 index 0000000..4ebda26 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit-GC.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..2aa9756 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 10.01 CarPartsInit-GC.xcscheme + + orderHint + 27 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC_Prefix.pch b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC_Prefix.pch new file mode 100644 index 0000000..b64647f --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/10.01 CarPartsInit-GC_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '10.01 CarPartsInit-GC' target in the '10.01 CarPartsInit-GC' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/AllWeatherRadial.h b/9781430241881_ch10/10.01 CarPartsInit-GC/AllWeatherRadial.h new file mode 100644 index 0000000..214abef --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/AllWeatherRadial.h @@ -0,0 +1,15 @@ +#import +#import "Tire.h" + +@interface AllWeatherRadial : Tire { + float rainHandling; + float snowHandling; +} + +- (void) setRainHandling: (float) rainHanding; +- (float) rainHandling; + +- (void) setSnowHandling: (float) snowHandling; +- (float) snowHandling; + +@end // AllWeatherRadial diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/AllWeatherRadial.m b/9781430241881_ch10/10.01 CarPartsInit-GC/AllWeatherRadial.m new file mode 100644 index 0000000..8c0bd15 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/AllWeatherRadial.m @@ -0,0 +1,57 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super initWithPressure: p + treadDepth: td]) { + rainHandling = 23.7; + snowHandling = 42.5; + } + + return (self); + +} // initWithPressure:treadDepth + + +- (void) setRainHandling: (float) rh +{ + rainHandling = rh; +} // setRainHandling + + +- (float) rainHandling +{ + return (rainHandling); +} // rainHandling + + +- (void) setSnowHandling: (float) sh +{ + snowHandling = sh; +} // setSnowHandling + + +- (float) snowHandling +{ + return (snowHandling); +} // snowHandling + + +- (NSString *) description +{ + NSString *desc; + desc = [[NSString alloc] initWithFormat: + @"AllWeatherRadial: %.1f / %.1f / %.1f / %.1f", + [self pressure], [self treadDepth], + [self rainHandling], + [self snowHandling]]; + + return (desc); + +} // description + +@end // AllWeatherRadial + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/Car.h b/9781430241881_ch10/10.01 CarPartsInit-GC/Car.h new file mode 100644 index 0000000..a10337a --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/Car.h @@ -0,0 +1,24 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +{ + NSMutableArray *tires; + Engine *engine; +} + +- (void) setEngine: (Engine *) newEngine; + +- (Engine *) engine; + + +- (void) setTire: (Tire *) tire + atIndex: (int) index; + +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/Car.m b/9781430241881_ch10/10.01 CarPartsInit-GC/Car.m new file mode 100644 index 0000000..4eeccc6 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/Car.m @@ -0,0 +1,66 @@ +#import "Car.h" + +@implementation Car + +- (id) init +{ + if (self = [super init]) + { + tires = [[NSMutableArray alloc] init]; + + for (int i = 0; i < 4; i++) + { + [tires addObject: [NSNull null]]; + } + } + + return (self); + +} // init + + +- (Engine *) engine +{ + return (engine); +} // engine + + +- (void) setEngine: (Engine *) newEngine +{ + engine = newEngine; + +} // setEngine + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + [tires replaceObjectAtIndex: index + withObject: tire]; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + Tire *tire; + tire = [tires objectAtIndex: index]; + + return (tire); + +} // tireAtIndex: + + +- (void) print +{ + for (int i = 0; i < 4; i++) + { + NSLog (@"%@", [self tireAtIndex: i]); + } + + NSLog (@"%@", engine); + +} // print + +@end // Car + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/Engine.h b/9781430241881_ch10/10.01 CarPartsInit-GC/Engine.h new file mode 100644 index 0000000..661a1f2 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/Engine.m b/9781430241881_ch10/10.01 CarPartsInit-GC/Engine.m new file mode 100644 index 0000000..83b1d4c --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/Engine.m @@ -0,0 +1,11 @@ +#import "Engine.h" + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/Slant6.h b/9781430241881_ch10/10.01 CarPartsInit-GC/Slant6.h new file mode 100644 index 0000000..22716ed --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/Slant6.h @@ -0,0 +1,6 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/Slant6.m b/9781430241881_ch10/10.01 CarPartsInit-GC/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/Tire.h b/9781430241881_ch10/10.01 CarPartsInit-GC/Tire.h new file mode 100644 index 0000000..18692cf --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/Tire.h @@ -0,0 +1,20 @@ +#import + +@interface Tire : NSObject { + float pressure; + float treadDepth; +} + +- (id) initWithPressure: (float) pressure; +- (id) initWithTreadDepth: (float) treadDepth; + +- (id) initWithPressure: (float) pressure + treadDepth: (float) treadDepth; + +- (void) setPressure: (float) pressure; +- (float) pressure; + +- (void) setTreadDepth: (float) treadDepth; +- (float) treadDepth; + +@end // Tire diff --git a/9781430241881_ch10/10.01 CarPartsInit-GC/Tire.m b/9781430241881_ch10/10.01 CarPartsInit-GC/Tire.m new file mode 100644 index 0000000..7b9c658 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit-GC/Tire.m @@ -0,0 +1,88 @@ +#import "Tire.h" + + +@implementation Tire + +- (id) init +{ + if (self = [self initWithPressure: 34 + treadDepth: 20]) { + } + + return (self); + +} // init + + +- (id) initWithPressure: (float) p +{ + if (self = [self initWithPressure: p + treadDepth: 20.0]) { + } + + return (self); + +} // initWithPressure + + +- (id) initWithTreadDepth: (float) td +{ + if (self = [self initWithPressure: 34.0 + treadDepth: td]) { + } + + return (self); + +} // initWithTreadDepth + + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super init]) { + pressure = p; + treadDepth = td; + } + + return (self); + +} // initWithPressure:treadDepth: + + + +- (void) setPressure: (float) p +{ + pressure = p; +} // setPressure + + +- (float) pressure +{ + return (pressure); +} // pressure + + +- (void) setTreadDepth: (float) td +{ + treadDepth = td; +} // setTreadDepth + + +- (float) treadDepth +{ + return (treadDepth); +} // treadDepth + + +- (NSString *) description +{ + NSString *desc; + desc = [NSString stringWithFormat: + @"Tire: Pressure: %.1f TreadDepth: %.1f", + pressure, treadDepth]; + return (desc); + +} // description + +@end // Tire + diff --git a/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.1 b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.1 new file mode 100644 index 0000000..e19d805 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/2/08 \" DATE +.Dt 10.01 CarPartsInit 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 10.01 CarPartsInit, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.m b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.m new file mode 100644 index 0000000..3b20cd7 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.m @@ -0,0 +1,32 @@ +#import +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + @autoreleasepool + { + Car *car = [[Car alloc] init]; + + for (int i = 0; i < 4; i++) + { + AllWeatherRadial *tire; + + tire = [[AllWeatherRadial alloc] init]; + + [car setTire:tire atIndex:i]; + + [tire release]; + } + + Engine *engine = [[Slant6 alloc] init]; + [car setEngine:engine]; + + [car print]; + [car release]; + } + return (0); + +} // main + diff --git a/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/TemplateIcon.icns b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/project.pbxproj b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/project.pbxproj new file mode 100644 index 0000000..659dc0c --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/project.pbxproj @@ -0,0 +1,257 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D7C36F30E452B7E001B1F50 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36EA0E452B7E001B1F50 /* Car.m */; }; + 7D7C36F40E452B7E001B1F50 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36ED0E452B7E001B1F50 /* AllWeatherRadial.m */; }; + 7D7C36F50E452B7E001B1F50 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36EF0E452B7E001B1F50 /* Engine.m */; }; + 7D7C36F60E452B7E001B1F50 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36F10E452B7E001B1F50 /* Slant6.m */; }; + 7D7C36F70E452B7E001B1F50 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36F20E452B7E001B1F50 /* Tire.m */; }; + 8DD76F9A0486AA7600D96B5E /* 10.01 CarPartsInit.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 10.01 CarPartsInit.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 10.01 CarPartsInit.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 10.01 CarPartsInit.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "10.01 CarPartsInit.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 10.01 CarPartsInit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "10.01 CarPartsInit_Prefix.pch"; sourceTree = ""; }; + 7D7C36E90E452B7E001B1F50 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 7D7C36EA0E452B7E001B1F50 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D7C36EB0E452B7E001B1F50 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 7D7C36EC0E452B7E001B1F50 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 7D7C36ED0E452B7E001B1F50 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 7D7C36EE0E452B7E001B1F50 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D7C36EF0E452B7E001B1F50 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 7D7C36F00E452B7E001B1F50 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D7C36F10E452B7E001B1F50 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 7D7C36F20E452B7E001B1F50 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "10.01 CarPartsInit"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 10.01 CarPartsInit.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "10.01 CarPartsInit.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 10.01 CarPartsInit */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "10.01 CarPartsInit"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 08FB7796FE84155DC02AAC07 /* 10.01 CarPartsInit.m */, + 32A70AAB03705E1F00C91783 /* 10.01 CarPartsInit_Prefix.pch */, + 7D7C36EB0E452B7E001B1F50 /* AllWeatherRadial.h */, + 7D7C36ED0E452B7E001B1F50 /* AllWeatherRadial.m */, + 7D7C36EC0E452B7E001B1F50 /* Car.h */, + 7D7C36EA0E452B7E001B1F50 /* Car.m */, + 7D7C36E90E452B7E001B1F50 /* Engine.h */, + 7D7C36EF0E452B7E001B1F50 /* Engine.m */, + 7D7C36EE0E452B7E001B1F50 /* Slant6.h */, + 7D7C36F10E452B7E001B1F50 /* Slant6.m */, + 7D7C36F00E452B7E001B1F50 /* Tire.h */, + 7D7C36F20E452B7E001B1F50 /* Tire.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 10.01 CarPartsInit.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 10.01 CarPartsInit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "10.01 CarPartsInit" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "10.01 CarPartsInit"; + productInstallPath = "$(HOME)/bin"; + productName = "10.01 CarPartsInit"; + productReference = 8DD76FA10486AA7600D96B5E /* 10.01 CarPartsInit */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "10.01 CarPartsInit" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 10.01 CarPartsInit */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 10.01 CarPartsInit */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 10.01 CarPartsInit.m in Sources */, + 7D7C36F30E452B7E001B1F50 /* Car.m in Sources */, + 7D7C36F40E452B7E001B1F50 /* AllWeatherRadial.m in Sources */, + 7D7C36F50E452B7E001B1F50 /* Engine.m in Sources */, + 7D7C36F60E452B7E001B1F50 /* Slant6.m in Sources */, + 7D7C36F70E452B7E001B1F50 /* Tire.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "10.01 CarPartsInit_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "10.01 CarPartsInit"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "10.01 CarPartsInit_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "10.01 CarPartsInit"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "10.01 CarPartsInit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "10.01 CarPartsInit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit.xcscheme b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit.xcscheme new file mode 100644 index 0000000..c538727 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/10.01 CarPartsInit.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..b06b8f8 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 10.01 CarPartsInit.xcscheme + + orderHint + 26 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit_Prefix.pch b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit_Prefix.pch new file mode 100644 index 0000000..3141b7e --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/10.01 CarPartsInit_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '10.01 CarPartsInit' target in the '10.01 CarPartsInit' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch10/10.01 CarPartsInit/AllWeatherRadial.h b/9781430241881_ch10/10.01 CarPartsInit/AllWeatherRadial.h new file mode 100644 index 0000000..62e37b2 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/AllWeatherRadial.h @@ -0,0 +1,16 @@ +#import +#import "Tire.h" + +@interface AllWeatherRadial : Tire +{ + float rainHandling; + float snowHandling; +} + +- (void) setRainHandling: (float) rainHanding; +- (float) rainHandling; + +- (void) setSnowHandling: (float) snowHandling; +- (float) snowHandling; + +@end // AllWeatherRadial diff --git a/9781430241881_ch10/10.01 CarPartsInit/AllWeatherRadial.m b/9781430241881_ch10/10.01 CarPartsInit/AllWeatherRadial.m new file mode 100644 index 0000000..8c0bd15 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/AllWeatherRadial.m @@ -0,0 +1,57 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super initWithPressure: p + treadDepth: td]) { + rainHandling = 23.7; + snowHandling = 42.5; + } + + return (self); + +} // initWithPressure:treadDepth + + +- (void) setRainHandling: (float) rh +{ + rainHandling = rh; +} // setRainHandling + + +- (float) rainHandling +{ + return (rainHandling); +} // rainHandling + + +- (void) setSnowHandling: (float) sh +{ + snowHandling = sh; +} // setSnowHandling + + +- (float) snowHandling +{ + return (snowHandling); +} // snowHandling + + +- (NSString *) description +{ + NSString *desc; + desc = [[NSString alloc] initWithFormat: + @"AllWeatherRadial: %.1f / %.1f / %.1f / %.1f", + [self pressure], [self treadDepth], + [self rainHandling], + [self snowHandling]]; + + return (desc); + +} // description + +@end // AllWeatherRadial + diff --git a/9781430241881_ch10/10.01 CarPartsInit/Car.h b/9781430241881_ch10/10.01 CarPartsInit/Car.h new file mode 100644 index 0000000..a10337a --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/Car.h @@ -0,0 +1,24 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +{ + NSMutableArray *tires; + Engine *engine; +} + +- (void) setEngine: (Engine *) newEngine; + +- (Engine *) engine; + + +- (void) setTire: (Tire *) tire + atIndex: (int) index; + +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/9781430241881_ch10/10.01 CarPartsInit/Car.m b/9781430241881_ch10/10.01 CarPartsInit/Car.m new file mode 100644 index 0000000..ea45277 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/Car.m @@ -0,0 +1,78 @@ +#import "Car.h" + +@implementation Car + +- (id) init +{ + if (self = [super init]) { + + tires = [[NSMutableArray alloc] init]; + + int i; + for (i = 0; i < 4; i++) { + [tires addObject: [NSNull null]]; + } + } + + return (self); + +} // init + +- (void) dealloc +{ + [tires release]; + [engine release]; + + [super dealloc]; + +} // dealloc + + + +- (Engine *) engine +{ + return (engine); +} // engine + + +- (void) setEngine: (Engine *) newEngine +{ + [newEngine retain]; + [engine release]; + + engine = newEngine; + +} // setEngine + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + [tires replaceObjectAtIndex: index + withObject: tire]; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + Tire *tire; + tire = [tires objectAtIndex: index]; + + return (tire); + +} // tireAtIndex: + + +- (void) print +{ + for (int i = 0; i < 4; i++) { + NSLog (@"%@", [self tireAtIndex: i]); + } + + NSLog (@"%@", engine); + +} // print + +@end // Car + diff --git a/9781430241881_ch10/10.01 CarPartsInit/Engine.h b/9781430241881_ch10/10.01 CarPartsInit/Engine.h new file mode 100644 index 0000000..661a1f2 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/9781430241881_ch10/10.01 CarPartsInit/Engine.m b/9781430241881_ch10/10.01 CarPartsInit/Engine.m new file mode 100644 index 0000000..83b1d4c --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/Engine.m @@ -0,0 +1,11 @@ +#import "Engine.h" + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/9781430241881_ch10/10.01 CarPartsInit/Slant6.h b/9781430241881_ch10/10.01 CarPartsInit/Slant6.h new file mode 100644 index 0000000..22716ed --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/Slant6.h @@ -0,0 +1,6 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + + diff --git a/9781430241881_ch10/10.01 CarPartsInit/Slant6.m b/9781430241881_ch10/10.01 CarPartsInit/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/9781430241881_ch10/10.01 CarPartsInit/Tire.h b/9781430241881_ch10/10.01 CarPartsInit/Tire.h new file mode 100644 index 0000000..18692cf --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/Tire.h @@ -0,0 +1,20 @@ +#import + +@interface Tire : NSObject { + float pressure; + float treadDepth; +} + +- (id) initWithPressure: (float) pressure; +- (id) initWithTreadDepth: (float) treadDepth; + +- (id) initWithPressure: (float) pressure + treadDepth: (float) treadDepth; + +- (void) setPressure: (float) pressure; +- (float) pressure; + +- (void) setTreadDepth: (float) treadDepth; +- (float) treadDepth; + +@end // Tire diff --git a/9781430241881_ch10/10.01 CarPartsInit/Tire.m b/9781430241881_ch10/10.01 CarPartsInit/Tire.m new file mode 100644 index 0000000..7b9c658 --- /dev/null +++ b/9781430241881_ch10/10.01 CarPartsInit/Tire.m @@ -0,0 +1,88 @@ +#import "Tire.h" + + +@implementation Tire + +- (id) init +{ + if (self = [self initWithPressure: 34 + treadDepth: 20]) { + } + + return (self); + +} // init + + +- (id) initWithPressure: (float) p +{ + if (self = [self initWithPressure: p + treadDepth: 20.0]) { + } + + return (self); + +} // initWithPressure + + +- (id) initWithTreadDepth: (float) td +{ + if (self = [self initWithPressure: 34.0 + treadDepth: td]) { + } + + return (self); + +} // initWithTreadDepth + + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super init]) { + pressure = p; + treadDepth = td; + } + + return (self); + +} // initWithPressure:treadDepth: + + + +- (void) setPressure: (float) p +{ + pressure = p; +} // setPressure + + +- (float) pressure +{ + return (pressure); +} // pressure + + +- (void) setTreadDepth: (float) td +{ + treadDepth = td; +} // setTreadDepth + + +- (float) treadDepth +{ + return (treadDepth); +} // treadDepth + + +- (NSString *) description +{ + NSString *desc; + desc = [NSString stringWithFormat: + @"Tire: Pressure: %.1f TreadDepth: %.1f", + pressure, treadDepth]; + return (desc); + +} // description + +@end // Tire + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/.DS_Store b/9781430241881_ch11/11.01 CarProperties-ARC/.DS_Store new file mode 100644 index 0000000..7f27044 Binary files /dev/null and b/9781430241881_ch11/11.01 CarProperties-ARC/.DS_Store differ diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/AllWeatherRadial.h b/9781430241881_ch11/11.01 CarProperties-ARC/AllWeatherRadial.h new file mode 100644 index 0000000..1555e71 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/AllWeatherRadial.h @@ -0,0 +1,7 @@ +#import +#import "Tire.h" + +@interface AllWeatherRadial : Tire +@property float rainHandling; +@property float snowHandling; +@end // AllWeatherRadial diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/AllWeatherRadial.m b/9781430241881_ch11/11.01 CarProperties-ARC/AllWeatherRadial.m new file mode 100644 index 0000000..e6f5d45 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/AllWeatherRadial.m @@ -0,0 +1,36 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +@synthesize rainHandling; +@synthesize snowHandling; + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super initWithPressure: p + treadDepth: td]) { + rainHandling = 23.7; + snowHandling = 42.5; + } + + return (self); + +} // initWithPressure:treadDepth + + +- (NSString *) description +{ + NSString *desc; + desc = [[NSString alloc] initWithFormat: + @"AllWeatherRadial: %.1f / %.1f / %.1f / %.1f", + [self pressure], [self treadDepth], + [self rainHandling], + [self snowHandling]]; + + return (desc); + +} // description + +@end // AllWeatherRadial + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/Car.h b/9781430241881_ch11/11.01 CarProperties-ARC/Car.h new file mode 100644 index 0000000..611d2a0 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/Car.h @@ -0,0 +1,16 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +@property (readwrite, copy) NSString *name; +@property (readwrite, strong) Engine *engine; + +- (void) setTire: (Tire *) tire + atIndex: (int) index; +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/Car.m b/9781430241881_ch11/11.01 CarProperties-ARC/Car.m new file mode 100644 index 0000000..c06df5f --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/Car.m @@ -0,0 +1,60 @@ +#import "Car.h" +#import "Engine.h" + +@implementation Car +{ + NSMutableArray *tires; +} + +@synthesize name = appellation; +@synthesize engine; + +- (id) init +{ + if (self = [super init]) { + + self.name = @"Car"; + tires = [[NSMutableArray alloc] init]; + + for (int i = 0; i < 4; i++) { + [tires addObject: [NSNull null]]; + } + } + + return (self); + +} // init + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + [tires replaceObjectAtIndex: index + withObject: tire]; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + Tire *tire; + tire = [tires objectAtIndex: index]; + + return (tire); + +} // tireAtIndex: + + +- (void) print +{ + NSLog (@"%@ has:", self.name); + + for (int i = 0; i < 4; i++) { + NSLog (@"%@", [self tireAtIndex: i]); + } + + NSLog (@"%@", engine); + +} // print + +@end // Car + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.m b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.m new file mode 100644 index 0000000..21ba8c4 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.m @@ -0,0 +1,32 @@ +#import +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + @autoreleasepool + { + Car *car = [[Car alloc] init]; + car.name = @"Herbie"; + + for (int i = 0; i < 4; i++) { + AllWeatherRadial *tire; + + tire = [[AllWeatherRadial alloc] init]; + [tire setRainHandling: 20 + i]; + [tire setSnowHandling: 28 + i]; + + [car setTire: tire atIndex: i]; + } + + Slant6 *engine = [[Slant6 alloc] init]; + car.engine = engine; + + [car print]; + } + + return (0); + +} // main + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/TemplateIcon.icns b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/project.pbxproj b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/project.pbxproj new file mode 100644 index 0000000..af6226b --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/project.pbxproj @@ -0,0 +1,259 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D2328710E45EC90005DC603 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2328670E45EC90005DC603 /* Engine.m */; }; + 7D2328720E45EC90005DC603 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2328690E45EC90005DC603 /* Car.m */; }; + 7D2328730E45EC90005DC603 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D23286C0E45EC90005DC603 /* Tire.m */; }; + 7D2328740E45EC90005DC603 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D23286F0E45EC90005DC603 /* AllWeatherRadial.m */; }; + 7D2328750E45EC90005DC603 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2328700E45EC90005DC603 /* Slant6.m */; }; + 8DD76F9A0486AA7600D96B5E /* CarProperties-ARC.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* CarProperties-ARC.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* CarProperties.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* CarProperties.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* CarProperties.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* CarProperties-ARC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CarProperties-ARC.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* CarProperties-ARC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CarProperties-ARC_Prefix.pch"; sourceTree = ""; }; + 7D2328670E45EC90005DC603 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 7D2328680E45EC90005DC603 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D2328690E45EC90005DC603 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D23286A0E45EC90005DC603 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 7D23286B0E45EC90005DC603 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D23286C0E45EC90005DC603 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 7D23286D0E45EC90005DC603 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 7D23286E0E45EC90005DC603 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 7D23286F0E45EC90005DC603 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 7D2328700E45EC90005DC603 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* CarProperties-ARC */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "CarProperties-ARC"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* CarProperties.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = CarProperties.1; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* CarProperties */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = CarProperties; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 7D23286D0E45EC90005DC603 /* AllWeatherRadial.h */, + 7D23286F0E45EC90005DC603 /* AllWeatherRadial.m */, + 7D23286A0E45EC90005DC603 /* Car.h */, + 7D2328690E45EC90005DC603 /* Car.m */, + 08FB7796FE84155DC02AAC07 /* CarProperties-ARC.m */, + 32A70AAB03705E1F00C91783 /* CarProperties-ARC_Prefix.pch */, + 7D23286E0E45EC90005DC603 /* Engine.h */, + 7D2328670E45EC90005DC603 /* Engine.m */, + 7D2328680E45EC90005DC603 /* Slant6.h */, + 7D2328700E45EC90005DC603 /* Slant6.m */, + 7D23286B0E45EC90005DC603 /* Tire.h */, + 7D23286C0E45EC90005DC603 /* Tire.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* CarProperties-ARC */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* CarProperties.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* CarProperties-ARC */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "CarProperties-ARC" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "CarProperties-ARC"; + productInstallPath = "$(HOME)/bin"; + productName = CarProperties; + productReference = 8DD76FA10486AA7600D96B5E /* CarProperties-ARC */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "CarProperties-ARC" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* CarProperties */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* CarProperties-ARC */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* CarProperties-ARC.m in Sources */, + 7D2328710E45EC90005DC603 /* Engine.m in Sources */, + 7D2328720E45EC90005DC603 /* Car.m in Sources */, + 7D2328730E45EC90005DC603 /* Tire.m in Sources */, + 7D2328740E45EC90005DC603 /* AllWeatherRadial.m in Sources */, + 7D2328750E45EC90005DC603 /* Slant6.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "CarProperties-ARC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "CarProperties-ARC"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_OBJC_ARC = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "CarProperties-ARC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "CarProperties-ARC"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "CarProperties-ARC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "CarProperties-ARC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarProperties-ARC.xcscheme b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarProperties-ARC.xcscheme new file mode 100644 index 0000000..8a6021e --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarProperties-ARC.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..4f2982f --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + CarProperties-ARC.xcscheme + + orderHint + 29 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC_Prefix.pch b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC_Prefix.pch new file mode 100644 index 0000000..53afce1 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties-ARC_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'CarProperties' target in the 'CarProperties' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties.1 b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties.1 new file mode 100644 index 0000000..1bf4fbe --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/CarProperties.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/3/08 \" DATE +.Dt CarProperties 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm CarProperties, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/Engine.h b/9781430241881_ch11/11.01 CarProperties-ARC/Engine.h new file mode 100644 index 0000000..661a1f2 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/Engine.m b/9781430241881_ch11/11.01 CarProperties-ARC/Engine.m new file mode 100644 index 0000000..83b1d4c --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/Engine.m @@ -0,0 +1,11 @@ +#import "Engine.h" + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/Slant6.h b/9781430241881_ch11/11.01 CarProperties-ARC/Slant6.h new file mode 100644 index 0000000..22716ed --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/Slant6.h @@ -0,0 +1,6 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/Slant6.m b/9781430241881_ch11/11.01 CarProperties-ARC/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/Tire.h b/9781430241881_ch11/11.01 CarProperties-ARC/Tire.h new file mode 100644 index 0000000..4a640ce --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/Tire.h @@ -0,0 +1,13 @@ +#import + +@interface Tire : NSObject +@property float pressure; +@property float treadDepth; + +- (id) initWithPressure: (float) pressure; +- (id) initWithTreadDepth: (float) treadDepth; + +- (id) initWithPressure: (float) pressure + treadDepth: (float) treadDepth; + +@end // Tire diff --git a/9781430241881_ch11/11.01 CarProperties-ARC/Tire.m b/9781430241881_ch11/11.01 CarProperties-ARC/Tire.m new file mode 100644 index 0000000..3b3cefe --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties-ARC/Tire.m @@ -0,0 +1,66 @@ +#import "Tire.h" + + +@implementation Tire + +@synthesize pressure; +@synthesize treadDepth; + +- (id) init +{ + if (self = [self initWithPressure: 34 + treadDepth: 20]) { + } + + return (self); + +} // init + + +- (id) initWithPressure: (float) p +{ + if (self = [self initWithPressure: p + treadDepth: 20.0]) { + } + + return (self); + +} // initWithPressure + + +- (id) initWithTreadDepth: (float) td +{ + if (self = [self initWithPressure: 34.0 + treadDepth: td]) { + } + + return (self); + +} // initWithTreadDepth + + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super init]) { + pressure = p; + treadDepth = td; + } + + return (self); + +} // initWithPressure:treadDepth: + + +- (NSString *) description +{ + NSString *desc; + desc = [NSString stringWithFormat: + @"Tire: Pressure: %.1f TreadDepth: %.1f", + pressure, treadDepth]; + return (desc); + +} // description + +@end // Tire + diff --git a/9781430241881_ch11/11.01 CarProperties/AllWeatherRadial.h b/9781430241881_ch11/11.01 CarProperties/AllWeatherRadial.h new file mode 100644 index 0000000..1555e71 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/AllWeatherRadial.h @@ -0,0 +1,7 @@ +#import +#import "Tire.h" + +@interface AllWeatherRadial : Tire +@property float rainHandling; +@property float snowHandling; +@end // AllWeatherRadial diff --git a/9781430241881_ch11/11.01 CarProperties/AllWeatherRadial.m b/9781430241881_ch11/11.01 CarProperties/AllWeatherRadial.m new file mode 100644 index 0000000..e6f5d45 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/AllWeatherRadial.m @@ -0,0 +1,36 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +@synthesize rainHandling; +@synthesize snowHandling; + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super initWithPressure: p + treadDepth: td]) { + rainHandling = 23.7; + snowHandling = 42.5; + } + + return (self); + +} // initWithPressure:treadDepth + + +- (NSString *) description +{ + NSString *desc; + desc = [[NSString alloc] initWithFormat: + @"AllWeatherRadial: %.1f / %.1f / %.1f / %.1f", + [self pressure], [self treadDepth], + [self rainHandling], + [self snowHandling]]; + + return (desc); + +} // description + +@end // AllWeatherRadial + diff --git a/9781430241881_ch11/11.01 CarProperties/Car.h b/9781430241881_ch11/11.01 CarProperties/Car.h new file mode 100644 index 0000000..9c170c4 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/Car.h @@ -0,0 +1,16 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +@property (readwrite, copy) NSString *name; +@property (readwrite, retain) Engine *engine; + +- (void) setTire: (Tire *) tire + atIndex: (int) index; +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/9781430241881_ch11/11.01 CarProperties/Car.m b/9781430241881_ch11/11.01 CarProperties/Car.m new file mode 100644 index 0000000..3968de9 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/Car.m @@ -0,0 +1,72 @@ +#import "Car.h" + +@implementation Car +{ + NSMutableArray *tires; +} + +@synthesize name = appellation; +@synthesize engine; + +- (id) init +{ + if (self = [super init]) { + + self.name = @"Car"; + tires = [[NSMutableArray alloc] init]; + + for (int i = 0; i < 4; i++) { + [tires addObject: [NSNull null]]; + } + } + + return (self); + +} // init + + +- (void) dealloc +{ + [appellation release]; + + [tires release]; + [engine release]; + + [super dealloc]; + +} // dealloc + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + [tires replaceObjectAtIndex: index + withObject: tire]; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + Tire *tire; + tire = [tires objectAtIndex: index]; + + return (tire); + +} // tireAtIndex: + + +- (void) print +{ + NSLog (@"%@ has:", self.name); + + for (int i = 0; i < 4; i++) { + NSLog (@"%@", [self tireAtIndex: i]); + } + + NSLog (@"%@", engine); + +} // print + +@end // Car + diff --git a/9781430241881_ch11/11.01 CarProperties/CarProperties.1 b/9781430241881_ch11/11.01 CarProperties/CarProperties.1 new file mode 100644 index 0000000..1bf4fbe --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/CarProperties.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/3/08 \" DATE +.Dt CarProperties 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm CarProperties, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch11/11.01 CarProperties/CarProperties.m b/9781430241881_ch11/11.01 CarProperties/CarProperties.m new file mode 100644 index 0000000..1c82fdc --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/CarProperties.m @@ -0,0 +1,37 @@ +#import +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + @autoreleasepool + { + Car *car = [[Car alloc] init]; + car.name = @"Herbie"; + + for (int i = 0; i < 4; i++) { + AllWeatherRadial *tire; + + tire = [[AllWeatherRadial alloc] init]; + [tire setRainHandling: 20 + i]; + [tire setSnowHandling: 28 + i]; + + [car setTire: tire atIndex: i]; + + [tire release]; + } + + Slant6 *engine = [[Slant6 alloc] init]; + car.engine = engine; + + [engine release]; + + [car print]; + [car release]; + } + + return (0); + +} // main + diff --git a/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/TemplateIcon.icns b/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/project.pbxproj b/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/project.pbxproj new file mode 100644 index 0000000..adc70e2 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/project.pbxproj @@ -0,0 +1,257 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D2328710E45EC90005DC603 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2328670E45EC90005DC603 /* Engine.m */; }; + 7D2328720E45EC90005DC603 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2328690E45EC90005DC603 /* Car.m */; }; + 7D2328730E45EC90005DC603 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D23286C0E45EC90005DC603 /* Tire.m */; }; + 7D2328740E45EC90005DC603 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D23286F0E45EC90005DC603 /* AllWeatherRadial.m */; }; + 7D2328750E45EC90005DC603 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2328700E45EC90005DC603 /* Slant6.m */; }; + 8DD76F9A0486AA7600D96B5E /* CarProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* CarProperties.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* CarProperties.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* CarProperties.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* CarProperties.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* CarProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CarProperties.m; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* CarProperties_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CarProperties_Prefix.pch; sourceTree = ""; }; + 7D2328670E45EC90005DC603 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 7D2328680E45EC90005DC603 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D2328690E45EC90005DC603 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D23286A0E45EC90005DC603 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 7D23286B0E45EC90005DC603 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D23286C0E45EC90005DC603 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 7D23286D0E45EC90005DC603 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 7D23286E0E45EC90005DC603 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 7D23286F0E45EC90005DC603 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 7D2328700E45EC90005DC603 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* CarProperties */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CarProperties; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* CarProperties.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = CarProperties.1; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* CarProperties */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = CarProperties; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 7D23286D0E45EC90005DC603 /* AllWeatherRadial.h */, + 7D23286F0E45EC90005DC603 /* AllWeatherRadial.m */, + 7D23286A0E45EC90005DC603 /* Car.h */, + 7D2328690E45EC90005DC603 /* Car.m */, + 08FB7796FE84155DC02AAC07 /* CarProperties.m */, + 32A70AAB03705E1F00C91783 /* CarProperties_Prefix.pch */, + 7D23286E0E45EC90005DC603 /* Engine.h */, + 7D2328670E45EC90005DC603 /* Engine.m */, + 7D2328680E45EC90005DC603 /* Slant6.h */, + 7D2328700E45EC90005DC603 /* Slant6.m */, + 7D23286B0E45EC90005DC603 /* Tire.h */, + 7D23286C0E45EC90005DC603 /* Tire.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* CarProperties */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* CarProperties.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* CarProperties */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "CarProperties" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CarProperties; + productInstallPath = "$(HOME)/bin"; + productName = CarProperties; + productReference = 8DD76FA10486AA7600D96B5E /* CarProperties */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "CarProperties" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* CarProperties */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* CarProperties */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* CarProperties.m in Sources */, + 7D2328710E45EC90005DC603 /* Engine.m in Sources */, + 7D2328720E45EC90005DC603 /* Car.m in Sources */, + 7D2328730E45EC90005DC603 /* Tire.m in Sources */, + 7D2328740E45EC90005DC603 /* AllWeatherRadial.m in Sources */, + 7D2328750E45EC90005DC603 /* Slant6.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = CarProperties_Prefix.pch; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = CarProperties; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = CarProperties_Prefix.pch; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = CarProperties; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "CarProperties" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "CarProperties" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarProperties.xcscheme b/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarProperties.xcscheme new file mode 100644 index 0000000..e1ae8d5 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/CarProperties.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d4406d4 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/CarProperties.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + CarProperties.xcscheme + + orderHint + 29 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch11/11.01 CarProperties/CarProperties_Prefix.pch b/9781430241881_ch11/11.01 CarProperties/CarProperties_Prefix.pch new file mode 100644 index 0000000..53afce1 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/CarProperties_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'CarProperties' target in the 'CarProperties' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch11/11.01 CarProperties/Engine.h b/9781430241881_ch11/11.01 CarProperties/Engine.h new file mode 100644 index 0000000..661a1f2 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/9781430241881_ch11/11.01 CarProperties/Engine.m b/9781430241881_ch11/11.01 CarProperties/Engine.m new file mode 100644 index 0000000..83b1d4c --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/Engine.m @@ -0,0 +1,11 @@ +#import "Engine.h" + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/9781430241881_ch11/11.01 CarProperties/Slant6.h b/9781430241881_ch11/11.01 CarProperties/Slant6.h new file mode 100644 index 0000000..22716ed --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/Slant6.h @@ -0,0 +1,6 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + + diff --git a/9781430241881_ch11/11.01 CarProperties/Slant6.m b/9781430241881_ch11/11.01 CarProperties/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/9781430241881_ch11/11.01 CarProperties/Tire.h b/9781430241881_ch11/11.01 CarProperties/Tire.h new file mode 100644 index 0000000..4a640ce --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/Tire.h @@ -0,0 +1,13 @@ +#import + +@interface Tire : NSObject +@property float pressure; +@property float treadDepth; + +- (id) initWithPressure: (float) pressure; +- (id) initWithTreadDepth: (float) treadDepth; + +- (id) initWithPressure: (float) pressure + treadDepth: (float) treadDepth; + +@end // Tire diff --git a/9781430241881_ch11/11.01 CarProperties/Tire.m b/9781430241881_ch11/11.01 CarProperties/Tire.m new file mode 100644 index 0000000..3b3cefe --- /dev/null +++ b/9781430241881_ch11/11.01 CarProperties/Tire.m @@ -0,0 +1,66 @@ +#import "Tire.h" + + +@implementation Tire + +@synthesize pressure; +@synthesize treadDepth; + +- (id) init +{ + if (self = [self initWithPressure: 34 + treadDepth: 20]) { + } + + return (self); + +} // init + + +- (id) initWithPressure: (float) p +{ + if (self = [self initWithPressure: p + treadDepth: 20.0]) { + } + + return (self); + +} // initWithPressure + + +- (id) initWithTreadDepth: (float) td +{ + if (self = [self initWithPressure: 34.0 + treadDepth: td]) { + } + + return (self); + +} // initWithTreadDepth + + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super init]) { + pressure = p; + treadDepth = td; + } + + return (self); + +} // initWithPressure:treadDepth: + + +- (NSString *) description +{ + NSString *desc; + desc = [NSString stringWithFormat: + @"Tire: Pressure: %.1f TreadDepth: %.1f", + pressure, treadDepth]; + return (desc); + +} // description + +@end // Tire + diff --git a/9781430241881_ch12_Categories.zip b/9781430241881_ch12_Categories.zip new file mode 100644 index 0000000..8fcf46b Binary files /dev/null and b/9781430241881_ch12_Categories.zip differ diff --git a/9781430241881_ch13/13.01 CarParts-Copy.1 b/9781430241881_ch13/13.01 CarParts-Copy.1 new file mode 100644 index 0000000..2620858 --- /dev/null +++ b/9781430241881_ch13/13.01 CarParts-Copy.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/4/08 \" DATE +.Dt 13.01 CarParts-Copy 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 13.01 CarParts-Copy, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/9781430241881_ch13/13.01 CarParts-Copy.m b/9781430241881_ch13/13.01 CarParts-Copy.m new file mode 100644 index 0000000..b839f56 --- /dev/null +++ b/9781430241881_ch13/13.01 CarParts-Copy.m @@ -0,0 +1,37 @@ +#import +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + @autoreleasepool + { + Car *car = [[Car alloc] init]; + car.name = @"Herbie"; + + for (int i = 0; i < 4; i++) + { + AllWeatherRadial *tire; + tire = [[AllWeatherRadial alloc] init]; + + [car setTire: tire + atIndex: i]; + [tire release]; + } + + Slant6 *engine = [[Slant6 alloc] init]; + car.engine = engine; + [engine release]; + + [car print]; + + Car *carCopy = [car copy]; + [carCopy print]; + + [car release]; + [carCopy release]; + } + return (0); +} // main + diff --git a/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/TemplateIcon.icns b/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/TemplateIcon.icns differ diff --git a/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/project.pbxproj b/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/project.pbxproj new file mode 100644 index 0000000..fec1f70 --- /dev/null +++ b/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/project.pbxproj @@ -0,0 +1,257 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D95E4030E47D1E40015E1D4 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D95E3FA0E47D1E40015E1D4 /* Slant6.m */; }; + 7D95E4040E47D1E40015E1D4 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D95E3FB0E47D1E40015E1D4 /* Car.m */; }; + 7D95E4050E47D1E40015E1D4 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D95E3FD0E47D1E40015E1D4 /* Tire.m */; }; + 7D95E4060E47D1E40015E1D4 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D95E3FF0E47D1E40015E1D4 /* Engine.m */; }; + 7D95E4070E47D1E40015E1D4 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D95E4000E47D1E40015E1D4 /* AllWeatherRadial.m */; }; + 8DD76F9A0486AA7600D96B5E /* 13.01 CarParts-Copy.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 13.01 CarParts-Copy.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 13.01 CarParts-Copy.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 13.01 CarParts-Copy.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 13.01 CarParts-Copy.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 13.01 CarParts-Copy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "13.01 CarParts-Copy.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 13.01 CarParts-Copy_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "13.01 CarParts-Copy_Prefix.pch"; sourceTree = ""; }; + 7D95E3F90E47D1E40015E1D4 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D95E3FA0E47D1E40015E1D4 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 7D95E3FB0E47D1E40015E1D4 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D95E3FC0E47D1E40015E1D4 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 7D95E3FD0E47D1E40015E1D4 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 7D95E3FE0E47D1E40015E1D4 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D95E3FF0E47D1E40015E1D4 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 7D95E4000E47D1E40015E1D4 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 7D95E4010E47D1E40015E1D4 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 7D95E4020E47D1E40015E1D4 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 13.01 CarParts-Copy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "13.01 CarParts-Copy"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 13.01 CarParts-Copy.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "13.01 CarParts-Copy.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 13.01 CarParts-Copy */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "13.01 CarParts-Copy"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 08FB7796FE84155DC02AAC07 /* 13.01 CarParts-Copy.m */, + 32A70AAB03705E1F00C91783 /* 13.01 CarParts-Copy_Prefix.pch */, + 7D95E4010E47D1E40015E1D4 /* AllWeatherRadial.h */, + 7D95E4000E47D1E40015E1D4 /* AllWeatherRadial.m */, + 7D95E4020E47D1E40015E1D4 /* Car.h */, + 7D95E3FB0E47D1E40015E1D4 /* Car.m */, + 7D95E3FC0E47D1E40015E1D4 /* Engine.h */, + 7D95E3FF0E47D1E40015E1D4 /* Engine.m */, + 7D95E3FE0E47D1E40015E1D4 /* Slant6.h */, + 7D95E3FA0E47D1E40015E1D4 /* Slant6.m */, + 7D95E3F90E47D1E40015E1D4 /* Tire.h */, + 7D95E3FD0E47D1E40015E1D4 /* Tire.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 13.01 CarParts-Copy */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 13.01 CarParts-Copy.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 13.01 CarParts-Copy */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "13.01 CarParts-Copy" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "13.01 CarParts-Copy"; + productInstallPath = "$(HOME)/bin"; + productName = "13.01 CarParts-Copy"; + productReference = 8DD76FA10486AA7600D96B5E /* 13.01 CarParts-Copy */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "13.01 CarParts-Copy" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 13.01 CarParts-Copy */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 13.01 CarParts-Copy */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 13.01 CarParts-Copy.m in Sources */, + 7D95E4030E47D1E40015E1D4 /* Slant6.m in Sources */, + 7D95E4040E47D1E40015E1D4 /* Car.m in Sources */, + 7D95E4050E47D1E40015E1D4 /* Tire.m in Sources */, + 7D95E4060E47D1E40015E1D4 /* Engine.m in Sources */, + 7D95E4070E47D1E40015E1D4 /* AllWeatherRadial.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "13.01 CarParts-Copy_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "13.01 CarParts-Copy"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "13.01 CarParts-Copy_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "13.01 CarParts-Copy"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "13.01 CarParts-Copy" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "13.01 CarParts-Copy" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/13.01 CarParts-Copy.xcscheme b/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/13.01 CarParts-Copy.xcscheme new file mode 100644 index 0000000..8bffe0c --- /dev/null +++ b/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/13.01 CarParts-Copy.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..a725a7c --- /dev/null +++ b/9781430241881_ch13/13.01 CarParts-Copy.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 13.01 CarParts-Copy.xcscheme + + orderHint + 27 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/9781430241881_ch13/13.01 CarParts-Copy_Prefix.pch b/9781430241881_ch13/13.01 CarParts-Copy_Prefix.pch new file mode 100644 index 0000000..5d460d2 --- /dev/null +++ b/9781430241881_ch13/13.01 CarParts-Copy_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '13.01 CarParts-Copy' target in the '13.01 CarParts-Copy' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/9781430241881_ch13/AllWeatherRadial.h b/9781430241881_ch13/AllWeatherRadial.h new file mode 100644 index 0000000..96beadb --- /dev/null +++ b/9781430241881_ch13/AllWeatherRadial.h @@ -0,0 +1,9 @@ +#import +#import "Tire.h" + +@interface AllWeatherRadial : Tire + +@property float rainHandling; +@property float snowHandling; + +@end // AllWeatherRadial diff --git a/9781430241881_ch13/AllWeatherRadial.m b/9781430241881_ch13/AllWeatherRadial.m new file mode 100644 index 0000000..d2e7969 --- /dev/null +++ b/9781430241881_ch13/AllWeatherRadial.m @@ -0,0 +1,48 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +@synthesize rainHandling; +@synthesize snowHandling; + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super initWithPressure: p + treadDepth: td]) { + rainHandling = 23.7; + snowHandling = 42.5; + } + + return (self); + +} // initWithPressure:treadDepth + + +- (id) copyWithZone: (NSZone *) zone +{ + AllWeatherRadial *tireCopy; + tireCopy = [super copyWithZone: zone]; + tireCopy.rainHandling = rainHandling; + tireCopy.snowHandling = snowHandling; + + return (tireCopy); + +} // copyWithZone + + +- (NSString *) description +{ + NSString *desc; + desc = [[NSString alloc] initWithFormat: + @"AllWeatherRadial: %.1f / %.1f / %.1f / %.1f", + [self pressure], [self treadDepth], + [self rainHandling], + [self snowHandling]]; + + return (desc); + +} // description + +@end // AllWeatherRadial + diff --git a/9781430241881_ch13/Car.h b/9781430241881_ch13/Car.h new file mode 100644 index 0000000..8b49aa7 --- /dev/null +++ b/9781430241881_ch13/Car.h @@ -0,0 +1,16 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +@property (readwrite, copy) NSString *name; +@property (readwrite, retain) Engine *engine; + +- (void) setTire: (Tire *) tire + atIndex: (int) index; +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/9781430241881_ch13/Car.m b/9781430241881_ch13/Car.m new file mode 100644 index 0000000..104d69e --- /dev/null +++ b/9781430241881_ch13/Car.m @@ -0,0 +1,99 @@ +#import "Car.h" + +@implementation Car { + NSMutableArray *tires; +} + +@synthesize name = appellation; +@synthesize engine; + +- (id) init +{ + if (self = [super init]) { + + self.name = @"Car"; + tires = [[NSMutableArray alloc] init]; + + for (int i = 0; i < 4; i++) + { + [tires addObject: [NSNull null]]; + } + } + + return (self); + +} // init + + +- (id) copyWithZone: (NSZone *) zone +{ + Car *carCopy; + carCopy = [[[self class] + allocWithZone: zone] + init]; + + carCopy.name = self.name; + + Engine *engineCopy; + engineCopy = [[engine copy] autorelease]; + carCopy.engine = engineCopy; + + for (int i = 0; i < 4; i++) + { + Tire *tireCopy; + + tireCopy = [[self tireAtIndex: i] copy]; + [tireCopy autorelease]; + + [carCopy setTire: tireCopy + atIndex: i]; + } + + return (carCopy); + +} // copyWithZone + + +- (void) dealloc +{ + self.name = nil; + [tires release]; + [engine release]; + + [super dealloc]; + +} // dealloc + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + [tires replaceObjectAtIndex: index + withObject: tire]; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + Tire *tire; + tire = [tires objectAtIndex: index]; + + return (tire); + +} // tireAtIndex: + + +- (void) print +{ + NSLog (@"%@ has:", self.name); + for (int i = 0; i < 4; i++) { + NSLog (@"%@", [self tireAtIndex: i]); + } + + NSLog (@"%@", engine); + +} // print + +@end // Car + diff --git a/9781430241881_ch13/Engine.h b/9781430241881_ch13/Engine.h new file mode 100644 index 0000000..cf863e6 --- /dev/null +++ b/9781430241881_ch13/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/9781430241881_ch13/Engine.m b/9781430241881_ch13/Engine.m new file mode 100644 index 0000000..388cc8d --- /dev/null +++ b/9781430241881_ch13/Engine.m @@ -0,0 +1,23 @@ +#import "Engine.h" + +@implementation Engine + +- (id) copyWithZone: (NSZone *) zone +{ + Engine *engineCopy; + engineCopy = [[[self class] + allocWithZone: zone] + init]; + + return (engineCopy); + +} // copyWithZone + + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/9781430241881_ch13/Slant6.h b/9781430241881_ch13/Slant6.h new file mode 100644 index 0000000..22716ed --- /dev/null +++ b/9781430241881_ch13/Slant6.h @@ -0,0 +1,6 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + + diff --git a/9781430241881_ch13/Slant6.m b/9781430241881_ch13/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/9781430241881_ch13/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/9781430241881_ch13/Tire.h b/9781430241881_ch13/Tire.h new file mode 100644 index 0000000..7dea619 --- /dev/null +++ b/9781430241881_ch13/Tire.h @@ -0,0 +1,13 @@ +#import + +@interface Tire : NSObject +@property float pressure; +@property float treadDepth; + +- (id) initWithPressure: (float) pressure; +- (id) initWithTreadDepth: (float) treadDepth; + +- (id) initWithPressure: (float) pressure + treadDepth: (float) treadDepth; + +@end // Tire diff --git a/9781430241881_ch13/Tire.m b/9781430241881_ch13/Tire.m new file mode 100644 index 0000000..6132de6 --- /dev/null +++ b/9781430241881_ch13/Tire.m @@ -0,0 +1,78 @@ +#import "Tire.h" + + +@implementation Tire + +@synthesize pressure; +@synthesize treadDepth; + +- (id) init +{ + if (self = [self initWithPressure: 34 + treadDepth: 20]) { + } + + return (self); + +} // init + + +- (id) copyWithZone: (NSZone *) zone +{ + Tire *tireCopy; + tireCopy = [[[self class] allocWithZone: zone] + initWithPressure: pressure + treadDepth: treadDepth]; + + return (tireCopy); + +} // copyWithZone + + +- (id) initWithPressure: (float) p +{ + if (self = [self initWithPressure: p + treadDepth: 20.0]) { + } + + return (self); + +} // initWithPressure + + +- (id) initWithTreadDepth: (float) td +{ + if (self = [self initWithPressure: 34.0 + treadDepth: td]) { + } + + return (self); + +} // initWithTreadDepth + + +- (id) initWithPressure: (float) p + treadDepth: (float) td +{ + if (self = [super init]) { + pressure = p; + treadDepth = td; + } + + return (self); + +} // initWithPressure:treadDepth: + + +- (NSString *) description +{ + NSString *desc; + desc = [NSString stringWithFormat: + @"Tire: Pressure: %.1f TreadDepth: %.1f", + pressure, treadDepth]; + return (desc); + +} // description + +@end // Tire + diff --git a/9781430241881_ch13_Protocols.zip b/9781430241881_ch13_Protocols.zip new file mode 100644 index 0000000..4256df3 Binary files /dev/null and b/9781430241881_ch13_Protocols.zip differ diff --git a/9781430241881_ch14_Blocks.zip b/9781430241881_ch14_Blocks.zip new file mode 100644 index 0000000..42e3191 Binary files /dev/null and b/9781430241881_ch14_Blocks.zip differ diff --git a/9781430241881_ch15_UIKit.zip b/9781430241881_ch15_UIKit.zip new file mode 100644 index 0000000..291b3d9 Binary files /dev/null and b/9781430241881_ch15_UIKit.zip differ diff --git a/9781430241881_ch16_IntroductionToTheAppKit.zip b/9781430241881_ch16_IntroductionToTheAppKit.zip new file mode 100644 index 0000000..5ac335b Binary files /dev/null and b/9781430241881_ch16_IntroductionToTheAppKit.zip differ diff --git a/9781430241881_ch17_FileLoadingAndSaving.zip b/9781430241881_ch17_FileLoadingAndSaving.zip new file mode 100644 index 0000000..f61517f Binary files /dev/null and b/9781430241881_ch17_FileLoadingAndSaving.zip differ diff --git a/9781430241881_ch18_KeyValueCoding.zip b/9781430241881_ch18_KeyValueCoding.zip new file mode 100644 index 0000000..1f4ea5c Binary files /dev/null and b/9781430241881_ch18_KeyValueCoding.zip differ diff --git a/9781430241881_ch20_NSPredicate.zip b/9781430241881_ch20_NSPredicate.zip new file mode 100644 index 0000000..f1b7579 Binary files /dev/null and b/9781430241881_ch20_NSPredicate.zip differ diff --git a/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.1 b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.1 new file mode 100644 index 0000000..4cfdc6c --- /dev/null +++ b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/2/08 \" DATE +.Dt 09.01 RetainCount-1 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 09.01 RetainCount-1, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.m b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.m new file mode 100644 index 0000000..21967cc --- /dev/null +++ b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.m @@ -0,0 +1,57 @@ +#import + +@interface RetainTracker : NSObject +@end // RetainTracker + +@implementation RetainTracker + +- (id) init +{ + if (self = [super init]) { + NSLog (@"init: Retain count of %d.", + [self retainCount]); + } + + return (self); + +} // init + + +- (void) dealloc +{ + NSLog (@"dealloc called. Bye Bye."); + [super dealloc]; + +} // dealloc + +@end // RetainTracker + + + +int main (int argc, const char * argv[]) +{ + RetainTracker *tracker = [RetainTracker new]; + // count: 1 + + [tracker retain]; // count: 2 + NSLog (@"%d", [tracker retainCount]); + + [tracker retain]; // count: 3 + NSLog (@"%d", [tracker retainCount]); + + [tracker release]; // count: 2 + NSLog (@"%d", [tracker retainCount]); + + [tracker release]; // count: 1 + NSLog (@"%d", [tracker retainCount]); + + [tracker retain]; // count 2 + NSLog (@"%d", [tracker retainCount]); + + [tracker release]; // count 1 + NSLog (@"%d", [tracker retainCount]); + + [tracker release]; // count: 0, dealloc it + + return (0); +} // main diff --git a/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/TemplateIcon.icns b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/TemplateIcon.icns differ diff --git a/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/project.pbxproj b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/project.pbxproj new file mode 100644 index 0000000..0e763b4 --- /dev/null +++ b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/project.pbxproj @@ -0,0 +1,227 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 09.01 RetainCount-1.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 09.01 RetainCount-1.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 09.01 RetainCount-1.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 09.01 RetainCount-1.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 09.01 RetainCount-1.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 09.01 RetainCount-1.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "09.01 RetainCount-1.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 09.01 RetainCount-1_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "09.01 RetainCount-1_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 09.01 RetainCount-1 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "09.01 RetainCount-1"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 09.01 RetainCount-1.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "09.01 RetainCount-1.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 09.01 RetainCount-1 */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "09.01 RetainCount-1"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 09.01 RetainCount-1_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 09.01 RetainCount-1.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 09.01 RetainCount-1 */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 09.01 RetainCount-1.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 09.01 RetainCount-1 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "09.01 RetainCount-1" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "09.01 RetainCount-1"; + productInstallPath = "$(HOME)/bin"; + productName = "09.01 RetainCount-1"; + productReference = 8DD76FA10486AA7600D96B5E /* 09.01 RetainCount-1 */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "09.01 RetainCount-1" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 09.01 RetainCount-1 */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 09.01 RetainCount-1 */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 09.01 RetainCount-1.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "09.01 RetainCount-1_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "09.01 RetainCount-1"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "09.01 RetainCount-1_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "09.01 RetainCount-1"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "09.01 RetainCount-1" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "09.01 RetainCount-1" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.01 RetainCount-1.xcscheme b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.01 RetainCount-1.xcscheme new file mode 100644 index 0000000..19a1ecb --- /dev/null +++ b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.01 RetainCount-1.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..67b01da --- /dev/null +++ b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 09.01 RetainCount-1.xcscheme + + orderHint + 22 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1_Prefix.pch b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1_Prefix.pch new file mode 100644 index 0000000..2c08f21 --- /dev/null +++ b/978143024188_ch09/09.01 RetainCount-1/09.01 RetainCount-1_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '09.01 RetainCount-1' target in the '09.01 RetainCount-1' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.1 b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.1 new file mode 100644 index 0000000..d4ce55e --- /dev/null +++ b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/2/08 \" DATE +.Dt 09.02 RetainCount-2 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 09.02 RetainCount-2, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.m b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.m new file mode 100644 index 0000000..1bba924 --- /dev/null +++ b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.m @@ -0,0 +1,59 @@ +#import + +@interface RetainTracker : NSObject +@end // RetainTracker + +@implementation RetainTracker + +- (id) init +{ + if (self = [super init]) { + NSLog (@"init: Retain count of %d.", + [self retainCount]); + } + + return (self); + +} // init + + +- (void) dealloc +{ + NSLog (@"dealloc called. Bye Bye."); + [super dealloc]; + +} // dealloc + +@end // RetainTracker + + +int main (int argc, const char * argv[]) +{ + NSAutoreleasePool *pool; + pool = [[NSAutoreleasePool alloc] init]; + + RetainTracker *tracker; + tracker = [RetainTracker new]; // count: 1 + + [tracker retain]; // count: 2 + [tracker autorelease]; // count: still 2 + [tracker release]; // count: 1 + + NSLog (@"releasing pool"); + [pool release]; + // gets nuked, sends release to tracker + + @autoreleasepool + { + RetainTracker *tracker2; + tracker2 = [RetainTracker new]; // count: 1 + + [tracker2 retain]; // count: 2 + [tracker2 autorelease]; // count: still 2 + [tracker2 release]; // count: 1 + + NSLog (@"auto releasing pool"); + } + + return (0); +} diff --git a/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/TemplateIcon.icns b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/TemplateIcon.icns differ diff --git a/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/project.pbxproj b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/project.pbxproj new file mode 100644 index 0000000..3d18848 --- /dev/null +++ b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/project.pbxproj @@ -0,0 +1,227 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DD76F9A0486AA7600D96B5E /* 09.02 RetainCount-2.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 09.02 RetainCount-2.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 09.02 RetainCount-2.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 09.02 RetainCount-2.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 09.02 RetainCount-2.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 09.02 RetainCount-2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "09.02 RetainCount-2.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 09.02 RetainCount-2_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "09.02 RetainCount-2_Prefix.pch"; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 09.02 RetainCount-2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "09.02 RetainCount-2"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 09.02 RetainCount-2.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "09.02 RetainCount-2.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 09.02 RetainCount-2 */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "09.02 RetainCount-2"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 32A70AAB03705E1F00C91783 /* 09.02 RetainCount-2_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 09.02 RetainCount-2.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 09.02 RetainCount-2 */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 09.02 RetainCount-2.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 09.02 RetainCount-2 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "09.02 RetainCount-2" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "09.02 RetainCount-2"; + productInstallPath = "$(HOME)/bin"; + productName = "09.02 RetainCount-2"; + productReference = 8DD76FA10486AA7600D96B5E /* 09.02 RetainCount-2 */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "09.02 RetainCount-2" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 09.02 RetainCount-2 */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 09.02 RetainCount-2 */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 09.02 RetainCount-2.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "09.02 RetainCount-2_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "09.02 RetainCount-2"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "09.02 RetainCount-2_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "09.02 RetainCount-2"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "09.02 RetainCount-2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "09.02 RetainCount-2" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.02 RetainCount-2.xcscheme b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.02 RetainCount-2.xcscheme new file mode 100644 index 0000000..a27d916 --- /dev/null +++ b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.02 RetainCount-2.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..05cfebd --- /dev/null +++ b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 09.02 RetainCount-2.xcscheme + + orderHint + 23 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2_Prefix.pch b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2_Prefix.pch new file mode 100644 index 0000000..698b8c5 --- /dev/null +++ b/978143024188_ch09/09.02 RetainCount-2/09.02 RetainCount-2_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '09.02 RetainCount-2' target in the '09.02 RetainCount-2' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.1 b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.1 new file mode 100644 index 0000000..c3500fb --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/2/08 \" DATE +.Dt 09.03 CarParts-GC 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 09.03 CarParts-GC, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.m b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.m new file mode 100644 index 0000000..088e6bf --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.m @@ -0,0 +1,31 @@ +#import + +#import "Tire.h" // don't really have to #import this or the next header file. +#import "Engine.h" // since they're brought in by Slant6.h and AllWeatherRadial.h +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + Car *car = [Car new]; + + int i; + for (i = 0; i < 4; i++) { + Tire *tire = [AllWeatherRadial new]; + + [car setTire: tire + atIndex: i]; + } + + Engine *engine = [Slant6 new]; + [car setEngine: engine]; + + [car print]; + + NSString **myString; + myString = malloc(10 * sizeof(NSString *)); + return (0); + +} // main + diff --git a/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/TemplateIcon.icns b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/TemplateIcon.icns differ diff --git a/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/project.pbxproj b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/project.pbxproj new file mode 100644 index 0000000..ca835aa --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/project.pbxproj @@ -0,0 +1,259 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D7C36C40E44E79B001B1F50 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36BA0E44E79B001B1F50 /* Engine.m */; }; + 7D7C36C50E44E79B001B1F50 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36BD0E44E79B001B1F50 /* Tire.m */; }; + 7D7C36C60E44E79B001B1F50 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36BF0E44E79B001B1F50 /* Car.m */; }; + 7D7C36C70E44E79B001B1F50 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36C10E44E79B001B1F50 /* Slant6.m */; }; + 7D7C36C80E44E79B001B1F50 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36C30E44E79B001B1F50 /* AllWeatherRadial.m */; }; + 8DD76F9A0486AA7600D96B5E /* 09.03 CarParts-GC.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 09.03 CarParts-GC.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 09.03 CarParts-GC.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 09.03 CarParts-GC.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 09.03 CarParts-GC.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 09.03 CarParts-GC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "09.03 CarParts-GC.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 09.03 CarParts-GC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "09.03 CarParts-GC_Prefix.pch"; sourceTree = ""; }; + 7D7C36BA0E44E79B001B1F50 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 7D7C36BB0E44E79B001B1F50 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 7D7C36BC0E44E79B001B1F50 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 7D7C36BD0E44E79B001B1F50 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 7D7C36BE0E44E79B001B1F50 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D7C36BF0E44E79B001B1F50 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D7C36C00E44E79B001B1F50 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 7D7C36C10E44E79B001B1F50 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 7D7C36C20E44E79B001B1F50 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D7C36C30E44E79B001B1F50 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 09.03 CarParts-GC */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "09.03 CarParts-GC"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 09.03 CarParts-GC.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "09.03 CarParts-GC.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 09.03 CarParts-GC */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "09.03 CarParts-GC"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 7D7C36BA0E44E79B001B1F50 /* Engine.m */, + 7D7C36BB0E44E79B001B1F50 /* Engine.h */, + 7D7C36BC0E44E79B001B1F50 /* AllWeatherRadial.h */, + 7D7C36BD0E44E79B001B1F50 /* Tire.m */, + 7D7C36BE0E44E79B001B1F50 /* Tire.h */, + 7D7C36BF0E44E79B001B1F50 /* Car.m */, + 7D7C36C00E44E79B001B1F50 /* Car.h */, + 7D7C36C10E44E79B001B1F50 /* Slant6.m */, + 7D7C36C20E44E79B001B1F50 /* Slant6.h */, + 7D7C36C30E44E79B001B1F50 /* AllWeatherRadial.m */, + 32A70AAB03705E1F00C91783 /* 09.03 CarParts-GC_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 09.03 CarParts-GC.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 09.03 CarParts-GC */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 09.03 CarParts-GC.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 09.03 CarParts-GC */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "09.03 CarParts-GC" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "09.03 CarParts-GC"; + productInstallPath = "$(HOME)/bin"; + productName = "09.03 CarParts-GC"; + productReference = 8DD76FA10486AA7600D96B5E /* 09.03 CarParts-GC */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "09.03 CarParts-GC" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 09.03 CarParts-GC */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 09.03 CarParts-GC */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 09.03 CarParts-GC.m in Sources */, + 7D7C36C40E44E79B001B1F50 /* Engine.m in Sources */, + 7D7C36C50E44E79B001B1F50 /* Tire.m in Sources */, + 7D7C36C60E44E79B001B1F50 /* Car.m in Sources */, + 7D7C36C70E44E79B001B1F50 /* Slant6.m in Sources */, + 7D7C36C80E44E79B001B1F50 /* AllWeatherRadial.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_GC = unsupported; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "09.03 CarParts-GC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "09.03 CarParts-GC"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_GC = unsupported; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "09.03 CarParts-GC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "09.03 CarParts-GC"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "09.03 CarParts-GC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "09.03 CarParts-GC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.03 CarParts-GC.xcscheme b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.03 CarParts-GC.xcscheme new file mode 100644 index 0000000..cb3549c --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.03 CarParts-GC.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..25cea3e --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 09.03 CarParts-GC.xcscheme + + orderHint + 24 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC_Prefix.pch b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC_Prefix.pch new file mode 100644 index 0000000..d090100 --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/09.03 CarParts-GC_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '09.03 CarParts-GC' target in the '09.03 CarParts-GC' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/978143024188_ch09/09.03 CarParts-GC/AllWeatherRadial.h b/978143024188_ch09/09.03 CarParts-GC/AllWeatherRadial.h new file mode 100644 index 0000000..a9f4ebf --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/AllWeatherRadial.h @@ -0,0 +1,5 @@ +#import "Tire.h" + +@interface AllWeatherRadial : Tire +@end // AllWeatherRadial + diff --git a/978143024188_ch09/09.03 CarParts-GC/AllWeatherRadial.m b/978143024188_ch09/09.03 CarParts-GC/AllWeatherRadial.m new file mode 100644 index 0000000..fa72c64 --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/AllWeatherRadial.m @@ -0,0 +1,11 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +- (NSString *) description +{ + return (@"I am a tire for rain or shine."); +} // description + +@end // AllWeatherRadial + diff --git a/978143024188_ch09/09.03 CarParts-GC/Car.h b/978143024188_ch09/09.03 CarParts-GC/Car.h new file mode 100644 index 0000000..2a60660 --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/Car.h @@ -0,0 +1,24 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +{ + Tire *tires[4]; + Engine *engine; +} + +- (void) setEngine: (Engine *) newEngine; + +- (Engine *) engine; + + +- (void) setTire: (Tire *) tire + atIndex: (int) index; + +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/978143024188_ch09/09.03 CarParts-GC/Car.m b/978143024188_ch09/09.03 CarParts-GC/Car.m new file mode 100644 index 0000000..4686a6d --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/Car.m @@ -0,0 +1,83 @@ +// +// Car.m +// 06.01 CarParts-Split +// +// Created by markd on 2/25/06. +// Copyright 2006 __MyCompanyName__. All rights reserved. +// + +#import "Car.h" +#import "Engine.h" +#import "Tire.h" + +@implementation Car + +- (id) init +{ + if (self = [super init]) { + engine = [Engine new]; + + tires[0] = [Tire new]; + tires[1] = [Tire new]; + tires[2] = [Tire new]; + tires[3] = [Tire new]; + } + + return (self); + +} // init + + +- (Engine *) engine +{ + return (engine); +} // engine + + +- (void) setEngine: (Engine *) newEngine +{ + engine = newEngine; +} // setEngine + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in setTire:atIndex:", + index); + exit (1); + } + + tires[index] = tire; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in tireAtIndex:", + index); + exit (1); + } + + return (tires[index]); + +} // tireAtIndex: + + + +- (void) print +{ + NSLog (@"%@", engine); + + NSLog (@"%@", tires[0]); + NSLog (@"%@", tires[1]); + NSLog (@"%@", tires[2]); + NSLog (@"%@", tires[3]); + +} // print + +@end // Car + diff --git a/978143024188_ch09/09.03 CarParts-GC/Engine.h b/978143024188_ch09/09.03 CarParts-GC/Engine.h new file mode 100644 index 0000000..661a1f2 --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/978143024188_ch09/09.03 CarParts-GC/Engine.m b/978143024188_ch09/09.03 CarParts-GC/Engine.m new file mode 100644 index 0000000..83b1d4c --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/Engine.m @@ -0,0 +1,11 @@ +#import "Engine.h" + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/978143024188_ch09/09.03 CarParts-GC/Slant6.h b/978143024188_ch09/09.03 CarParts-GC/Slant6.h new file mode 100644 index 0000000..76199c8 --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/Slant6.h @@ -0,0 +1,5 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + diff --git a/978143024188_ch09/09.03 CarParts-GC/Slant6.m b/978143024188_ch09/09.03 CarParts-GC/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/978143024188_ch09/09.03 CarParts-GC/Tire.h b/978143024188_ch09/09.03 CarParts-GC/Tire.h new file mode 100644 index 0000000..fbfa492 --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/Tire.h @@ -0,0 +1,4 @@ +#import + +@interface Tire : NSObject +@end // Tire diff --git a/978143024188_ch09/09.03 CarParts-GC/Tire.m b/978143024188_ch09/09.03 CarParts-GC/Tire.m new file mode 100644 index 0000000..9aba39b --- /dev/null +++ b/978143024188_ch09/09.03 CarParts-GC/Tire.m @@ -0,0 +1,12 @@ +#import "Tire.h" + + +@implementation Tire + +- (NSString *) description +{ + return (@"I am a tire. I last a while"); +} // description + +@end // Tire + diff --git a/978143024188_ch09/09.04 CarParts-ARC/.DS_Store b/978143024188_ch09/09.04 CarParts-ARC/.DS_Store new file mode 100644 index 0000000..396c08e Binary files /dev/null and b/978143024188_ch09/09.04 CarParts-ARC/.DS_Store differ diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.1 b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.1 new file mode 100644 index 0000000..c3500fb --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 8/2/08 \" DATE +.Dt 09.03 CarParts-GC 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm 09.03 CarParts-GC, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.m b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.m new file mode 100644 index 0000000..a263df1 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.m @@ -0,0 +1,28 @@ +#import + +#import "Tire.h" // don't really have to #import this or the next header file. +#import "Engine.h" // since they're brought in by Slant6.h and AllWeatherRadial.h +#import "Car.h" +#import "Slant6.h" +#import "AllWeatherRadial.h" + +int main (int argc, const char * argv[]) +{ + Car *car = [Car new]; + + int i; + for (i = 0; i < 4; i++) { + Tire *tire = [AllWeatherRadial new]; + + [car setTire: tire + atIndex: i]; + } + + Engine *engine = [Slant6 new]; + [car setEngine: engine]; + + [car print]; + return (0); + +} // main + diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/TemplateIcon.icns b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/TemplateIcon.icns new file mode 100644 index 0000000..62cb701 Binary files /dev/null and b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/TemplateIcon.icns differ diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.pbxproj b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.pbxproj new file mode 100644 index 0000000..0229ef7 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.pbxproj @@ -0,0 +1,263 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7D7C36C40E44E79B001B1F50 /* Engine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36BA0E44E79B001B1F50 /* Engine.m */; }; + 7D7C36C50E44E79B001B1F50 /* Tire.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36BD0E44E79B001B1F50 /* Tire.m */; }; + 7D7C36C60E44E79B001B1F50 /* Car.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36BF0E44E79B001B1F50 /* Car.m */; }; + 7D7C36C70E44E79B001B1F50 /* Slant6.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36C10E44E79B001B1F50 /* Slant6.m */; }; + 7D7C36C80E44E79B001B1F50 /* AllWeatherRadial.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D7C36C30E44E79B001B1F50 /* AllWeatherRadial.m */; }; + 8DD76F9A0486AA7600D96B5E /* 09.04 CarParts-ARC.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 09.04 CarParts-ARC.m */; settings = {ATTRIBUTES = (); }; }; + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; + 8DD76F9F0486AA7600D96B5E /* 09.04 CarParts-ARC.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 09.04 CarParts-ARC.1 */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 8DD76F9F0486AA7600D96B5E /* 09.04 CarParts-ARC.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 08FB7796FE84155DC02AAC07 /* 09.04 CarParts-ARC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "09.04 CarParts-ARC.m"; sourceTree = ""; }; + 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 32A70AAB03705E1F00C91783 /* 09.04 CarParts-ARC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "09.04 CarParts-ARC_Prefix.pch"; sourceTree = ""; }; + 7D7C36BA0E44E79B001B1F50 /* Engine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Engine.m; sourceTree = ""; }; + 7D7C36BB0E44E79B001B1F50 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Engine.h; sourceTree = ""; }; + 7D7C36BC0E44E79B001B1F50 /* AllWeatherRadial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllWeatherRadial.h; sourceTree = ""; }; + 7D7C36BD0E44E79B001B1F50 /* Tire.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tire.m; sourceTree = ""; }; + 7D7C36BE0E44E79B001B1F50 /* Tire.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tire.h; sourceTree = ""; }; + 7D7C36BF0E44E79B001B1F50 /* Car.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Car.m; sourceTree = ""; }; + 7D7C36C00E44E79B001B1F50 /* Car.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Car.h; sourceTree = ""; }; + 7D7C36C10E44E79B001B1F50 /* Slant6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Slant6.m; sourceTree = ""; }; + 7D7C36C20E44E79B001B1F50 /* Slant6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Slant6.h; sourceTree = ""; }; + 7D7C36C30E44E79B001B1F50 /* AllWeatherRadial.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllWeatherRadial.m; sourceTree = ""; }; + 8DD76FA10486AA7600D96B5E /* 09.04 CarParts-ARC */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "09.04 CarParts-ARC"; sourceTree = BUILT_PRODUCTS_DIR; }; + C6859EA3029092ED04C91782 /* 09.04 CarParts-ARC.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = "09.04 CarParts-ARC.1"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* 09.03 CarParts-GC */ = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07 /* Source */, + C6859EA2029092E104C91782 /* Documentation */, + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = "09.03 CarParts-GC"; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 7D7C36BA0E44E79B001B1F50 /* Engine.m */, + 7D7C36BB0E44E79B001B1F50 /* Engine.h */, + 7D7C36BC0E44E79B001B1F50 /* AllWeatherRadial.h */, + 7D7C36BD0E44E79B001B1F50 /* Tire.m */, + 7D7C36BE0E44E79B001B1F50 /* Tire.h */, + 7D7C36BF0E44E79B001B1F50 /* Car.m */, + 7D7C36C00E44E79B001B1F50 /* Car.h */, + 7D7C36C10E44E79B001B1F50 /* Slant6.m */, + 7D7C36C20E44E79B001B1F50 /* Slant6.h */, + 7D7C36C30E44E79B001B1F50 /* AllWeatherRadial.m */, + 32A70AAB03705E1F00C91783 /* 09.04 CarParts-ARC_Prefix.pch */, + 08FB7796FE84155DC02AAC07 /* 09.04 CarParts-ARC.m */, + ); + name = Source; + sourceTree = ""; + }; + 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + 08FB779EFE84155DC02AAC07 /* Foundation.framework */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8DD76FA10486AA7600D96B5E /* 09.04 CarParts-ARC */, + ); + name = Products; + sourceTree = ""; + }; + C6859EA2029092E104C91782 /* Documentation */ = { + isa = PBXGroup; + children = ( + C6859EA3029092ED04C91782 /* 09.04 CarParts-ARC.1 */, + ); + name = Documentation; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DD76F960486AA7600D96B5E /* 09.04 CarParts-ARC */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "09.04 CarParts-ARC" */; + buildPhases = ( + 8DD76F990486AA7600D96B5E /* Sources */, + 8DD76F9B0486AA7600D96B5E /* Frameworks */, + 8DD76F9E0486AA7600D96B5E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "09.04 CarParts-ARC"; + productInstallPath = "$(HOME)/bin"; + productName = "09.03 CarParts-GC"; + productReference = 8DD76FA10486AA7600D96B5E /* 09.04 CarParts-ARC */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "09.04 CarParts-ARC" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* 09.03 CarParts-GC */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76F960486AA7600D96B5E /* 09.04 CarParts-ARC */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DD76F990486AA7600D96B5E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DD76F9A0486AA7600D96B5E /* 09.04 CarParts-ARC.m in Sources */, + 7D7C36C40E44E79B001B1F50 /* Engine.m in Sources */, + 7D7C36C50E44E79B001B1F50 /* Tire.m in Sources */, + 7D7C36C60E44E79B001B1F50 /* Car.m in Sources */, + 7D7C36C70E44E79B001B1F50 /* Slant6.m in Sources */, + 7D7C36C80E44E79B001B1F50 /* AllWeatherRadial.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB927508733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_GC = unsupported; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "09.04 CarParts-ARC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "09.04 CarParts-ARC"; + }; + name = Debug; + }; + 1DEB927608733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_GC = unsupported; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "09.04 CarParts-ARC_Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = /usr/local/bin; + PRODUCT_NAME = "09.04 CarParts-ARC"; + }; + name = Release; + }; + 1DEB927908733DD40010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 1DEB927A08733DD40010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "09.04 CarParts-ARC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927508733DD40010E9CD /* Debug */, + 1DEB927608733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "09.04 CarParts-ARC" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB927908733DD40010E9CD /* Debug */, + 1DEB927A08733DD40010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..66ff093 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..1e63cff Binary files /dev/null and b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.04 CarParts-ARC.xcscheme b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.04 CarParts-ARC.xcscheme new file mode 100644 index 0000000..9b7bcfd --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/09.04 CarParts-ARC.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..896c5db --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + 09.04 CarParts-ARC.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 8DD76F960486AA7600D96B5E + + primary + + + + + diff --git a/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC_Prefix.pch b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC_Prefix.pch new file mode 100644 index 0000000..d090100 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/09.04 CarParts-ARC_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the '09.03 CarParts-GC' target in the '09.03 CarParts-GC' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/978143024188_ch09/09.04 CarParts-ARC/AllWeatherRadial.h b/978143024188_ch09/09.04 CarParts-ARC/AllWeatherRadial.h new file mode 100644 index 0000000..a9f4ebf --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/AllWeatherRadial.h @@ -0,0 +1,5 @@ +#import "Tire.h" + +@interface AllWeatherRadial : Tire +@end // AllWeatherRadial + diff --git a/978143024188_ch09/09.04 CarParts-ARC/AllWeatherRadial.m b/978143024188_ch09/09.04 CarParts-ARC/AllWeatherRadial.m new file mode 100644 index 0000000..fa72c64 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/AllWeatherRadial.m @@ -0,0 +1,11 @@ +#import "AllWeatherRadial.h" + +@implementation AllWeatherRadial + +- (NSString *) description +{ + return (@"I am a tire for rain or shine."); +} // description + +@end // AllWeatherRadial + diff --git a/978143024188_ch09/09.04 CarParts-ARC/Car.h b/978143024188_ch09/09.04 CarParts-ARC/Car.h new file mode 100644 index 0000000..2a60660 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/Car.h @@ -0,0 +1,24 @@ +#import + +@class Tire; +@class Engine; + +@interface Car : NSObject +{ + Tire *tires[4]; + Engine *engine; +} + +- (void) setEngine: (Engine *) newEngine; + +- (Engine *) engine; + + +- (void) setTire: (Tire *) tire + atIndex: (int) index; + +- (Tire *) tireAtIndex: (int) index; + +- (void) print; + +@end // Car diff --git a/978143024188_ch09/09.04 CarParts-ARC/Car.m b/978143024188_ch09/09.04 CarParts-ARC/Car.m new file mode 100644 index 0000000..4686a6d --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/Car.m @@ -0,0 +1,83 @@ +// +// Car.m +// 06.01 CarParts-Split +// +// Created by markd on 2/25/06. +// Copyright 2006 __MyCompanyName__. All rights reserved. +// + +#import "Car.h" +#import "Engine.h" +#import "Tire.h" + +@implementation Car + +- (id) init +{ + if (self = [super init]) { + engine = [Engine new]; + + tires[0] = [Tire new]; + tires[1] = [Tire new]; + tires[2] = [Tire new]; + tires[3] = [Tire new]; + } + + return (self); + +} // init + + +- (Engine *) engine +{ + return (engine); +} // engine + + +- (void) setEngine: (Engine *) newEngine +{ + engine = newEngine; +} // setEngine + + +- (void) setTire: (Tire *) tire + atIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in setTire:atIndex:", + index); + exit (1); + } + + tires[index] = tire; + +} // setTire:atIndex: + + +- (Tire *) tireAtIndex: (int) index +{ + if (index < 0 || index > 3) { + NSLog (@"bad index (%d) in tireAtIndex:", + index); + exit (1); + } + + return (tires[index]); + +} // tireAtIndex: + + + +- (void) print +{ + NSLog (@"%@", engine); + + NSLog (@"%@", tires[0]); + NSLog (@"%@", tires[1]); + NSLog (@"%@", tires[2]); + NSLog (@"%@", tires[3]); + +} // print + +@end // Car + diff --git a/978143024188_ch09/09.04 CarParts-ARC/Engine.h b/978143024188_ch09/09.04 CarParts-ARC/Engine.h new file mode 100644 index 0000000..661a1f2 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/Engine.h @@ -0,0 +1,5 @@ +#import + +@interface Engine : NSObject +@end // Engine + diff --git a/978143024188_ch09/09.04 CarParts-ARC/Engine.m b/978143024188_ch09/09.04 CarParts-ARC/Engine.m new file mode 100644 index 0000000..83b1d4c --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/Engine.m @@ -0,0 +1,11 @@ +#import "Engine.h" + +@implementation Engine + +- (NSString *) description +{ + return (@"I am an engine. Vrooom!"); +} // description + +@end // Engine + diff --git a/978143024188_ch09/09.04 CarParts-ARC/Slant6.h b/978143024188_ch09/09.04 CarParts-ARC/Slant6.h new file mode 100644 index 0000000..76199c8 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/Slant6.h @@ -0,0 +1,5 @@ +#import "Engine.h" + +@interface Slant6 : Engine +@end // Slant6 + diff --git a/978143024188_ch09/09.04 CarParts-ARC/Slant6.m b/978143024188_ch09/09.04 CarParts-ARC/Slant6.m new file mode 100644 index 0000000..4d5f8f3 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/Slant6.m @@ -0,0 +1,12 @@ +#import "Slant6.h" + + +@implementation Slant6 + +- (NSString *) description +{ + return (@"I am a slant-6. VROOOM!"); +} // description + +@end // Slant6 + diff --git a/978143024188_ch09/09.04 CarParts-ARC/Tire.h b/978143024188_ch09/09.04 CarParts-ARC/Tire.h new file mode 100644 index 0000000..fbfa492 --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/Tire.h @@ -0,0 +1,4 @@ +#import + +@interface Tire : NSObject +@end // Tire diff --git a/978143024188_ch09/09.04 CarParts-ARC/Tire.m b/978143024188_ch09/09.04 CarParts-ARC/Tire.m new file mode 100644 index 0000000..9aba39b --- /dev/null +++ b/978143024188_ch09/09.04 CarParts-ARC/Tire.m @@ -0,0 +1,12 @@ +#import "Tire.h" + + +@implementation Tire + +- (NSString *) description +{ + return (@"I am a tire. I last a while"); +} // description + +@end // Tire + diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..113e151 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,27 @@ +Freeware License, some rights reserved + +Copyright (c) 2012 Scott Knaster, Mark Dalrymple, and Waqar Malik + +Permission is hereby granted, free of charge, to anyone obtaining a copy +of this software and associated documentation files (the "Software"), +to work with the Software within the limits of freeware distribution and fair use. +This includes the rights to use, copy, and modify the Software for personal use. +Users are also allowed and encouraged to submit corrections and modifications +to the Software for the benefit of other users. + +It is not allowed to reuse, modify, or redistribute the Software for +commercial use in any way, or for a user’s educational materials such as books +or blog articles without prior permission from the copyright holder. + +The above copyright notice and this permission notice need to be included +in all copies or substantial portions of the software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..f9692f3 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +#Apress Source Code + +This repository accompanies [*Learn Objective-C on the Mac*](http://www.apress.com/9781430241881) by Scott Knaster, Mark Dalrymple, and Waqar Malik (Apress, 2012). + +![Cover image](9781430241881.jpg) + +Download the files as a zip using the green button, or clone the repository to your machine using Git. + +##Releases + +Release v1.0 corresponds to the code in the published book, without corrections or updates. + +##Contributions + +See the file Contributing.md for more information on how you can contribute to this repository. diff --git a/__MACOSX/._19.01 CarParts Error b/__MACOSX/._19.01 CarParts Error new file mode 100644 index 0000000..01bb104 Binary files /dev/null and b/__MACOSX/._19.01 CarParts Error differ diff --git a/__MACOSX/._19.02 CarPartsPredicate Fixed b/__MACOSX/._19.02 CarPartsPredicate Fixed new file mode 100644 index 0000000..dfb8ae7 Binary files /dev/null and b/__MACOSX/._19.02 CarPartsPredicate Fixed differ diff --git a/__MACOSX/19.01 CarParts Error/._.DS_Store b/__MACOSX/19.01 CarParts Error/._.DS_Store new file mode 100644 index 0000000..a410e55 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/._.DS_Store differ diff --git a/__MACOSX/19.01 CarParts Error/._CarParts Error b/__MACOSX/19.01 CarParts Error/._CarParts Error new file mode 100644 index 0000000..dc30417 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/._CarParts Error differ diff --git a/__MACOSX/19.01 CarParts Error/._CarParts Error.xcodeproj b/__MACOSX/19.01 CarParts Error/._CarParts Error.xcodeproj new file mode 100644 index 0000000..a65c161 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/._CarParts Error.xcodeproj differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._project.pbxproj b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._project.pbxproj new file mode 100644 index 0000000..7d7a9df Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._project.pbxproj differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._project.xcworkspace b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._project.xcworkspace new file mode 100644 index 0000000..76cad43 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._project.xcworkspace differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._xcuserdata b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._xcuserdata new file mode 100644 index 0000000..1615a07 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/._xcuserdata differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/._contents.xcworkspacedata b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/._contents.xcworkspacedata new file mode 100644 index 0000000..585b444 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/._contents.xcworkspacedata differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/._xcuserdata b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/._xcuserdata new file mode 100644 index 0000000..5ac632f Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/._xcuserdata differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/._malik.xcuserdatad b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/._malik.xcuserdatad new file mode 100644 index 0000000..1eee08c Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/._malik.xcuserdatad differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/._UserInterfaceState.xcuserstate b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/._UserInterfaceState.xcuserstate new file mode 100644 index 0000000..92669ae Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/project.xcworkspace/xcuserdata/malik.xcuserdatad/._UserInterfaceState.xcuserstate differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/._malik.xcuserdatad b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/._malik.xcuserdatad new file mode 100644 index 0000000..c0dc068 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/._malik.xcuserdatad differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/._xcschemes b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/._xcschemes new file mode 100644 index 0000000..d3d13b0 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/._xcschemes differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/._CarParts Error.xcscheme b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/._CarParts Error.xcscheme new file mode 100644 index 0000000..065157a Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/._CarParts Error.xcscheme differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/._xcschememanagement.plist b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/._xcschememanagement.plist new file mode 100644 index 0000000..7d122ad Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error.xcodeproj/xcuserdata/malik.xcuserdatad/xcschemes/._xcschememanagement.plist differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._AllWeatherRadial.h b/__MACOSX/19.01 CarParts Error/CarParts Error/._AllWeatherRadial.h new file mode 100644 index 0000000..f076f91 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._AllWeatherRadial.h differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._AllWeatherRadial.m b/__MACOSX/19.01 CarParts Error/CarParts Error/._AllWeatherRadial.m new file mode 100644 index 0000000..bccdf38 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._AllWeatherRadial.m differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Car.h b/__MACOSX/19.01 CarParts Error/CarParts Error/._Car.h new file mode 100644 index 0000000..2c3ee3c Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Car.h differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Car.m b/__MACOSX/19.01 CarParts Error/CarParts Error/._Car.m new file mode 100644 index 0000000..6815d34 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Car.m differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._CarParts Error-Prefix.pch b/__MACOSX/19.01 CarParts Error/CarParts Error/._CarParts Error-Prefix.pch new file mode 100644 index 0000000..67334ea Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._CarParts Error-Prefix.pch differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._CarParts_Error.1 b/__MACOSX/19.01 CarParts Error/CarParts Error/._CarParts_Error.1 new file mode 100644 index 0000000..aae85d6 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._CarParts_Error.1 differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Engine.h b/__MACOSX/19.01 CarParts Error/CarParts Error/._Engine.h new file mode 100644 index 0000000..f67b662 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Engine.h differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Engine.m b/__MACOSX/19.01 CarParts Error/CarParts Error/._Engine.m new file mode 100644 index 0000000..bd0179b Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Engine.m differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Garage.h b/__MACOSX/19.01 CarParts Error/CarParts Error/._Garage.h new file mode 100644 index 0000000..f64648e Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Garage.h differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Garage.m b/__MACOSX/19.01 CarParts Error/CarParts Error/._Garage.m new file mode 100644 index 0000000..73ae669 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Garage.m differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Slant6.h b/__MACOSX/19.01 CarParts Error/CarParts Error/._Slant6.h new file mode 100644 index 0000000..837c711 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Slant6.h differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Slant6.m b/__MACOSX/19.01 CarParts Error/CarParts Error/._Slant6.m new file mode 100644 index 0000000..32a539e Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Slant6.m differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Tire.h b/__MACOSX/19.01 CarParts Error/CarParts Error/._Tire.h new file mode 100644 index 0000000..ff0d063 Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Tire.h differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._Tire.m b/__MACOSX/19.01 CarParts Error/CarParts Error/._Tire.m new file mode 100644 index 0000000..2adc65a Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._Tire.m differ diff --git a/__MACOSX/19.01 CarParts Error/CarParts Error/._main.m b/__MACOSX/19.01 CarParts Error/CarParts Error/._main.m new file mode 100644 index 0000000..ad4e83f Binary files /dev/null and b/__MACOSX/19.01 CarParts Error/CarParts Error/._main.m differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/._.DS_Store b/__MACOSX/19.02 CarPartsPredicate Fixed/._.DS_Store new file mode 100644 index 0000000..a3fa934 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/._.DS_Store differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/._CarPartsPredicate b/__MACOSX/19.02 CarPartsPredicate Fixed/._CarPartsPredicate new file mode 100644 index 0000000..a3f7e4e Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/._CarPartsPredicate differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/._CarPartsPredicate.xcodeproj b/__MACOSX/19.02 CarPartsPredicate Fixed/._CarPartsPredicate.xcodeproj new file mode 100644 index 0000000..1f9e312 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/._CarPartsPredicate.xcodeproj differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/._SourceAnnotations.h b/__MACOSX/19.02 CarPartsPredicate Fixed/._SourceAnnotations.h new file mode 100644 index 0000000..ab86153 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/._SourceAnnotations.h differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/._project.pbxproj b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/._project.pbxproj new file mode 100644 index 0000000..a33d388 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/._project.pbxproj differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/._project.xcworkspace b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/._project.xcworkspace new file mode 100644 index 0000000..2ea20cb Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/._project.xcworkspace differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.xcworkspace/._contents.xcworkspacedata b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.xcworkspace/._contents.xcworkspacedata new file mode 100644 index 0000000..3043311 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate.xcodeproj/project.xcworkspace/._contents.xcworkspacedata differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._AllWeatherRadial.h b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._AllWeatherRadial.h new file mode 100644 index 0000000..df9886c Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._AllWeatherRadial.h differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._AllWeatherRadial.m b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._AllWeatherRadial.m new file mode 100644 index 0000000..025d556 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._AllWeatherRadial.m differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Car.h b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Car.h new file mode 100644 index 0000000..6bf7594 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Car.h differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Car.m b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Car.m new file mode 100644 index 0000000..d5a0c09 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Car.m differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._CarPartsPredicate-Prefix.pch b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._CarPartsPredicate-Prefix.pch new file mode 100644 index 0000000..7c0939d Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._CarPartsPredicate-Prefix.pch differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._CarPartsPredicate.1 b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._CarPartsPredicate.1 new file mode 100644 index 0000000..37e7174 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._CarPartsPredicate.1 differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Engine.h b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Engine.h new file mode 100644 index 0000000..a43968b Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Engine.h differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Engine.m b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Engine.m new file mode 100644 index 0000000..873a6f2 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Engine.m differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Garage.h b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Garage.h new file mode 100644 index 0000000..36f3fa5 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Garage.h differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Garage.m b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Garage.m new file mode 100644 index 0000000..abba340 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Garage.m differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Slant6.h b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Slant6.h new file mode 100644 index 0000000..d66aef1 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Slant6.h differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Slant6.m b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Slant6.m new file mode 100644 index 0000000..8d5db70 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Slant6.m differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Tire.h b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Tire.h new file mode 100644 index 0000000..b3e8884 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Tire.h differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Tire.m b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Tire.m new file mode 100644 index 0000000..9e70297 Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._Tire.m differ diff --git a/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._main.m b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._main.m new file mode 100644 index 0000000..468709e Binary files /dev/null and b/__MACOSX/19.02 CarPartsPredicate Fixed/CarPartsPredicate/._main.m differ diff --git a/contributing.md b/contributing.md new file mode 100644 index 0000000..f6005ad --- /dev/null +++ b/contributing.md @@ -0,0 +1,14 @@ +# Contributing to Apress Source Code + +Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers. + +## How to Contribute + +1. Make sure you have a GitHub account. +2. Fork the repository for the relevant book. +3. Create a new branch on which to make your change, e.g. +`git checkout -b my_code_contribution` +4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted. +5. Submit a pull request. + +Thank you for your contribution! \ No newline at end of file