From 1587aeb142a5e318d18ff7dfa44ef19fa1c9d8fb Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Mon, 23 Nov 2026 07:53:20 -0500 Subject: [PATCH 1/3] Redo the NSObjectScripting header as a category as it's supposed to be --- Documentation/ReleaseNotes.gsdoc | 6 +++ Headers/Foundation/NSObjectScripting.h | 35 +++++++++++++++-- Source/NSObjectScripting.m | 35 ++++++++++++++++- Tests/base/NSObject/scripting.m | 52 ++++++++++++++++++++++++++ Tools/classes.m | 1 - 5 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 Tests/base/NSObject/scripting.m diff --git a/Documentation/ReleaseNotes.gsdoc b/Documentation/ReleaseNotes.gsdoc index 1b5ad37c33..54d428ccc0 100644 --- a/Documentation/ReleaseNotes.gsdoc +++ b/Documentation/ReleaseNotes.gsdoc @@ -30,6 +30,12 @@ notice and this notice are preserved.
Version 1.32.0

+ NSObjectScripting: + Replaced the erroneous empty NSObjectScripting class with Cocoa's + NSScripting category on NSObject and its method declarations. + The methods remain unimplemented and raise exceptions unless + overridden. Code using the former placeholder class must use + NSObject instead and be rebuilt.

