<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">Dear llvm dev community I need your help please.</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">I am new to llvm-dev and not an expert in LLVM or UNIX or C.</div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><b class="">I am trying to build a MacOSX app that can compile and link Objective C files.</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">I can succeed in doing this if sandboxing is turned off.</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">However, when sandboxing is turned on, the compiling works but linking fails with the error:</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><b class="">clang-9 xcrun: error: cannot be used within an App Sandbox.</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">I have downloaded the LLVM binary and created a Tools folder that contains the folders of the binary, namely bin, include, li, libexec, share.  </div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">My example app uses NSTask to call clang from Tools/bin/clang.</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">If you call clang from usr/bin/clang then sandboxing will not allow compilation.</div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">I presume that linking fails because the LLVM clang linker is calling routines that are external to the LLVM binary.</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">Is it possible to make the LLVM clang linker self-contained? and if so, how?</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">Alternatively, I might have got some of the linker flags wrong.</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">Or do I need a completely different approach?</div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">My code follows.</div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 15px; line-height: normal;" class=""><b class="">Error Message</b><span style="font-stretch: normal; font-size: 12px; line-height: normal;" class="">:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><b class=""></b><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class="">2020-03-20 11:57:13.664406+0000 NewClangM21[669:9420] Compilation was successfull.</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class="">2020-03-20 11:57:13.797517+0000 NewClangM21[669:9420] There was a linking error: clang version 9.0.0 (<a href="git://github.com/llvm/llvm-project.git" class="">git://github.com/llvm/llvm-project.git</a> 0399d5a9682b3cef71c653373e38890c63c4c365)</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class="">Target: x86_64-apple-darwin18.7.0</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class="">Thread model: posix</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class="">InstalledDir: /Users/edmundfurse/Documents/NewClang/NewClangM21/DerivedData/NewClangM21/Build/Products/Debug/NewClangM21.app/Contents/Resources/Tools/bin</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class=""> "/Applications/Xcode.app/Contents/Developer/usr/bin/ld" -demangle -lto_library /Users/edmundfurse/Documents/NewClang/NewClangM21/DerivedData/NewClangM21/Build/Products/Debug/NewClangM21.app/Contents/Resources/Tools/lib/libLTO.dylib -dynamic -arch x86_64 -bundle -macosx_version_min 10.14.0 -o "/Users/edmundfurse/Library/Containers/com.uk.imitation.NewClangM21/Data/Library/Application Support/NewClangM21/ImitateScriptSystem/TemporaryFiles/TestMain" -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk "/Users/edmundfurse/Library/Containers/com.uk.imitation.NewClangM21/Data/Library/Application Support/NewClangM21/ImitateScriptSystem/TemporaryFiles/TestMain.o" -framework Cocoa -framework Foundation -lSystem /Users/edmundfurse/Documents/NewClang/NewClangM21/DerivedData/NewClangM21/Build/Products/Debug/NewClangM21.app/Contents/Resources/Tools/lib/clang/9.0.0/lib/darwin/libclang_rt.osx.a "-F/Users/edmundfurse/Library/Containers/com.uk.imitation.NewClangM21/Data/Library/Application Support/NewClangM21/ImitateScriptSystem/TemporaryFiles/"</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class="">xcrun: error: cannot be used within an App Sandbox.</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class="">clang-9: error: linker command failed with exit code 1 (use -v to see invocation)</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><b class="">2020-03-20 11:57:13.798321+0000 NewClangM21[669:9420] CASE 1 LINK ERROR</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 15px; line-height: normal;" class=""><b class="">Code:</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #643820" class="">#import </span>"AppDelegate.h"</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #643820" class="">#import </span>"NSFileManager+DirectoryLocations.h"</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(50, 109, 116); background-color: rgb(255, 255, 255);" class=""><span style="color: #9b2393" class=""><b class="">@interface</b></span><span style="color: #000000" class=""> </span>AppDelegate<span style="color: #000000" class=""> ()</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><b class="">@property</b><span style="color: #000000" class=""> (</span><b class="">weak</b><span style="color: #000000" class="">) </span><b class="">IBOutlet</b><span style="color: #000000" class=""> </span><span style="color: #5c2699" class="">NSWindow</span><span style="color: #000000" class=""> *window;</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><b class="">@end</b></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><b class="">@implementation</b><span style="color: #000000" class=""> AppDelegate</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">- (<span style="color: #9b2393" class=""><b class="">void</b></span>)applicationDidFinishLaunching:(<span style="color: #5c2699" class="">NSNotification</span> *)aNotification {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(83, 101, 121); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><i class="">// Insert code here to initialize your application</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span>* compileResult = [<span style="color: #9b2393" class=""><b class="">self</b></span> <span style="color: #245256" class="">compileScriptFile</span>:<span style="color: #c41a16" class="">@"TestMain"</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> ([compileResult <span style="color: #3900a0" class="">isEqualToString</span>:<span style="color: #c41a16" class="">@""</span>])</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">        </span><span style="color: #3900a0" class="">NSLog</span><span style="color: #000000" class="">(</span>@"Compilation was successfull."<span style="color: #000000" class="">);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">BOOL</b></span> linkResult = [<span style="color: #9b2393" class=""><b class="">self</b></span> <span style="color: #245256" class="">linkScriptFiles</span>:<span style="color: #c41a16" class="">@"TestMain"</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (linkResult)</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">        </span><span style="color: #3900a0" class="">NSLog</span><span style="color: #000000" class="">(</span>@"Linking was successfull."<span style="color: #000000" class="">);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">- (<span style="color: #9b2393" class=""><b class="">void</b></span>)applicationWillTerminate:(<span style="color: #5c2699" class="">NSNotification</span> *)aNotification {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(83, 101, 121); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><i class="">// Insert code here to tear down your application</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">- (<span style="color: #5c2699" class="">NSString</span>*)compileScriptFile:(<span style="color: #5c2699" class="">NSString</span>*)theScriptName</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span> *applicationSupportDirectoryPath = [[<span style="color: #5c2699" class="">NSFileManager</span> <span style="color: #3900a0" class="">defaultManager</span>] <span style="color: #245256" class="">applicationSupportDirectory</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span>* temporaryFilesDirectoryName = <span style="color: #245256" class="">concatenate</span>(applicationSupportDirectoryPath, <span style="color: #c41a16" class="">@"/ImitateScriptSystem/TemporaryFiles/"</span>);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span>* result = [<span style="color: #9b2393" class=""><b class="">self</b></span> <span style="color: #245256" class="">compileFile</span>:theScriptName</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                             <span style="color: #245256" class="">inDirectory</span>:temporaryFilesDirectoryName</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                             <span style="color: #245256" class="">toDirectory</span>:temporaryFilesDirectoryName];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (![result <span style="color: #3900a0" class="">isEqualToString</span>:<span style="color: #c41a16" class="">@""</span>])</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">        </span><span style="color: #3900a0" class="">NSLog</span><span style="color: #000000" class="">(</span>@"There was an error compiling the file"<span style="color: #000000" class="">);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">return</b></span> result;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">return</b></span> <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">- (<span style="color: #5c2699" class="">NSString</span>*)compileFile:(<span style="color: #5c2699" class="">NSString</span>*)fileName</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">             inDirectory:(<span style="color: #5c2699" class="">NSString</span>*)fromDirectoryPath</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">             toDirectory:(<span style="color: #5c2699" class="">NSString</span>*)toDirectoryPath</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(83, 101, 121); background-color: rgb(255, 255, 255);" class=""><i class="">// compiles the file using clang</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSTask</span>* compileTask = [[<span style="color: #5c2699" class="">NSTask</span> <span style="color: #3900a0" class="">alloc</span>] <span style="color: #3900a0" class="">init</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(57, 0, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><span style="color: #5c2699" class="">NSString</span><span style="color: #000000" class="">* clangPath = [[</span><span style="color: #5c2699" class="">NSBundle</span><span style="color: #000000" class=""> </span>mainBundle<span style="color: #000000" class="">] </span>pathForResource<span style="color: #000000" class="">:</span><span style="color: #c41a16" class="">@"clang"</span><span style="color: #000000" class=""> </span>ofType<span style="color: #000000" class="">:</span><span style="color: #c41a16" class="">@""</span><span style="color: #000000" class=""> </span>inDirectory<span style="color: #000000" class="">:</span><span style="color: #c41a16" class="">@"Tools/bin/"</span><span style="color: #000000" class="">];</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    [compileTask <span style="color: #3900a0" class="">setLaunchPath</span>:clangPath];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    [compileTask <span style="color: #3900a0" class="">setArguments</span>:[<span style="color: #5c2699" class="">NSArray</span> <span style="color: #3900a0" class="">arrayWithObjects</span>:<span style="color: #c41a16" class="">@"-c"</span>,<span style="color: #245256" class="">concatenate3</span>(fromDirectoryPath, fileName, <span style="color: #c41a16" class="">@".m"</span>),</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                               <span style="color: #c41a16" class="">@"-isysroot"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">                            </span>@"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"<span style="color: #000000" class="">,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                           <span style="color: #536579" class=""><i class="">//    macosxSDKPath,</i></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                               <span style="color: #c41a16" class="">@"-o"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                               <span style="color: #245256" class="">concatenate3</span>(toDirectoryPath, fileName, <span style="color: #c41a16" class="">@".o"</span>),</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                               <span style="color: #9b2393" class=""><b class="">nil</b></span>]];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSPipe</span>* errorPipe = [[<span style="color: #5c2699" class="">NSPipe</span> <span style="color: #3900a0" class="">alloc</span>] <span style="color: #3900a0" class="">init</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSFileHandle</span>* errorReader = [errorPipe <span style="color: #3900a0" class="">fileHandleForReading</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    [compileTask <span style="color: #3900a0" class="">setStandardError</span>:errorPipe];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    [compileTask <span style="color: #3900a0" class="">launch</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    [compileTask <span style="color: #3900a0" class="">waitUntilExit</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span>*  errorString = [[<span style="color: #5c2699" class="">NSString</span> <span style="color: #3900a0" class="">alloc</span>] <span style="color: #3900a0" class="">initWithData</span>:[errorReader <span style="color: #3900a0" class="">readDataToEndOfFile</span>]</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                                                   <span style="color: #3900a0" class="">encoding</span>:<span style="color: #3900a0" class="">NSUTF8StringEncoding</span>];</div><p style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class="">    <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> ([errorString <span style="color: #3900a0" class="">length</span>] != <span style="color: #1c00cf" class="">0</span>)</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">        </span><span style="color: #3900a0" class="">NSLog</span><span style="color: #000000" class="">(</span>@"There was a Compilation error: %@"<span style="color: #000000" class="">, errorString);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">return</b></span> errorString;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">return</b></span> <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">- (<span style="color: #9b2393" class=""><b class="">BOOL</b></span>)linkScriptFiles:(<span style="color: #5c2699" class="">NSString</span>*)theScriptName</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(83, 101, 121); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><i class="">//   NSLog(@"IN LoadScript: linkScriptFiles:");</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span> *applicationSupportDirectoryPath = [[<span style="color: #5c2699" class="">NSFileManager</span> <span style="color: #3900a0" class="">defaultManager</span>] <span style="color: #245256" class="">applicationSupportDirectory</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span>* temporaryFilesDirectoryName = <span style="color: #245256" class="">concatenate</span>(applicationSupportDirectoryPath, <span style="color: #c41a16" class="">@"/ImitateScriptSystem/TemporaryFiles/"</span>);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span>* linkResult = [<span style="color: #9b2393" class=""><b class="">self</b></span> <span style="color: #245256" class="">linkTheScriptFilesToScriptName</span>:theScriptName</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                                                  <span style="color: #245256" class="">intoDirectory</span>:temporaryFilesDirectoryName];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">   <span style="color: #9b2393" class=""><b class="">if</b></span> (![linkResult <span style="color: #3900a0" class="">isEqualToString</span>:<span style="color: #c41a16" class="">@""</span>])</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">if</b></span> (<span style="color: #245256" class="">searchOfString</span>(<span style="color: #c41a16" class="">@"error"</span>, linkResult) != -<span style="color: #1c00cf" class="">1</span> || <span style="color: #245256" class="">searchOfString</span>(<span style="color: #c41a16" class="">@"Error"</span>, linkResult) != -<span style="color: #1c00cf" class="">1</span> || <span style="color: #245256" class="">searchOfString</span>(<span style="color: #c41a16" class="">@"ERROR"</span>, linkResult) != -<span style="color: #1c00cf" class="">1</span>)</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">            </span><span style="color: #3900a0" class="">NSLog</span><span style="color: #000000" class="">(</span>@"CASE 1 LINK ERROR"<span style="color: #000000" class="">);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">            <span style="color: #9b2393" class=""><b class="">return</b></span> <span style="color: #9b2393" class=""><b class="">NO</b></span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">else</b></span> <span style="color: #9b2393" class=""><b class="">if</b></span> (<span style="color: #245256" class="">searchOfString</span>(<span style="color: #c41a16" class="">@"warning"</span>, linkResult) != -<span style="color: #1c00cf" class="">1</span> || <span style="color: #245256" class="">searchOfString</span>(<span style="color: #c41a16" class="">@"Warning"</span>, linkResult) != -<span style="color: #1c00cf" class="">1</span> || <span style="color: #245256" class="">searchOfString</span>(<span style="color: #c41a16" class="">@"WARNING"</span>, linkResult) != -<span style="color: #1c00cf" class="">1</span>)</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">            </span><span style="color: #3900a0" class="">NSLog</span><span style="color: #000000" class="">(</span>@"CASE 2 LINK WARNING"<span style="color: #000000" class="">);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">            <span style="color: #9b2393" class=""><b class="">return</b></span> <span style="color: #9b2393" class=""><b class="">YES</b></span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">else</b></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">            </span><span style="color: #3900a0" class="">NSLog</span><span style="color: #000000" class="">(</span>@"CASE 3 UNKNOWN LINK PROBLEM"<span style="color: #000000" class="">);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">            <span style="color: #9b2393" class=""><b class="">return</b></span> <span style="color: #9b2393" class=""><b class="">NO</b></span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><b class="">return</b><span style="color: #000000" class=""> </span><b class="">YES</b><span style="color: #000000" class="">;</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">- (<span style="color: #5c2699" class="">NSString</span>*)linkTheScriptFilesToScriptName:(<span style="color: #5c2699" class="">NSString</span>*)theScriptName intoDirectory:(<span style="color: #5c2699" class="">NSString</span>*)dir</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(83, 101, 121); background-color: rgb(255, 255, 255);" class=""><i class="">// links the file using clang</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">   <span style="color: #5c2699" class="">NSString</span> *applicationSupportDirectoryPath = [[<span style="color: #5c2699" class="">NSFileManager</span> <span style="color: #3900a0" class="">defaultManager</span>] <span style="color: #245256" class="">applicationSupportDirectory</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span>* temporaryFilesDirectoryName = <span style="color: #245256" class="">concatenate</span>(applicationSupportDirectoryPath, <span style="color: #c41a16" class="">@"/ImitateScriptSystem/TemporaryFiles/"</span>);</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSTask</span>* linkTask = [[<span style="color: #5c2699" class="">NSTask</span> <span style="color: #3900a0" class="">alloc</span>] <span style="color: #3900a0" class="">init</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(57, 0, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><span style="color: #5c2699" class="">NSString</span><span style="color: #000000" class="">* clangPath = [[</span><span style="color: #5c2699" class="">NSBundle</span><span style="color: #000000" class=""> </span>mainBundle<span style="color: #000000" class="">] </span>pathForResource<span style="color: #000000" class="">:</span><span style="color: #c41a16" class="">@"clang"</span><span style="color: #000000" class=""> </span>ofType<span style="color: #000000" class="">:</span><span style="color: #c41a16" class="">@""</span><span style="color: #000000" class=""> </span>inDirectory<span style="color: #000000" class="">:</span><span style="color: #c41a16" class="">@"Tools/bin/"</span><span style="color: #000000" class="">];</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">     [linkTask <span style="color: #3900a0" class="">setLaunchPath</span>:clangPath];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(57, 0, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">     [linkTask </span>setArguments<span style="color: #000000" class="">:[</span><span style="color: #5c2699" class="">NSArray</span><span style="color: #000000" class=""> </span>arrayWithObjects<span style="color: #000000" class="">:</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #245256" class="">concatenate3</span>(temporaryFilesDirectoryName, theScriptName, <span style="color: #c41a16" class="">@".o"</span>),</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #c41a16" class="">@"-framework"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #c41a16" class="">@"Cocoa"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #c41a16" class="">@"-framework"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #c41a16" class="">@"Foundation"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #245256" class="">concatenate</span>(<span style="color: #c41a16" class="">@"-F"</span>, temporaryFilesDirectoryName),</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #c41a16" class="">@"-v"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #c41a16" class="">@"-L"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">        </span>@"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"<span style="color: #000000" class="">,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                             <span style="color: #c41a16" class="">@"-bundle"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #c41a16" class="">@"-o"</span>,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #245256" class="">concatenate</span>(dir, theScriptName),</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                            <span style="color: #9b2393" class=""><b class="">nil</b></span>]];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSPipe</span>* errorPipe = [[<span style="color: #5c2699" class="">NSPipe</span> <span style="color: #3900a0" class="">alloc</span>] <span style="color: #3900a0" class="">init</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSFileHandle</span>* errorReader = [errorPipe <span style="color: #3900a0" class="">fileHandleForReading</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    [linkTask <span style="color: #3900a0" class="">setStandardError</span>:errorPipe];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    [linkTask <span style="color: #3900a0" class="">launch</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    [linkTask <span style="color: #3900a0" class="">waitUntilExit</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSString</span>*  errorString = [[<span style="color: #5c2699" class="">NSString</span> <span style="color: #3900a0" class="">alloc</span>] <span style="color: #3900a0" class="">initWithData</span>:[errorReader <span style="color: #3900a0" class="">readDataToEndOfFile</span>]</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">                                                   <span style="color: #3900a0" class="">encoding</span>:<span style="color: #3900a0" class="">NSUTF8StringEncoding</span>];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> ([errorString <span style="color: #3900a0" class="">length</span>] != <span style="color: #1c00cf" class="">0</span>)</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(196, 26, 22); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">        </span><span style="color: #3900a0" class="">NSLog</span><span style="color: #000000" class="">(</span>@"There was a linking error: %@"<span style="color: #000000" class="">, errorString);</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">if</b></span> ((<span style="color: #245256" class="">searchOfString</span>(<span style="color: #c41a16" class="">@"error"</span>, errorString) != -<span style="color: #1c00cf" class="">1</span>) ||</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">            (<span style="color: #245256" class="">searchOfString</span>(<span style="color: #c41a16" class="">@"ERROR"</span>, errorString) != -<span style="color: #1c00cf" class="">1</span>))</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">            <span style="color: #9b2393" class=""><b class="">return</b></span> errorString;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">else</b></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        {</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(83, 101, 121); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">            </span><span style="color: #9b2393" class=""><b class="">return</b></span><span style="color: #000000" class=""> </span><span style="color: #c41a16" class="">@""</span><span style="color: #000000" class="">; </span><i class="">// ALLOW WARNINGS.</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">return</b></span> errorString;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    }</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">return</b></span> <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(92, 38, 153); background-color: rgb(255, 255, 255);" class="">NSString<span style="color: #000000" class="">* concatenate(</span>NSString<span style="color: #000000" class="">* x, </span>NSString<span style="color: #000000" class="">* y)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (!x && !y) <span style="color: #9b2393" class=""><b class="">return</b></span> <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">else</b></span> <span style="color: #9b2393" class=""><b class="">if</b></span>(!x) <span style="color: #9b2393" class=""><b class="">return</b></span> y;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">else</b></span> <span style="color: #9b2393" class=""><b class="">if</b></span> (!y) <span style="color: #9b2393" class=""><b class="">return</b></span> x;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(57, 0, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><span style="color: #9b2393" class=""><b class="">return</b></span><span style="color: #000000" class=""> [x </span>stringByAppendingString<span style="color: #000000" class="">:y];</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(92, 38, 153); background-color: rgb(255, 255, 255);" class="">NSString<span style="color: #000000" class="">* concatenate3(</span>NSString<span style="color: #000000" class="">* x, </span>NSString<span style="color: #000000" class="">* y, </span>NSString<span style="color: #000000" class="">* z)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (!x) x = <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (!y) y = <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (!z) z = <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(57, 0, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><span style="color: #9b2393" class=""><b class="">return</b></span><span style="color: #000000" class=""> [[x </span>stringByAppendingString<span style="color: #000000" class="">:y] </span>stringByAppendingString<span style="color: #000000" class="">:z];</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(92, 38, 153); background-color: rgb(255, 255, 255);" class="">NSString<span style="color: #000000" class="">* concatenate4(</span>NSString<span style="color: #000000" class="">* w, </span>NSString<span style="color: #000000" class="">* x, </span>NSString<span style="color: #000000" class="">* y, </span>NSString<span style="color: #000000" class="">* z)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (!x) x = <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (!y) y = <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (!z) z = <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (!w) w = <span style="color: #c41a16" class="">@""</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(57, 0, 160); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><span style="color: #9b2393" class=""><b class="">return</b></span><span style="color: #000000" class=""> [[[w </span>stringByAppendingString<span style="color: #000000" class="">:x] </span>stringByAppendingString<span style="color: #000000" class="">:y] </span>stringByAppendingString<span style="color: #000000" class="">:z];</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #9b2393" class=""><b class="">int</b></span> searchOfString(<span style="color: #5c2699" class="">NSString</span>* x, <span style="color: #5c2699" class="">NSString</span>* str)</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(83, 101, 121); background-color: rgb(255, 255, 255);" class=""><i class="">//searches for x within str, if not found returns -1</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(83, 101, 121); background-color: rgb(255, 255, 255);" class=""><i class="">//otherwise returns its location.</i></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">{</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> ((<span style="color: #9b2393" class=""><b class="">int</b></span>)[str <span style="color: #3900a0" class="">length</span>] == <span style="color: #1c00cf" class="">0</span>) <span style="color: #9b2393" class=""><b class="">return</b></span> -<span style="color: #1c00cf" class="">1</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> ((<span style="color: #9b2393" class=""><b class="">int</b></span>)[x <span style="color: #3900a0" class="">length</span>] > (<span style="color: #9b2393" class=""><b class="">int</b></span>)[str <span style="color: #3900a0" class="">length</span>]) <span style="color: #9b2393" class=""><b class="">return</b></span> -<span style="color: #1c00cf" class="">1</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #5c2699" class="">NSRange</span> myRange = [str <span style="color: #3900a0" class="">rangeOfString</span>:x];</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">    <span style="color: #9b2393" class=""><b class="">if</b></span> (myRange.<span style="color: #5c2699" class="">location</span> != <span style="color: #5c2699" class="">NSNotFound</span>)</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">        <span style="color: #9b2393" class=""><b class="">return</b></span> (<span style="color: #9b2393" class=""><b class="">int</b></span>)myRange.<span style="color: #5c2699" class="">location</span>;</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><span style="color: #000000" class="">    </span><b class="">else</b><span style="color: #000000" class=""> </span><b class="">return</b><span style="color: #000000" class=""> -</span><span style="color: #1c00cf" class="">1</span><span style="color: #000000" class="">;</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(155, 35, 147); background-color: rgb(255, 255, 255);" class=""><b class="">@end</b></div><div class=""><b class=""><br class=""></b></div></body></html>