├── .gitignore ├── DPCIManager ├── DPCIManager.icns ├── DPCIManager │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── DPCIManager-Info.plist │ ├── DPCIManager-Prefix.pch │ ├── Hardware.h │ ├── Hardware.m │ ├── License.h │ ├── Match.h │ ├── Match.m │ ├── PCI.h │ ├── PCI.m │ ├── Tables.h │ ├── Task.h │ ├── Task.m │ └── main.m ├── ddcli │ ├── LICENSE.txt │ └── lib │ │ ├── DDCliApplication.h │ │ ├── DDCliApplication.m │ │ ├── DDCliParseException.h │ │ ├── DDCliParseException.m │ │ ├── DDCliUtil.h │ │ ├── DDCliUtil.m │ │ ├── DDCommandLineInterface.h │ │ ├── DDGetoptLongParser.h │ │ ├── DDGetoptLongParser.m │ │ └── dd_getopt_long-fbsd.m ├── dspci.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── dspci.xcscheme ├── dspci │ ├── DataTypeHandler.h │ ├── DataTypeHandler.m │ ├── DataTypes.h │ ├── JSON.h │ ├── JSON.m │ ├── dspci.h │ ├── dspci.m │ └── main.m └── pci.ids ├── KUMenuBar ├── KUMenuBar.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── KUMenuBar.xcscheme ├── KUMenuBar │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── EFIMount.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ └── HF Logo SW.png │ │ ├── Contents.json │ │ ├── MenuBarButton.imageset │ │ │ ├── Contents.json │ │ │ ├── MenuBarButton.png │ │ │ └── MenuBarButtonDark.png │ │ ├── efihd.imageset │ │ │ ├── Contents.json │ │ │ └── efihd.png │ │ ├── menubar_efifolder.imageset │ │ │ ├── Contents.json │ │ │ └── menubar_efifolder.png │ │ └── menubar_folder.imageset │ │ │ ├── Contents.json │ │ │ └── menubar_folder.png │ ├── Info.plist │ ├── KUMenuBar.swift │ ├── Localizable.strings │ ├── MenuBarButton.png │ ├── MenuBarButtonDark.png │ ├── bashstrings │ ├── bin │ │ └── BDMESG │ ├── de.lproj │ │ ├── Localizable.strings │ │ └── Main.strings │ ├── main.swift │ ├── script │ │ ├── efimount.command │ │ └── script.command │ └── sound │ │ └── done.mp3 └── README.md ├── KUNotifier ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ └── appIcon.png │ └── Contents.json ├── KUNotifier.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── KUNotifier.xcscheme └── KUNotifier │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ └── MainMenu.xib │ ├── Info.plist │ ├── KUNotifier-Prefix.pch │ └── main.m ├── Kext Updater.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── Kext Updater.xcscheme ├── Kext Updater.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── swiftpm │ └── Package.resolved ├── Kext Updater ├── About.swift ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ └── appIcon.png │ ├── Contents.json │ ├── HF Logo.imageset │ │ ├── Contents.json │ │ ├── HF Logo.png │ │ └── logodark.png │ ├── Nightly build.imageset │ │ ├── Contents.json │ │ ├── Nightly build dark.png │ │ └── Nightly build.png │ ├── Pfeil.imageset │ │ ├── Contents.json │ │ ├── Pfeil dark.png │ │ └── Pfeil.png │ ├── applied.imageset │ │ ├── Contents.json │ │ └── applied.png │ ├── authroot.imageset │ │ ├── Contents.json │ │ └── authroot.png │ ├── bug-report.imageset │ │ ├── Contents.json │ │ ├── bug-report dark.png │ │ └── bug-report.png │ ├── clover_logo_shadow.imageset │ │ ├── Contents.json │ │ └── clover_logo_shadow.png │ ├── crt.imageset │ │ ├── Contents.json │ │ └── crt.png │ ├── efifolder.imageset │ │ ├── Contents.json │ │ └── efifolder.png │ ├── efihd.imageset │ │ ├── Contents.json │ │ └── efihd.png │ ├── efimaker.imageset │ │ ├── Contents.json │ │ ├── efimaker-dark.png │ │ └── efimaker.png │ ├── eject.imageset │ │ ├── Contents.json │ │ ├── eject.png │ │ └── eject_dark.png │ ├── excludekexts.imageset │ │ ├── Contents.json │ │ └── excludekexts.png │ ├── harddisk.imageset │ │ ├── Contents.json │ │ └── harddisk.png │ ├── hf-newyear.imageset │ │ ├── Contents.json │ │ └── hf-newyear.png │ ├── hf-snow.imageset │ │ ├── Contents.json │ │ └── hf-snow.png │ ├── hf-xmas.imageset │ │ ├── Contents.json │ │ └── hf-xmas.png │ ├── hflogo.imageset │ │ ├── Contents.json │ │ └── hflogo.png │ ├── hint.imageset │ │ ├── Contents.json │ │ ├── hint.png │ │ └── hint_dark.png │ ├── kext.imageset │ │ ├── Contents.json │ │ └── kext.png │ ├── keychain.imageset │ │ ├── Contents.json │ │ └── keychain.png │ ├── link.imageset │ │ ├── Contents.json │ │ ├── link.png │ │ └── link_dark-1.png │ ├── lock.imageset │ │ ├── Contents.json │ │ └── lock.png │ ├── notapplied.imageset │ │ ├── Contents.json │ │ └── notapplied.png │ ├── nvidia.imageset │ │ ├── Contents.json │ │ └── nvidia.png │ ├── opencore_logo_shadow.imageset │ │ ├── Contents.json │ │ └── opencore_logo_shadow.png │ ├── paypal-logo.imageset │ │ ├── Contents.json │ │ ├── paypal-logo-dark.png │ │ └── paypal-logo.png │ ├── ssd.imageset │ │ ├── Contents.json │ │ └── ssd.png │ ├── usbhd.imageset │ │ ├── Contents.json │ │ └── usbhd.png │ └── usbstick.imageset │ │ ├── Contents.json │ │ └── usbstick.png ├── AuthRoot.swift ├── AuthRootApplyReboot.swift ├── Base.lproj │ ├── Main.storyboard │ └── Main.storyboard_ori ├── Bootloader.swift ├── Changelog.swift ├── CustomTableCell.swift ├── DiskInformation.swift ├── Hint.swift ├── Info.plist ├── KUMenuBar │ ├── de.xcloc │ │ ├── Localized Contents │ │ │ └── de.xliff │ │ ├── Source Contents │ │ │ └── KUMenuBar │ │ │ │ ├── Base.lproj │ │ │ │ └── Main.storyboard │ │ │ │ └── en.lproj │ │ │ │ └── InfoPlist.strings │ │ └── contents.json │ └── en.xcloc │ │ ├── Localized Contents │ │ └── en.xliff │ │ ├── Source Contents │ │ └── KUMenuBar │ │ │ ├── Base.lproj │ │ │ └── Main.storyboard │ │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ │ └── contents.json ├── KextUpdater.swift ├── Kext_Updater.entitlements ├── LESLEWarning.swift ├── LetsMoveIt.swift ├── OCConfigCompare.swift ├── PasswordWindow.swift ├── Preferences.swift ├── ScanPolicyCalculator.swift ├── SingleKexts.swift ├── Tools.swift ├── ViewController.swift ├── Website.swift ├── WindowController.swift ├── bashstrings │ ├── de.bashstrings │ └── en.bashstrings ├── bin │ ├── AppleGFXHDA │ ├── BDMESG │ ├── KUMenuBar.app │ │ └── Contents │ │ │ ├── Info.plist │ │ │ ├── MacOS │ │ │ └── KUMenuBar │ │ │ ├── PkgInfo │ │ │ └── Resources │ │ │ ├── AppIcon.icns │ │ │ ├── Assets.car │ │ │ ├── Base.lproj │ │ │ └── Main.storyboardc │ │ │ │ ├── Info.plist │ │ │ │ ├── MainMenu.nib │ │ │ │ ├── NSViewController-mjF-K0-W90.nib │ │ │ │ ├── NSViewController-qdv-kZ-Khq.nib │ │ │ │ ├── mjF-K0-W90-view-QeS-rR-bDf.nib │ │ │ │ └── qdv-kZ-Khq-view-oYs-At-w56.nib │ │ │ ├── Localizable.strings │ │ │ ├── bashstrings │ │ │ ├── de.bashstrings │ │ │ └── en.bashstrings │ │ │ ├── bin │ │ │ └── BDMESG │ │ │ ├── de.lproj │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ │ ├── script │ │ │ ├── efimount.command │ │ │ └── script.command │ │ │ └── sound │ │ │ └── done.mp3 │ ├── KUNotifier.app │ │ └── Contents │ │ │ ├── Info.plist │ │ │ ├── MacOS │ │ │ └── KUNotifier │ │ │ ├── PkgInfo │ │ │ └── Resources │ │ │ ├── AppIcon.icns │ │ │ ├── Assets.car │ │ │ └── Base.lproj │ │ │ └── MainMenu.nib │ ├── PlistBuddy │ ├── dspci │ ├── lspci │ │ ├── lspci │ │ └── pci.ids │ └── slsoft.de.KUMenuBar.plist ├── de.lproj │ ├── InfoPlist.strings │ ├── Localizable.strings │ └── Main.strings ├── en.lproj │ └── Main.strings ├── html │ └── report.html ├── kexts │ ├── IO80211Family.kext │ │ └── Contents │ │ │ ├── Info.plist │ │ │ ├── MacOS │ │ │ └── IO80211Family │ │ │ ├── PlugIns │ │ │ └── AirPortAtheros40.kext │ │ │ │ └── Contents │ │ │ │ ├── Info.plist │ │ │ │ ├── MacOS │ │ │ │ └── AirPortAtheros40 │ │ │ │ ├── _CodeSignature │ │ │ │ └── CodeResources │ │ │ │ └── version.plist │ │ │ ├── _CodeSignature │ │ │ └── CodeResources │ │ │ └── version.plist │ └── lspci │ │ └── 10.10DirektHW.kext.zip ├── kextupdaterng.html ├── nVidiaWebdriver.swift ├── pics │ ├── admin.png │ └── locked.png ├── script │ └── script.command └── sounds │ ├── done.mp3 │ ├── error.aif │ ├── mq.mp3 │ ├── passok.aif │ ├── pm52.mp3 │ ├── quadra.mp3 │ ├── quadradeath.mp3 │ └── ta.mp3 └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.xcuserstate 3 | project.xcworkspace/ 4 | xcuserdata/ 5 | -------------------------------------------------------------------------------- /DPCIManager/DPCIManager.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MacThings/kextupdater/42a24ebd787403ecb37bdae14b6c373533523dcc/DPCIManager/DPCIManager.icns -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DPCIManager 4 | // 5 | // Created by PHPdev32 on 9/12/12. 6 | // Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt 7 | // 8 | 9 | @class Match; 10 | 11 | typedef struct { 12 | UInt32 core; 13 | UInt32 index; 14 | UInt32 hi; 15 | UInt32 lo; 16 | } msrcmd_t; 17 | 18 | @interface AppDelegate : NSObject 19 | 20 | @property (assign) IBOutlet NSPanel *panel; 21 | @property (assign) IBOutlet NSPopover *pop; 22 | @property (assign) IBOutlet NSPopUpButton *nodeLocation; 23 | @property (assign) IBOutlet NSWindow *reporter; 24 | @property NSMutableDictionary *report; 25 | @property NSMutableData *flashout; 26 | @property Match *match; 27 | @property NSConditionLock *cond; 28 | @property NSArray *matches; 29 | @property NSString *patch; 30 | @property NSString *bdmesg; 31 | @property NSTask *watcher; 32 | @property NSMutableArray *log; 33 | @property NSArray *pcis; 34 | @property NSDictionary *status; 35 | 36 | -(IBAction)updateIDs:(id)sender; 37 | -(IBAction)dumpTables:(id)sender; 38 | -(IBAction)dumpDsdt:(id)sender; 39 | -(IBAction)ethString:(id)sender; 40 | -(IBAction)fetchKext:(id)sender; 41 | -(IBAction)repair:(id)sender; 42 | -(IBAction)rebuild:(id)sender; 43 | -(IBAction)install:(id)sender; 44 | -(IBAction)fetchvBIOS:(id)sender; 45 | -(IBAction)savePCIInfo:(id)sender; 46 | -(void)logTask:(NSData *)data; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/DPCIManager-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | DPCIManager 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | ${CURRENT_MARKETING_VERSION} 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | ${CURRENT_PROJECT_VERSION} 25 | LSApplicationCategoryType 26 | public.app-category.utilities 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | NSHumanReadableCopyright 30 | Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/DPCIManager-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'DPCIManager' target in the 'DPCIManager' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | #define kSLE @"/System/Library/Extensions" 9 | #define kLE @"/Library/Extensions" 10 | #define SHOWFILE(x) [[NSWorkspace sharedWorkspace] selectFile:x inFileViewerRootedAtPath:x.stringByDeletingLastPathComponent] 11 | #define assignWithNotice(x,y,z) [x willChangeValueForKey:@""#y];y=z;[x didChangeValueForKey:@""#y]; 12 | #define muteWithNotice(x,y,z) [x willChangeValueForKey:@""#y];z;[x didChangeValueForKey:@""#y]; 13 | #define strHexDec(x) strtol([x UTF8String], NULL, 16) 14 | #define pciIDsPath [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"pci.ids"] 15 | NS_INLINE NSError* ModalError(NSError *error){ 16 | if (error) 17 | [[NSAlert alertWithError:error] runModal]; 18 | return error; 19 | } 20 | NS_INLINE void ModalErrorWithDict(NSDictionary *err){ 21 | if (err && [[err objectForKey:NSAppleScriptErrorNumber] integerValue] != -128) 22 | NSRunCriticalAlertPanel([err objectForKey:NSAppleScriptErrorMessage], @"%@", [err objectForKey:NSAppleScriptErrorBriefMessage], nil, nil, nil); 23 | } 24 | NS_INLINE NSOpenPanel* DirectoryChooser() { 25 | NSOpenPanel *temp = [NSOpenPanel openPanel]; 26 | [temp setCanChooseDirectories:true]; 27 | [temp setCanChooseFiles:false]; 28 | [temp setCanCreateDirectories:true]; 29 | [temp setPrompt:@"Choose a destination folder"]; 30 | return temp; 31 | } 32 | -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/Hardware.h: -------------------------------------------------------------------------------- 1 | // 2 | // Hardware.h 3 | // DPCIManager 4 | // 5 | // Created by PHPdev32 on 3/29/13. 6 | // Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #define kStubMAC @"88:88:88:88:87:88" 11 | 12 | @interface AppDelegate (HardwareAdditions) 13 | 14 | +(void)acpitables:(NSString *)only; 15 | +(NSString *)bdmesg; 16 | +(NSDictionary *)readHardware; 17 | +(NSURL *)findKext:(NSString *)bundle; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/License.h: -------------------------------------------------------------------------------- 1 | /* The following license applies to code derived from the FreeBSD hdac driver. */ 2 | 3 | /* Copyright (c) 2006 Stephane E. Potvin 4 | * Copyright (c) 2006 Ariff Abdullah 5 | * Copyright (c) 2008 Alexander Motin 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | 30 | /* The following license applies to code upon which the included PCMBlitterLib 31 | * and AudioClip source code (from AudioReflectorDriver) is based. It also applies 32 | * to portions of VoodooHDA which were derived from SamplePCIAudioDevice and other 33 | * sample code available from Apple. */ 34 | 35 | /* Copyright © 2007 Apple Inc. All Rights Reserved. 36 | * 37 | * Disclaimer: IMPORTANT: This Apple software is supplied to you by 38 | * Apple Inc. ("Apple") in consideration of your agreement to the 39 | * following terms, and your use, installation, modification or 40 | * redistribution of this Apple software constitutes acceptance of these 41 | * terms. If you do not agree with these terms, please do not use, 42 | * install, modify or redistribute this Apple software. 43 | * 44 | * In consideration of your agreement to abide by the following terms, and 45 | * subject to these terms, Apple grants you a personal, non-exclusive 46 | * license, under Apple's copyrights in this original Apple software (the 47 | * "Apple Software"), to use, reproduce, modify and redistribute the Apple 48 | * Software, with or without modifications, in source and/or binary forms; 49 | * provided that if you redistribute the Apple Software in its entirety and 50 | * without modifications, you must retain this notice and the following 51 | * text and disclaimers in all such redistributions of the Apple Software. 52 | * Neither the name, trademarks, service marks or logos of Apple Inc. 53 | * may be used to endorse or promote products derived from the Apple 54 | * Software without specific prior written permission from Apple. Except 55 | * as expressly stated in this notice, no other rights or licenses, express 56 | * or implied, are granted by Apple herein, including but not limited to 57 | * any patent rights that may be infringed by your derivative works or by 58 | * other works in which the Apple Software may be incorporated. 59 | * 60 | * The Apple Software is provided by Apple on an "AS IS" basis. APPLE 61 | * MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 62 | * THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 63 | * FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 64 | * OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 65 | * 66 | * IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 67 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 68 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 69 | * INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 70 | * MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 71 | * AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 72 | * STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 73 | * POSSIBILITY OF SUCH DAMAGE. 74 | */ 75 | -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/Match.h: -------------------------------------------------------------------------------- 1 | // 2 | // Match.h 3 | // DPCIManager 4 | // 5 | // Created by PHPdev32 on 10/12/12. 6 | // Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt 7 | // 8 | 9 | @class pciDevice; 10 | 11 | @interface Match : NSObject 12 | 13 | @property NSDictionary *seed; 14 | @property NSDictionary *native; 15 | 16 | +(Match *)create; 17 | -(NSArray *)match:(pciDevice *)device; 18 | 19 | @end 20 | 21 | @interface matchFormatter : NSValueTransformer 22 | +(BOOL)allowsReverseTransformation; 23 | +(Class)transformedValueClass; 24 | -(id)transformedValue:(id)value; 25 | @end -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/PCI.h: -------------------------------------------------------------------------------- 1 | // 2 | // pci.h 3 | // DPCIManager 4 | // 5 | // Created by PHPdev32 on 10/8/12. 6 | // Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt 7 | // 8 | 9 | @interface pciDevice : NSObject 10 | 11 | @property uint64_t entryID; 12 | @property NSNumber *shadowVendor; 13 | @property NSNumber *shadowDevice; 14 | @property NSNumber *revision; 15 | @property NSArray *bus; 16 | @property NSNumber *vendor; 17 | @property NSNumber *device; 18 | @property NSNumber *subVendor; 19 | @property NSNumber *subDevice; 20 | @property NSNumber *pciClassCode; 21 | @property NSNumber *pciClass; 22 | @property NSNumber *pciSubClass; 23 | @property NSString *vendorString; 24 | @property NSString *deviceString; 25 | @property NSString *classString; 26 | @property NSString *subClassString; 27 | @property (readonly) NSString *fullClassString; 28 | @property (readonly) NSString *lspciString; 29 | @property (readonly) NSDictionary *lspciDictionary; 30 | @property (readonly) long fullID; 31 | @property (readonly) long fullSubID; 32 | @property (readonly) short bdf; 33 | 34 | +(long)nameToLong:(NSString *)name; 35 | +(bool)isPCI:(io_service_t)service; 36 | +(NSNumber *)grabNumber:(CFStringRef)entry forService:(io_service_t)service; 37 | +(NSString *)grabString:(CFStringRef)entry forService:(io_service_t)service; 38 | +(NSDictionary *)match:(pciDevice *)pci; 39 | +(pciDevice *)create:(io_service_t)service classes:(NSMutableDictionary *)classes vendors:(NSMutableDictionary *)vendors; 40 | +(pciDevice *)create:(io_service_t)service; 41 | +(NSArray *)readIDs; 42 | 43 | @end 44 | 45 | @interface pciVendor : NSObject 46 | @property NSString *name; 47 | @property NSMutableDictionary *devices; 48 | +(pciVendor *)create:(NSString *)name; 49 | @end 50 | 51 | @interface pciClass : NSObject 52 | @property NSString *name; 53 | @property NSMutableDictionary *subClasses; 54 | +(pciClass *)create:(NSString *)name; 55 | @end 56 | 57 | @interface efiObject : NSObject 58 | @property NSDictionary *properties; 59 | @property pciDevice *device; 60 | +(efiObject *)create:(pciDevice *)device injecting:(NSDictionary *)properties; 61 | +(NSString *)stringWithArray:(NSArray *)array; 62 | @end 63 | 64 | @interface hexFormatter : NSValueTransformer 65 | +(BOOL)allowsReverseTransformation; 66 | +(Class)transformedValueClass; 67 | -(id)transformedValue:(id)value; 68 | @end 69 | -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/Task.h: -------------------------------------------------------------------------------- 1 | // 2 | // Task.h 3 | // DPCIManager 4 | // 5 | // Created by PHPdev32 on 10/13/12. 6 | // Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt 7 | // 8 | 9 | @interface NSTask (TaskAdditions) 10 | 11 | @property SEL callback; 12 | @property id listener; 13 | 14 | +(NSString *)launchAndOut:(NSString *)path args:(NSArray *)arguments; 15 | +(NSTask *)create:(NSString *)path args:(NSArray *)arguments callback:(SEL)selector listener:(id)object; 16 | +(NSTask *)createSingle:(NSString *)path args:(NSArray *)arguments callback:(SEL)selector listener:(id)object; 17 | -(void)launchAndWait; 18 | -(void)read:(NSNotification *)aNotification; 19 | 20 | @end 21 | 22 | @interface AScript : NSObject 23 | 24 | +(NSString *)tempFile:(NSString *)template; 25 | +(NSAppleEventDescriptor *)adminExec:(NSString *)command; 26 | +(NSAppleEventDescriptor *)loadKext:(NSString *)path; 27 | 28 | @end 29 | 30 | @interface URLTask : NSObject MAC_OS_X_VERSION_10_7 32 | , NSURLConnectionDataDelegate 33 | #endif 34 | > 35 | 36 | @property NSURLConnection *connection; 37 | @property NSMutableData *hold; 38 | @property NSNumber *progress; 39 | @property (copy, nonatomic) void (^successBlock)(NSData *data); 40 | @property (copy, nonatomic) void (^errorBlock)(NSError *error); 41 | 42 | +(bool)conditionalGet:(NSURL *)url toFile:(NSString *)file; 43 | +(NSDictionary *)getMACs; 44 | +(NSURL *)getURL:(NSString *)url withQuery:(NSDictionary *)dict; 45 | +(URLTask *)asyncUpload:(NSURLRequest *)request withMode:(NSString *)mode onSuccess:(void(^)(NSData *data))successBlock onError:(void(^)(NSError *error))errorBlock; 46 | 47 | @end 48 | 49 | @interface NSConditionLock (NSTaskAdditions) 50 | 51 | -(void)waitOn:(NSUInteger)condition; 52 | -(void)setCondition:(NSInteger)condition; 53 | -(void)increment; 54 | -(void)decrement; 55 | 56 | @end 57 | 58 | @interface NSAlert (HyperlinkAdditions) 59 | 60 | +(NSTextView *)hyperlink:(NSString *)hyperlink title:(NSString *)title; 61 | +(NSAlert *)alertWithMessageTextAndView:(NSString *)message defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton accessoryView:(NSView *)view informativeTextWithFormat:(NSString *)format, ...; 62 | 63 | @end -------------------------------------------------------------------------------- /DPCIManager/DPCIManager/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DPCIManager 4 | // 5 | // Created by PHPdev32 on 9/12/12. 6 | // Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /DPCIManager/ddcli/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2007-2013 Dave Dribin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /DPCIManager/ddcli/lib/DDCliApplication.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2013 Dave Dribin 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import 27 | #import "DDCliApplication.h" 28 | #import "DDGetoptLongParser.h" 29 | #import "DDCliUtil.h" 30 | #import "DDCliParseException.h" 31 | 32 | DDCliApplication * DDCliApp = nil; 33 | 34 | @interface DDCliApplication () 35 | 36 | - (Class)findFirstDelegateClass; 37 | 38 | @end 39 | 40 | @implementation DDCliApplication 41 | 42 | + (DDCliApplication *)sharedApplication; 43 | { 44 | if (DDCliApp == nil) 45 | DDCliApp = [[DDCliApplication alloc] init]; 46 | return DDCliApp; 47 | } 48 | 49 | - (id)init; 50 | { 51 | self = [super init]; 52 | if (self == nil) 53 | return nil; 54 | 55 | NSProcessInfo * processInfo = [NSProcessInfo processInfo]; 56 | _name = [processInfo processName]; 57 | 58 | return self; 59 | } 60 | 61 | - (NSString *)name; 62 | { 63 | return _name; 64 | } 65 | 66 | - (NSString *)description; 67 | { 68 | return [self name]; 69 | } 70 | 71 | - (int)runWithDelegate:(id)delegate 72 | arguments:(NSArray *)arguments 73 | { 74 | int result = EXIT_SUCCESS; 75 | @try 76 | { 77 | DDGetoptLongParser * optionsParser = 78 | [DDGetoptLongParser optionsWithTarget: delegate]; 79 | [delegate application: self willParseOptions: optionsParser]; 80 | if ( arguments == nil ) 81 | { 82 | arguments = [optionsParser parseOptions]; 83 | } 84 | else 85 | { 86 | arguments = [optionsParser parseOptionsWithArguments:arguments command:[[NSProcessInfo processInfo] processName]]; 87 | } 88 | if (arguments == nil) 89 | { 90 | return EX_USAGE; 91 | } 92 | 93 | result = [delegate application: self 94 | runWithArguments: arguments]; 95 | } 96 | @catch (DDCliParseException * e) 97 | { 98 | ddfprintf(stderr, @"%@: %@\n", self, [e reason]); 99 | result = [e exitCode]; 100 | } 101 | @catch (NSException * e) 102 | { 103 | ddfprintf(stderr, @"Caught: %@: %@\n", [e name], [e description]); 104 | result = EXIT_FAILURE; 105 | } 106 | 107 | return result; 108 | } 109 | 110 | - (int)runWithClass:(Class)delegateClass 111 | { 112 | id delegateInstance = nil; 113 | @try { 114 | if (delegateClass == nil) 115 | delegateClass = [self findFirstDelegateClass]; 116 | if (delegateClass == nil) 117 | { 118 | ddfprintf(stderr, @"%@: delegate class not found\n", self); 119 | return EX_CONFIG; 120 | } 121 | 122 | delegateInstance = [[delegateClass alloc] init]; 123 | return [self runWithDelegate:delegateInstance arguments:nil]; 124 | } 125 | @finally { 126 | delegateInstance = nil; 127 | } 128 | 129 | } 130 | 131 | - (Class)findFirstDelegateClass; 132 | { 133 | Protocol * delegateProtocol = @protocol(DDCliApplicationDelegate); 134 | Class delegateClass = nil; 135 | 136 | Class * classes = NULL; 137 | int numClasses = objc_getClassList(NULL, 0); 138 | 139 | if (numClasses > 0 ) 140 | { 141 | classes = (__unsafe_unretained Class *)alloca(sizeof(Class) * numClasses); 142 | numClasses = objc_getClassList(classes, numClasses); 143 | } 144 | int i; 145 | for (i = 0; i < numClasses; i++) 146 | { 147 | if (class_conformsToProtocol(classes[i], delegateProtocol)) 148 | { 149 | delegateClass = classes[i]; 150 | break; 151 | } 152 | } 153 | 154 | return delegateClass; 155 | } 156 | 157 | @end 158 | 159 | int DDCliAppRunWithClass(Class delegateClass) 160 | { 161 | @autoreleasepool { 162 | 163 | // Initialize singleton/global 164 | DDCliApplication * app = [DDCliApplication sharedApplication]; 165 | int result = [app runWithClass: delegateClass]; 166 | 167 | 168 | return result; 169 | } 170 | } 171 | 172 | int DDCliAppRunWithDefaultClass() 173 | { 174 | return DDCliAppRunWithClass(nil); 175 | } 176 | -------------------------------------------------------------------------------- /DPCIManager/ddcli/lib/DDCliParseException.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2013 Dave Dribin 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | 28 | /** 29 | * A option parsing exception. This should cause the program to 30 | * terminate with the given exit code. 31 | */ 32 | @interface DDCliParseException : NSException { 33 | @private 34 | int _exitCode; 35 | } 36 | 37 | /** 38 | * Create a new exception with a given reason and exit code. 39 | * 40 | * @param reason Reason for the exception 41 | * @param exitCode Desired exit code 42 | * @return Autoreleased exception 43 | */ 44 | + (DDCliParseException *)parseExceptionWithReason:(NSString *)reason exitCode:(int)exitCode; 45 | 46 | /** 47 | * Create a new exception with a given reason and exit code. 48 | * 49 | * @param reason Reason for the exception 50 | * @param exitCode Desired exit code 51 | * @return New exception 52 | */ 53 | - (id)initWithReason:(NSString *)reason exitCode:(int)exitCode; 54 | 55 | /** 56 | * Returns the desired exit code. 57 | * 58 | * @return The desired exit code 59 | */ 60 | - (int)exitCode; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /DPCIManager/ddcli/lib/DDCliParseException.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2013 Dave Dribin 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #import "DDCliParseException.h" 26 | 27 | 28 | @implementation DDCliParseException 29 | 30 | + (DDCliParseException *)parseExceptionWithReason:(NSString *)reason 31 | exitCode:(int)exitCode; 32 | { 33 | return [[self alloc] initWithReason: reason 34 | exitCode: exitCode]; 35 | } 36 | 37 | - (id)initWithReason:(NSString *)reason 38 | exitCode:(int)exitCode; 39 | { 40 | self = [super initWithName: NSStringFromClass([self class]) 41 | reason: reason 42 | userInfo: nil]; 43 | _exitCode = exitCode; 44 | return self; 45 | } 46 | 47 | - (int)exitCode; 48 | { 49 | return _exitCode; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /DPCIManager/ddcli/lib/DDCliUtil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2013 Dave Dribin 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | /** 28 | * @ingroup functions 29 | * @{ 30 | */ 31 | 32 | /** 33 | * Like printf, but with Objective-C formatting. 34 | * 35 | * @param format String format specification 36 | */ 37 | void ddprintf(NSString * format, ...); 38 | 39 | /** 40 | * Like fprintf, but with Objective-C formatting. 41 | * 42 | * @param stream Standard I/O stream 43 | * @param format String format specification 44 | */ 45 | void ddfprintf(FILE * stream, NSString * format, ...); 46 | 47 | /** @} */ 48 | -------------------------------------------------------------------------------- /DPCIManager/ddcli/lib/DDCliUtil.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2013 Dave Dribin 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #import "DDCliUtil.h" 26 | 27 | 28 | void ddfprintf(FILE * stream, NSString * format, ...) 29 | { 30 | va_list arguments; 31 | va_start(arguments, format); 32 | NSString * string = [[NSString alloc] initWithFormat: format 33 | arguments: arguments]; 34 | va_end(arguments); 35 | 36 | fprintf(stream, "%s", [string UTF8String]); 37 | } 38 | 39 | void ddprintf(NSString * format, ...) 40 | { 41 | va_list arguments; 42 | va_start(arguments, format); 43 | NSString * string = [[NSString alloc] initWithFormat: format 44 | arguments: arguments]; 45 | va_end(arguments); 46 | 47 | printf("%s", [string UTF8String]); 48 | } 49 | -------------------------------------------------------------------------------- /DPCIManager/ddcli/lib/DDCommandLineInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2013 Dave Dribin 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, copy, 8 | * modify, merge, publish, distribute, sublicense, and/or sell copies 9 | * of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | 26 | #import 27 | #import 28 | 29 | #import "DDGetoptLongParser.h" 30 | #import "DDCliApplication.h" 31 | #import "DDCliUtil.h" 32 | #import "DDCliParseException.h" 33 | 34 | 35 | /** 36 | * @mainpage ddcli: An Objective-C Command Line Helper 37 | * 38 | * ddcli is an 39 | * Objective-C library to help write command line 40 | * applications by simplifying parsing command line options and 41 | * eliminating much of the boiler plate code. The getopt_long(3) 43 | * function is used to parse command options, but the complexity of 44 | * using this function is hidden by an Objective-C wrapper 45 | * (DDGetoptLongParser). Key-Value 47 | * Coding (KVC) is used to set the options on a target class. A 48 | * simple example should help make this clear. 49 | * 50 | * The main class is DDCliApplication. You customize its behavior by 51 | * creating a class that implements the DDCliApplicationDelegate 52 | * protocol. This protocol has two methods that must be implemented: 53 | * 54 | * @include appDelegate.m 55 | * 56 | * The first method allows the delegate to add options to the parser. 57 | * The second method is the main entry point for the command line 58 | * application. The simplest way to add options is to use the 59 | * DDGetoptLongParser.addOptionsFromTable: method: 60 | * 61 | * @include willParseOptions.m 62 | * 63 | * As options are parsed your delegate is also used as the target of 64 | * KVC modifiers. The long option is used as the key to the 65 | * setValue:forKey: call. The value is a boolean YES for options that 66 | * take no arguments or a string for options that do. The simplest 67 | * way to handle this is to use instance variables with the same name 68 | * as the long options: 69 | * 70 | * @include SimpleApp.h 71 | * 72 | * After options are parsed, the entry point is called, assuming there 73 | * were no invalid options. This implementation just prints the 74 | * arguments, and exits: 75 | * 76 | * @include runWithArguments.m 77 | * 78 | * This code also uses #ddprintf which works just like printf, except 79 | * you can use the %@ format string. The final part that needs 80 | * implementing is the main function. The #DDCliAppRunWithDefaultClass 81 | * function makes this a one liner: 82 | * 83 | * @include ddcli_main.m 84 | * 85 | * Here are a few sample runs of this program: 86 | * 87 | * @verbatim 88 | % simple 89 | Output: (null), help: 0 90 | Arguments: () 91 | @endverbatim 92 | @verbatim 93 | % simple -o output.txt the quick "brown fox" 94 | Output: output.txt, help: 0 95 | Arguments: (the, quick, "brown fox") 96 | @endverbatim 97 | @verbatim 98 | % simple -h 99 | Output: (null), help: 1 100 | Arguments: () 101 | @endverbatim 102 | * 103 | * The full source for this simple application can be found on @link 104 | * SimpleApp.m @endlink example. 105 | * 106 | * Since KVC is used, you can implement a set