]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add CCodeModule and CCodeBaseModule classes as preparation to make the
authorJürg Billeter <j@bitron.ch>
Fri, 24 Oct 2008 09:30:44 +0000 (09:30 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Fri, 24 Oct 2008 09:30:44 +0000 (09:30 +0000)
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

svn path=/trunk/; revision=1882

ChangeLog
gobject/Makefile.am
gobject/valaccodebasemodule.vala [new file with mode: 0644]
gobject/valaccodegenerator.vala
gobject/valaccodemodule.vala [new file with mode: 0644]

index fee87d66ae16f743e7f1f6dc3cfccbf854026728..964b8c3f8a8685fadb130057e50803d7564db80c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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
+
 2008-10-24  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valaccodeinvocationexpressionbinding.vala:
index 1d116c0ba5fe5126a02e89589f59c250c2e7f8d8..8193b6c6958e9734b394699693101d1ee1051cd2 100644 (file)
@@ -14,6 +14,7 @@ lib_LTLIBRARIES = \
 libvala_la_VALASOURCES = \
        valaccodearraycreationexpressionbinding.vala \
        valaccodeassignmentbinding.vala \
+       valaccodebasemodule.vala \
        valaccodebinding.vala \
        valaccodeclassbinding.vala \
        valaccodecompiler.vala \
@@ -31,6 +32,7 @@ libvala_la_VALASOURCES = \
        valaccodeinvocationexpressionbinding.vala \
        valaccodememberaccessbinding.vala \
        valaccodemethodbinding.vala \
+       valaccodemodule.vala \
        valaccodeobjecttypesymbolbinding.vala \
        valaccodetypesymbolbinding.vala \
        valaclassregisterfunction.vala \
diff --git a/gobject/valaccodebasemodule.vala b/gobject/valaccodebasemodule.vala
new file mode 100644 (file)
index 0000000..9fef4a1
--- /dev/null
@@ -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);
+       }
+}
index 0279e48f5d3a789739200e0ca83d64c46e0ffc4b..81b513a70ae1a4dcc8a135dcb40b07ace8e6a28f 100644 (file)
@@ -28,6 +28,8 @@ using Gee;
  * Code visitor generating C Code.
  */
 public class Vala.CCodeGenerator : CodeGenerator {
+       CCodeModule head;
+
        public CodeContext context;
        
        public Symbol root_symbol;
@@ -139,6 +141,8 @@ public class Vala.CCodeGenerator : CodeGenerator {
        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 class Vala.CCodeGenerator : CodeGenerator {
        }
 
        public override void emit (CodeContext context) {
+               this.head.emit (context);
+
                this.context = context;
        
                context.find_header_cycles ();
diff --git a/gobject/valaccodemodule.vala b/gobject/valaccodemodule.vala
new file mode 100644 (file)
index 0000000..d78de0a
--- /dev/null
@@ -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);
+               }
+       }
+}