4
Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
7
Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
8
Mircea Oancea <mircea@jupiter.elcom.pub.ro>
10
This file is part of libFoundation.
12
Permission to use, copy, modify, and distribute this software and its
13
documentation for any purpose and without fee is hereby granted, provided
14
that the above copyright notice appear in all copies and that both that
15
copyright notice and this permission notice appear in supporting
18
We disclaim all warranties with regard to this software, including all
19
implied warranties of merchantability and fitness, in no event shall
20
we be liable for any special, indirect or consequential damages or any
21
damages whatsoever resulting from loss of use, data or profits, whether in
22
an action of contract, negligence or other tortious action, arising out of
23
or in connection with the use or performance of this software.
26
#include <Foundation/common.h>
27
#include <Foundation/NSString.h>
28
#include <Foundation/NSObjCRuntime.h>
29
#include <Foundation/NSUtilities.h>
31
#include <extensions/objc-runtime.h>
34
* Objective-C runtime info
37
LF_DECLARE Class NSClassFromString(NSString *aClassName)
39
unsigned len = [aClassName cStringLength];
42
if (len == 0) return NULL;
43
buf = malloc(len + 1);
44
[aClassName getCString:buf]; buf[len] = '\0';
45
clazz = objc_lookup_class(buf);
50
LF_DECLARE SEL NSSelectorFromString(NSString *aSelectorName)
52
unsigned len = [aSelectorName cStringLength];
55
if (len == 0) return NULL;
56
buf = malloc(len + 1);
57
[aSelectorName getCString:buf]; buf[len] = '\0';
58
sel = sel_get_any_uid(buf);
63
LF_DECLARE NSString *NSStringFromClass(Class aClass)
66
[NSString stringWithCStringNoCopy:(char*)class_get_class_name(aClass)
67
freeWhenDone:NO] : nil;
70
LF_DECLARE NSString *NSStringFromSelector(SEL aSelector)
73
return [NSString stringWithCStringNoCopy:(char*)sel_get_name(aSelector)
77
NSLog(@"WARNING: called %s with NULL-selector !", __PRETTY_FUNCTION__);