]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
- libvaladoc - yields-keyword - dynamic-keyword
authorFlorian Brosch <flobrosch@src.gnome.org>
Sun, 9 Nov 2008 22:46:42 +0000 (22:46 +0000)
committerFlorian Brosch <flobrosch@src.gnome.org>
Sun, 9 Nov 2008 22:46:42 +0000 (22:46 +0000)
 - libvaladoc
  - yields-keyword
  - dynamic-keyword

 - html-doclet, devhelp-doclet
  - global namespace:
   - navigation fixes
   - content list improvements

svn path=/trunk/; revision=15

src/doclets/devhelp/doclet/template.vala
src/doclets/html/doclet/template.vala
src/doclets/htmlhelpers/Makefile.am
src/doclets/htmlhelpers/htmlhelpers.vala
src/doclets/valadoc.org/doclet/template.vala
src/libvaladoc/doclet.vala
src/libvaladoc/doctree.vala
src/libvaladoc/parser.vala
src/valadoc/valadoc.vala

index b4d78ee602005d4812ac6374c680401de61b0435..360d27738663e443bee45e533f5570328a2b9e34 100644 (file)
@@ -444,6 +444,9 @@ public class Valadoc.HtmlDoclet : Valadoc.BasicHtmlDoclet, Valadoc.HtmlHelper {
                this.write_file_footer ( file );
                file = null;
        }
+
+       public override void cleanups () {
+       }
 }
 
 
