From: Jean Privat Date: Thu, 13 Oct 2011 00:24:33 +0000 (-0400) Subject: Merge branch 'pu/class_name' into wip X-Git-Tag: v0.5~40 X-Git-Url: http://nitlanguage.org?hp=-c Merge branch 'pu/class_name' into wip --- d0acecc174e048031970f46e8f75486b0a087f4f diff --combined src/compiling/compiling_global.nit index 1a5aa73,cc81b4e..1a8a817 --- a/src/compiling/compiling_global.nit +++ b/src/compiling/compiling_global.nit @@@ -116,7 -116,7 +116,7 @@@ redef class MMModul # Compile module file for the current module fun compile_local_table_to_c(v: CompilerVisitor) do - v.add_instr("const char *LOCATE_{name} = \"{location.file}\";") + v.add_instr("const char *LOCATE_{name} = \"{location.file.filename}\";") if v.program.tc.use_SFT_optimization or local_table.is_empty then return @@@ -281,6 -281,14 +281,14 @@@ redef class TableEltClassSelfI end end + redef class TableEltClassSelfName + redef fun compile_to_c(v, c) + do + var prog = v.program + return "\"{c.global.name}\" /* {prog.table_information.color(self)}: Class Name */" + end + end + redef class TableEltClassObjectSize redef fun compile_to_c(v, c) do diff --combined src/compiling/compiling_icode.nit index 40894fe,164bb22..4bc53ab --- a/src/compiling/compiling_icode.nit +++ b/src/compiling/compiling_icode.nit @@@ -168,7 -168,7 +168,7 @@@ class I2CCompilerVisito if l != null then visitor.add_indent(w) w.add("/* ") - w.add(l.file) + w.add(l.file.filename) w.add(":") w.add(l.line_start.to_s) w.add(" */\n") @@@ -864,7 -864,14 +864,14 @@@ redef class INativ s = "NEW_NativeArray(UNTAG_Int({regs[1]}), sizeof(val_t))" else if n == once "calloc_string".to_symbol then s = "BOX_NativeString((char*)raw_alloc((UNTAG_Int({regs[1]}) * sizeof(char))))" + # Add output_class_name native implementation + else if n == once "output_class_name".to_symbol then + s = "printf(\"%s\\n\", VAL2VFT({regs[0]})[2].cname);" + # Add class_name implementation + else if n == once "native_class_name".to_symbol then + s = "BOX_NativeString(VAL2VFT({regs[0]})[2].cname);" end + if s == null then var ll = location if ll != null then v.add_instr("fprintf(stderr, \"{ll.to_s}: \");")