Author: rfm
Date: Thu May 22 18:55:18 2014
New Revision: 37904

URL: http://svn.gna.org/viewcvs/gnustep?rev=37904&view=rev
Log:
reinstate deleted code (bug #42405)

Added:
    libs/base/trunk/Tests/base/NSInvocation/test02.m
Modified:
    libs/base/trunk/ChangeLog
    libs/base/trunk/Headers/Foundation/NSInvocation.h
    libs/base/trunk/Source/GSInvocation.h
    libs/base/trunk/Source/NSInvocation.m

Modified: libs/base/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=37904&r1=37903&r2=37904&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog   (original)
+++ libs/base/trunk/ChangeLog   Thu May 22 18:55:18 2014
@@ -1,3 +1,11 @@
+2014-05-22  Richard Frith-Macdonald <[email protected]>
+
+       * Source/GSInvocation.h:
+       * Source/NSInvocation.m:
+       * Headers/Foundation/NSInvocation.h:
+       * Tests/base/NSInvocation/test02.m:
+       Reinstate lost code for NS_MESSAGE and NS_INVOCATION macros
+
 2014-05-20  Richard Frith-Macdonald <[email protected]>
 
        * Source/GSHTTPURLHandle.m:

Modified: libs/base/trunk/Headers/Foundation/NSInvocation.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Headers/Foundation/NSInvocation.h?rev=37904&r1=37903&r2=37904&view=diff
==============================================================================
--- libs/base/trunk/Headers/Foundation/NSInvocation.h   (original)
+++ libs/base/trunk/Headers/Foundation/NSInvocation.h   Thu May 22 18:55:18 2014
@@ -121,6 +121,14 @@
 @end
 #endif
 
+/** For use by macros only.
+ */
+@interface NSInvocation (MacroSetup)
+- (id) initWithMethodSignature: (NSMethodSignature*)aSignature;
++ (id) _newProxyForInvocation: (id)target;
++ (id) _newProxyForMessage: (id)target;
++ (NSInvocation*) _returnInvocationAndDestroyProxy: (id)proxy;
+@end
 /**
  *  Creates and returns an autoreleased invocation containing a
  *  message to an instance of the class.  The 'message' consists

Modified: libs/base/trunk/Source/GSInvocation.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSInvocation.h?rev=37904&r1=37903&r2=37904&view=diff
==============================================================================
--- libs/base/trunk/Source/GSInvocation.h       (original)
+++ libs/base/trunk/Source/GSInvocation.h       Thu May 22 18:55:18 2014
@@ -39,10 +39,6 @@
   BOOL         isReg;
 } NSArgumentInfo;
 
-@interface NSInvocation (MacroSetup)
-- (id) initWithMethodSignature: (NSMethodSignature*)aSignature;
-@end
-
 
 @interface GSFFIInvocation : NSInvocation
 {
@@ -77,13 +73,15 @@
 extern void
 GSFFIInvokeWithTargetAndImp(NSInvocation *inv, id anObject, IMP imp);
 
-#define CLEAR_RETURN_VALUE_IF_OBJECT  do { if (_validReturn && *_inf[0].type 
== _C_ID) \
-                                            { \
-                                            RELEASE (*(id*) _retval); \
-                                            *(id*) _retval = nil; \
-                                            _validReturn = NO; \
-                                            }\
-                                        } while (0)
+#define CLEAR_RETURN_VALUE_IF_OBJECT \
+do {\
+  if (_validReturn && *_inf[0].type == _C_ID) \
+    { \
+      RELEASE (*(id*) _retval); \
+      *(id*) _retval = nil; \
+      _validReturn = NO; \
+    }\
+  } while (0)
 
 #define RETAIN_RETURN_VALUE IF_NO_GC(do { if (*_inf[0].type == _C_ID) RETAIN 
(*(id*) _retval);} while (0))                                         
 

Modified: libs/base/trunk/Source/NSInvocation.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSInvocation.m?rev=37904&r1=37903&r2=37904&view=diff
==============================================================================
--- libs/base/trunk/Source/NSInvocation.m       (original)
+++ libs/base/trunk/Source/NSInvocation.m       Thu May 22 18:55:18 2014
@@ -185,6 +185,22 @@
 
 
 
+
+GS_ROOT_CLASS
+@interface GSInvocationProxy
+{
+@public
+  Class                isa;
+  id           target;
+  NSInvocation *invocation;
+}
++ (id) _newWithTarget: (id)t;
+- (NSInvocation*) _invocation;
+- (void) forwardInvocation: (NSInvocation*)anInvocation;
+- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector;
+@end
+@interface GSMessageProxy : GSInvocationProxy
+@end
 
 #define        _inf    ((NSArgumentInfo*)_info)
 
@@ -804,6 +820,23 @@
   return nil;
 }
 
+/**
+ * Internal use.
+ */
++ (id) _newProxyForInvocation: (id)target
+{
+  return (id)[GSInvocationProxy _newWithTarget: target];
+}
++ (id) _newProxyForMessage: (id)target
+{
+  return (id)[GSMessageProxy _newWithTarget: target];
+}
++ (NSInvocation*) _returnInvocationAndDestroyProxy: (id)proxy
+{
+  NSInvocation  *inv = [proxy _invocation];
+  NSDeallocateObject(proxy);
+  return inv;
+}
 @end
 
 @implementation NSInvocation (BackwardCompatibility)
@@ -818,7 +851,6 @@
 #if !defined(USE_FFCALL) && !defined(USE_LIBFFI)
 #warning Using dummy NSInvocation implementation.  It is strongly recommended 
that you use libffi.
 @implementation GSDummyInvocation
-
 
 /*
  *     This is the de_signated initialiser.
@@ -845,3 +877,33 @@
 @end
 #endif
 
+@implementation        GSInvocationProxy
++ (id) _newWithTarget: (id)t
+{
+  GSInvocationProxy    *o;
+  o = (GSInvocationProxy*) NSAllocateObject(self, 0, NSDefaultMallocZone());
+  o->target = RETAIN(t);
+  return o;
+}
+- (NSInvocation*) _invocation
+{
+  return invocation;
+}
+- (void) forwardInvocation: (NSInvocation*)anInvocation
+{
+  invocation = anInvocation;
+}
+- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector
+{
+  return [target methodSignatureForSelector: aSelector];
+}
+@end
+
+@implementation        GSMessageProxy
+- (NSInvocation*) _invocation
+{
+  [invocation setTarget: target];
+  return invocation;
+}
+@end
+

Added: libs/base/trunk/Tests/base/NSInvocation/test02.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Tests/base/NSInvocation/test02.m?rev=37904&view=auto
==============================================================================
--- libs/base/trunk/Tests/base/NSInvocation/test02.m    (added)
+++ libs/base/trunk/Tests/base/NSInvocation/test02.m    Thu May 22 18:55:18 2014
@@ -0,0 +1,34 @@
+#import <Foundation/Foundation.h>
+#import "Testing.h"
+
+static int      called = 0;
+
+@interface NSMessageTest : NSObject
+@end
+
+@implementation NSMessageTest
+
+- (void) methodToCall
+{
+  called++;
+}
+
+@end
+
+
+
+int main(void)
+{
+  NSAutoreleasePool* pool = [NSAutoreleasePool new];
+  NSMessageTest* test = [NSMessageTest new];
+
+  [NS_MESSAGE(test, methodToCall) invoke];
+
+  PASS(called > 0, "NS_MESSAGE worked");
+
+  [pool release];
+  return 0;
+}
+
+
+


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to