src/ffi: fix use of c_name for mangled names
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 17 Oct 2015 15:16:21 +0000 (11:16 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 1 Mar 2016 17:11:10 +0000 (12:11 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/compiler/compiler_ffi/compiler_ffi.nit
src/nitni/nitni_utilities.nit

index 79c2f14..2170a67 100644 (file)
@@ -262,7 +262,7 @@ redef class MExplicitCast
                #
 
                # In nitni files, declare internal function as extern
-               var full_friendly_csignature = "int {v.compiler.mainmodule.name }___{from.mangled_cname}_is_a_{to.mangled_cname}({from.cname_blind})"
+               var full_friendly_csignature = "int {v.compiler.mainmodule.c_name }___{from.mangled_cname}_is_a_{to.mangled_cname}({from.cname_blind})"
                ccu.header_decl.add("extern {full_friendly_csignature};\n")
 
                # In nitni files, #define friendly as extern
@@ -273,7 +273,7 @@ redef class MExplicitCast
                        var nitni_visitor = v.compiler.new_visitor
                        nitni_visitor.frame = v.frame
 
-                       var full_internal_csignature = "int {v.compiler.mainmodule.name }___{from.mangled_cname}_is_a_{to.mangled_cname}({internal_call_context.name_mtype(from)} from)"
+                       var full_internal_csignature = "int {v.compiler.mainmodule.c_name }___{from.mangled_cname}_is_a_{to.mangled_cname}({internal_call_context.name_mtype(from)} from)"
 
                        nitni_visitor.add_decl("/* nitni check for {from} to {to} */")
                        nitni_visitor.add_decl("{full_internal_csignature} \{")
@@ -297,7 +297,7 @@ redef class MExplicitCast
                #
 
                # In nitni files, declare internal function as extern
-               full_friendly_csignature = "{to.cname_blind} {v.compiler.mainmodule.name }___{from.mangled_cname}_as_{to.mangled_cname}({from.cname_blind})"
+               full_friendly_csignature = "{to.cname_blind} {v.compiler.mainmodule.c_name }___{from.mangled_cname}_as_{to.mangled_cname}({from.cname_blind})"
                ccu.header_decl.add("extern {full_friendly_csignature};\n")
 
                # In nitni files, #define friendly as extern
@@ -308,7 +308,7 @@ redef class MExplicitCast
                        var nitni_visitor = v.compiler.new_visitor
                        nitni_visitor.frame = v.frame
 
-                       var full_internal_csignature = "{to.cname_blind} {v.compiler.mainmodule.name }___{from.mangled_cname}_as_{to.mangled_cname}({internal_call_context.name_mtype(from)} from)"
+                       var full_internal_csignature = "{to.cname_blind} {v.compiler.mainmodule.c_name }___{from.mangled_cname}_as_{to.mangled_cname}({internal_call_context.name_mtype(from)} from)"
                        nitni_visitor.add_decl("/* nitni cast for {from} to {to} */")
                        nitni_visitor.add_decl("{full_internal_csignature} \{")
 
index c0a8a15..910877b 100644 (file)
@@ -19,7 +19,7 @@ import nitni_base
 
 redef class MMethod
        # Build a C function name for the FFI implementation (uses friendly naming).
-       # * On a specific static receiver mype `recv_mtype` 
+       # * On a specific static receiver type `recv_mtype`
        # * In referene to the module `from_module` (used for type resolving and as a possible prefix)
        # * Has a possible `suffix` to the method name (may be "__super", "__impl", null, etc.)
        # * With a specified length indicating whether it uses the sort name or the long name with
@@ -39,13 +39,13 @@ redef class MMethod
 
                if suffix != null then cname = "{cname}{suffix}"
 
-               if length.long then cname = "{from_mmodule.name}___{cname}"
+               if length.long then cname = "{from_mmodule.c_name}___{cname}"
 
                return cname
        end
 
        # Build a C function signature for the FFI implementation (uses friendly naming).
-       # * On a specific static receiver mype `recv_mtype` 
+       # * On a specific static receiver type `recv_mtype`
        # * In referene to the module `from_module` (used for type resolving and as a possible prefix)
        # * Has a possible `suffix` to the method name (may be "__super", "__impl", null, etc.)
        # * With a specified length indicating whether it uses the sort name or the long name with
@@ -83,7 +83,7 @@ redef class MMethod
        end
 
        # Build a C function call for the FFI implementation (uses friendly naming).
-       # * On a specific static receiver mype `recv_mtype` 
+       # * On a specific static receiver type `recv_mtype`
        # * In referene to the module `from_module` (used for type resolving and as a possible prefix)
        # * Has a possible `suffix` to the method name (may be "__super", "__impl", null, etc.)
        # * With a specified length indicating whether it uses the sort name or the long name with