/ include / CoreFoundation / GSInvocation.h
GSInvocation.h
 1  /* Interface for NSInvocation concrete classes for GNUStep
 2     Copyright (C) 1998 Free Software Foundation, Inc.
 3  
 4     Written: Adam Fedor <fedor@gnu.org>
 5     Date: Nov 2000
 6     
 7     This file is part of the GNUstep Base Library.
 8  
 9     This library is free software; you can redistribute it and/or
10     modify it under the terms of the GNU Lesser General Public
11     License as published by the Free Software Foundation; either
12     version 2 of the License, or (at your option) any later version.
13     
14     This library is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17     Library General Public License for more details.
18     
19     You should have received a copy of the GNU Lesser General Public
20     License along with this library; if not, write to the Free
21     Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22     Boston, MA 02111 USA.
23     */ 
24  
25  #ifndef __GSInvocation_h_GNUSTEP_BASE_INCLUDE
26  #define __GSInvocation_h_GNUSTEP_BASE_INCLUDE
27  
28  #include <Foundation/NSInvocation.h>
29  
30  @class	NSMutableData;
31  
32  typedef struct	{
33    int		offset;
34    unsigned	size;
35    const char	*type;
36    const char	*qtype;
37    unsigned	align;
38    unsigned	qual;
39    BOOL		isReg;
40  } NSArgumentInfo;
41  
42  
43  @interface GSFFIInvocation : NSInvocation
44  {
45  @public
46    uint8_t	_retbuf[32];	// Store return values of up to 32 bytes here.
47    NSMutableData	*_frame;
48  }
49  @end
50  
51  @interface GSFFCallInvocation : NSInvocation
52  {
53  }
54  @end
55  
56  @interface GSDummyInvocation : NSInvocation
57  {
58  }
59  @end
60  
61  @interface NSInvocation (DistantCoding)
62  - (BOOL) encodeWithDistantCoder: (NSCoder*)coder passPointers: (BOOL)passp;
63  @end
64  
65  @interface NSMethodSignature (GNUstep)
66  - (const char*) methodType;
67  - (NSArgumentInfo*) methodInfo;
68  @end
69  
70  extern void
71  GSFFCallInvokeWithTargetAndImp(NSInvocation *inv, id anObject, IMP imp);
72  
73  extern void
74  GSFFIInvokeWithTargetAndImp(NSInvocation *inv, id anObject, IMP imp);
75  
76  #define CLEAR_RETURN_VALUE_IF_OBJECT \
77  do {\
78    if (_validReturn && *_inf[0].type == _C_ID) \
79      { \
80        RELEASE (*(id*) _retval); \
81        *(id*) _retval = nil; \
82        _validReturn = NO; \
83      }\
84    } while (0)
85  
86  #define RETAIN_RETURN_VALUE do { if (*_inf[0].type == _C_ID) RETAIN (*(id*) _retval);} while (0)
87  
88  #define	_inf	((NSArgumentInfo*)_info)
89  
90  #endif