pypy / pypy / translator / cli /

Diff from to


 from py.builtin import set
 from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.lltypesystem import rffi
 from pypy.rpython.ootypesystem import ootype
 from pypy.translator.cli.option import getoption
 from pypy.translator.cli import oopspec
 T = CliPrimitiveType
 class types:
     void =    T('void')
+    int16 =   T('int16')
     int32 =   T('int32')
     uint32 =  T('unsigned int32')
     int64 =   T('int64')
 _lltype_to_cts = {
     ootype.Void: types.void,
+    rffi.SHORT: types.int16,
     ootype.Signed: types.int32,    
     ootype.Unsigned: types.uint32,
     ootype.SignedLongLong: types.int64,
     def ctor_name(self, t):
         return 'instance void %s::.ctor()' % self.lltype_to_cts(t)
+    def static_meth_to_signature(self, sm):
+        from pypy.translator.oosupport import metavm
+        graph = getattr(sm, 'graph', None)
+        if graph:
+            return self.graph_to_signature(graph)
+        module, name = metavm.get_primitive_name(sm)
+        func_name = '[pypylib]pypy.builtin.%s::%s' % (module, name)
+        T = ootype.typeOf(sm)
+        return self.format_signatue(func_name, T.ARGS, T.RESULT)
     def graph_to_signature(self, graph, is_method = False, func_name = None):
-        ret_type, ret_var = self.llvar_to_cts(graph.getreturnvar())
         func_name = func_name or
         func_name = self.escape_name(func_name)
         namespace = getattr(graph.func, '_namespace_', None)
         if namespace:
             func_name = '%s::%s' % (namespace, func_name)
-        args = [arg for arg in graph.getargs() if arg.concretetype is not ootype.Void]
+        ARGS = [arg.concretetype for arg in graph.getargs() if arg.concretetype is not ootype.Void]
         if is_method:
-            args = args[1:]
+            ARGS = ARGS[1:]
+        RESULT = graph.getreturnvar().concretetype
+        return self.format_signatue(func_name, ARGS, RESULT)
-        arg_types = [self.lltype_to_cts(arg.concretetype).typename() for arg in args]
+    def format_signatue(self, func_name, ARGS, RESULT):
+        arg_types = [self.lltype_to_cts(ARG).typename() for ARG in ARGS]
         arg_list = ', '.join(arg_types)
+        ret_type = self.lltype_to_cts(RESULT)
         return '%s %s(%s)' % (ret_type, func_name, arg_list)
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
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.