/* Don't change the name if it's already NAME. */
if ([[view window] miniwindowTitle]
&& ([[[view window] miniwindowTitle]
- isEqualToString: [NSString stringWithUTF8String:
- SSDATA (arg)]]))
+ isEqualToString: [NSString stringWithLispString:arg]]))
return;
[[view window] setMiniwindowTitle:
- [NSString stringWithUTF8String: SSDATA (arg)]];
+ [NSString stringWithLispString:arg]];
}
static void
return;
if (NILP (name))
- name = build_string ([ns_app_name UTF8String]);
+ name = [ns_app_name lispString];
else
CHECK_STRING (name);
{
encoded_filename = ENCODE_UTF_8 (filename);
- fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)];
+ fstr = [NSString stringWithLispString:encoded_filename];
if (fstr == nil) fstr = @"";
}
else
block_input ();
pool = [[NSAutoreleasePool alloc] init];
if (f->output_data.ns->miniimage
- && [[NSString stringWithUTF8String: SSDATA (f->name)]
+ && [[NSString stringWithLispString:f->name]
isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]])
{
[pool release];
if (SYMBOLP (elt) && EQ (elt, Qt) && SSDATA (f->name)[0] == '/')
{
NSString *str
- = [NSString stringWithUTF8String: SSDATA (f->name)];
+ = [NSString stringWithLispString:f->name];
if ([[NSFileManager defaultManager] fileExistsAtPath: str])
image = [[[NSWorkspace sharedWorkspace] iconForFile: str] retain];
}
image = [EmacsImage allocInitFromFile: XCDR (elt)];
if (image == nil)
image = [[NSImage imageNamed:
- [NSString stringWithUTF8String:
- SSDATA (XCDR (elt))]] retain];
+ [NSString stringWithLispString:XCDR (elt)]] retain];
}
}
image = [EmacsImage allocInitFromFile: arg];
if (image == nil)
- image =[NSImage imageNamed: [NSString stringWithUTF8String:
- SSDATA (arg)]];
+ image =[NSImage imageNamed: [NSString stringWithLispString:arg]];
if (image == nil)
{
static Lisp_Object
ns_appkit_version_str (void)
{
- char tmp[256];
+ NSString *tmp;
#ifdef NS_IMPL_GNUSTEP
- sprintf(tmp, "gnustep-gui-%s", Xstr(GNUSTEP_GUI_VERSION));
+ tmp = [NSString stringWithFormat:@"gnustep-gui-%s", Xstr(GNUSTEP_GUI_VERSION)];
#elif defined (NS_IMPL_COCOA)
- NSString *osversion
- = [[NSProcessInfo processInfo] operatingSystemVersionString];
- sprintf(tmp, "appkit-%.2f %s",
- NSAppKitVersionNumber,
- [osversion UTF8String]);
+ tmp = [NSString stringWithFormat:@"appkit-%.2f %@",
+ NSAppKitVersionNumber,
+ [[NSProcessInfo processInfo] operatingSystemVersionString]];
#else
- tmp = "ns-unknown";
+ tmp = [NSString initWithUTF8String:@"ns-unknown"];
#endif
- return build_string (tmp);
+ return [tmp lispString];
}
be set. */
if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name))
{
- fset_name (f, build_string ([ns_app_name UTF8String]));
+ fset_name (f, [ns_app_name lispString]);
f->explicit_name = 0;
}
else
Lisp_Object fname = Qnil;
NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
- [NSString stringWithUTF8String: SSDATA (prompt)];
+ [NSString stringWithLispString:prompt];
NSString *dirS = NILP (dir) || !STRINGP (dir) ?
- [NSString stringWithUTF8String: SSDATA (BVAR (current_buffer, directory))] :
- [NSString stringWithUTF8String: SSDATA (dir)];
+ [NSString stringWithLispString:BVAR (current_buffer, directory)] :
+ [NSString stringWithLispString:dir];
NSString *initS = NILP (init) || !STRINGP (init) ? nil :
- [NSString stringWithUTF8String: SSDATA (init)];
+ [NSString stringWithLispString:init];
NSEvent *nxev;
check_window_system (NULL);
{
NSString *str = ns_filename_from_panel (panel);
if (! str) str = ns_directory_from_panel (panel);
- if (str) fname = build_string ([str UTF8String]);
+ if (str) fname = [str lispString];
}
[[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
check_window_system (NULL);
if (NILP (owner))
- owner = build_string([ns_app_name UTF8String]);
+ owner = [ns_app_name lispString];
CHECK_STRING (name);
value = ns_get_defaults_value (SSDATA (name));
{
check_window_system (NULL);
if (NILP (owner))
- owner = build_string ([ns_app_name UTF8String]);
+ owner = [ns_app_name lispString];
CHECK_STRING (name);
if (NILP (value))
{
[[NSUserDefaults standardUserDefaults] removeObjectForKey:
- [NSString stringWithUTF8String: SSDATA (name)]];
+ [NSString stringWithLispString:name]];
}
else
{
CHECK_STRING (value);
[[NSUserDefaults standardUserDefaults] setObject:
- [NSString stringWithUTF8String: SSDATA (value)]
- forKey: [NSString stringWithUTF8String:
- SSDATA (name)]];
+ [NSString stringWithLispString:value]
+ forKey: [NSString stringWithLispString:name]];
}
return Qnil;
NSEnumerator *cnames = [[clist allKeys] reverseObjectEnumerator];
NSString *cname;
while ((cname = [cnames nextObject]))
- list = Fcons (build_string ([cname UTF8String]), list);
+ list = Fcons ([cname lispString], list);
/* for (i = [[clist allKeys] count] - 1; i >= 0; i--)
list = Fcons (build_string ([[[clist allKeys] objectAtIndex: i]
UTF8String]), list); */
{
id pb;
NSString *svcName;
- char *utfStr;
CHECK_STRING (service);
check_window_system (NULL);
- utfStr = SSDATA (service);
- svcName = [NSString stringWithUTF8String: utfStr];
+ svcName = [NSString stringWithLispString:service];
pb =[NSPasteboard pasteboardWithUniqueName];
ns_string_to_pasteboard (pb, send);
NSAppleScript *scriptObject =
[[NSAppleScript alloc] initWithSource:
- [NSString stringWithUTF8String: SSDATA (script)]];
+ [NSString stringWithLispString:script]];
returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
[scriptObject release];
{
desc = [returnDescriptor coerceToDescriptorType: typeUTF8Text];
if (desc)
- *result = build_string([[desc stringValue] UTF8String]);
+ *result = [[desc stringValue] lispString];
}
else
{
*d++ = c;
else if (c <= 0x10ffff)
{
- *d++ = 0xd800 + (c & 0x3ff);
- *d++ = 0xdc00 + ((c - 0x10000) >> 10);
+ *d++ = 0xd800 + ((c - 0x10000) >> 10);
+ *d++ = 0xdc00 + (c & 0x3ff);
}
else
*d++ = 0xfffd; /* Not valid for UTF-16. */
xfree (chars);
return str;
}
+
+/* Make a Lisp string from an NSString. */
+- (Lisp_Object)lispString
+{
+ return build_string ([self UTF8String]);
+}
@end
/* ==========================================================================
emacs_event->kind = NS_NONKEY_EVENT;
emacs_event->code = KEY_NS_OPEN_FILE_LINE;
- ns_input_file = append2 (ns_input_file, build_string ([fileName UTF8String]));
+ ns_input_file = append2 (ns_input_file, [fileName lispString]);
ns_input_line = Qnil; /* can be start or cons start,end */
emacs_event->modifiers =0;
EV_TRAILER (theEvent);
error: (NSString **)error
{
[ns_pending_service_names addObject: userData];
- [ns_pending_service_args addObject: [NSString stringWithUTF8String:
- SSDATA (ns_string_from_pasteboard (pboard))]];
+ [ns_pending_service_args addObject: [NSString stringWithLispString:ns_string_from_pasteboard (pboard)]];
}
emacs_event->kind = NS_NONKEY_EVENT;
emacs_event->code = KEY_NS_SPI_SERVICE_CALL;
- ns_input_spi_name = build_string ([name UTF8String]);
- ns_input_spi_arg = build_string ([arg UTF8String]);
+ ns_input_spi_name = [name lispString];
+ ns_input_spi_arg = [arg lispString];
emacs_event->modifiers = EV_MODIFIERS (theEvent);
EV_TRAILER (theEvent);
size = [newFont pointSize];
ns_input_fontsize = make_fixnum (lrint (size));
- ns_input_font = build_string ([[newFont familyName] UTF8String]);
+ ns_input_font = [[newFont familyName] lispString];
EV_TRAILER (e);
}
}
processingCompose = YES;
[workingText release];
workingText = [str copy];
- ns_working_text = build_string ([workingText UTF8String]);
+ ns_working_text = [workingText lispString];
emacs_event->kind = NS_TEXT_EVENT;
emacs_event->code = KEY_NS_PUT_WORKING_TEXT;
tem = f->icon_name;
if (!NILP (tem))
[win setMiniwindowTitle:
- [NSString stringWithUTF8String: SSDATA (tem)]];
+ [NSString stringWithLispString:tem]];
if (FRAME_PARENT_FRAME (f) != NULL)
{
fenum = [files objectEnumerator];
while ( (file = [fenum nextObject]) )
- strings = Fcons (build_string ([file UTF8String]), strings);
+ strings = Fcons ([file lispString], strings);
}
else if ([type isEqualToString: NSURLPboardType])
{
type_sym = Qurl;
- strings = list1 (build_string ([[url absoluteString] UTF8String]));
+ strings = list1 ([[url absoluteString] lispString]);
}
else if ([type isEqualToString: NSStringPboardType]
|| [type isEqualToString: NSTabularTextPboardType])
type_sym = Qnil;
- strings = list1 (build_string ([data UTF8String]));
+ strings = list1 ([data lispString]);
}
else
{
}
if (STRINGP (str))
{
- const char *utfStr = SSDATA (str);
- NSString *nsStr = [NSString stringWithUTF8String: utfStr];
- return nsStr;
+ return [NSString stringWithLispString:str];
}
}