]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
only parse .vala source files support disabling automatic property
authorJürg Billeter <j@bitron.ch>
Sat, 5 Aug 2006 12:00:46 +0000 (12:00 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 5 Aug 2006 12:00:46 +0000 (12:00 +0000)
2006-08-05  Jürg Billeter  <j@bitron.ch>

* vala/valaparser.vala: only parse .vala source files
* vala/valasymbolbuilder.vala, vala/valaproperty.vala: support disabling
  automatic property accessor generation
* vala/valasemanticanalyzer.vala: fix typo
* vala/valacodegenerator.vala, vala/valainterfacewriter.vala,
  vala/valacodecontext.vala: use correct includes for libraries
* vala/valacodegenerator.vala: use get_canonical_cconstant method for
  signals
* vala/valainterfacewriter.vala: support interfaces, non-null types,
  callbacks, and construction methods
* vala/valasignal.vala: add get_canonical_cconstant method
* vala/valaenum.vala, vala/valainterface.vala, vala/valanamespace.vala,
  vala/valastruct: add default arguments
* vala/Makefile.am: install libvala.so and header files
* ccode/Makefile.am: install header files
* compiler/valacompiler.vala: set library name in code context
* compiler/Makefile.am: adapt to build system changes
* vapi/glib-2.0.vala: add skeletons for Callback, Closure, IOChannel,
  TimeVal, Scanner, SpawnFlags, OptionGroup, MarkupParser, and Quark
* vapi/Makefile.am: add vala-1.0.vala
* vala-1.0.pc.in
* configure.ac: disable static library by default, add vala-1.0.pc
* Makefile.am: add vala-1.0.pc

svn path=/trunk/; revision=92

23 files changed:
vala/ChangeLog
vala/Makefile.am
vala/ccode/Makefile.am
vala/compiler/Makefile.am
vala/compiler/valacompiler.vala
vala/configure.ac
vala/vala-1.0.pc.in [new file with mode: 0644]
vala/vala/Makefile.am
vala/vala/valaclass.vala
vala/vala/valacodecontext.vala
vala/vala/valacodegenerator.vala
vala/vala/valaenum.vala
vala/vala/valainterface.vala
vala/vala/valainterfacewriter.vala
vala/vala/valanamespace.vala
vala/vala/valaparser.vala
vala/vala/valaproperty.vala
vala/vala/valasemanticanalyzer.vala
vala/vala/valasignal.vala
vala/vala/valastruct.vala
vala/vala/valasymbolbuilder.vala
vala/vapi/Makefile.am
vala/vapi/glib-2.0.vala

index 0234deb3a1c1951852c1d81194e4da5f93c3d5a0..86781b2dab2c2d367c84da0afeec8a6dc0123518 100644 (file)
@@ -1,3 +1,29 @@
+2006-08-05  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valaparser.vala: only parse .vala source files
+       * vala/valasymbolbuilder.vala, vala/valaproperty.vala: support disabling
+         automatic property accessor generation
+       * vala/valasemanticanalyzer.vala: fix typo
+       * vala/valacodegenerator.vala, vala/valainterfacewriter.vala,
+         vala/valacodecontext.vala: use correct includes for libraries
+       * vala/valacodegenerator.vala: use get_canonical_cconstant method for
+         signals
+       * vala/valainterfacewriter.vala: support interfaces, non-null types,
+         callbacks, and construction methods
+       * vala/valasignal.vala: add get_canonical_cconstant method
+       * vala/valaenum.vala, vala/valainterface.vala, vala/valanamespace.vala,
+         vala/valastruct: add default arguments
+       * vala/Makefile.am: install libvala.so and header files
+       * ccode/Makefile.am: install header files
+       * compiler/valacompiler.vala: set library name in code context
+       * compiler/Makefile.am: adapt to build system changes
+       * vapi/glib-2.0.vala: add skeletons for Callback, Closure, IOChannel,
+         TimeVal, Scanner, SpawnFlags, OptionGroup, MarkupParser, and Quark
+       * vapi/Makefile.am: add vala-1.0.vala
+       * vala-1.0.pc.in
+       * configure.ac: disable static library by default, add vala-1.0.pc
+       * Makefile.am: add vala-1.0.pc
+
 2006-08-02  Jürg Billeter  <j@bitron.ch>
 
        * configure.ac: Post-release version bump.
index ef9230beb8e17be5364b9538fcb971bafdae49e5..0466f1dcac89ad8f95fc2d18a010939e8d0ee6aa 100644 (file)
@@ -7,3 +7,8 @@ SUBDIRS = \
        vapi \
        tests \
        $(NULL)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = vala-1.0.pc
+
+EXTRA_DIST = vala-1.0.pc.in
index 94aa64feeaea6301c6b1a82f125779debf2a1de9..a41023ef4598af6f3a6b67ffa1a55db79657a7c9 100644 (file)
@@ -4,7 +4,7 @@ INCLUDES = \
        $(GLIB_CFLAGS) \
        $(NULL)
 
-BUILT_SOURCES = valaccode.vala.stamp
+BUILT_SOURCES = ccode.vala.stamp
 
 noinst_LTLIBRARIES = \
        libvalaccode.la
@@ -14,7 +14,7 @@ libvalaccode_la_VALASOURCES = \
        $(NULL)
 
 libvalaccode_la_SOURCES = \
-       valaccode.vala.stamp \
+       ccode.vala.stamp \
        valaccodeassignment.c \
        valaccodeassignment.h \
        valaccodeassignment.vala \
@@ -152,12 +152,62 @@ libvalaccode_la_SOURCES = \
        valaccodeelementaccess.vala \
        $(NULL)
 
-valaccode.vala valaccode.vala.stamp: $(filter %.vala,$(libvalaccode_la_SOURCES))
-       $(VALAC) --vapidir $(srcdir)/../vapi --library valaccode $^
+ccodeincludedir = $(includedir)/vala-1.0/ccode
+
+ccodeinclude_HEADERS = \
+       valaccodeassignment.h \
+       valaccodebinaryexpression.h \
+       valaccodeblock.h \
+       valaccodebreakstatement.h \
+       valaccodecasestatement.h \
+       valaccodecastexpression.h \
+       valaccodecommaexpression.h \
+       valaccodecomment.h \
+       valaccodeconditionalexpression.h \
+       valaccodeconstant.h \
+       valaccodecontinuestatement.h \
+       valaccodedeclaration.h \
+       valaccodedeclarator.h \
+       valaccodeemptystatement.h \
+       valaccodeenum.h \
+       valaccodeexpression.h \
+       valaccodeexpressionstatement.h \
+       valaccodeformalparameter.h \
+       valaccodeforstatement.h \
+       valaccodefragment.h \
+       valaccodefunction.h \
+       valaccodefunctioncall.h \
+       valaccodefunctiondeclarator.h \
+       valaccodeidentifier.h \
+       valaccodeifstatement.h \
+       valaccodeincludedirective.h \
+       valaccodeinitializerlist.h \
+       valaccodelinedirective.h \
+       valaccodemacroreplacement.h \
+       valaccodememberaccess.h \
+       valaccodemodifiers.h \
+       valaccodenewline.h \
+       valaccodenode.h \
+       valaccodeoncesection.h \
+       valaccodeparenthesizedexpression.h \
+       valaccodereturnstatement.h \
+       valaccodestatement.h \
+       valaccodestruct.h \
+       valaccodeswitchstatement.h \
+       valaccodetypedefinition.h \
+       valaccodeunaryexpression.h \
+       valaccodevariabledeclarator.h \
+       valaccodewhilestatement.h \
+       valaccodewriter.h \
+       valaccodeelementaccess.h \
+       $(NULL)
+
+ccode.vala ccode.vala.stamp: $(filter %.vala,$(libvalaccode_la_SOURCES))
+       $(VALAC) --vapidir $(srcdir)/../vapi --library ccode $^
        touch $@
 
 libvalaccode_la_LIBADD = \
        $(GLIB_LIBS) \
        $(NULL)
 
-EXTRA_DIST = valaccode.vala valaccode.vala.stamp
+EXTRA_DIST = ccode.vala ccode.vala.stamp
index 971d7d7869116fc9cf925e2cb142ba58df65fa57..9da684b95671e92f9526bf28ab5672efb37cce0e 100644 (file)
@@ -2,8 +2,6 @@ NULL =
 
 INCLUDES = \
        $(GLIB_CFLAGS) \
-       -I../ccode \
-       -I../vala \
        $(NULL)
 
 BUILT_SOURCES = valac.vala.stamp
@@ -20,12 +18,11 @@ valac_SOURCES = \
        $(NULL)
 
 valac.vala.stamp: $(filter %.vala,$(valac_SOURCES))
-       $(VALAC) --vapidir $(srcdir)/../vapi --vapidir ../ccode --pkg valaccode --vapidir ../vala --pkg vala $^
+       $(VALAC) --vapidir $(srcdir)/../vapi --vapidir ../ccode --pkg ccode --vapidir ../vala --pkg vala $^
        touch $@
 
 valac_LDADD = \
        $(GLIB_LIBS) \
-       ../ccode/libvalaccode.la \
        ../vala/libvala.la \
        $(NULL)
 
index 6ff6de52ef92de87a2365fa17f8b9d5591cce8df..90d4e09d15f28fd8b90609f814d05c314652f3e1 100644 (file)
@@ -93,6 +93,8 @@ class Vala.Compiler {
        private int run () {
                context = new CodeContext ();
                
+               context.library = library;
+               
                /* default package */
                if (!add_package ("glib-2.0")) {
                        Report.error (null, "glib-2.0 not found in specified Vala API directories");
index 29c186915f82a59714ef65178c175bd182bb6c16..e808a005cf30b609103e20bdcb8ca905ab292baa 100644 (file)
@@ -7,6 +7,7 @@ AM_MAINTAINER_MODE
 
 # Checks for programs.
 AC_PROG_CC
+AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 AM_PROG_LEX
 AC_PROG_YACC
@@ -25,6 +26,7 @@ AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
 AC_CONFIG_FILES([Makefile
+           vala-1.0.pc
            ccode/Makefile
            vala/Makefile
            compiler/Makefile
diff --git a/vala/vala-1.0.pc.in b/vala/vala-1.0.pc.in
new file mode 100644 (file)
index 0000000..7a6c50f
--- /dev/null
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+datarootdir=@datarootdir@
+datadir=@datadir@
+
+Name: Vala
+Description: The Vala compiler library
+Version: @VERSION@
+Requires: glib-2.0 gobject-2.0
+Libs: -L${libdir} -lvala
+Cflags: -I${includedir}/vala-1.0
index a0ab14065148720bc9a895380ee1c7c3332c184c..74eaff7a63072429592f215fbd6f4017dcd8f2f6 100644 (file)
@@ -2,13 +2,12 @@ NULL =
 
 INCLUDES = \
        $(GLIB_CFLAGS) \
-       -I ../ccode \
        $(NULL)
 
 BUILT_SOURCES = parser.h vala.vala.stamp
 AM_YFLAGS = -d
 
-noinst_LTLIBRARIES = \
+lib_LTLIBRARIES = \
        libvala.la
        $(NULL)
 
@@ -17,6 +16,9 @@ libvala_la_SOURCES = \
        scanner.l \
        vala.h \
        vala.vala.stamp \
+       valaarray.c \
+       valaarray.h \
+       valaarray.vala \
        valaassignment.c \
        valaassignment.h \
        valaassignment.vala \
@@ -278,13 +280,104 @@ libvala_la_SOURCES = \
        valawhilestatement.c \
        valawhilestatement.h \
        valawhilestatement.vala \
-       valaarray.c \
+       $(NULL)
+
+valaincludedir = $(includedir)/vala-1.0/vala
+
+valainclude_HEADERS = \
+       vala.h \
        valaarray.h \
-       valaarray.vala \
+       valaassignment.h \
+       valaattribute.h \
+       valaattributeprocessor.h \
+       valabinaryexpression.h \
+       valablock.h \
+       valabooleanliteral.h \
+       valabreakstatement.h \
+       valacallback.h \
+       valacastexpression.h \
+       valacharacterliteral.h \
+       valaclass.h \
+       valaclassregisterfunction.h \
+       valacodecontext.h \
+       valacodegenerator.h \
+       valacodenode.h \
+       valacodevisitor.h \
+       valaconditionalexpression.h \
+       valaconstant.h \
+       valaconstructor.h \
+       valacontinuestatement.h \
+       valadatatype.h \
+       valadeclarationstatement.h \
+       valadestructor.h \
+       valadostatement.h \
+       valaelementaccess.h \
+       valaemptystatement.h \
+       valaenum.h \
+       valaenumvalue.h \
+       valaexpression.h \
+       valaexpressionstatement.h \
+       valafield.h \
+       valaflags.h \
+       valaflagsvalue.h \
+       valaforeachstatement.h \
+       valaformalparameter.h \
+       valaforstatement.h \
+       valaifstatement.h \
+       valainitializerlist.h \
+       valainstancecast.h \
+       valaintegerliteral.h \
+       valainterface.h \
+       valainterfaceregisterfunction.h \
+       valainterfacewriter.h \
+       valainvocationexpression.h \
+       valalambdaexpression.h \
+       valaliteral.h \
+       valaliteralexpression.h \
+       valalocalvariabledeclaration.h \
+       valamemberaccess.h \
+       valamemberaccessibility.h \
+       valamemorymanager.h \
+       valamethod.h \
+       valanamedargument.h \
+       valanamespace.h \
+       valanamespacereference.h \
+       valanullliteral.h \
+       valaobjectcreationexpression.h \
+       valaparenthesizedexpression.h \
+       valaparser.h \
+       valapostfixexpression.h \
+       valapropertyaccessor.h \
+       valaproperty.h \
+       valarealliteral.h \
+       valareport.h \
+       valareturnstatement.h \
+       valasemanticanalyzer.h \
+       valasignal.h \
+       valasourcefile.h \
+       valasourcefilecycle.h \
+       valasourcereference.h \
+       valastatement.h \
+       valastringliteral.h \
+       valastruct.h \
+       valaswitchlabel.h \
+       valaswitchsection.h \
+       valaswitchstatement.h \
+       valasymbolbuilder.h \
+       valasymbol.h \
+       valasymbolresolver.h \
+       valatypecheck.h \
+       valatypeofexpression.h \
+       valatypeparameter.h \
+       valatypereference.h \
+       valatyperegisterfunction.h \
+       valaunaryexpression.h \
+       valavariabledeclarator.h \
+       valawhilestatement.h \
        $(NULL)
 
 vala.vala vala.vala.stamp: $(filter %.vala,$(libvala_la_SOURCES))
-       $(VALAC) --vapidir $(srcdir)/../vapi --vapidir ../ccode --pkg valaccode --library vala $^
+       $(VALAC) --vapidir $(srcdir)/../vapi --vapidir ../ccode --pkg ccode --library vala $^
        touch $@
 
 libvala_la_LIBADD = \
index 55de21b14205f1ada971b0cf7ca19e6b5eb0b962..03b8358d8cb0644ed132b30fbeceb67a407bedd3 100644 (file)
@@ -84,7 +84,7 @@ public class Vala.Class : DataType {
         * @param source reference to source code
         * @return       newly created class
         */
-       public construct (string! _name, SourceReference source) {
+       public construct (string! _name, SourceReference source = null) {
                name = _name;
                source_reference = source;
        }
index a56407995bf51315caa44541bbb7fc2a6081c0d8..7366362347581f7d81a9a976611f620e7d0e7f59 100644 (file)
@@ -26,6 +26,14 @@ using GLib;
  * The root of the code tree.
  */
 public class Vala.CodeContext {
+       /**
+        * Specifies the name of the library to be built.
+        *
+        * Public header files of a library will be assumed to be installed in
+        * a subdirectory named like the library.
+        */
+       public string library { get; set; }
+
        List<SourceFile> source_files;
        private Symbol! root = new Symbol ();
        
index c996f92bd3ba6068ab362d2661e7f8612abcd7ab..ff8d5f2e690ba787207afc3bc5037d61873ef4cb 100644 (file)
@@ -32,6 +32,8 @@ public class Vala.CodeGenerator : CodeVisitor {
         */
        public bool memory_management { get; set; }
        
+       private CodeContext context;
+       
        Symbol root_symbol;
        Symbol current_symbol;
        Symbol current_type_symbol;
@@ -74,6 +76,8 @@ public class Vala.CodeGenerator : CodeVisitor {
         * @param context a code context
         */
        public void emit (CodeContext! context) {
+               this.context = context;
+       
                context.find_header_cycles ();
 
                root_symbol = context.get_root ();
@@ -95,6 +99,14 @@ public class Vala.CodeGenerator : CodeVisitor {
                        }
                }
        }
+       
+       private ref CCodeIncludeDirective get_internal_include (string! filename) {
+               if (context.library != null) {
+                       return new CCodeIncludeDirective ("%s/%s".printf (context.library, filename));
+               } else {
+                       return new CCodeIncludeDirective (filename, true);
+               }
+       }
 
        public override void visit_begin_source_file (SourceFile! source_file) {
                header_begin = new CCodeFragment ();
@@ -123,7 +135,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                }
                foreach (string filename2 in source_file.get_header_internal_includes ()) {
                        if (used_includes.find_custom (filename2, strcmp) == null) {
-                               header_begin.append (new CCodeIncludeDirective (filename2, true));
+                               header_begin.append (get_internal_include (filename2));
                                used_includes.append (filename2);
                        }
                }
@@ -135,7 +147,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                }
                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));
+                               source_include_directives.append (get_internal_include (filename4));
                                used_includes.append (filename4);
                        }
                }
@@ -2321,7 +2333,7 @@ public class Vala.CodeGenerator : CodeVisitor {
                                ccall.add_argument (new CCodeIdentifier ("self"));
                        }
 
-                       ccall.add_argument (new CCodeConstant ("\"%s\"".printf (sig.name)));
+                       ccall.add_argument (sig.get_canonical_cconstant ());
 
                        ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier (m.get_cname ()), "GCallback"));
 
index 855e12b062a78a4366eb368aad424956d5da39c1..a7c67d0ac52ac7a85a4b45d575123cd156782e00 100644 (file)
@@ -37,7 +37,7 @@ public class Vala.Enum : DataType {
         * @param source reference to source code
         * @return       newly created enum
         */
-       public construct (string! _name, SourceReference source) {
+       public construct (string! _name, SourceReference source = null) {
                name = _name;
                source_reference = source;
        }
index d37fb950d8c4807d6a4851d701cbc9fb24ea4e3e..d878f6d089e171d47ff3dcebb19d8ae4e3be3cf5 100644 (file)
@@ -41,7 +41,7 @@ public class Vala.Interface : DataType {
         * @param source reference to source code
         * @return       newly created interface
         */
-       public construct (string! _name, SourceReference source) {
+       public construct (string! _name, SourceReference source = null) {
                name = _name;
                source_reference = source;
        }
index 46ca4608946da215bc37d3d8ae849ea1f1371d6a..12c42ce0caf5cb569560fce97d2226dbac646e1c 100644 (file)
@@ -26,6 +26,8 @@ using GLib;
  * Code visitor generating Vala API file for the public interface.
  */
 public class Vala.InterfaceWriter : CodeVisitor {
+       private CodeContext context;
+       
        File stream;
        
        int indent;
@@ -44,6 +46,8 @@ public class Vala.InterfaceWriter : CodeVisitor {
         * @param filename a relative or absolute filename
         */
        public void write_file (CodeContext! context, string! filename) {
+               this.context = context;
+       
                stream = File.open (filename, "w");
        
                /* we're only interested in non-pkg source files */
@@ -58,6 +62,10 @@ public class Vala.InterfaceWriter : CodeVisitor {
 
        public override void visit_begin_source_file (SourceFile! source_file) {
                current_cheader_filename = source_file.get_cheader_filename ();
+
+               if (context.library != null) {
+                       current_cheader_filename = "%s/%s".printf (context.library, current_cheader_filename);
+               }
        }
 
        public override void visit_begin_namespace (Namespace! ns) {
@@ -147,6 +155,30 @@ public class Vala.InterfaceWriter : CodeVisitor {
                write_newline ();
        }
 
+       public override void visit_begin_interface (Interface! iface) {
+               if (iface.access != MemberAccessibility.PUBLIC) {
+                       internal_scope = true;
+                       return;
+               }
+               
+               write_indent ();
+               write_string ("public ");
+               write_string ("interface ");
+               write_identifier (iface.name);
+
+               write_begin_block ();
+       }
+
+       public override void visit_end_interface (Interface! iface) {
+               if (iface.access != MemberAccessibility.PUBLIC) {
+                       internal_scope = false;
+                       return;
+               }
+               
+               write_end_block ();
+               write_newline ();
+       }
+
        public override void visit_begin_enum (Enum! en) {
                if (en.access != MemberAccessibility.PUBLIC) {
                        internal_scope = true;
@@ -212,46 +244,12 @@ public class Vala.InterfaceWriter : CodeVisitor {
                write_string (";");
                write_newline ();
        }
-
-       public override void visit_begin_method (Method! m) {
-               if (internal_scope || m.access != MemberAccessibility.PUBLIC || m.overrides) {
-                       return;
-               }
-               
-               write_indent ();
-               write_string ("public ");
-               
-               if (m.construction) {
-                       write_string ("construct ");
-               } else if (!m.instance) {
-                       write_string ("static ");
-               } else if (m.is_abstract) {
-                       write_string ("abstract ");
-               } else if (m.is_virtual) {
-                       write_string ("virtual ");
-               }
-               
-               if (!m.construction) {
-                       var type = m.return_type.data_type;
-                       if (type == null) {
-                               write_string ("void");
-                       } else {
-                               if (m.return_type.transfers_ownership) {
-                                       write_string ("ref ");
-                               }
-                               write_string (m.return_type.data_type.symbol.get_full_name ());
-                       }
-               }
-               
-               if (m.name != null) {
-                       write_string (" ");
-                       write_identifier (m.name);
-               }
-               
-               write_string (" (");
+       
+       private void write_params (List<FormalParameter> params) {
+               write_string ("(");
                
                bool first = true;
-               foreach (FormalParameter param in m.get_parameters ()) {
+               foreach (FormalParameter param in params) {
                        if (!first) {
                                write_string (", ");
                        } else {
@@ -277,8 +275,16 @@ public class Vala.InterfaceWriter : CodeVisitor {
                                }
                                write_string (">");
                        }
+
+                       if (param.type_reference.non_null) {
+                               write_string ("!");
+                       }
                        
                        write_string (" ");
+                       if (param.name == "callback" || param.name == "flags" ||
+                           param.name == "out") {
+                               write_string ("@");
+                       }
                        write_identifier (param.name);
                        
                        if (param.default_expression != null) {
@@ -287,7 +293,90 @@ public class Vala.InterfaceWriter : CodeVisitor {
                        }
                }
                
-               write_string (");");
+               write_string (")");
+       }
+
+       public override void visit_begin_callback (Callback! cb) {
+               if (internal_scope || cb.access != MemberAccessibility.PUBLIC) {
+                       return;
+               }
+               
+               write_indent ();
+               write_string ("public callback ");
+               
+               var type = cb.return_type.data_type;
+               if (type == null) {
+                       write_string ("void");
+               } else {
+                       if (cb.return_type.transfers_ownership) {
+                               write_string ("ref ");
+                       }
+                       write_string (cb.return_type.data_type.symbol.get_full_name ());
+               }
+               
+               write_string (" ");
+               write_identifier (cb.name);
+               
+               write_string (" ");
+               
+               write_params (cb.get_parameters ());
+
+               write_string (";");
+
+               write_newline ();
+       }
+
+       public override void visit_begin_method (Method! m) {
+               if (internal_scope || m.access != MemberAccessibility.PUBLIC || m.overrides) {
+                       return;
+               }
+               
+               write_indent ();
+               write_string ("public");
+               
+               if (m.construction) {
+                       write_string (" construct");
+               } else if (!m.instance) {
+                       write_string (" static");
+               } else if (m.is_abstract) {
+                       write_string (" abstract");
+               } else if (m.is_virtual) {
+                       write_string (" virtual");
+               }
+               
+               if (!m.construction) {
+                       write_string (" ");
+
+                       var type = m.return_type.data_type;
+                       if (type == null) {
+                               write_string ("void");
+                       } else {
+                               if (m.return_type.transfers_ownership) {
+                                       write_string ("ref ");
+                               }
+                               write_string (m.return_type.data_type.symbol.get_full_name ());
+                               if (m.return_type.non_null) {
+                                       write_string ("!");
+                               }
+                       }
+               }
+               
+               if (m.name != null) {
+                       write_string (" ");
+                       if (m.name == "class" || m.name == "construct" ||
+                           m.name == "foreach" || m.name == "get" ||
+                           m.name == "ref" || m.name == "set") {
+                               write_string ("@");
+                       }
+                       write_identifier (m.name);
+               }
+               
+               write_string (" ");
+               
+               write_params (m.get_parameters ());
+
+               write_string (";");
+
                write_newline ();
        }
 
index c242ec5e4afe8493fa41a64213756068957ea111..59cc2eaddea34eaa15e30ab2debd6f155c6988b3 100644 (file)
@@ -52,7 +52,7 @@ public class Vala.Namespace : CodeNode {
         * @param source reference to source code
         * @return       newly created namespace
         */
-       public construct (string _name, SourceReference source) {
+       public construct (string _name, SourceReference source = null) {
                name = _name;
                source_reference = source;
        }
index 80836a3939d21ae4aaccde72a2bcead4aa5603a4..c8749fd6b7386a9c0448fb09c523d5e67fa5293e 100644 (file)
@@ -40,8 +40,10 @@ public class Vala.Parser : CodeVisitor {
        }
 
        public override void visit_begin_source_file (SourceFile! source_file) {
-               parse_file (source_file);
-               source_file.comment = _file_comment;
+               if (source_file.filename.has_suffix (".vala")) {
+                       parse_file (source_file);
+                       source_file.comment = _file_comment;
+               }
        }
        
        public override void visit_end_source_file (SourceFile! source_file) {
index 811da79f7e55574a40e9123bfce1243e4cebdb54..69c28874d9cc73e6321248debed0b78a4b1a9d1f 100644 (file)
@@ -65,6 +65,12 @@ public class Vala.Property : CodeNode {
         */
        public bool no_accessor_method { get; set; }
        
+       /**
+        * Specifies whether automatic accessor code generation should be
+        * disabled.
+        */
+       public bool interface_only { get; set; }
+       
        /**
         * Creates a new property.
         *
index 5a6f39dc6d9cb3faccbf474cffbf07ca1d67a3ed..4b556c93a4b29263ca943c9337bec258589c5486 100644 (file)
@@ -185,7 +185,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                                                if (base_method.is_abstract || base_method.is_virtual) {
                                                        if (!m.equals (base_method)) {
                                                                m.error = true;
-                                                               Report.error (m.source_reference, "Return type and or parameters of overridding method `%s' do not match overridden method `%s'.".printf (m.symbol.get_full_name (), base_method.symbol.get_full_name ()));
+                                                               Report.error (m.source_reference, "Return type and or parameters of overriding method `%s' do not match overridden method `%s'.".printf (m.symbol.get_full_name (), base_method.symbol.get_full_name ()));
                                                                return;
                                                        }
                                                        
index d1aa4a16071f5a1534295c22ef812b3948910613..bdf90ddfa5a1642df5effc1c78bebc5263082ae2 100644 (file)
@@ -45,6 +45,8 @@ public class Vala.Signal : CodeNode {
        private List<FormalParameter> parameters;
        private Callback generated_callback;
 
+       private string cname;
+
        /**
         * Creates a new signal.
         *
@@ -99,6 +101,48 @@ public class Vala.Signal : CodeNode {
                
                return generated_callback;
        }
+
+       /**
+        * Returns the name of this signal as it is used in C code.
+        *
+        * @return the name to be used in C code
+        */
+       public string! get_cname () {
+               if (cname == null) {
+                       cname = name;
+               }
+               return cname;
+       }
+       
+       public void set_cname (string cname) {
+               this.cname = cname;
+       }
+       
+       /**
+        * Returns the string literal of this signal to be used in C code.
+        *
+        * @return string literal to be used in C code
+        */
+       public ref CCodeConstant! get_canonical_cconstant () {
+               var str = new String ("\"");
+               
+               string i = name;
+               
+               while (i.len () > 0) {
+                       unichar c = i.get_char ();
+                       if (c == '_') {
+                               str.append_c ('-');
+                       } else {
+                               str.append_unichar (c);
+                       }
+                       
+                       i = i.next_char ();
+               }
+               
+               str.append_c ('"');
+               
+               return new CCodeConstant (str.str);
+       }
        
        public override void accept (CodeVisitor! visitor) {
                visitor.visit_begin_signal (this);
index 2f1b805bbf54120d17ca27f55a308aaef157e2f3..714e59ea6be0a6fc66c31bcd603ef24e51f9a17c 100644 (file)
@@ -51,7 +51,7 @@ public class Vala.Struct : DataType {
         * @param source reference to source code
         * @return       newly created struct
         */
-       public construct (string! _name, SourceReference source) {
+       public construct (string! _name, SourceReference source = null) {
                name = _name;
                source_reference = source;
        }
index 501dda9b383d1fe914333dbeeecbac30e818f93d..f5e7328f38ee3ca59e4faf125e201a3958405460 100644 (file)
@@ -276,6 +276,10 @@ public class Vala.SymbolBuilder : CodeVisitor {
                        /* no accessor body specified, insert default body */
                        
                        var prop = (Property) acc.symbol.parent_symbol.node;
+               
+                       if (prop.interface_only) {
+                               return;
+                       }
                        
                        var block = new Block ();
                        if (acc.readable) {
index a87b9584d744af3f9b5bc76c889e61e6220cc14b..efeaaf23c1038ba982fcc79ace1f3902fa491bd5 100644 (file)
@@ -2,9 +2,13 @@ NULL =
 
 vapidir = $(pkgdatadir)/vapi
 
+vala-1.0.vala: ../ccode/ccode.vala ../vala/vala.vala
+       cat $^ > $@
+
 dist_vapi_DATA = \
        glib-2.0.vala \
        libxml-2.0.vala \
        gtk+-2.0.vala \
        pango.vala \
+       vala-1.0.vala \
        $(NULL)
index 0a8f4032b80ee2782530f75bcf617d6fbf8176c9..9c187338c88f046c51582fa9794980439e7b5d80 100644 (file)
@@ -219,6 +219,11 @@ namespace GLib {
                public Object get_object ();
        }
        
+       public callback void Callback ();
+       
+       public struct Closure {
+       }
+       
        [ReferenceType (dup_function = "g_main_loop_ref", free_function = "g_main_loop_unref")]
        public struct MainLoop {
                public construct (MainContext context, bool is_running);
@@ -282,6 +287,10 @@ namespace GLib {
        }
        
        public static pointer malloc0 (ulong n_bytes);
+       
+       [ReferenceType ()]
+       public struct IOChannel {
+       }
 
        [ReferenceType ()]
        public struct Error {
@@ -303,6 +312,9 @@ namespace GLib {
                public static ref string decode (string! text, ref ulong out_len);
        }
        
+       public struct TimeVal {
+       }
+       
        public struct Environment {
                [CCode (cname = "g_get_application_name")]
                public static string get_application_name ();
@@ -322,6 +334,15 @@ namespace GLib {
                [CCode (cname = "g_build_filename")]
                public static ref string build_filename (string first_element, ...);
        }
+       
+       [ReferenceType (free_function = "g_scanner_destroy")]
+       public struct Scanner {
+       }
+       
+       public enum SpawnFlags {
+       }
+       
+       public callback void SpawnChildSetupFunc (pointer user_data);
 
        public enum FileTest {
                IS_REGULAR,
@@ -436,6 +457,40 @@ namespace GLib {
                string arg_description;
        }
        
+       [ReferenceType ()]
+       public struct OptionGroup {
+       }
+       
+       [CCode (cprefix = "G_MARKUP_")]
+       public enum MarkupParseFlags {
+               TREAT_CDATA_AS_TEXT
+       }
+       
+       [ReferenceType (free_function = "g_markup_parse_context_free")]
+       public struct MarkupParseContext {
+               public construct (MarkupParser parser, MarkupParseFlags _flags, pointer user_data, DestroyNotify user_data_dnotify);
+               public bool parse (string text, long text_len, out Error error);
+       }
+       
+       public callback void MarkupParserStartElementFunc (MarkupParseContext context, string element_name, string[] attribute_names, string[] attribute_values, pointer user_data, out Error error);
+       
+       public callback void MarkupParserEndElementFunc (MarkupParseContext context, string element_name, pointer user_data, out Error error);
+       
+       public callback void MarkupParserTextFunc (MarkupParseContext context, string text, ulong text_len, pointer user_data, out Error error);
+       
+       public callback void MarkupParserPassthroughFunc (MarkupParseContext context, string passthrough_text, ulong text_len, pointer user_data, out Error error);
+       
+       public callback void MarkupParserErrorFunc (MarkupParseContext context, Error error, pointer user_data);
+       
+       [ReferenceType (free_function = "g_free")]
+       public struct MarkupParser {
+               public MarkupParserStartElementFunc start_element;
+               public MarkupParserEndElementFunc end_element;
+               public MarkupParserTextFunc text;
+               public MarkupParserPassthroughFunc passthrough;
+               public MarkupParserErrorFunc error;
+       }
+       
        [ReferenceType (dup_function = "g_list_copy", free_function = "g_list_free")]
        public struct List<G> {
                [ReturnsModifiedPointer ()]
@@ -576,4 +631,9 @@ namespace GLib {
                public long len;
                public long allocated_len;
        }
+       
+       public struct Quark {
+               public static Quark from_string (string string);
+               public string to_string ();
+       }
 }