vala r1899 - in trunk: . gobject
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1899 - in trunk: . gobject
- Date: Fri, 24 Oct 2008 14:54:03 +0000 (UTC)
Author: juergbi
Date: Fri Oct 24 14:54:03 2008
New Revision: 1899
URL: http://svn.gnome.org/viewvc/vala?rev=1899&view=rev
Log:
2008-10-24 JÃrg Billeter <j bitron ch>
* gobject/Makefile.am:
* gobject/valaccodegenerator.vala:
* gobject/valaccodemodule.vala:
* gobject/valaccodestructmodule.vala:
Add CCodeStructModule
Added:
trunk/gobject/valaccodestructmodule.vala (contents, props changed)
- copied, changed from r1880, /trunk/gobject/valaccodegeneratorstruct.vala
Removed:
trunk/gobject/valaccodegeneratorstruct.vala
Modified:
trunk/ChangeLog
trunk/gobject/Makefile.am
trunk/gobject/valaccodegenerator.vala
trunk/gobject/valaccodemodule.vala
Modified: trunk/gobject/Makefile.am
==============================================================================
--- trunk/gobject/Makefile.am (original)
+++ trunk/gobject/Makefile.am Fri Oct 24 14:54:03 2008
@@ -21,11 +21,11 @@
valaccodeelementaccessmodule.vala \
valaccodegenerator.vala \
valaccodegeneratorsourcefile.vala \
- valaccodegeneratorstruct.vala \
valaccodeinvocationexpressionmodule.vala \
valaccodememberaccessmodule.vala \
valaccodemethodmodule.vala \
valaccodemodule.vala \
+ valaccodestructmodule.vala \
valaclassregisterfunction.vala \
valadbusmodule.vala \
valagirwriter.vala \
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Fri Oct 24 14:54:03 2008
@@ -142,6 +142,7 @@
public CCodeGenerator () {
head = new CCodeBaseModule (this, head);
+ head = new CCodeStructModule (this, head);
head = new CCodeMethodModule (this, head);
head = new CCodeMemberAccessModule (this, head);
head = new CCodeElementAccessModule (this, head);
@@ -308,6 +309,10 @@
head.visit_interface (iface);
}
+ public override void visit_struct (Struct st) {
+ head.visit_struct (st);
+ }
+
public override void visit_enum (Enum en) {
cenum = new CCodeEnum (en.get_cname ());
Modified: trunk/gobject/valaccodemodule.vala
==============================================================================
--- trunk/gobject/valaccodemodule.vala (original)
+++ trunk/gobject/valaccodemodule.vala Fri Oct 24 14:54:03 2008
@@ -60,6 +60,10 @@
next.visit_interface (iface);
}
+ public virtual void visit_struct (Struct st) {
+ next.visit_struct (st);
+ }
+
public virtual void visit_method (Method m) {
next.visit_method (m);
}
Copied: trunk/gobject/valaccodestructmodule.vala (from r1880, /trunk/gobject/valaccodegeneratorstruct.vala)
==============================================================================
--- /trunk/gobject/valaccodegeneratorstruct.vala (original)
+++ trunk/gobject/valaccodestructmodule.vala Fri Oct 24 14:54:03 2008
@@ -1,4 +1,4 @@
-/* valaccodegeneratorstruct.vala
+/* valaccodestructmodule.vala
*
* Copyright (C) 2006-2008 JÃrg Billeter, Raffaele Sandrini
*
@@ -23,23 +23,27 @@
using GLib;
-public class Vala.CCodeGenerator {
+public class Vala.CCodeStructModule : CCodeModule {
+ public CCodeStructModule (CCodeGenerator codegen, CCodeModule? next) {
+ base (codegen, next);
+ }
+
public override void visit_struct (Struct st) {
- var old_type_symbol = current_type_symbol;
- var old_instance_struct = instance_struct;
- var old_instance_finalize_fragment = instance_finalize_fragment;
- current_type_symbol = st;
- instance_struct = new CCodeStruct ("_%s".printf (st.get_cname ()));
- instance_finalize_fragment = new CCodeFragment ();
+ var old_type_symbol = codegen.current_type_symbol;
+ var old_instance_struct = codegen.instance_struct;
+ var old_instance_finalize_fragment = codegen.instance_finalize_fragment;
+ codegen.current_type_symbol = st;
+ codegen.instance_struct = new CCodeStruct ("_%s".printf (st.get_cname ()));
+ codegen.instance_finalize_fragment = new CCodeFragment ();
CCodeFragment decl_frag;
CCodeFragment def_frag;
if (st.access != SymbolAccessibility.PRIVATE) {
- decl_frag = header_type_declaration;
- def_frag = header_type_definition;
+ decl_frag = codegen.header_type_declaration;
+ def_frag = codegen.header_type_definition;
} else {
- decl_frag = source_type_declaration;
- def_frag = source_type_definition;
+ decl_frag = codegen.source_type_declaration;
+ def_frag = codegen.source_type_definition;
}
if (st.source_reference.file.cycle == null) {
@@ -49,18 +53,18 @@
if (st.source_reference.comment != null) {
def_frag.append (new CCodeComment (st.source_reference.comment));
}
- def_frag.append (instance_struct);
+ def_frag.append (codegen.instance_struct);
- st.accept_children (this);
+ st.accept_children (codegen);
if (st.is_disposable ()) {
add_struct_copy_function (st);
add_struct_destroy_function (st);
}
- current_type_symbol = old_type_symbol;
- instance_struct = old_instance_struct;
- instance_finalize_fragment = old_instance_finalize_fragment;
+ codegen.current_type_symbol = old_type_symbol;
+ codegen.instance_struct = old_instance_struct;
+ codegen.instance_finalize_fragment = old_instance_finalize_fragment;
}
void add_struct_copy_function (Struct st) {
@@ -73,16 +77,16 @@
function.add_parameter (new CCodeFormalParameter ("dest", st.get_cname () + "*"));
if (st.access != SymbolAccessibility.PRIVATE) {
- header_type_member_declaration.append (function.copy ());
+ codegen.header_type_member_declaration.append (function.copy ());
} else {
- source_type_member_declaration.append (function.copy ());
+ codegen.source_type_member_declaration.append (function.copy ());
}
var cblock = new CCodeBlock ();
function.block = cblock;
- source_type_member_definition.append (function);
+ codegen.source_type_member_definition.append (function);
}
void add_struct_destroy_function (Struct st) {
@@ -94,18 +98,18 @@
function.add_parameter (new CCodeFormalParameter ("self", st.get_cname () + "*"));
if (st.access != SymbolAccessibility.PRIVATE) {
- header_type_member_declaration.append (function.copy ());
+ codegen.header_type_member_declaration.append (function.copy ());
} else {
- source_type_member_declaration.append (function.copy ());
+ codegen.source_type_member_declaration.append (function.copy ());
}
var cblock = new CCodeBlock ();
- cblock.add_statement (instance_finalize_fragment);
+ cblock.add_statement (codegen.instance_finalize_fragment);
function.block = cblock;
- source_type_member_definition.append (function);
+ codegen.source_type_member_definition.append (function);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]