Commit 0c563506 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

rename CodeGenerator to CCodeGenerator, add abstract CodeGenerator and

2007-09-17  Juerg Billeter  <j@bitron.ch>

	* vala/Makefile.am, vala/valacodebinding.vala,
	  vala/valacodecontext.vala, vala/valacodegenerator.vala,
	  vala/valacodenode.vala, gobject/Makefile.am,
	  gobject/valaccodegenerator.vala, compiler/valacompiler.vala: rename
	  CodeGenerator to CCodeGenerator, add abstract CodeGenerator and
	  CodeBinding classes

svn path=/trunk/; revision=617
parent 251f0e7a
2007-09-17 Jürg Billeter <j@bitron.ch>
* vala/Makefile.am, vala/valacodebinding.vala,
vala/valacodecontext.vala, vala/valacodegenerator.vala,
vala/valacodenode.vala, gobject/Makefile.am,
gobject/valaccodegenerator.vala, compiler/valacompiler.vala: rename
CodeGenerator to CCodeGenerator, add abstract CodeGenerator and
CodeBinding classes
2007-09-17 Jürg Billeter <j@bitron.ch>
* vala/valacodevisitor.vala, vala/valalambdaexpression.vala,
......
......@@ -170,6 +170,8 @@ class Vala.Compiler : Object {
context.optlevel = optlevel;
context.save_temps = save_temps;
context.codegen = new CCodeGenerator (!disable_memory_management);
/* default package */
if (!add_package (context, "glib-2.0")) {
Report.error (null, "glib-2.0 not found in specified Vala API directories");
......@@ -248,8 +250,7 @@ class Vala.Compiler : Object {
}
}
var code_generator = new CodeGenerator (!disable_memory_management);
code_generator.emit (context);
context.codegen.emit (context);
if (Report.get_errors () > 0) {
return quit ();
......
......@@ -19,36 +19,36 @@ libvala_la_SOURCES = \
valaclassregisterfunction.c \
valaclassregisterfunction.h \
valaclassregisterfunction.vala \
valacodegenerator.c \
valacodegenerator.h \
valacodegenerator.vala \
valacodegeneratorassignment.c \
valacodegeneratorassignment.h \
valacodegeneratorassignment.vala \
valacodegeneratorclass.c \
valacodegeneratorclass.h \
valacodegeneratorclass.vala \
valacodegeneratorinterface.c \
valacodegeneratorinterface.h \
valacodegeneratorinterface.vala \
valacodegeneratorinvocationexpression.c \
valacodegeneratorinvocationexpression.h \
valacodegeneratorinvocationexpression.vala \
valacodegeneratormemberaccess.c \
valacodegeneratormemberaccess.h \
valacodegeneratormemberaccess.vala \
valacodegeneratormethod.c \
valacodegeneratormethod.h \
valacodegeneratormethod.vala \
valacodegeneratorsignal.c \
valacodegeneratorsignal.h \
valacodegeneratorsignal.vala \
valacodegeneratorsourcefile.c \
valacodegeneratorsourcefile.h \
valacodegeneratorsourcefile.vala \
valacodegeneratorstruct.c \
valacodegeneratorstruct.h \
valacodegeneratorstruct.vala \
valaccodegenerator.c \
valaccodegenerator.h \
valaccodegenerator.vala \
valaccodegeneratorassignment.c \
valaccodegeneratorassignment.h \
valaccodegeneratorassignment.vala \
valaccodegeneratorclass.c \
valaccodegeneratorclass.h \
valaccodegeneratorclass.vala \
valaccodegeneratorinterface.c \
valaccodegeneratorinterface.h \
valaccodegeneratorinterface.vala \
valaccodegeneratorinvocationexpression.c \
valaccodegeneratorinvocationexpression.h \
valaccodegeneratorinvocationexpression.vala \
valaccodegeneratormemberaccess.c \
valaccodegeneratormemberaccess.h \
valaccodegeneratormemberaccess.vala \
valaccodegeneratormethod.c \
valaccodegeneratormethod.h \
valaccodegeneratormethod.vala \
valaccodegeneratorsignal.c \
valaccodegeneratorsignal.h \
valaccodegeneratorsignal.vala \
valaccodegeneratorsourcefile.c \
valaccodegeneratorsourcefile.h \
valaccodegeneratorsourcefile.vala \
valaccodegeneratorstruct.c \
valaccodegeneratorstruct.h \
valaccodegeneratorstruct.vala \
valadbusbindingprovider.c \
valadbusbindingprovider.h \
valadbusbindingprovider.vala \
......@@ -71,16 +71,16 @@ gobjectincludedir = $(includedir)/vala-1.0/gobject
gobjectinclude_HEADERS = \
valaccodecompiler.h \
valaclassregisterfunction.h \
valacodegenerator.h \
valacodegeneratorassignment.h \
valacodegeneratorclass.h \
valacodegeneratorinterface.h \
valacodegeneratorinvocationexpression.h \
valacodegeneratormemberaccess.h \
valacodegeneratormethod.h \
valacodegeneratorsignal.h \
valacodegeneratorsourcefile.h \
valacodegeneratorstruct.h \
valaccodegenerator.h \
valaccodegeneratorassignment.h \
valaccodegeneratorclass.h \
valaccodegeneratorinterface.h \
valaccodegeneratorinvocationexpression.h \
valaccodegeneratormemberaccess.h \
valaccodegeneratormethod.h \
valaccodegeneratorsignal.h \
valaccodegeneratorsourcefile.h \
valaccodegeneratorstruct.h \
valadbusbindingprovider.h \
valadbusmethod.h \
valadbussignal.h \
......
/* valacodegenerator.vala
/* valaccodegenerator.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -27,7 +27,7 @@ using Gee;
/**
* Code visitor generating C Code.
*/
public class Vala.CodeGenerator : CodeVisitor {
public class Vala.CCodeGenerator : CodeGenerator {
/**
* Specifies whether automatic memory management is active.
*/
......@@ -123,7 +123,7 @@ public class Vala.CodeGenerator : CodeVisitor {
private bool requires_array_free;
private bool requires_array_move;
public CodeGenerator (bool manage_memory = true) {
public CCodeGenerator (bool manage_memory = true) {
memory_management = manage_memory;
}
......@@ -193,12 +193,7 @@ public class Vala.CodeGenerator : CodeVisitor {
c_keywords.add ("cdecl");
}
/**
* Generate and emit C code for the specified code context.
*
* @param context a code context
*/
public void emit (CodeContext! context) {
public override void emit (CodeContext! context) {
this.context = context;
context.find_header_cycles ();
......
/* valacodegeneratorassignment.vala
/* valaccodegeneratorassignment.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -24,7 +24,7 @@
using GLib;
using Gee;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
public override void visit_assignment (Assignment! a) {
a.accept_children (this);
......
/* valacodegeneratorclass.vala
/* valaccodegeneratorclass.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -23,7 +23,7 @@
using GLib;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
public override void visit_class (Class! cl) {
var old_symbol = current_symbol;
var old_type_symbol = current_type_symbol;
......
/* valacodegeneratorinterface.vala
/* valaccodegeneratorinterface.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -23,7 +23,7 @@
using GLib;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
public override void visit_interface (Interface! iface) {
current_symbol = iface;
current_type_symbol = iface;
......
/* valacodegeneratorinvocationexpression.vala
/* valaccodegeneratorinvocationexpression.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -24,7 +24,7 @@
using GLib;
using Gee;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
public override void visit_invocation_expression (InvocationExpression! expr) {
expr.accept_children (this);
......
/* valacodegeneratormemberaccess.vala
/* valaccodegeneratormemberaccess.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -23,7 +23,7 @@
using GLib;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
private void process_cmember (MemberAccess! expr, CCodeExpression pub_inst, DataType base_type) {
if (expr.symbol_reference is Method) {
var m = (Method) expr.symbol_reference;
......
/* valacodegeneratormethod.vala
/* valaccodegeneratormethod.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -24,7 +24,7 @@
using GLib;
using Gee;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
public override void visit_method (Method! m) {
Method old_method = current_method;
TypeReference old_return_type = current_return_type;
......
/* valacodegeneratorsignal.vala
/* valaccodegeneratorsignal.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -23,7 +23,7 @@
using GLib;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
private string get_marshaller_type_name (TypeReference t) {
if (t.type_parameter != null) {
return ("POINTER");
......
/* valacodegeneratorsourcefile.vala
/* valaccodegeneratorsourcefile.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -24,7 +24,7 @@
using GLib;
using Gee;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
private CCodeIncludeDirective get_internal_include (string! filename) {
return new CCodeIncludeDirective (filename, context.library == null);
}
......
/* valacodegeneratorstruct.vala
/* valaccodegeneratorstruct.vala
*
* Copyright (C) 2006-2007 Jürg Billeter, Raffaele Sandrini
*
......@@ -23,7 +23,7 @@
using GLib;
public class Vala.CodeGenerator {
public class Vala.CCodeGenerator {
public override void visit_struct (Struct! st) {
var old_type_symbol = current_type_symbol;
var old_instance_struct = instance_struct;
......
......@@ -77,9 +77,15 @@ libvalacore_la_SOURCES = \
valaclass.c \
valaclass.h \
valaclass.vala \
valacodebinding.c \
valacodebinding.h \
valacodebinding.vala \
valacodecontext.c \
valacodecontext.h \
valacodecontext.vala \
valacodegenerator.c \
valacodegenerator.h \
valacodegenerator.vala \
valacodenode.c \
valacodenode.h \
valacodenode.vala \
......@@ -346,7 +352,9 @@ valainclude_HEADERS = \
valacatchclause.h \
valacharacterliteral.h \
valaclass.h \
valacodebinding.h \
valacodecontext.h \
valacodegenerator.h \
valacodenode.h \
valacodevisitor.h \
valaconditionalexpression.h \
......
/* valacodebinding.vala
*
* Copyright (C) 2007 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 GLib;
/**
* The link between a source code node and generated code.
*/
public abstract class Vala.CodeBinding : Object {
}
......@@ -120,6 +120,11 @@ public class Vala.CodeContext : Object {
get { return _root; }
}
/**
* The selected code generator.
*/
public CodeGenerator codegen { get; set; }
/**
* Returns a copy of the list of source files.
*
......
/* valacodegenerator.vala
*
* Copyright (C) 2007 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 GLib;
/**
* Abstract code visitor generating code.
*/
public abstract class Vala.CodeGenerator : CodeVisitor {
/**
* Generate and emit C code for the specified code context.
*
* @param context a code context
*/
public abstract void emit (CodeContext! context);
}
......@@ -63,6 +63,11 @@ public abstract class Vala.CodeNode : Object {
}
}
/**
* Binding to the generated code.
*/
public CodeBinding code_binding { get; set; }
/**
* Specifies whether a fatal error has been detected in this code node.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment