objc: migrate remaining ns_string call sites to xx NSString

NSLog's fmt, addObserver's name, UIApplicationMain's principal-class, CADisplayLink's run-loop mode, and metal's newLibraryWithSource/newFunctionWithName string args are retyped *NSString, so their call sites read xx "..." instead of ns_string("...".ptr). ns_string is now used only by impl Into(*NSString) for string.
This commit is contained in:
agra
2026-05-30 17:54:23 +03:00
parent 8e3c3ae981
commit a29ede0383
3 changed files with 18 additions and 20 deletions

View File

@@ -387,29 +387,28 @@ metal_create_shader_ios :: (self: *MetalGPU, src: string) -> u32 {
msg_o : (*void, *void) -> *void callconv(.c) = xx objc_msgSend;
msg_oo : (*void, *void, *void) -> void callconv(.c) = xx objc_msgSend;
msg_oo_r : (*void, *void, *void) -> *void callconv(.c) = xx objc_msgSend;
msg_oo_r : (*void, *void, *NSString) -> *void callconv(.c) = xx objc_msgSend;
msg_ou : (*void, *void, u64) -> void callconv(.c) = xx objc_msgSend;
msg_ouret: (*void, *void, u64) -> *void callconv(.c) = xx objc_msgSend;
msg_ob : (*void, *void, u8) -> void callconv(.c) = xx objc_msgSend;
// [device newLibraryWithSource:src options:nil error:&err]
msg_lib : (*void, *void, *void, *void, **void) -> *void callconv(.c) = xx objc_msgSend;
src_ns := ns_string(src.ptr);
msg_lib : (*void, *void, *NSString, *void, **void) -> *void callconv(.c) = xx objc_msgSend;
err : *void = null;
library := msg_lib(self.device,
sel_registerName("newLibraryWithSource:options:error:".ptr),
src_ns, xx 0, @err);
xx src, xx 0, @err);
if library == null {
NSLog(ns_string("[metal] MSL compile failed\n".ptr));
NSLog(xx "[metal] MSL compile failed\n");
return 0;
}
vfn := msg_oo_r(library, sel_registerName("newFunctionWithName:".ptr),
ns_string("vmain".ptr));
xx "vmain");
ffn := msg_oo_r(library, sel_registerName("newFunctionWithName:".ptr),
ns_string("fmain".ptr));
if vfn == null { NSLog(ns_string("[metal] missing vmain in MSL\n".ptr)); return 0; }
if ffn == null { NSLog(ns_string("[metal] missing fmain in MSL\n".ptr)); return 0; }
xx "fmain");
if vfn == null { NSLog(xx "[metal] missing vmain in MSL\n"); return 0; }
if ffn == null { NSLog(xx "[metal] missing fmain in MSL\n"); return 0; }
MTLRenderPipelineDescriptor := objc_getClass("MTLRenderPipelineDescriptor".ptr);
desc := msg_o(MTLRenderPipelineDescriptor, sel_registerName("alloc".ptr));
@@ -434,7 +433,7 @@ metal_create_shader_ios :: (self: *MetalGPU, src: string) -> u32 {
sel_registerName("newRenderPipelineStateWithDescriptor:error:".ptr),
desc, @err2);
if state == null {
NSLog(ns_string("[metal] pipeline state creation failed\n".ptr));
NSLog(xx "[metal] pipeline state creation failed\n");
return 0;
}

View File

@@ -15,7 +15,7 @@
#import "modules/platform/types.sx";
#import "modules/platform/api.sx";
UIApplicationMain :: (argc: s32, argv: *void, principal_class: *void, delegate_class: *void) -> s32 #foreign;
UIApplicationMain :: (argc: s32, argv: *void, principal_class: *NSString, delegate_class: *void) -> s32 #foreign;
dlsym :: (handle: *void, name: [*]u8) -> *void #foreign;
chdir :: (path: [*]u8) -> s32 #foreign;
@@ -105,7 +105,7 @@ NSBundle :: #foreign #objc_class("NSBundle") {
NSNotificationCenter :: #foreign #objc_class("NSNotificationCenter") {
#extends NSObject;
defaultCenter :: () -> *NSNotificationCenter;
addObserver_selector_name_object :: (self: *Self, observer: *void, sel: *void, name: *void, obj: *void);
addObserver_selector_name_object :: (self: *Self, observer: *void, sel: *void, name: *NSString, obj: *void);
}
// ── RunLoop + display timing (Phase 3.2 C3) ────────────────────────────
@@ -118,7 +118,7 @@ NSRunLoop :: #foreign #objc_class("NSRunLoop") {
CADisplayLink :: #foreign #objc_class("CADisplayLink") {
#extends NSObject;
displayLinkWithTarget_selector :: (target: *void, sel: *void) -> *CADisplayLink;
addToRunLoop_forMode :: (self: *Self, runloop: *NSRunLoop, mode: *void);
addToRunLoop_forMode :: (self: *Self, runloop: *NSRunLoop, mode: *NSString);
targetTimestamp :: (self: *Self) -> f64;
duration :: (self: *Self) -> f64;
}
@@ -212,7 +212,7 @@ SxAppDelegate :: #objc_class("SxAppDelegate") {
center.addObserver_selector_name_object(
xx self,
sel_registerName("sxKeyboardWillChangeFrame:".ptr),
ns_string("UIKeyboardWillChangeFrameNotification".ptr),
xx "UIKeyboardWillChangeFrameNotification",
null);
}
}
@@ -364,7 +364,7 @@ impl Platform for UIKitPlatform {
self.has_frame_closure = true;
g_uikit_plat = self;
inline if OS == .ios {
UIApplicationMain(0, xx 0, xx 0, ns_string("SxAppDelegate".ptr));
UIApplicationMain(0, xx 0, xx "SxAppDelegate", xx 0);
}
}
@@ -513,7 +513,7 @@ impl Platform for UIKitPlatform {
status := glCheckFramebufferStatus(GL_FRAMEBUFFER);
if status != GL_FRAMEBUFFER_COMPLETE {
NSLog(ns_string("[sx] framebuffer incomplete after renderbuffer setup\n".ptr));
NSLog(xx "[sx] framebuffer incomplete after renderbuffer setup\n");
}
}
@@ -698,10 +698,9 @@ impl Platform for UIKitPlatform {
link := CADisplayLink.displayLinkWithTarget_selector(gl_view, sel_tick);
self.display_link = link;
runloop := NSRunLoop.currentRunLoop();
mode_ns := ns_string("kCFRunLoopDefaultMode".ptr);
link.addToRunLoop_forMode(runloop, mode_ns);
link.addToRunLoop_forMode(runloop, xx "kCFRunLoopDefaultMode");
NSLog(ns_string("[sx] UIKitPlatform booted\n".ptr));
NSLog(xx "[sx] UIKitPlatform booted\n");
}
// CADisplayLink callback (vsync-paced). Drives keyboard-inset

View File

@@ -72,7 +72,7 @@ objc_registerClassPair :: (cls: *void) ->
// Foundation C-API helpers (Foundation is already linked above via #framework).
// NSLog takes an NSString format; the variadic tail is not exposed here.
NSLog :: (fmt: *void) #foreign;
NSLog :: (fmt: *NSString) #foreign;
// ─── Convenience helpers ────────────────────────────────────────────────
// These hide the typed-fn-pointer cast for the most common shapes. They