]> err.no Git - sope/blob - sope-core/NGExtensions/FdExt.subproj/NSMethodSignature+misc.m
fixed a bug in plist comment parsing
[sope] / sope-core / NGExtensions / FdExt.subproj / NSMethodSignature+misc.m
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #import "common.h"
23 #import "NSMethodSignature+misc.h"
24
25 @implementation NSMethodSignature(misc)
26
27 #if NeXT_Foundation_LIBRARY
28 - (NSString *)objCTypes {
29   return [NSString stringWithCString:self->_types];
30 }
31 #else
32 - (NSString *)objCTypes {
33   char buf[256], *bufPos = buf;
34   int  argCount = [self numberOfArguments];
35   char *pos1    = NULL, *pos2 = NULL;
36   
37   // return type
38 #if GNUSTEP_BASE_LIBRARY
39   pos1 = (char *)[self methodType];
40 #else
41   pos1 = (char *)[self types];
42 #endif
43   pos2 = (char *)objc_skip_typespec(pos1);
44   strncpy(bufPos, pos1, pos2 - pos1);
45   bufPos += pos2 - pos1;
46   //*bufPos = '\0';
47   pos1 = (char *)objc_skip_offset(pos2);
48
49   // arguments
50   {
51     register int i;
52
53     for (i = 0; i < argCount; i++) {
54       pos2 = (char *)objc_skip_typespec(pos1); // forward to offset
55       strncpy(bufPos, pos1, pos2 - pos1);
56       bufPos += pos2 - pos1;
57       //*bufPos = '\0';
58       pos1 = (char *)objc_skip_offset(pos2);   // forward to next type
59     }
60   }
61   *bufPos = '\0';
62
63   return [NSString stringWithCString:buf];
64 }
65 #endif
66
67 @end /* NSMethodSignature(misc) */
68
69 void __link_NSMethodSignature_misc() {
70   __link_NSMethodSignature_misc();
71 }