def _write_marshaller_code(self, writer, elem, for_header):
        
        if for_header:
            file_name = self._file_name_manager.get_marshaller_header_name(elem)
        else:
            file_name = self._file_name_manager.get_marshaller_source_name(elem)
            
        file_path = self._outdir + os.sep + file_name
        file_out = FileOut(file_path)

        if self.verbose:
            print "generating file %s..." % file_path,
            
        saved_out = writer.get_output()
        writer.set_output(file_out)
        
        file_out.open()
        
        marshaller_gen = MarshallerGenerator(elem)
        lines = marshaller_gen.get_code(for_header)
        
        for line in lines:
            writer.writeln(line)
        writer.writeln()
        file_out.close()
        
        writer.set_output(saved_out)
        
        if self.verbose:
            print "done"
 def _write_marshaller(self, header = True):
     
     marshaller_gen = MarshallerGenerator(self._obj)
     
     lines = marshaller_gen.get_code(for_header = header)
     for line in lines:
         self.writeln(line)
         
     self._writeln()
 def _write_add_signal_section(self, clif_class_name):
     
     if not self._obj.signals:
         return
     
     self.writeln("/* add signals */")
     self.writeln()
     
     marshaller_gen = MarshallerGenerator(self._obj)
     
     for signal in self._obj.signals:
         
         saved_out = self.output
         list_out = ListOut()
         self.output = list_out
         
         self.write("%(prefix)s_signals[" % self._vars)
         self.writeln("%s] = g_signal_new(\"%s\"," % (signal.internal_name.upper(), signal.name))
         self.indent()
         self.writeln(self.gtypename(self._obj) + ",")
         self.writeln("G_SIGNAL_RUN_LAST|G_SIGNAL_DETAILED,")
         self.write("G_STRUCT_OFFSET(%s, " % clif_class_name)
         self.writeln(signal.internal_name + "),")
         self.writeln("NULL, /* accumulator */")
         self.writeln("NULL,")
         self.writeln("%s," % marshaller_gen.get_marshaller_name(signal))
         self.writeln("%s," % self.gtypename(signal.result))
         if signal.parameters:
             self.writeln("%d," % len(signal.parameters))
             for param in signal.parameters:
                 self.write(self.gtypename(param[1]))
                 if not param is signal.parameters[-1]:
                     self.writeln(",")
                 else:
                     self.writeln()
         else:
             self.writeln("0")
         self.writeln(");")
         self.unindent()
                     
         self.output = saved_out
         
         self.user_section("signal_%s" % signal.internal_name,
                           default_code = list_out.get_lines(), 
                           indent_level = -1
                           )
         self.writeln()