source: project/macosx/macosx-url.scm @ 5402

Last change on this file since 5402 was 5402, checked in by Kon Lovett, 13 years ago

Chgd to unsigned-c-string* use, bumped verno.

File size: 683 bytes
Line 
1;;;; macosx-url.scm
2;;;; Kon Lovett, Sep '06
3
4(declare
5  (no-procedure-checks)
6  (no-bound-checks)
7        (export
8                macosx:open-url) )
9
10#>
11#import <ApplicationServices/ApplicationServices.h>
12#import <CoreFoundation/CoreFoundation.h>
13
14static int
15open_url (const char * urlstr, int len)
16{
17        OSStatus    sta = 1;
18        CFURLRef    url = CFURLCreateWithBytes (NULL, (const UInt8 *) urlstr, len, kCFStringEncodingASCII, NULL);
19        if (NULL != url) {
20                sta = LSOpenCFURLRef (url, NULL);
21                CFRelease (url);
22        }
23        return sta;
24}
25<#
26
27(define (macosx:open-url url)
28        (let ([sta ($ int open_url (c-string url) (int (string-length url)))])
29          (unless (fx= 0 sta)
30            (error 'macosx:open-url "OSStatus" sta) ) ) )
Note: See TracBrowser for help on using the repository browser.