Commits

Ronald Oussoren  committed 7ae09f1

Switch pyobjc-framework-Cocoa to new metadata system, and fix some bugs

  • Participants
  • Parent commits 94399a9

Comments (0)

Files changed (40)

File pyobjc-core/Lib/PyObjCTools/_BSCompiler.py

         if value is None and value64 is not None:
             value = value64
 
+
         if value is None:
             le_value = int(node.get("le_value"))
             be_value = int(node.get("be_value"))
             fp.write("$")
 
         else:
+            if '.' in value:
+                value = float(value)
+            else:
+                value = int(value)
+
+            if '.' in value64:
+                value64 = float(value64)
+            else:
+                value64 = int(value64)
+
+
             others[name] = sel32or64(value, value64)
 
     fp.write("'''\n")
             value = value.encode('ascii')
         items[nm] = value
 
-    print >>fp, "string_constants = %s"%(items)
+    print >>fp, "misc.update(%s)"%(items)
 
 def emit_functions(fp, tree):
     items = {}
             if node.get('c_array_delimited_by_null', 'false') == 'true':
                 meta['c_array_delimited_by_null'] = True
 
-            if node.get('c_array_delimited_by_null') is not None:
+            if node.get('c_array_length_in_arg') is not None:
                 meta['c_array_length_in_arg'] =  \
                         int(node.get('c_array_length_in_arg'))
 
                 continue
             sel = bstr(method.get('selector'))
             meta = {}
+            if method.get('variadic', 'false') == 'true':
+                meta['variadic'] = 'true'
+                if method.get('c_array_delimited_by_null', 'false') == 'true':
+                    meta['c_array_delimited_by_null'] = True
+
+                if method.get('c_array_length_in_arg') is not None:
+                    meta['c_array_length_in_arg'] =  \
+                            int(node.get('c_array_length_in_arg'))
             for info in method:
                 if info.tag == 'retval':
                     n = meta['retval'] = {}

File pyobjc-core/Lib/objc/_lazyimport.py

 
         self.__load_cftypes(metadict.get('cftypes'))
 
+        if metadict.get('protocols') is not None:
+            self.__dict__['protocols'] = module('%s.protocols'%(name,))
+            self.__dict__['protocols'].__dict__.update(
+                    metadict['protocols'])
+
+            for p in objc.protocolsForProcess():
+                                setattr(self.__dict__['protocols'], p.__name__, p)
+
+
     def __dir__(self):
         return self.__all__
 

File pyobjc-core/Modules/objc/bundle-variables.m

 	}
 	function_list = PyCapsule_GetPointer(pyFunctionsList, "objc.__inline__");
 	if (function_list == NULL) {
-		PyErr_SetString(PyExc_ValueError, "no function list\n");
+		PyErr_SetString(PyExc_ValueError, "no function list");
 		return NULL;
 	}
 

File pyobjc-core/Modules/objc/test/metadatafunction.m

 #if PY_VERSION_MAJOR == 2 && PY_VERSION_MINOR < 7
 	v = PyCObject_FromVoidPtr(gFunctionMap, NULL);
 #else
-	v = PyCapsule_New(gFunctionMap, "objc.__functionlist__", NULL);
+	v = PyCapsule_New(gFunctionMap, "objc.__inline__", NULL);
 #endif
 	if (v == NULL) {
 		INITERROR();

File pyobjc-core/libffi-src/x86/x86-ffi64.c

 							break;
 						   }
 
+						case FFI_TYPE_UINT8:
+						   {
+							u_int8_t shortval = *(u_int8_t*)a;
+							u_int64_t  actval = (u_int64_t)shortval;
+							memcpy (&reg_args->gpr[gprcount], &actval, 8);
+							break;
+						   }
+
+						case FFI_TYPE_UINT16:
+						   {
+							u_int16_t shortval = *(u_int16_t*)a;
+							u_int64_t  actval = (u_int64_t)shortval;
+							memcpy (&reg_args->gpr[gprcount], &actval, 8);
+							break;
+						   }
+
+						case FFI_TYPE_UINT32:
+						   {
+							u_int32_t shortval = *(u_int32_t*)a;
+							u_int64_t  actval = (u_int64_t)shortval;
+							memcpy (&reg_args->gpr[gprcount], &actval, 8);
+							break;
+						   }
+
 						default:
 							memcpy (&reg_args->gpr[gprcount], a, size < 8 ? size : 8);
 						}