vala r1882 - in trunk: . gobject



Author: juergbi
Date: Fri Oct 24 09:30:44 2008
New Revision: 1882
URL: http://svn.gnome.org/viewvc/vala?rev=1882&view=rev

Log:
2008-10-24  JÃrg Billeter  <j bitron ch>

	* gobject/Makefile.am:
	* gobject/valaccodebasemodule.vala:
	* gobject/valaccodegenerator.vala:
	* gobject/valaccodemodule.vala:

	Add CCodeModule and CCodeBaseModule classes as preparation to
	make the backend more modular


Added:
   trunk/gobject/valaccodebasemodule.vala
   trunk/gobject/valaccodemodule.vala
Modified:
   trunk/ChangeLog
   trunk/gobject/Makefile.am
   trunk/gobject/valaccodegenerator.vala

Modified: trunk/gobject/Makefile.am
==============================================================================
--- trunk/gobject/Makefile.am	(original)
+++ trunk/gobject/Makefile.am	Fri Oct 24 09:30:44 2008
@@ -14,6 +14,7 @@
 libvala_la_VALASOURCES = \
 	valaccodearraycreationexpressionbinding.vala \
 	valaccodeassignmentbinding.vala \
+	valaccodebasemodule.vala \
 	valaccodebinding.vala \
 	valaccodeclassbinding.vala \
 	valaccodecompiler.vala \
@@ -31,6 +32,7 @@
 	valaccodeinvocationexpressionbinding.vala \
 	valaccodememberaccessbinding.vala \
 	valaccodemethodbinding.vala \
+	valaccodemodule.vala \
 	valaccodeobjecttypesymbolbinding.vala \
 	valaccodetypesymbolbinding.vala \
 	valaclassregisterfunction.vala \

Added: trunk/gobject/valaccodebasemodule.vala
==============================================================================
--- (empty file)
+++ trunk/gobject/valaccodebasemodule.vala	Fri Oct 24 09:30:44 2008
@@ -0,0 +1,30 @@
+/* valaccodebasemodule.vala
+ *
+ * Copyright (C) 2008  JÃrg Billeter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
+ * 	JÃrg Billeter <j bitron ch>
+ */
+
+/**
+ * Code visitor generating C Code.
+ */
+public class Vala.CCodeBaseModule : CCodeModule {
+	public CCodeBaseModule (CCodeModule? next) {
+		base (next);
+	}
+}

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Fri Oct 24 09:30:44 2008
@@ -28,6 +28,8 @@
  * Code visitor generating C Code.
  */
 public class Vala.CCodeGenerator : CodeGenerator {
+	CCodeModule head;
+
 	public CodeContext context;
 	
 	public Symbol root_symbol;
@@ -139,6 +141,8 @@
 	private Set<string> wrappers;
 
 	public CCodeGenerator () {
+		this.head = new CCodeBaseModule (null);
+
 		predefined_marshal_set = new HashSet<string> (str_hash, str_equal);
 		predefined_marshal_set.add ("VOID:VOID");
 		predefined_marshal_set.add ("VOID:BOOLEAN");
@@ -205,6 +209,8 @@
 	}
 
 	public override void emit (CodeContext context) {
+		this.head.emit (context);
+
 		this.context = context;
 	
 		context.find_header_cycles ();

Added: trunk/gobject/valaccodemodule.vala
==============================================================================
--- (empty file)
+++ trunk/gobject/valaccodemodule.vala	Fri Oct 24 09:30:44 2008
@@ -0,0 +1,42 @@
+/* valaccodemodule.vala
+ *
+ * Copyright (C) 2008  JÃrg Billeter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
+ * 	JÃrg Billeter <j bitron ch>
+ */
+
+using Gee;
+
+/**
+ * Code visitor generating C Code.
+ */
+public abstract class Vala.CCodeModule {
+	public weak CCodeModule head { get; private set; }
+
+	public CCodeModule? next { get; private set; }
+
+	public CCodeModule (CCodeModule? next) {
+		this.next = next;
+	}
+
+	public virtual void emit (CodeContext context) {
+		if (next != null) {
+			next.emit (context);
+		}
+	}
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]