Ronald Oussoren avatar Ronald Oussoren committed 024fb58

Forgot to check-in some changes a while ago

Comments (0)

Files changed (2)

objective/metadata/compile.py

 
     def __cmp__(self, other):
         if not isinstance(other, ustr):
-            raise TypeError
+            raise TypeError((self, other))
 
         return cmp(self._value, other._value)
 
     metadata['retval'] = cleanup_type(dict(metadata['retval']))
 
     d = {}
-    if isinstance(metadata['args'], dict):
-        metadata['args'] = [ metadata['args'][x] for x in range(len(metadata['args'])) ]
-    for k, val in enumerate(metadata['args']):
-        d[k] = cleanup_type(dict(val))
+    if 'args' in metadata:
+        if isinstance(metadata['args'], dict):
+            metadata['args'] = [ metadata['args'][x] for x in range(len(metadata['args'])) ]
+        for k, val in enumerate(metadata['args']):
+            d[k] = cleanup_type(dict(val))
 
-    metadata['arguments'] = d
-    del metadata['args']
+        metadata['arguments'] = d
+        del metadata['args']
 
     return metadata
 
                 if excinfo[name].get('ignore', False): continue
 
 
+            print name
             typestr, metadata = calc_func_proto(excinfo.get(name, {}), value, info['arch'])
             value = { 'typestr': typestr, 'metadata': metadata, 'arch': info['arch'] }
 
             functions[name] = [value]
 
     result = {}
-    for name, value in functions.items():
-        info = merge_defs(value, 'typestr')
+    for idx, (name, value) in enumerate(sorted(functions.items())):
+        try:
+            info = merge_defs(value, 'typestr')
+        except:
+            print "[%d/%d] %s"%(idx+1, len(functions), name)
+            raise
         if value[0]['metadata']:
             result[name] = (info['typestr'], '', value[0]['metadata'])
         else:
 
     result = {}
     for name, values in sorted(aliases.items()):
+        print name
         alias = merge_defs(values, 'alias')['alias']
 
         result[name] = alias
 
     # Finally add definitions that were manually added to  the exceptions file
     for name in excinfo:
+        if excinfo[name].get('ignore', False): continue
         if name not in result and 'type_override' in excinfo[name]:
             result[name] = [{'typestr':excinfo[name]['type_override'], 'arch': None }]
         if name not in result and 'typestr' in excinfo[name]:
         try:
             result[name] = merge_defs(result[name], 'value')
         except MergeNeededException:
+            print name
 
             if name.endswith('Count'):
                 # A number of headers define a kFooCount value that is
                 callable = a['callable']
                 for value in itertools.chain([callable.get('retval',{})], callable.get('arguments', {}).values()):
                     if 'type' not in value:
-                        raise ValueError("%s %s"%(
+                        raise ValueError("Missing 'type' in argument/retval spec for %s %s"%(
                             infolist[0]['class'], infolist[0]['selector']))
                     if isinstance(value['type'], str):
                         value['type'] = bstr(value['type'])
+
+                    elif isinstance(value['type'], _wrapped_call):
+                        pass
+
                     else:
                         value['type'] = sel32or64(bstr(value['type'][0]), bstr(value['type'][1]))
 
         else:
             use_key = key
 
+        print key[0], key[1], key[2]
         result[key] = merge_method_info(key[0], key[1], key[2], result[key], 
                 exception_method(excinfo, use_key), section == 'classes')
 
         fieldnames = values[0]['fieldnames']
         for v in values:
             v['typestr'] = bstr(v['typestr'])
+        print name
         typestr = merge_defs(values, 'typestr')['typestr']
         alias   = values[0]['alias']
         pack   = values[0]['pack']

objective/metadata/typecodes.py

             return self.__typestr_for_node(node.type, name)
 
         if isinstance(node, c_ast.Enum):
-            return objc._C_INT, special
+            if node.type is None:
+                return objc._C_INT, special
+
+
+            if isinstance(node.type, str):
+                key = node.type
+            else:
+                key = ' '.join(node.type)
+            result =  self._definitions[key], key in self._special
+            return result
 
         if isinstance(node, c_ast.Struct):
             result = [ objc._C_STRUCT_B ]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.