From: Florian Brosch Date: Sun, 9 Nov 2008 22:46:42 +0000 (+0000) Subject: - libvaladoc - yields-keyword - dynamic-keyword X-Git-Tag: 0.37.1~3^2~619 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1be50bad1b50b32d34cf31e156e5250b414a41c;p=thirdparty%2Fvala.git - libvaladoc - yields-keyword - dynamic-keyword - libvaladoc - yields-keyword - dynamic-keyword - html-doclet, devhelp-doclet - global namespace: - navigation fixes - content list improvements svn path=/trunk/; revision=15 --- diff --git a/src/doclets/devhelp/doclet/template.vala b/src/doclets/devhelp/doclet/template.vala index b4d78ee60..360d27738 100644 --- a/src/doclets/devhelp/doclet/template.vala +++ b/src/doclets/devhelp/doclet/template.vala @@ -444,6 +444,9 @@ public class Valadoc.HtmlDoclet : Valadoc.BasicHtmlDoclet, Valadoc.HtmlHelper { this.write_file_footer ( file ); file = null; } + + public override void cleanups () { + } } diff --git a/src/doclets/html/doclet/template.vala b/src/doclets/html/doclet/template.vala index 95e74a53d..70f029d05 100644 --- a/src/doclets/html/doclet/template.vala +++ b/src/doclets/html/doclet/template.vala @@ -147,8 +147,7 @@ public class Valadoc.HtmlDoclet : Valadoc.BasicHtmlDoclet, Valadoc.LinkHelper { private Gee.ArrayList source_namespaces = new Gee.ArrayList (); private Gee.ArrayList files = new Gee.ArrayList (); - - ~HtmlDoclet () { + public override void cleanups () { this.directory_level = 0; copy_directory ( Config.doclet_path + "deps/", this.settings.path ); diff --git a/src/doclets/htmlhelpers/Makefile.am b/src/doclets/htmlhelpers/Makefile.am index 0258e3aab..156e0b8d1 100644 --- a/src/doclets/htmlhelpers/Makefile.am +++ b/src/doclets/htmlhelpers/Makefile.am @@ -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 $@ diff --git a/src/doclets/htmlhelpers/htmlhelpers.vala b/src/doclets/htmlhelpers/htmlhelpers.vala index 0e8395b6e..214bd6c63 100644 --- a/src/doclets/htmlhelpers/htmlhelpers.vala +++ b/src/doclets/htmlhelpers/htmlhelpers.vala @@ -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 ( "weak ", css_keyword ); + modifiers.append ( "weak " ); + + if ( modifiers.len > 0 ) + file.printf ( "%s ", 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 ( " yields ", 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 ( " %s ", css_keyword, modifiers.str ); - file.printf ( " %s ", 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 ( " signal ", 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 ( "
    \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 ( "
\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 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 nsl = nh.get_namespace_list (); if ( nsl.size > 0 ) { file.printf ( "

Namespaces:

\n", css_title ); file.printf ( "
    \n", css_inline_navigation ); foreach ( Namespace ns in nsl ) { if ( ns.name != null ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_namespace, css_navi_link, this.get_link(ns, nh), ns.name ); + file.printf ( "\t
  • %s
  • \n", css_inline_navigation_namespace, css_navi_link, this.get_link(ns, (mself == null)? nh : mself), ns.name ); } } file.puts ( "
\n" ); @@ -1868,7 +1891,11 @@ public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { ns.write_comment ( file ); file.printf ( "\n\t\t\t\t

Content:

\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 ); diff --git a/src/doclets/valadoc.org/doclet/template.vala b/src/doclets/valadoc.org/doclet/template.vala index 277eaae36..aa3dcf99f 100644 --- a/src/doclets/valadoc.org/doclet/template.vala +++ b/src/doclets/valadoc.org/doclet/template.vala @@ -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 () { + } } diff --git a/src/libvaladoc/doclet.vala b/src/libvaladoc/doclet.vala index 56326a4aa..9e85c8be3 100755 --- a/src/libvaladoc/doclet.vala +++ b/src/libvaladoc/doclet.vala @@ -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 ); diff --git a/src/libvaladoc/doctree.vala b/src/libvaladoc/doctree.vala index e51c8df39..cf475f81b 100755 --- a/src/libvaladoc/doctree.vala +++ b/src/libvaladoc/doctree.vala @@ -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; diff --git a/src/libvaladoc/parser.vala b/src/libvaladoc/parser.vala index 2fb154170..d093ed377 100644 --- a/src/libvaladoc/parser.vala +++ b/src/libvaladoc/parser.vala @@ -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 ; diff --git a/src/valadoc/valadoc.vala b/src/valadoc/valadoc.vala index b94f306d1..dfe19cb6b 100755 --- a/src/valadoc/valadoc.vala +++ b/src/valadoc/valadoc.vala @@ -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 (); }