~ubuntu-branches/ubuntu/maverick/vala/maverick

« back to all changes in this revision

Viewing changes to vala/valacodewriter.vala

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-04-02 10:10:55 UTC
  • mfrom: (1.4.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100402101055-qbx3okzv0tnp3wpp
Tags: 0.8.0-0ubuntu1
* New upstream release:
  - Infer type arguments when calling generic methods.
  - Support `in' operator for arrays.
  - Add experimental support for regular expression literals.
  - Add experimental support for chained relational expressions.
  - Add va_list support.
  - Add clutter-gtk-0.10 bindings (Gordon Allott).
  - Add gdl-1.0 bindings (Nicolas Joseph).
  - Add gstreamer-app-0.10 bindings (Sebastian Dröge).
  - Add gstreamer-cdda-0.10 bindings (Sebastian Dröge).
  - Add gudev-1.0 bindings (Jim Nelson).
  - Add libgda-report-4.0 bindings (Shawn Ferris).
  - Add libgvc (graphviz) bindings (Martin Olsson).
  - Add purple bindings (Adrien Bustany).
  - Many bug fixes and binding updates.
* debian/patches/99_ltmain_as-needed.patch: refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* valacodewriter.vala
2
2
 *
3
 
 * Copyright (C) 2006-2009  Jürg Billeter
 
3
 * Copyright (C) 2006-2010  Jürg Billeter
4
4
 * Copyright (C) 2006-2008  Raffaele Sandrini
5
5
 *
6
6
 * This library is free software; you can redistribute it and/or
70
70
                this.context = context;
71
71
        
72
72
                stream = FileStream.open (filename, "w");
 
73
                if (stream == null) {
 
74
                        Report.error (null, "unable to open `%s' for writing".printf (filename));
 
75
                        return;
 
76
                }
73
77
 
74
 
                write_string ("/* %s generated by %s, do not modify. */".printf (Path.get_basename (filename), Environment.get_prgname ()));
 
78
                var header = context.version_header ?
 
79
                        "/* %s generated by %s %s, do not modify. */".printf (Path.get_basename (filename), Environment.get_prgname (), Config.BUILD_VERSION) :
 
80
                        "/* %s generated by %s, do not modify. */".printf (Path.get_basename (filename), Environment.get_prgname ());
 
81
                write_string (header);
75
82
                write_newline ();
76
83
                write_newline ();
77
84
 
623
630
                bool custom_cname = (f.get_cname () != f.get_default_cname ());
624
631
                bool custom_ctype = (f.get_ctype () != null);
625
632
                bool custom_cheaders = (f.parent_symbol is Namespace);
626
 
                if (custom_cname || custom_ctype || custom_cheaders || (f.no_array_length && f.field_type is ArrayType)) {
 
633
                bool custom_array_length_cname = (f.get_array_length_cname () != null);
 
634
                bool custom_array_length_type = (f.array_length_type != null);
 
635
                if (custom_cname || custom_ctype || custom_cheaders || custom_array_length_cname || custom_array_length_type || (f.no_array_length && f.field_type is ArrayType)) {
627
636
                        write_indent ();
628
637
                        write_string ("[CCode (");
629
638
 
647
656
                                write_string ("cheader_filename = \"%s\"".printf (get_cheaders(f)));
648
657
                        }
649
658
 
650
 
                        if (f.no_array_length && f.field_type is ArrayType) {
651
 
                                if (custom_cname || custom_ctype || custom_cheaders) {
652
 
                                        write_string (", ");
653
 
                                }
654
 
 
655
 
                                write_string ("array_length = false");
656
 
 
657
 
                                if (f.array_null_terminated) {
658
 
                                        write_string (", array_null_terminated = true");
 
659
                        if (f.field_type is ArrayType) {
 
660
                                if (f.no_array_length) {
 
661
                                        if (custom_cname || custom_ctype || custom_cheaders) {
 
662
                                                write_string (", ");
 
663
                                        }
 
664
 
 
665
                                        write_string ("array_length = false");
 
666
 
 
667
                                        if (f.array_null_terminated) {
 
668
                                                write_string (", array_null_terminated = true");
 
669
                                        }
 
670
                                } else {
 
671
                                        if (custom_array_length_cname) {
 
672
                                                if (custom_cname || custom_ctype || custom_cheaders) {
 
673
                                                        write_string (", ");
 
674
                                                }
 
675
 
 
676
                                                write_string ("array_length_cname = \"%s\"".printf (f.get_array_length_cname ()));
 
677
                                        }
 
678
 
 
679
                                        if (custom_array_length_type) {
 
680
                                                if (custom_cname || custom_ctype || custom_cheaders || custom_array_length_cname) {
 
681
                                                        write_string (", ");
 
682
                                                }
 
683
 
 
684
                                                write_string ("array_length_type = \"%s\"".printf (f.array_length_type));
 
685
                                        }
659
686
                                }
660
687
                        }
661
688
 
798
825
 
799
826
                if (!cb.has_target) {
800
827
                        write_string (", has_target = false");
 
828
                } else if (!float_equal (cb.cinstance_parameter_position, -2)) {
 
829
                        write_string (", instance_pos = %g".printf (cb.cinstance_parameter_position));
801
830
                }
802
831
 
803
832
                write_string (")]");
1016
1045
                write_identifier (prop.name);
1017
1046
                write_string (" {");
1018
1047
                if (prop.get_accessor != null) {
1019
 
                        if (prop.get_accessor.value_type.is_disposable ()) {
 
1048
                        if (context.profile != Profile.DOVA && prop.get_accessor.value_type.is_disposable ()) {
1020
1049
                                write_string (" owned");
1021
1050
                        }
1022
1051
 
1024
1053
                        write_code_block (prop.get_accessor.body);
1025
1054
                }
1026
1055
                if (prop.set_accessor != null) {
1027
 
                        if (prop.set_accessor.value_type.value_owned) {
1028
 
                                write_string ("owned ");
 
1056
                        if (context.profile != Profile.DOVA && prop.set_accessor.value_type.value_owned) {
 
1057
                                write_string (" owned");
1029
1058
                        }
1030
1059
 
1031
1060
                        if (prop.set_accessor.writable) {
1662
1691
        private void write_identifier (string s) {
1663
1692
                char* id = (char*)s;
1664
1693
                int id_length = (int)s.length;
1665
 
                if ( Vala.Scanner.get_identifier_or_keyword (id, id_length) != Vala.TokenType.IDENTIFIER ||
1666
 
                     s.get_char ().isdigit ()) {
 
1694
                if (context.profile != Profile.DOVA &&
 
1695
                    (Vala.Scanner.get_identifier_or_keyword (id, id_length) != Vala.TokenType.IDENTIFIER ||
 
1696
                     s.get_char ().isdigit ())) {
1667
1697
                        stream.putc ('@'); 
1668
1698
                }
1669
1699
                write_string (s);