1/*
2 * This module is used in the unittests for object identity.
3 */
4#include "Python.h"
5#include "pyobjc-api.h"
6
7#import <Foundation/Foundation.h>
8
9@interface ClassWithVariables : NSObject
10{
11	int	intValue;
12	double	floatValue;
13	char	charValue;
14	char*	strValue;
15	NSRect  rectValue;
16	NSObject* nilValue;
17	PyObject* pyValue;
18	NSString* objValue;
19}
20-init;
21-(void)dealloc;
22@end
23
24@implementation ClassWithVariables
25-init
26{
27	self = [super init];
28	if (self == nil) return nil;
29
30	intValue = 42;
31	floatValue = -10.055;
32	charValue = 'a';
33	strValue = "hello world";
34	rectValue = NSMakeRect(1,2,3,4);
35	nilValue = nil;
36	pyValue = PySlice_New(
37			PyInt_FromLong(1),
38			PyInt_FromLong(10),
39			PyInt_FromLong(4));
40	objValue = [[NSObject alloc] init];
41	return self;
42}
43
44-(void)dealloc
45{
46	Py_XDECREF(pyValue);
47	[objValue release];
48	[nilValue release];
49	[super dealloc];
50}
51
52@end
53
54
55static PyMethodDef ivar_methods[] = {
56	{ 0, 0, 0, 0 }
57};
58
59void initinstanceVariables(void);
60void initinstanceVariables(void)
61{
62	PyObject* m;
63
64	m = Py_InitModule4("instanceVariables", ivar_methods,
65			NULL, NULL, PYTHON_API_VERSION);
66
67	PyObjC_ImportAPI(m);
68	PyModule_AddObject(m, "ClassWithVariables",
69		PyObjCClass_New([ClassWithVariables class]));
70}
71