diff --git a/Headers/Foundation/NSObjectScripting.h b/Headers/Foundation/NSObjectScripting.h index 50f1271331..e533821f47 100644 --- a/Headers/Foundation/NSObjectScripting.h +++ b/Headers/Foundation/NSObjectScripting.h @@ -1,4 +1,4 @@ -/**Definition of class NSObjectScripting +/** Scripting additions to NSObject Copyright (C) 2019 Free Software Foundation, Inc. By: Gregory John Casamento @@ -32,8 +32,37 @@ extern "C" { #endif -GS_EXPORT_CLASS -@interface NSObjectScripting : NSObject +@class NSDictionary, NSScriptObjectSpecifier, NSString; + +/** + * Cocoa scripting hooks for scriptable objects. These methods are currently + * unimplemented in GNUstep and raise an exception unless overridden. + */ +@interface NSObject (NSScripting) + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST) +/** Returns the receiver's scriptable properties. */ +- (NSDictionary *) scriptingProperties; + +/** Sets the supplied scriptable properties of the receiver. */ +- (void) setScriptingProperties: (NSDictionary *)properties; +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST) +/** Evaluates an object specifier in the receiving container. */ +- (id) scriptingValueForSpecifier: (NSScriptObjectSpecifier *)objectSpecifier; + +/** Copies a scripting value and sets the supplied properties on the copies. */ +- (id) copyScriptingValue: (id)value + forKey: (NSString *)key + withProperties: (NSDictionary *)properties; + +/** Creates a scriptable object with the supplied contents and properties. */ +- (id) newScriptingObjectOfClass: (Class)objectClass + forValueForKey: (NSString *)key + withContentsValue: (id)contentsValue + properties: (NSDictionary *)properties; +#endif @end diff --git a/Source/NSObjectScripting.m b/Source/NSObjectScripting.m index e94559c00d..1b45cd7642 100644 --- a/Source/NSObjectScripting.m +++ b/Source/NSObjectScripting.m @@ -1,4 +1,4 @@ -/* Implementation of class NSObjectScripting +/* Implementation of NSObject scripting additions Copyright (C) 2019 Free Software Foundation, Inc. By: heron @@ -22,8 +22,39 @@ */ #import "Foundation/NSObjectScripting.h" +#import "GNUstepBase/NSObject+GNUstepBase.h" -@implementation NSObjectScripting +@implementation NSObject (NSScripting) + +- (NSDictionary *) scriptingProperties +{ + return [self notImplemented: _cmd]; +} + +- (void) setScriptingProperties: (NSDictionary *)properties +{ + [self notImplemented: _cmd]; +} + +- (id) scriptingValueForSpecifier: (NSScriptObjectSpecifier *)objectSpecifier +{ + return [self notImplemented: _cmd]; +} + +- (id) copyScriptingValue: (id)value + forKey: (NSString *)key + withProperties: (NSDictionary *)properties +{ + return [self notImplemented: _cmd]; +} + +- (id) newScriptingObjectOfClass: (Class)objectClass + forValueForKey: (NSString *)key + withContentsValue: (id)contentsValue + properties: (NSDictionary *)properties +{ + return [self notImplemented: _cmd]; +} @end diff --git a/Tests/base/NSObject/scripting.m b/Tests/base/NSObject/scripting.m new file mode 100644 index 0000000000..9ab7d29914 --- /dev/null +++ b/Tests/base/NSObject/scripting.m @@ -0,0 +1,52 @@ +#import +#import +#import +#import +#import "Testing.h" + +@interface ScriptingObject : NSObject + +@end + +@implementation ScriptingObject + +@end + +int +main (void) +{ + ENTER_POOL + ScriptingObject *object = AUTORELEASE([[ScriptingObject alloc] init]); + + PASS(NSClassFromString(@"NSObjectScripting") == Nil, + "NSObjectScripting is not a standalone class"); + PASS([object respondsToSelector: @selector(scriptingProperties)] + && [object respondsToSelector: @selector(setScriptingProperties:)] + && [object respondsToSelector: @selector(scriptingValueForSpecifier:)] + && [object respondsToSelector: + @selector(copyScriptingValue:forKey:withProperties:)] + && [object respondsToSelector: + @selector(newScriptingObjectOfClass:forValueForKey:withContentsValue:properties:)], + "NSObject subclasses inherit Cocoa's scripting category methods"); + +#ifdef GNUSTEP + PASS_EXCEPTION([object scriptingProperties], NSInvalidArgumentException, + "unimplemented scriptingProperties raises an exception"); + PASS_EXCEPTION([object setScriptingProperties: nil], NSInvalidArgumentException, + "unimplemented setScriptingProperties: raises an exception"); + PASS_EXCEPTION([object scriptingValueForSpecifier: nil], + NSInvalidArgumentException, + "unimplemented specifier evaluation raises an exception"); + PASS_EXCEPTION([object copyScriptingValue: nil forKey: @"items" + withProperties: nil], NSInvalidArgumentException, + "unimplemented scripting copy raises an exception"); + PASS_EXCEPTION([object newScriptingObjectOfClass: [NSObject class] + forValueForKey: @"items" withContentsValue: nil properties: nil], + NSInvalidArgumentException, + "unimplemented scripting creation raises an exception"); +#endif + + LEAVE_POOL + return 0; +} + diff --git a/Tools/classes.m b/Tools/classes.m index 1481d327f2..f69fcc0c6a 100644 --- a/Tools/classes.m +++ b/Tools/classes.m @@ -135,7 +135,6 @@ "NSNumber", "NSNumberFormatter", "NSObject", - "NSObjectScripting", "NSOperation", "NSOperationQueue", "NSOrderedSet", From 1878c6e81ab3c7e2fd4afc5c4bde970f8f6d03e7 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Mon, 23 Nov 2026 08:16:49 -0500 Subject: [PATCH 2/3] Update ChangeLog --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 923f1a0129..f073a731bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2026-11-22 Gregory John Casamento + + * Source/NSObjectScripting.m: Provide dummy implementations of the + methods. + * Headers/AppKit/NSObjectScripting.h: Properly declare the category + on NSObject. + 2026-11-19 Richard Frith-Macdonald * Source/GSTLS.m: From 4e85ff8e6edc4a82cfbf591b6ef09cb855230419 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Mon, 23 Nov 2026 08:18:43 -0500 Subject: [PATCH 3/3] Replace AppKit with Foundation in description --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f073a731bd..ed6f9c4881 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ * Source/NSObjectScripting.m: Provide dummy implementations of the methods. - * Headers/AppKit/NSObjectScripting.h: Properly declare the category + * Headers/Foundation/NSObjectScripting.h: Properly declare the category on NSObject. 2026-11-19 Richard Frith-Macdonald