*/
public string filename { get; set; }
+ /**
+ * Specifies the source file used to generate this one.
+ */
+ private string source_filename;
+
/**
* Specifies whether to emit line directives.
*/
/* at begin of line */
private bool _bol = true;
- public CCodeWriter (string filename) {
+ public CCodeWriter (string filename, string? source_filename = null) {
this.filename = filename;
+ this.source_filename = source_filename;
}
/**
stream = FileStream.open (filename, "w");
}
+ write_string ("/* %s generated by valac, the Vala compiler".printf (Path.get_basename (filename)));
+
+ // Write the file name if known
+ if (source_filename != null) {
+ write_newline ();
+ write_string (" * generated from %s".printf (Path.get_basename (source_filename)));
+ }
+
+ write_string (", do not modify */");
+ write_newline ();
+ write_newline ();
+
return (stream != null);
}
source_type_member_definition.append (cfunc);
}
- var writer = new CCodeWriter (source_file.get_csource_filename ());
+ var writer = new CCodeWriter (source_file.get_csource_filename (), source_file.filename);
if (!writer.open ()) {
Report.error (null, "unable to open `%s' for writing".printf (writer.filename));
return;