[Lldb-commits] [lldb] r112536 - /lldb/trunk/source/Host/macosx/Host.mm

Greg Clayton gclayton at apple.com
Mon Aug 30 15:00:34 PDT 2010


Author: gclayton
Date: Mon Aug 30 17:00:34 2010
New Revision: 112536

URL: http://llvm.org/viewvc/llvm-project?rev=112536&view=rev
Log:
Stopped the external editor from adding stuff to the recent list when lldb
is launched with the -e option on Mac OS X.


Modified:
    lldb/trunk/source/Host/macosx/Host.mm

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=112536&r1=112535&r2=112536&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Mon Aug 30 17:00:34 2010
@@ -787,30 +787,40 @@
 {
     // We attach this to an 'odoc' event to specify a particular selection
     typedef struct {
-      int16_t      reserved0;      // must be zero
-      int16_t      fLineNumber;
-      int32_t      fSelStart;
-      int32_t      fSelEnd;
-      uint32_t      reserved1;      // must be zero
-      uint32_t      reserved2;      // must be zero
+        int16_t   reserved0;  // must be zero
+        int16_t   fLineNumber;
+        int32_t   fSelStart;
+        int32_t   fSelEnd;
+        uint32_t  reserved1;  // must be zero
+        uint32_t  reserved2;  // must be zero
     } BabelAESelInfo;
     
     char file_path[PATH_MAX];
     file_spec.GetPath(file_path, PATH_MAX);
     CFCString file_cfstr (file_path, kCFStringEncodingUTF8);
-    CFCReleaser<CFURLRef> file_URL(::CFURLCreateWithFileSystemPath(NULL, file_cfstr.get(), kCFURLPOSIXPathStyle, false));
-
+    CFCReleaser<CFURLRef> file_URL (::CFURLCreateWithFileSystemPath (NULL, 
+                                                                     file_cfstr.get(), 
+                                                                     kCFURLPOSIXPathStyle, 
+                                                                     false));
+    
     OSStatus error;	
-    BabelAESelInfo file_and_line_info;
+    BabelAESelInfo file_and_line_info = 
+    {
+        0,              // reserved0
+        line_no - 1,    // fLineNumber (zero based line number)
+        1,              // fSelStart
+        1024,           // fSelEnd
+        0,              // reserved1
+        0               // reserved2
+    };
 
     AEKeyDesc file_and_line_desc;
     
-    bzero(&file_and_line_info, sizeof (file_and_line_info));
-    file_and_line_info.fSelStart = 1;
-    file_and_line_info.fSelEnd = 1;
-    file_and_line_info.fLineNumber = line_no - 1;
+    error = ::AECreateDesc (typeUTF8Text, 
+                            &file_and_line_info, 
+                            sizeof (file_and_line_info), 
+                            &(file_and_line_desc.descContent));
     
-    error = AECreateDesc(typeChar, &file_and_line_info, sizeof (file_and_line_info), &(file_and_line_desc.descContent));
     if (error != noErr)
     {
         return false;
@@ -820,12 +830,19 @@
     
     LSApplicationParameters app_params;
     bzero (&app_params, sizeof (app_params));
-    app_params.flags = kLSLaunchDefaults | kLSLaunchDontSwitch;
+    app_params.flags = kLSLaunchDefaults | 
+                       kLSLaunchDontAddToRecents | 
+                       kLSLaunchDontSwitch;
 
     ProcessSerialNumber psn;
     CFCReleaser<CFArrayRef> file_array(CFArrayCreate (NULL, (const void **) file_URL.ptr_address(false), 1, NULL));
-    error = LSOpenURLsWithRole(file_array.get(), kLSRolesAll, &file_and_line_desc, &app_params, &psn, 1);
-
+    error = ::LSOpenURLsWithRole (file_array.get(), 
+                                  kLSRolesViewer, 
+                                  &file_and_line_desc, 
+                                  &app_params, 
+                                  &psn, 
+                                  1);
+    
     AEDisposeDesc (&(file_and_line_desc.descContent));
 
     if (error != noErr)
@@ -837,7 +854,7 @@
     bzero(&which_process, sizeof(which_process));
     unsigned char ap_name[PATH_MAX];
     which_process.processName = ap_name;
-    error = GetProcessInformation (&psn, &which_process);
+    error = ::GetProcessInformation (&psn, &which_process);
     
     bool using_xcode = strncmp((char *) ap_name+1, "Xcode", 5) == 0;
     
@@ -861,8 +878,8 @@
       
         if (osa_component == NULL)
         {
-            osa_component = OpenDefaultComponent (kOSAComponentType, 
-                        kAppleScriptSubtype);
+            osa_component = ::OpenDefaultComponent (kOSAComponentType,
+                                                    kAppleScriptSubtype);
         }
         
         if (osa_component == NULL)
@@ -872,21 +889,34 @@
 
         uint32_t as_str_size = as_template_len + strlen (file_path) + 3 * chars_for_int + 1;     
         as_str = (char *) malloc (as_str_size);
-        snprintf (as_str, as_str_size - 1, as_template, file_path, line_no, line_no, line_no);
-        error = AECreateDesc (typeChar, as_str, strlen (as_str), &as_desc);
-
-        free (as_str);
+        ::snprintf (as_str, 
+                    as_str_size - 1, 
+                    as_template, 
+                    file_path, 
+                    line_no, 
+                    line_no, 
+                    line_no);
+
+        error = ::AECreateDesc (typeChar, 
+                                as_str, 
+                                strlen (as_str),
+                                &as_desc);
+        
+        ::free (as_str);
 
         if (error != noErr)
             return false;
             
         OSAID ret_OSAID;
-        error = OSACompileExecute (osa_component, &as_desc, kOSANullScript, 
-                   kOSAModeNeverInteract, &ret_OSAID);
-
-        OSADispose (osa_component, ret_OSAID);
+        error = ::OSACompileExecute (osa_component, 
+                                     &as_desc, 
+                                     kOSANullScript, 
+                                     kOSAModeNeverInteract, 
+                                     &ret_OSAID);
+        
+        ::OSADispose (osa_component, ret_OSAID);
 
-        AEDisposeDesc (&as_desc);
+        ::AEDisposeDesc (&as_desc);
 
         if (error != noErr)
             return false;





More information about the lldb-commits mailing list