index 95e74a53d54ef4018c5cb1456b4a9e9cf6a5bd94..70f029d05579c955fcab56e96280a1a50c4f2d08 100644 (file)
@@ -147,8 +147,7 @@ public class Valadoc.HtmlDoclet : Valadoc.BasicHtmlDoclet, Valadoc.LinkHelper {
        private Gee.ArrayList<Namespace> source_namespaces = new Gee.ArrayList<Namespace> ();
        private Gee.ArrayList<Package> files = new Gee.ArrayList<Package> ();
 
-
-       ~HtmlDoclet () {
+       public override void cleanups () {
                this.directory_level = 0;
                copy_directory ( Config.doclet_path + "deps/", this.settings.path );
 
index 0258e3aab0a9935e8dc2ddf95e6d67994efde602..156e0b8d163d491aa5ff9c73e9f44cb0f418d387 100644 (file)
@@ -11,7 +11,7 @@ BUILT_SOURCES = libhtmlhelpers.vala.stamp
 
 
 libhtmlhelpers.vala.stamp: $(libhtmlhelpers_VALASOURCES)
-       $(VALAC) -C --library libhtmlhelpers-1.0 --basedir . --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^
+       $(VALAC) -C --library libhtmlhelpers-1.0 --basedir . --vapidir ../../vapi --pkg valadoc-1.0 --disable-non-null $^
        touch $@
 
 
index 0e8395b6edcb41c1a825eb3cfad2a55354369913..214bd6c63ae1a0bb389be046bc1ec38fa9de460f 100644 (file)
@@ -357,8 +357,18 @@ public abstract class Valadoc.BasicHtmlLanglet : Valadoc.Langlet {
                if ( type_reference.type_name == null )
                        return ;
 
+
+               GLib.StringBuilder modifiers = new GLib.StringBuilder ();
+
+               if ( type_reference.is_dynamic )
+                       modifiers.append ( "dynamic " );
+
                if ( type_reference.is_weak )
-                       file.printf ( "<font class=\"%s\">weak</font> ", css_keyword );
+                       modifiers.append ( "weak " );
+
+               if ( modifiers.len > 0 )
+                       file.printf ( "<font class=\"%s\">%s</font> ", css_keyword, modifiers.str );
+
 
                this.write_type_reference_name ( type_reference, file );
                this.write_type_reference_template_arguments ( type_reference, file );
@@ -495,9 +505,9 @@ public abstract class Valadoc.BasicHtmlLanglet : Valadoc.Langlet {
 
                if ( m.is_abstract )
                        modifiers.append ( " abstract" );
-               if ( m.is_virtual )
+               else if ( m.is_virtual )
                        modifiers.append ( " virtual" );
-               if ( m.is_override )
+               else if ( m.is_override )
                        modifiers.append ( " override" );
                if ( m.is_static )
                        modifiers.append ( " static" );
@@ -509,6 +519,10 @@ public abstract class Valadoc.BasicHtmlLanglet : Valadoc.Langlet {
                file.puts ( m.name );
                file.puts ( " " );
                this.write_parameter_list ( m, file );
+
+               if ( m.is_yields )
+                       file.printf ( " <span class=\"%s\">yields</span> ", css_keyword );
+
                this.write_exception_list ( m, file );
        }
 
@@ -598,13 +612,14 @@ public abstract class Valadoc.BasicHtmlLanglet : Valadoc.Langlet {
 
                if ( prop.is_virtual )
                        modifiers.append ( " virtual " );
-               if ( prop.is_abstract )
+               else if ( prop.is_abstract )
                        modifiers.append ( " abstract " );
-               if ( prop.is_override )
+               else if ( prop.is_override )
                        modifiers.append ( " override " );
 
+               if ( modifiers.len > 0 )
+                       file.printf ( " <span class=\"%s\">%s</span> ", css_keyword, modifiers.str );
 
-               file.printf ( " <span class=\"%s\">%s</span> ", css_keyword, modifiers.str );
                this.write_type_reference ( prop.return_type, file );
                file.printf ( " %s { ", prop.name );
 
@@ -627,6 +642,7 @@ public abstract class Valadoc.BasicHtmlLanglet : Valadoc.Langlet {
                this.write_accessor ( sig, file );
 
                file.printf ( " <span class=\"%s\">signal</span> ", css_keyword );
+
                this.write_type_reference ( sig.return_type, file );
                file.printf ( " %s ", sig.name );
                this.write_parameter_list ( sig, file );
@@ -832,8 +848,9 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
 
                if ( mself == null )
                        mself = element;
-               else if ( mself.name == null )
-                       mself = mself.parent;
+
+//             else if ( mself.name == null )
+//                     mself = mself.parent;
 
                string package_name = element.file.name;
 
@@ -846,9 +863,7 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
 
                for ( int i = lst.size-1; i >= 0  ; i-- ) {
                        Basic el = lst.get ( i );
-                       if ( el.name != null ) {
-                               this.write_navi_top_entry ( file, el, mself );
-                       }
+                       this.write_navi_top_entry ( file, el, mself );
                }
        }
 
@@ -910,6 +925,11 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
 
        protected void write_navi_child_namespaces_inline ( GLib.FileStream file, Namespace ns, Basic mself ) {
                file.printf ( "<ul class=\"%s\">\n", css_navi );
+
+               if ( ns.name == null ) {
+                       this.write_navi_child_namespaces_without_childs ( file, (Package)ns.parent, ns );
+               }
+
                this.write_navi_child_namespaces_inline_withouth_block ( file, ns, mself );
                file.puts ( "</ul>\n" );
        }
@@ -1348,6 +1368,9 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
        protected void write_navi_child_namespaces_without_childs ( GLib.FileStream file, NamespaceHandler nsh, Basic mself ) {
                Gee.ReadOnlyCollection<Namespace> namespaces = nsh.get_namespace_list ( );
                foreach ( Namespace ns in namespaces ) {
+                       if ( ns.name == null )
+                               continue ;
+
                        if ( ns == mself )
                                this.write_navi_entry ( file, ns, mself, css_navi_namespace, false );
                        else
@@ -1543,14 +1566,14 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                }
        }
 
-       protected void write_child_namespaces ( GLib.FileStream file, NamespaceHandler nh ) {
+       protected void write_child_namespaces ( GLib.FileStream file, NamespaceHandler nh, Basic? mself = null ) {
                Gee.ReadOnlyCollection<Namespace> nsl = nh.get_namespace_list ();
                if ( nsl.size > 0 ) {
                        file.printf ( "<h3 class=\"%s\">Namespaces:</h3>\n", css_title );
                        file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
                        foreach ( Namespace ns in nsl ) {
                                if ( ns.name != null ) {
-                                       file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_namespace, css_navi_link, this.get_link(ns, nh), ns.name );
+                                       file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", css_inline_navigation_namespace, css_navi_link, this.get_link(ns, (mself == null)? nh : mself), ns.name );
                                }
                        }
                        file.puts ( "</ul>\n" );
@@ -1868,7 +1891,11 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet {
                ns.write_comment ( file );
 
                file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
-               this.write_child_namespaces ( file, ns );
+               if ( ns.name == null )
+                       this.write_child_namespaces ( file, (Package)ns.parent, ns );
+               else
+                       this.write_child_namespaces ( file, ns );
+
                this.write_child_classes ( file, ns );
                this.write_child_interfaces ( file, ns );
                this.write_child_structs ( file, ns );
index 277eaae360d6459923a93b724efddd1bef989b52..aa3dcf99f8ff2a3d5b3b5d32aeba40af6d61b1d6 100644 (file)
@@ -410,6 +410,9 @@ public class Valadoc.HtmlDoclet : Valadoc.BasicHtmlDoclet, Valadoc.LinkHelper {
                this.write_method_content ( file, m, parent );
                file = null;
        }
+
+       public override void cleanups () {
+       }
 }
 
 
index 56326a4aae869f324dda53fa04b568e573a007b0..9e85c8be3dacc5ce0d23ec90d9e9860f1ddb2bd6 100755 (executable)
@@ -29,6 +29,9 @@ public static delegate Type Valadoc.DocletRegisterFunction ( );
 public abstract class Valadoc.Doclet : GLib.Object {
        public abstract void initialisation ( Settings settings );
 
+       // walkarround for a strage bug
+       public abstract void cleanups ( );
+
        public abstract void visit_package ( Package pkg );
 
        public abstract void visit_namespace ( Namespace ns );
index e51c8df390940c9ebaa89d882360324eb3e9478f..cf475f81b238d5ecd782bf07109eaf1c1e8e26ef 100755 (executable)
@@ -1803,6 +1803,12 @@ public class Valadoc.TypeReference : Basic {
                }
                return true;
        }
+       
+       public bool is_dynamic {
+               get {
+                       return this.vtyperef.is_dynamic;
+               }
+       }
 
        public bool is_weak {
                get {
@@ -2419,6 +2425,12 @@ public class Valadoc.Method : Basic, ParameterListHandler, ExceptionHandler, Tem
                private get;
        }
 
+       public bool is_yields {
+               get {
+                       return this.vmethod.coroutine;
+               }
+       }
+
        public bool is_abstract {
                get {
                        return this.vmethod.is_abstract;
index 2fb154170c1295658068d6fcf29a77a6bc149398..d093ed3775e18c6ef964ebb68fb8adbd115a3d47 100644 (file)
@@ -490,7 +490,7 @@ public class Parser : Object {
                                pos = 0;
 
                                this.skip_deadh_zone ( ref str, ref chr, linenr, ref pos );
-                               this.set_prev_chr ( out prevchr, out prevprevchr, 'p' );
+//                             this.set_prev_chr ( out prevchr, out prevprevchr, 'p' );
                                return buf.str;
                        }
 
@@ -559,7 +559,6 @@ public class Parser : Object {
                return true;
        }
 
-       // add a line counter!!
        private inline void skip_spaces ( ref string str, ref int pos ) {
                for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
                        pos++;
@@ -576,6 +575,8 @@ public class Parser : Object {
                str = str.next_char();
                pos++;
 
+               string tagline = linestart;
+
                string? currtagname = "";
                unichar prevprevchr = '\0';
                unichar prevchr = '\0';
@@ -597,6 +598,9 @@ public class Parser : Object {
                if ( tagname == null )
                        return null;
 
+               str = str.next_char();
+//             pos++;
+
                if ( !this.taglets.contains( tagname ) ) {
                        string line = this.extract_line ( linestart );
                        string reportmsg = "Taglet '%s' is not registered.\n".printf( tagname );
@@ -613,6 +617,7 @@ public class Parser : Object {
                        return null;
                }
 
+
                for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
                        pos++;
 
@@ -622,6 +627,15 @@ public class Parser : Object {
                                continue ;
                        }
 
+                       tmp = this.newline_handler ( buf, ref linestart, ref str, ref linenr, ref pos, ref linestartnr, ref chr, ref prevchr, ref prevprevchr );
+                       if ( chr == '\0' ) {
+                               stdout.printf ( ">>WTF<<\n" );
+                               break;
+                       }
+                       else if ( tmp == true ) {
+                               continue;
+                       }
+
                        tmp = this.skip_double_spaces ( ref str, buf, chr, ref prevchr, ref prevprevchr );
                        if ( tmp == true )
                                continue ;
@@ -633,8 +647,8 @@ public class Parser : Object {
 
                                InlineTaglet rtag = ((InlineTaglet)tag);
                                rtag.init ( );
-                               //rtag.parse ( this.settings, tree, this.reporter, linestart.offset(1), linenr, pos, me, buf.str );
-                               rtag.parse ( this.settings, tree, this.reporter, linestart.offset(1), taglinenr, tagpos, me, buf.str );
+
+                               rtag.parse ( this.settings, tree, this.reporter, tagline.offset(1), taglinenr, tagpos, me, buf.str );
                                return rtag;
                        }
 
@@ -697,6 +711,27 @@ public class Parser : Object {
                return false;
        }
 
+       private bool newline_handler ( GLib.StringBuilder buf, ref string linestart, ref string str, ref int linenr, ref int pos, ref int linestartnr, ref unichar chr, ref unichar prevchr, ref unichar prevprevchr ) {
+               if ( chr == '\n' ) {
+                       linestartnr = linenr;
+                       linestart = str;
+                       linenr++;
+                       pos = 0;
+
+                       this.skip_deadh_zone ( ref str, ref chr, linenr, ref pos );
+                       if ( chr == '\0' )
+                               return false;
+
+                       if ( prevchr == '\n' ) {
+                               buf.append_unichar ( '\n' );
+                       }
+
+                       this.set_prev_chr ( out prevchr, out prevprevchr, '\n' );
+                       return true;
+               }
+               return false;
+       }
+
        public DocumentationTree? parse ( Valadoc.Tree tree, Valadoc.Basic me, string str2 ) {
                string str = str2;
 
@@ -735,28 +770,14 @@ public class Parser : Object {
                                continue ;
                        }
 
-                       if ( chr == '\n' ) {
-                               linestartnr = linenr;
-                               linestart = str;
-                               linenr++;
-                               pos = 0;
-
-                               this.skip_deadh_zone ( ref str, ref chr, linenr, ref pos );
-                               if ( chr == '\0' )
-                                       break;
-
-                               if ( prevchr == '\n' ) {
-                                       buf.append_unichar ( '\n' );
-                               }
-
-                               this.set_prev_chr ( out prevchr, out prevprevchr, '\n' );
-                               continue ;
+                       tmp = this.newline_handler ( buf, ref linestart, ref str, ref linenr, ref pos, ref linestartnr, ref chr, ref prevchr, ref prevprevchr );
+                       if ( chr == '\0' ) {
+                               break;
                        }
-/*
-                       if ( prevchr == '\n' && prevprevchr == '\n' ) {
-                                       buf.append_unichar ( '\n' );
+                       else if ( tmp == true ) {
+                               continue;
                        }
-*/
+
                        tmp = this.skip_double_spaces ( ref str, buf, chr, ref prevchr, ref prevprevchr );
                        if ( tmp == true )
                                continue ;
index b94f306d1e7353aac77e8a84b51e0dd63f7135b4..dfe19cb6b6d941bf6c71df547e1aa3e82594b152 100755 (executable)
@@ -540,14 +540,14 @@ public class ValaDoc : Object {
                        return 1;
 
 
-
-
                doclet.initialisation ( settings );
 
+               doctree.visit ( doclet );
 
+               doclet.cleanups ( );
 
-               doctree.visit ( doclet );
                doclet = null;
+               settings = null;
                doctree = null;
                return quit ();
        }