1#include <Python.h> 2#include "pyobjc-api.h" 3 4#import <Foundation/Foundation.h> 5 6typedef struct s { int i; char b; } struct_s; 7@interface OCPropertyDefinitions : NSObject { 8 int _prop1; 9 float _prop2; 10 struct_s _prop3; 11 id _prop4; 12 id _prop5; 13 id _prop6; 14 id _prop7; 15 id _prop8; 16 id _prop9; 17 struct_s _prop10; 18 id _prop11; 19 id _prop12; 20} 21 22#if (PyObjC_BUILD_RELEASE >= 1005) 23 24#pragma message "Ignore warnings about properties in this file." 25@property int prop1; 26@property float prop2; 27@property struct_s prop3; 28@property id prop4; 29@property(readonly) id prop5; 30@property(readwrite) id prop6; 31@property(assign) id prop7; 32@property(retain) id prop8; 33@property(copy) id prop9; 34@property(nonatomic) struct_s prop10; 35@property(getter=propGetter,setter=propSetter:) id prop11; 36@property(nonatomic,readwrite,retain) id prop12; 37@property(readwrite,copy) id prop13; 38 39#endif 40 41@end 42 43@implementation OCPropertyDefinitions 44 45#if (PyObjC_BUILD_RELEASE >= 1005 ) 46 47@synthesize prop1 = _prop1; 48@synthesize prop2 = _prop2; 49@synthesize prop3 = _prop3; 50@synthesize prop4 = _prop4; 51@synthesize prop5 = _prop5; 52@synthesize prop6 = _prop6; 53@synthesize prop7 = _prop7; 54@synthesize prop8 = _prop8; 55@synthesize prop9 = _prop9; 56@synthesize prop10 = _prop10; 57@synthesize prop11 = _prop11; 58@synthesize prop12 = _prop12; 59@dynamic prop13; 60 61#endif 62 63@end 64 65 66static PyMethodDef mod_methods[] = { 67 { 0, 0, 0, 0 } 68}; 69 70#if PY_VERSION_HEX >= 0x03000000 71 72static struct PyModuleDef mod_module = { 73 PyModuleDef_HEAD_INIT, 74 "properties", 75 NULL, 76 0, 77 mod_methods, 78 NULL, 79 NULL, 80 NULL, 81 NULL 82}; 83 84#define INITERROR() return NULL 85#define INITDONE() return m 86 87PyObject* PyInit_properties(void); 88 89PyObject* 90PyInit_properties(void) 91 92#else 93 94#define INITERROR() return 95#define INITDONE() return 96 97void initproperties(void); 98 99void 100initproperties(void) 101#endif 102{ 103 PyObject* m; 104 105#if PY_VERSION_HEX >= 0x03000000 106 m = PyModule_Create(&mod_module); 107#else 108 m = Py_InitModule4("properties", mod_methods, 109 NULL, NULL, PYTHON_API_VERSION); 110#endif 111 if (!m) { 112 INITERROR(); 113 } 114 115 if (PyObjC_ImportAPI(m) < 0) { 116 INITERROR(); 117 } 118 119 if (PyModule_AddObject(m, "OCPropertyDefinitions", 120 PyObjCClass_New([OCPropertyDefinitions class])) < 0) { 121 INITERROR(); 122 } 123 124 INITDONE(); 125} 126