+2006-08-02 Jürg Billeter <j@bitron.ch>
+
+ * NEWS: update for 0.0.2 release
+ * vala/valasemanticanalyzer.vala: check for floating reference in
+ construction methods
+ * vala/valasourcefile.vala, vala/valacodegenerator.vala,
+ ccode/valaccodeincludedirective.vala: differentiate between
+ package-internal and external includes
+ * vapi/gtk+-2.0.vala: port to construction methods
+
2006-08-02 Jürg Billeter <j@bitron.ch>
* port to construction methods
+Vala 0.0.2
+==========
+
+ * Support named construction methods.
+ * Basic interface support.
+ * Improve error handling.
+ * Many bug fixes.
+
+
Vala 0.0.1
==========
*/
public string! filename { get; set construct; }
- public construct (string! _filename) {
+ /**
+ * Specifies whether the specified file should be searched in the local
+ * directory.
+ */
+ public bool local { get; set; }
+
+ public construct (string! _filename, bool _local = false) {
filename = _filename;
+ local = _local;
}
public override void write (CCodeWriter! writer) {
writer.write_indent ();
- writer.write_string ("#include <");
+ writer.write_string ("#include ");
+ if (local) {
+ writer.write_string ("\"");
+ } else {
+ writer.write_string ("<");
+ }
writer.write_string (filename);
- writer.write_string (">");
+ if (local) {
+ writer.write_string ("\"");
+ } else {
+ writer.write_string (">");
+ }
writer.write_newline ();
}
}
next_temp_var_id = 0;
header_begin.append (new CCodeIncludeDirective ("glib.h"));
- source_include_directives.append (new CCodeIncludeDirective (source_file.get_cheader_filename ()));
+ source_include_directives.append (new CCodeIncludeDirective (source_file.get_cheader_filename (), true));
ref List<string> used_includes = null;
used_includes.append ("glib.h");
}
foreach (string filename2 in source_file.get_header_internal_includes ()) {
if (used_includes.find_custom (filename2, strcmp) == null) {
- header_begin.append (new CCodeIncludeDirective (filename2));
+ header_begin.append (new CCodeIncludeDirective (filename2, true));
used_includes.append (filename2);
}
}
- foreach (string filename3 in source_file.get_source_includes ()) {
+ foreach (string filename3 in source_file.get_source_external_includes ()) {
if (used_includes.find_custom (filename3, strcmp) == null) {
source_include_directives.append (new CCodeIncludeDirective (filename3));
used_includes.append (filename3);
}
}
+ foreach (string filename4 in source_file.get_source_internal_includes ()) {
+ if (used_includes.find_custom (filename4, strcmp) == null) {
+ source_include_directives.append (new CCodeIncludeDirective (filename4, true));
+ used_includes.append (filename4);
+ }
+ }
if (source_file.is_cycle_head) {
foreach (SourceFile cycle_file in source_file.cycle.files) {
var namespaces = cycle_file.get_namespaces ();
m.return_type.data_type = (DataType) current_symbol.node;
m.return_type.transfers_ownership = true;
+ if (current_symbol.node is Class) {
+ // check for floating reference
+ var cl = (Class) current_symbol.node;
+ while (cl != null) {
+ if (cl == initially_unowned_type) {
+ m.return_type.floating_reference = true;
+ break;
+ }
+
+ cl = cl.base_class;
+ }
+ }
+
if (m.body != null) {
m.body.construction = true;
}
private List<weak string> header_external_includes;
private List<weak string> header_internal_includes;
- private List<weak string> source_includes;
+ private List<weak string> source_external_includes;
+ private List<weak string> source_internal_includes;
private List<weak SourceFile> header_internal_full_dependencies;
private List<weak SourceFile> header_internal_dependencies;
}
if (dep_type == SourceFileDependencyType.SOURCE) {
- source_includes.concat (t.get_cheader_filenames ());
+ if (t.source_reference.file.pkg) {
+ source_external_includes.concat (t.get_cheader_filenames ());
+ } else {
+ source_internal_includes.concat (t.get_cheader_filenames ());
+ }
return;
}
}
/**
- * Returns the list of externel includes the generated C header file
+ * Returns the list of external includes the generated C header file
* requires.
*
* @return external include list for C header file
}
/**
- * Returns the list of package-internal includes the generated C header file
- * requires.
+ * Returns the list of package-internal includes the generated C header
+ * file requires.
*
* @return internal include list for C header file
*/
}
/**
- * Returns the list of includes the generated C source file requires.
+ * Returns the list of external includes the generated C source file
+ * requires.
+ *
+ * @return include list for C source file
+ */
+ public List<string> get_source_external_includes () {
+ return source_external_includes;
+ }
+
+ /**
+ * Returns the list of package-internal includes the generated C source
+ * file requires.
*
* @return include list for C source file
*/
- public List<string> get_source_includes () {
- return source_includes;
+ public List<string> get_source_internal_includes () {
+ return source_internal_includes;
}
/**
}
public class Dialog : Window {
- [FloatingReference ()]
- public static ref Widget new ();
- [FloatingReference ()]
- public static ref Widget new_with_buttons (string title, Window parent, DialogFlags @flags, string first_button_text, ...);
+ public construct ();
+ public construct with_buttons (string title, Window parent, DialogFlags _flags, string first_button_text, ...);
public int run ();
public void response (int response_id);
public Widget add_button (string button_text, int response_id);
}
public class MessageDialog : Dialog {
- [FloatingReference ()]
- public static ref Widget new (Window parent, DialogFlags @flags, MessageType type, ButtonsType buttons, string message_format, ...);
+ public construct (Window parent, DialogFlags _flags, MessageType type, ButtonsType buttons, string message_format, ...);
}
public enum MessageType {
}
public class StatusIcon {
- public static ref StatusIcon! new_from_stock (string! stock_id);
+ public construct from_stock (string! stock_id);
public bool blinking { get; set; }
public bool visible { get; set; }
}
public class Button : Container {
- [FloatingReference ()]
- public static ref Button new_with_label (string label);
+ public construct with_label (string label);
- public string label { get; construct; }
+ public string label { get; set construct; }
public signal void activate ();
public signal void clicked ();
}
public class Entry : Widget {
- [FloatingReference ()]
- public static ref Entry new ();
+ public construct ();
}
public class TextBuffer {
}
public class TreeViewColumn : Object {
- [FloatingReference ()]
- public static ref TreeViewColumn new_with_attributes (string title, CellRenderer cell, ...);
+ public construct with_attributes (string title, CellRenderer cell, ...);
public int fixed_width { get; set; }
public TreeViewColumnSizing sizing { get; set; }
}
public class TreeStore : TreeModel {
- public static ref TreeStore new (int n_columns, ...);
+ public construct (int n_columns, ...);
public void @set (ref TreeIter iter, ...);
public void append (ref TreeIter iter, ref TreeIter parent);
}
public class Menu : MenuShell {
- [FloatingReference ()]
- public static ref Menu new ();
+ public construct ();
}
public class MenuBar : MenuShell {
- [FloatingReference ()]
- public static ref MenuBar new ();
+ public construct ();
}
public class MenuItem : Item {
- [FloatingReference ()]
- public static ref MenuItem new_with_label (string label);
+ public construct with_label (string label);
public void set_submenu (Menu submenu);
}
}
public class Toolbar : Container {
- [FloatingReference ()]
- public static ref Toolbar new ();
+ public construct ();
}
public class HBox : Box {
- [FloatingReference ()]
- public static ref HBox new (bool homogeneous, int spacing);
+ public construct (bool homogeneous, int spacing);
}
public class VBox : Box {
- [FloatingReference ()]
- public static ref VBox new (bool homogeneous, int spacing);
+ public construct (bool homogeneous, int spacing);
}
public class VPaned : Paned {