]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: package view
authorFlorian Brosch <flobrosch@src.gnome.org>
Mon, 3 Nov 2008 00:25:13 +0000 (00:25 +0000)
committerFlorian Brosch <flobrosch@src.gnome.org>
Mon, 3 Nov 2008 00:25:13 +0000 (00:25 +0000)
libvaladoc:
 * package view

svn path=/trunk/; revision=9

src/doclets/devhelp/doclet/template.vala
src/doclets/devhelp/linkhelper/helper.vala
src/doclets/html/doclet/template.vala
src/doclets/html/linkhelper/helper.vala
src/doclets/valadoc.org/doclet/template.vala
src/doclets/valadoc.org/linkhelper/helper.vala
src/libvaladoc/doclet.vala
src/libvaladoc/doctree.vala
src/libvaladoc/langlet.vala

index 62e3038630d6b6a124edfc21e01c0a7694ceb5ba..21f2cd9a3c91894f8d2e9a3d47a7e094a001ca22 100644 (file)
@@ -462,7 +462,7 @@ public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper {
        public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) {
        }
 
-       public override void write_file ( Valadoc.File file, void* ptr ) {
+       public override void write_file ( Valadoc.Package file, void* ptr ) {
        }
 }
 
@@ -542,42 +542,6 @@ public class DevhelpFormat : Object {
                ""
        };
 
-       private Xml.Node* find_child_node ( Xml.Node* element, string name ) {
-               for ( Xml.Node* pos = element->children; pos != null ; pos = pos->next ) {
-                       if ( name == pos->get_prop ( "name" ) ) {
-                               return pos;
-                       }
-               }
-               return null;
-       }
-
-       private Xml.Node* get_node ( string full_name ) {
-               Xml.Node* cur = this.chapters;
-               string[] path = full_name.split ( "." );
-
-               for ( int i = 0; path[i] != null ; i++ ) {
-                       cur = this.find_child_node ( cur, path[i] );
-                       if ( cur == null ) {
-                               return null;
-                       }
-               }
-
-               return null;
-       }
-
-       public void reset ( ) {
-               this.current = this.chapters;
-       }
-
-       public bool jump_to_chapter ( string full_name ) {
-               Xml.Node* node = this.get_node ( full_name );
-               if ( node != null ) {
-                       this.current = node;
-                       return true;
-               }
-               return false;
-       }
-
        public void add_chapter_start ( string name, string link ) {
                this.current = this.current->new_child ( null, "sub" );
                this.current->new_prop ( "name", name );
@@ -655,10 +619,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                return this.settings.get_real_path ( ) + "/" + this.package_dir_name + "/" + "img/" + element.full_name () + ".png";
        }
 
-       ~HtmlDoclet ( ) {
-               this.devhelp.save_file ( this.settings.get_real_path () + "/" + vala_file_package_name + "/" + vala_file_package_name + ".devhelp2" );
-       }
-
        public Valadoc.Settings settings {
                construct set;
                protected get;
@@ -696,48 +656,25 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
        private bool visited_non_package = false;
 
 
-       public override void visit_file ( File file ) {
+       public override void visit_package ( Package file ) {
                string pkg_name = get_package_name ( file.name );
                string path = this.settings.get_real_path () + pkg_name + "/";
                this.package_dir_name = pkg_name;
 
-               if ( file.is_package == true ) {
-                       var rt = DirUtils.create ( path, 0777 );
-                       rt = DirUtils.create ( path + "img/", 0777 );
-                       copy_directory ( Config.doclet_path + "deps/", path );
-
-                       DevhelpFormat tmp = this.devhelp;
+               var rt = DirUtils.create ( path, 0777 );
+               rt = DirUtils.create ( path + "img/", 0777 );
+               copy_directory ( Config.doclet_path + "deps/", path );
 
-                       this.devhelp = new DevhelpFormat ( pkg_name, "" );
+               this.devhelp = new DevhelpFormat ( pkg_name, "" );
 
-                       GLib.FileStream ifile = GLib.FileStream.open ( path + "index.htm", "w" );
-                       this.write_file_header_template ( ifile, pkg_name );
-                       this.write_file_footer ( ifile );
-                       ifile = null;
+               GLib.FileStream ifile = GLib.FileStream.open ( path + "index.htm", "w" );
+               this.write_file_header_template ( ifile, pkg_name );
+               this.write_file_footer ( ifile );
+               ifile = null;
 
-                       file.visit_namespaces ( this );
+               file.visit_namespaces ( this );
 
-                       this.devhelp.save_file ( path + pkg_name + ".devhelp2" );
-                       this.devhelp = tmp;
-               }
-               else {
-                       if ( !visited_non_package ) {
-                               this.vala_file_package_name = pkg_name;
-                               var rt = DirUtils.create ( path, 0777 );
-                               rt = DirUtils.create ( path + "img/", 0777 );
-                               copy_directory ( Config.doclet_path + "deps/", path );
-                               this.devhelp.reset ( );
-                       }
-
-                       GLib.FileStream ifile = GLib.FileStream.open ( path + "index.htm", "w" );
-                       this.write_file_header_template ( ifile, pkg_name );
-                       this.write_file_footer ( ifile );
-                       ifile = null;
-
-                       file.visit_namespaces ( this );
-
-                       this.visited_non_package = true;
-               }
+               this.devhelp.save_file ( path + pkg_name + ".devhelp2" );
        }
 
        public void write_namespace_content ( GLib.FileStream file, Namespace ns ) {
@@ -751,25 +688,15 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                string rpath = this.get_real_path ( ns );
                string path = this.get_path ( ns );
 
-               bool file_exists = FileUtils.test ( rpath, FileTest.EXISTS);
-               if ( !file_exists ) {
-                       GLib.FileStream file = GLib.FileStream.open ( rpath, "w" );
-                       this.write_file_header_template ( file, ns.full_name() );
-                       this.write_namespace_content ( file, ns );
-                       this.write_file_footer ( file );
-                       file = null;
-
-                       if ( ns.name != null ) {
-                               this.devhelp.add_keyword ( KeywordType.NAMESPACE, ns.name, path );
-                               this.devhelp.add_chapter_start ( ns.name, path );
-                       }
-               }
-               else {
-                       bool available = this.devhelp.jump_to_chapter ( ns.full_name () );
-                       if ( available == false ) {
-                               this.devhelp.add_keyword ( KeywordType.NAMESPACE, ns.name, path );
-                               this.devhelp.add_chapter_start ( ns.name, path );
-                       }
+               GLib.FileStream file = GLib.FileStream.open ( rpath, "w" );
+               this.write_file_header_template ( file, ns.full_name() );
+               this.write_namespace_content ( file, ns );
+               this.write_file_footer ( file );
+               file = null;
+
+               if ( ns.name != null ) {
+                       this.devhelp.add_keyword ( KeywordType.NAMESPACE, ns.name, path );
+                       this.devhelp.add_chapter_start ( ns.name, path );
                }
 
                // file:
index aede9ed598d37df9324c2c6d97303410015070bf..9ad8fe184294e032d29ff890c937c1047116d1bd 100755 (executable)
@@ -119,7 +119,7 @@ public interface Valadoc.LinkHelper : Object {
                Valadoc.Basic pos = tag;
 
                while ( pos != null ) {
-                       if ( pos is Valadoc.File )
+                       if ( pos is Valadoc.Package )
                                return pos.name;
 
                        pos = pos.parent;
index 14a755ee4b89ad44193779fc62fd763631786fe4..d0d252ed31abbb507d6deead0dcc947abd74eec4 100644 (file)
@@ -493,106 +493,7 @@ public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper {
        public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) {
        }
 
-       public override void write_file ( Valadoc.File file, void* ptr ) {
-       }
-}
-
-
-
-
-private class NamespaceBundle : Object {
-       public Namespace creation_namespace { construct set; get; }
-       public NamespaceBundle? parent { construct set; get; }
-       public string? name { construct set; get; }
-       public string path { construct set; get; }
-
-       public Gee.ArrayList<NamespaceBundle> subnamespaces = new Gee.ArrayList<NamespaceBundle> ();
-
-       public string full_name () {
-               return this.creation_namespace.full_name ();
-       }
-
-       public NamespaceBundle ( string path, string? name, Namespace creation_namespace, NamespaceBundle? parent = null ) {
-               this.creation_namespace = creation_namespace;
-               this.parent = parent;
-               this.name = name;
-               this.path = path;
-       }
-
-       private NamespaceBundle get_namespace_bundle ( Namespace ns ) {
-               foreach ( NamespaceBundle bundle in this.subnamespaces ) {
-                       if ( this.name == ns.name ) {
-                               return bundle;
-                       }
-               }
-
-               NamespaceBundle nsbundle = new NamespaceBundle ( this.path + ns.name + "/", ns.name, ns, this );
-               this.subnamespaces.add ( nsbundle );
-               return nsbundle;
-       }
-
-       public Gee.ArrayList<ErrorDomain> errordomains = new Gee.ArrayList<ErrorDomain> ();
-       public Gee.ArrayList<Interface> interfaces = new Gee.ArrayList<Interface> ();
-       public Gee.ArrayList<Struct> structs = new Gee.ArrayList<Struct> ();
-       public Gee.ArrayList<Class> classes = new Gee.ArrayList<Class> ();
-       public Gee.ArrayList<Enum> enums = new Gee.ArrayList<Enum> ();
-
-       public Gee.ArrayList<Constant> constants = new Gee.ArrayList<Constant> ();
-       public Gee.ArrayList<Delegate> delegates = new Gee.ArrayList<Delegate> ();
-       public Gee.ArrayList<Method> methods = new Gee.ArrayList<Method> ();
-       public Gee.ArrayList<Field> fields = new Gee.ArrayList<Field> ();
-
-       public void merge_namespace ( Namespace ns ) {
-               Gee.Collection<Namespace> subnamespaces = ns.get_namespace_list ();
-               foreach ( Namespace subns in subnamespaces ) {
-                       NamespaceBundle nsbundle = this.get_namespace_bundle ( subns );
-                       nsbundle.merge_namespace ( subns );
-               }
-
-               Gee.Collection<ErrorDomain> errordomains = ns.get_error_domain_list ();
-               foreach ( ErrorDomain errdom in errordomains ) {
-                       this.errordomains.add ( errdom );
-               }
-
-               Gee.Collection<Interface> interfaces = ns.get_interface_list ();
-               foreach ( Interface iface in interfaces ) {
-                       this.interfaces.add ( iface );
-               }
-
-               Gee.Collection<Struct> structs = ns.get_struct_list ();
-               foreach ( Struct stru in structs ) {
-                       this.structs.add ( stru );
-               }
-
-               Gee.Collection<Class> classes = ns.get_class_list ();
-               foreach ( Class cl in classes ) {
-                       this.classes.add ( cl );
-               }
-
-               Gee.Collection<Enum> enums = ns.get_enum_list ();
-               foreach ( Enum en in enums ) {
-                       this.enums.add ( en );
-               }
-
-               Gee.Collection<Constant> constants = ns.get_constant_list ();
-               foreach ( Constant c in constants ) {
-                       this.constants.add ( c );
-               }
-
-               Gee.Collection<Delegate> delegates = ns.get_delegate_list ();
-               foreach ( Delegate d in delegates ) {
-                       this.delegates.add ( d );
-               }
-
-               Gee.Collection<Method> methods = ns.get_method_list ();
-               foreach ( Method m in methods ) {
-                       this.methods.add ( m );
-               }
-
-               Gee.Collection<Field> fields = ns.get_field_list ();
-               foreach ( Field f in fields ) {
-                       this.fields.add ( f );
-               }
+       public override void write_file ( Valadoc.Package file, void* ptr ) {
        }
 }
 
@@ -627,7 +528,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                        else
                                name = element.name;
                }
-               else if ( element is File ) {
+               else if ( element is Package ) {
                        string path = this.get_file_name ( element );
                        name = this.get_package_name ( path );
                }
@@ -662,7 +563,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                        style = css_navi_class;
                else if ( element is Interface )
                        style = css_navi_iface;
-               else if ( element is File ) {
+               else if ( element is Package ) {
                        name = this.get_package_name ( element.name );
                        style = css_navi_package;
                }
@@ -721,7 +622,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                }
        }
 
-       private void write_navi_file ( GLib.FileStream file, File efile ) {
+       private void write_navi_file ( GLib.FileStream file, Package efile ) {
                Gee.ArrayList<Namespace> ns_list = new Gee.ArrayList<Namespace> ();
                this.fetch_subnamespace_names (efile, ns_list );
 
@@ -1132,7 +1033,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                GLib.StringBuilder str = new GLib.StringBuilder ( "" );
 
                for ( var pos = element; pos != null ; pos = pos.parent ) {
-                       if ( pos is File )
+                       if ( pos is Package )
                                break;
 
                        str.prepend_unichar ( '/' );
@@ -1181,7 +1082,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                file.printf ( "<img cass=\"%s\" src=\"%s\"/>\n", css_diagram, imgpath );
        }
 
-       private void write_file_content ( GLib.FileStream file, File f ) {
+       private void write_file_content ( GLib.FileStream file, Package f ) {
                file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
                file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, this.package_name );
                file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
@@ -1189,26 +1090,23 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                file.puts ( "\t\t\t</div>\n" );
        }
 
-       private Gee.ArrayList<File> files = new Gee.ArrayList<File> ();
-
-       public override void visit_file ( File file ) {
+       public override void visit_package ( Package file ) {
                this.package_name = this.get_package_name ( file.name );
-               this.is_vapi = file.name.has_suffix (".vapi");
-               this.files.add ( file );
+
+               this.is_vapi = file.is_external_package;
+               if ( this.is_vapi )
+                       this.files.add ( file );
 
                string new_path = this.settings.path + this.package_name + "/";
                bool dir_exists = FileUtils.test ( new_path, FileTest.EXISTS);
 
-               if ( !dir_exists ) {
-                       var rt = DirUtils.create ( new_path, 0777 );
-
-                       GLib.FileStream sfile = GLib.FileStream.open ( new_path + "index.html", "w" );
-                       this.write_file_header ( sfile );
-                       this.write_navi_file ( sfile, file );
-                       this.write_file_content ( sfile, file );
-                       this.write_file_footer ( sfile );
-                       sfile = null;
-               }
+               var rt = DirUtils.create ( new_path, 0777 );
+               GLib.FileStream sfile = GLib.FileStream.open ( new_path + "index.html", "w" );
+               this.write_file_header ( sfile );
+               this.write_navi_file ( sfile, file );
+               this.write_file_content ( sfile, file );
+               this.write_file_footer ( sfile );
+               sfile = null;
 
                this.current_path = new_path;
                file.visit_namespaces ( this );
@@ -1216,146 +1114,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
        }
 
 
-//     private Gee.ArrayList<Namespace> namespaces = new Gee.ArrayList<Namespace> ();
-//  globale Funktionen
-//  globale Konstante
-//  globale Delegates
-//  globale Felder
-
-       private Gee.ArrayList<NamespaceBundle> namespaces = new Gee.ArrayList<NamespaceBundle> ();
-
-       private void add_namespace_bundle ( Namespace ns ) {
-               if ( ns.parent is Namespace )
-                       return ;
-
-               foreach ( NamespaceBundle bundle in this.namespaces ) {
-                       if ( bundle.name == ns.name ) {
-                               bundle.merge_namespace ( ns );
-                               return ;
-                       }
-               }
-
-               NamespaceBundle bundle = new NamespaceBundle ( this.current_path, ns.name, ns );
-               this.namespaces.add ( bundle );
-               bundle.merge_namespace ( ns );
-       }
-
-       private void write_navi_namespace_bundle_path_navigation ( NamespaceBundle nsbundle, GLib.FileStream navi, Basic mself ) {
-               this.directory_level++;
-
-               string top_link = this.get_top_link ( (mself == null)? nsbundle.creation_namespace : mself );
-
-               Gee.ArrayList<NamespaceBundle> parents = new Gee.ArrayList<NamespaceBundle> ();
-               for ( NamespaceBundle nsb = nsbundle.parent; nsb != null ; nsb = nsb.parent ) {
-                       parents.insert ( 0, nsb );
-               }
-
-               navi.printf ( "\t\t\t<div class=\"%s\">\n", css_style_navigation );
-               this.write_top_element ( navi, mself );
-
-               navi.printf ( "<ul class=\"%s\">\n", css_navi );
-               this.write_navi_entry_html_template_with_link ( navi, css_navi_package, top_link + this.package_name + "/index.html", this.package_name );
-               navi.puts ( "</ul>\n" );
-               navi.printf ( "<hr class=\"%s\">\n", css_navi_hr );
-
-               int indent = parents.size;
-
-               foreach ( NamespaceBundle nsb in parents ) {
-                       string ns_link = "";
-
-                       for ( int i = 0; indent > i ; i++ )
-                               ns_link += "../";
-
-                       ns_link += "index.html";
-
-                       navi.printf ( "<ul class=\"%s\">\n", css_navi );
-                       this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, ns_link, (nsb.name == null)? "Global Namespace" : nsb.name );
-                       navi.puts ( "</ul>\n" );
-                       navi.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
-               }
-
-               navi.printf ( "<ul class=\"%s\">\n", css_navi );
-               if ( mself.name == nsbundle.name ) {
-                       this.write_navi_entry_html_template ( navi, css_navi_namespace, (nsbundle.name == null)? "Global Namespace" : nsbundle.name );
-               }
-               else {
-                       this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, "../index.html", (nsbundle.name == null)? "Global Namespace" : nsbundle.name );
-               }
-               navi.puts ( "</ul>\n" );
-               navi.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
-
-               navi.printf ( "<ul class=\"%s\">\n", css_navi );
-               foreach ( NamespaceBundle nsb in nsbundle.subnamespaces ) {
-                       this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, nsb.name + "/index.html", (nsb.name == null)? "Global Namespace" : nsb.name );
-               }
-
-               this.write_navi_child_classes_without_childs_collection ( navi, nsbundle.classes, mself );
-               this.write_navi_child_interfaces_without_childs_collection ( navi, nsbundle.interfaces, mself );
-               this.write_navi_child_structs_without_childs_collection ( navi, nsbundle.structs, mself );
-               this.write_navi_child_enums_without_childs_collection ( navi, nsbundle.enums, mself );
-               this.write_navi_child_error_domains_without_childs_collection ( navi, nsbundle.errordomains, mself );
-               this.write_navi_child_delegates_collection ( navi, nsbundle.delegates, mself );
-               this.write_navi_child_methods_collection ( navi, nsbundle.methods, mself );
-               this.write_navi_child_fields_collection ( navi, nsbundle.fields, mself );
-               this.write_navi_child_constants_collection ( navi, nsbundle.constants, mself );
-
-               navi.puts ( "</ul>\n" );
-               navi.puts ( "\t\t\t</div>\n" );
-
-               this.directory_level--;
-       }
-
-       private void write_navi_namespace_bundle ( NamespaceBundle nsbundle, Basic mself ) {
-               this.directory_level++;
-
-               foreach ( NamespaceBundle subnsbundle in nsbundle.subnamespaces ) {
-                       this.write_navi_namespace_bundle ( subnsbundle, mself );
-               }
-
-               this.directory_level++;
-               foreach ( Delegate del in nsbundle.delegates ) {
-                       GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + del.name + "/index.html", "w" );
-                       this.write_file_header ( file );
-                       this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, del );
-                       this.write_delegate_content ( file, del );
-                       this.write_file_footer ( file );
-               }
-               foreach ( Method m in nsbundle.methods ) {
-                       GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + m.name + "/index.html", "w" );
-                       this.write_file_header ( file );
-                       this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, m );
-                       this.write_method_content ( file, m, (MethodHandler)m.parent );
-                       this.write_file_footer ( file );
-               }
-               foreach ( Field f in nsbundle.fields ) {
-                       GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + f.name + "/index.html", "w" );
-                       this.write_file_header ( file );
-                       this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, f );
-                       this.write_field_content ( file, f, (FieldHandler)f.parent );
-                       this.write_file_footer ( file );
-               }
-               foreach ( Constant c in nsbundle.constants ) {
-                       GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + c.name + "/index.html", "w" );
-                       this.write_file_header ( file );
-                       this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, c );
-                       this.write_constant_content ( file, c, (ConstantHandler)c.parent );
-                       this.write_file_footer ( file );
-               }
-               this.directory_level--;
-
-               GLib.FileStream file = GLib.FileStream.open ( nsbundle.path + "index.html", "w" );
-               this.write_file_header ( file );
-               this.write_navi_namespace_bundle_path_navigation ( nsbundle, file, (mself == null)? nsbundle.creation_namespace : mself );
-               file.printf ( "\t\t\t<div class=\"%s\">\n", css_style_content );
-               file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, (nsbundle.name == null)? "Global Namespace" : nsbundle.full_name () );
-               file.printf ( "<hr class=\"%s\" />\n", css_hr );
-               file.printf ( "<h2 class=\"%s\">Description:</h2>\n", css_title );
-               file.puts ( "\t\t\t</div>\n" );
-               this.write_file_footer ( file );
-
-               this.directory_level--;
-       }
-
        private bool is_depency ( string dep ) {
                foreach ( string file in this.settings.files ) {
                        if ( dep == file )
@@ -1364,32 +1122,32 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                return true;
        }
 
+       private Gee.ArrayList<Namespace> source_namespaces = new Gee.ArrayList<Namespace> ();
+       private Gee.ArrayList<Package> files = new Gee.ArrayList<Package> ();
+
+
        ~HtmlDoclet () {
                this.directory_level = 1;
-
                copy_directory ( Config.doclet_path + "deps/", this.settings.path );
 
-               foreach ( NamespaceBundle nsbundle in this.namespaces ) {
-                       this.write_navi_namespace_bundle ( nsbundle, null );
-               }
-
                GLib.FileStream sfile = GLib.FileStream.open ( this.settings.path + "index.html", "w" );
                string title = ( this.settings.pkg_name == null )? "" : this.settings.pkg_name;
                this.write_file_header_template ( sfile, title, 0 );
 
-               sfile.printf ( "<h2 class=\"%s\">Namespaces:</h2>\n", css_title );
-               sfile.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
-               foreach ( NamespaceBundle nsb in this.namespaces ) {
-                       string dir = (nsb.name == null)? "0" : nsb.name;
-                       this.write_navi_entry_html_template_with_link ( sfile, css_inline_navigation_namespace,  this.package_name + "/" + dir + "/index.html", (nsb.name == null)? "Global Namespace" : nsb.name );
+               if ( this.source_namespaces.size > 0 ) {
+                       sfile.printf ( "<h2 class=\"%s\">Namespaces:</h2>\n", css_title );
+                       sfile.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
+                       foreach ( Namespace ns in this.source_namespaces ) {
+                               string dir = (ns.name == null)? "0" : ns.name;
+                               this.write_navi_entry_html_template_with_link ( sfile, css_inline_navigation_namespace, this.get_link(ns, null), (ns.name == null)? "Global Namespace" : ns.full_name () );
+                       }               
+                       sfile.puts ( "</ul>\n\n" );
                }
-               sfile.puts ( "</ul>\n\n" );
-
 
                sfile.printf ( "<h2 class=\"%s\">Depencies:</h2>\n", css_title );
                sfile.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
 
-               foreach ( File file in this.files ) {
+               foreach ( Package file in this.files ) {
                        if ( !this.is_depency ( file.name ) )
                                continue;
 
@@ -1400,9 +1158,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                }
 
                sfile.puts ( "</ul>\n" );
-
                this.write_file_footer ( sfile );
-               sfile = null;
        }
 
        public void write_namespace_content ( GLib.FileStream file, Namespace ns ) {
@@ -1870,49 +1626,41 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                string path = this.current_path + constant.name + "/";
 
                var rt = DirUtils.create ( path, 0777 );
-
-               if ( this.is_vapi || constant.parent is Namespace == false ) {
-                       this.directory_level++;
-                       GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
-                       this.write_file_header ( file );
-                       this.write_navi_constant ( file, constant );
-                       this.write_constant_content ( file, constant, parent );
-                       this.write_file_footer ( file );
-                       this.directory_level--;
-                       file = null;
-               }
+               this.directory_level++;
+               GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+               this.write_file_header ( file );
+               this.write_navi_constant ( file, constant );
+               this.write_constant_content ( file, constant, parent );
+               this.write_file_footer ( file );
+               this.directory_level--;
+               file = null;
        }
 
        public override void visit_field ( Field field, FieldHandler parent ) {
                string path = this.current_path + field.name + "/";
                var rt = DirUtils.create ( path, 0777 );
-
-               if ( this.is_vapi || field.parent is Namespace == false ) {
-                       this.directory_level++;
-                       GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
-                       this.write_file_header ( file );
-                       this.write_navi_field ( file, field );
-                       this.write_field_content ( file, field, parent );
-                       this.write_file_footer ( file );
-                       this.directory_level--;
-                       file = null;
-               }
+               this.directory_level++;
+               GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+               this.write_file_header ( file );
+               this.write_navi_field ( file, field );
+               this.write_field_content ( file, field, parent );
+               this.write_file_footer ( file );
+               this.directory_level--;
+               file = null;
        }
 
        public override void visit_delegate ( Delegate del ) {
                string path = this.current_path + del.name + "/";
                var rt = DirUtils.create ( path, 0777 );
 
-               if ( this.is_vapi || del.parent is Namespace == false ) {
-                       this.directory_level++;
-                       GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
-                       this.write_file_header ( file );
-                       this.write_navi_delegate ( file, del );
-                       this.write_delegate_content ( file, del );
-                       this.write_file_footer ( file );
-                       this.directory_level--;
-                       file = null;
-               }
+               this.directory_level++;
+               GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+               this.write_file_header ( file );
+               this.write_navi_delegate ( file, del );
+               this.write_delegate_content ( file, del );
+               this.write_file_footer ( file );
+               this.directory_level--;
+               file = null;
        }
 
        public override void visit_signal ( Signal sig ) {
@@ -1935,24 +1683,25 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                string path = this.current_path + m.name + "/";
                var rt = DirUtils.create ( path, 0777 );
 
-               if ( this.is_vapi || m.parent is Namespace == false ) {
-                       this.directory_level++;
-
-                       GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
-                       this.write_file_header ( file );
-                       this.write_navi_method ( file, m );
-                       this.write_method_content ( file, m, parent );
-                       this.write_file_footer ( file );
+               this.directory_level++;
+               GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
+               this.write_file_header ( file );
+               this.write_navi_method ( file, m );
+               this.write_method_content ( file, m, parent );
+               this.write_file_footer ( file );
 
-                       this.directory_level--;
-                       file = null;
-               }
+               this.directory_level--;
+               file = null;
        }
 
        public override void visit_namespace ( Namespace ns ) {
                string old_path = this.current_path;
                this.directory_level++;
 
+               if ( !this.is_vapi )
+                       this.source_namespaces.add ( ns );
+
+
                if ( ns.name == null ) {
                        string tmp = this.current_path + "0/";
                        this.current_path = tmp;
@@ -1962,22 +1711,13 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                        this.current_path = tmp;
                }
 
-               if ( !this.is_vapi ) {
-                       this.add_namespace_bundle ( ns );
-               }
-
-               bool dir_exists = FileUtils.test ( this.current_path, FileTest.EXISTS);
-               if ( !dir_exists ) {
-                       var rt = DirUtils.create ( this.current_path, 0777 );
-                       if ( this.is_vapi ) {
-                               GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
-                               this.write_file_header ( file );
-                               this.write_navi_namespace ( file, ns );
-                               this.write_namespace_content ( file, ns );
-                               this.write_file_footer ( file );
-                               file = null;
-                       }
-               }
+               var rt = DirUtils.create ( this.current_path, 0777 );
+               GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
+               this.write_file_header ( file );
+               this.write_navi_namespace ( file, ns );
+               this.write_namespace_content ( file, ns );
+               this.write_file_footer ( file );
+               file = null;
 
                // file:
                ns.visit_namespaces ( this );
index 2f3e468f691b5f5c2370efeb79c69c69bf811a33..4bcdc7d4a4d8cfa67d739310c92eb7587708147a 100755 (executable)
@@ -121,7 +121,7 @@ public interface Valadoc.LinkHelper : Object {
                Valadoc.Basic pos = tag;
 
                while ( pos != null ) {
-                       if ( pos is Valadoc.File )
+                       if ( pos is Valadoc.Package )
                                return pos.name;
 
                        pos = pos.parent;
@@ -129,7 +129,10 @@ public interface Valadoc.LinkHelper : Object {
                return null;
        }
 
-       protected string get_top_link ( Valadoc.Basic postag ) {
+       protected string get_top_link ( Valadoc.Basic? postag ) {
+               if ( postag == null )
+                       return "";
+
                GLib.StringBuilder str = new GLib.StringBuilder ( "" );
                Valadoc.Basic pos = postag;
 
@@ -140,7 +143,7 @@ public interface Valadoc.LinkHelper : Object {
                return str.str;
        }
 
-       protected string? get_link ( Valadoc.Basic tag, Valadoc.Basic postag ) {
+       protected string? get_link ( Valadoc.Basic tag, Valadoc.Basic? postag ) {
                if ( !this.settings.to_doc( tag.file_name ) )
                        return null;
 
@@ -149,7 +152,7 @@ public interface Valadoc.LinkHelper : Object {
 
                string? link_id = null;
 
-               if ( tag is Valadoc.File == false ) {
+               if ( tag is Valadoc.Package == false ) {
                        if ( tag is Valadoc.EnumValue || tag is Valadoc.ErrorCode ) {
                                link_id = "#"+tag.name;
                                pos = pos.parent;
@@ -163,7 +166,7 @@ public interface Valadoc.LinkHelper : Object {
 
                                str.prepend ( "/" );
 
-                               if ( pos.parent is Valadoc.File )
+                               if ( pos.parent is Valadoc.Package )
                                        break;
 
                                pos = pos.parent;
index 4676d0dbde1e80338f100f2a245b8f55efa36ecb..e2de2f0344e10c555c4073c59e4c7048018435df 100644 (file)
@@ -486,7 +486,7 @@ public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper {
        public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) {
        }
 
-       public override void write_file ( Valadoc.File file, void* ptr ) {
+       public override void write_file ( Valadoc.Package file, void* ptr ) {
        }
 }
 
@@ -496,101 +496,6 @@ public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper {
 
 
 
-private class NamespaceBundle : Object {
-       public NamespaceBundle? parent { construct set; get; }
-       public string? name { construct set; get; }
-       public string path { construct set; get; }
-       public string link { construct set; get; }
-
-       public Gee.ArrayList<NamespaceBundle> subnamespaces = new Gee.ArrayList<NamespaceBundle> ();
-
-       public NamespaceBundle ( string path, string link, string? name, NamespaceBundle? parent = null ) {
-               this.parent = parent;
-               this.name = name;
-               this.path = path;
-               this.link = link;
-       }
-
-       private NamespaceBundle get_namespace_bundle ( Namespace ns ) {
-               foreach ( NamespaceBundle bundle in this.subnamespaces ) {
-                       if ( this.name == ns.name ) {
-                               return bundle;
-                       }
-               }
-
-               NamespaceBundle nsbundle = new NamespaceBundle ( this.path + ns.name + "/", this.link+"::"+ns.name, ns.name, this );
-               this.subnamespaces.add ( nsbundle );
-               return nsbundle;
-       }
-
-       public Gee.ArrayList<ErrorDomain> errordomains = new Gee.ArrayList<ErrorDomain> ();
-       public Gee.ArrayList<Interface> interfaces = new Gee.ArrayList<Interface> ();
-       public Gee.ArrayList<Struct> structs = new Gee.ArrayList<Struct> ();
-       public Gee.ArrayList<Class> classes = new Gee.ArrayList<Class> ();
-       public Gee.ArrayList<Enum> enums = new Gee.ArrayList<Enum> ();
-
-       public Gee.ArrayList<Constant> constants = new Gee.ArrayList<Constant> ();
-       public Gee.ArrayList<Delegate> delegates = new Gee.ArrayList<Delegate> ();
-       public Gee.ArrayList<Method> methods = new Gee.ArrayList<Method> ();
-       public Gee.ArrayList<Field> fields = new Gee.ArrayList<Field> ();
-
-       public void merge_namespace ( Namespace ns ) {
-               Gee.Collection<Namespace> subnamespaces = ns.get_namespace_list ();
-               foreach ( Namespace subns in subnamespaces ) {
-                       NamespaceBundle nsbundle = this.get_namespace_bundle ( subns );
-                       nsbundle.merge_namespace ( subns );
-               }
-
-               Gee.Collection<ErrorDomain> errordomains = ns.get_error_domain_list ();
-               foreach ( ErrorDomain errdom in errordomains ) {
-                       this.errordomains.add ( errdom );
-               }
-
-               Gee.Collection<Interface> interfaces = ns.get_interface_list ();
-               foreach ( Interface iface in interfaces ) {
-                       this.interfaces.add ( iface );
-               }
-
-               Gee.Collection<Struct> structs = ns.get_struct_list ();
-               foreach ( Struct stru in structs ) {
-                       this.structs.add ( stru );
-               }
-
-               Gee.Collection<Class> classes = ns.get_class_list ();
-               foreach ( Class cl in classes ) {
-                       this.classes.add ( cl );
-               }
-
-               Gee.Collection<Enum> enums = ns.get_enum_list ();
-               foreach ( Enum en in enums ) {
-                       this.enums.add ( en );
-               }
-
-               Gee.Collection<Constant> constants = ns.get_constant_list ();
-               foreach ( Constant c in constants ) {
-                       this.constants.add ( c );
-               }
-
-               Gee.Collection<Delegate> delegates = ns.get_delegate_list ();
-               foreach ( Delegate d in delegates ) {
-                       this.delegates.add ( d );
-               }
-
-               Gee.Collection<Method> methods = ns.get_method_list ();
-               foreach ( Method m in methods ) {
-                       this.methods.add ( m );
-               }
-
-               Gee.Collection<Field> fields = ns.get_field_list ();
-               foreach ( Field f in fields ) {
-                       this.fields.add ( f );
-               }
-       }
-}
-
-
-
-
 
 
 public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
@@ -617,7 +522,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                        else
                                name = element.name;
                }
-               else if ( element is File ) {
+               else if ( element is Package ) {
                        string path = this.get_file_name ( element );
                        name = this.get_package_name ( path );
                }
@@ -652,7 +557,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                        style = css_navi_class;
                else if ( element is Interface )
                        style = css_navi_iface;
-               else if ( element is File ) {
+               else if ( element is Package ) {
                        name = this.get_package_name ( element.name );
                        style = css_navi_package;
                }
@@ -705,7 +610,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                }
        }
 
-       private void write_navi_file ( GLib.FileStream file, File efile ) {
+       private void write_navi_file ( GLib.FileStream file, Package efile ) {
                Gee.ArrayList<Namespace> ns_list = new Gee.ArrayList<Namespace> ();
                this.fetch_subnamespace_names (efile, ns_list );
 
@@ -1077,7 +982,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                GLib.StringBuilder str = new GLib.StringBuilder ( "" );
 
                for ( var pos = element; pos != null ; pos = pos.parent ) {
-                       if ( pos is File )
+                       if ( pos is Package )
                                break;
 
                        str.prepend_unichar ( '/' );
@@ -1126,129 +1031,22 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                file.printf ( "<img cass=\"%s\" src=\"%s\"/>\n", css_diagram, imgpath );
        }
 
-       public override void visit_file ( File file ) {
+       public override void visit_package ( Package file ) {
                string package_name = this.get_package_name ( file.name );
-               this.is_vapi = file.name.has_suffix (".vapi");
-
-               stdout.printf ( "File:%s - %s\n", file.name, (this.is_vapi)?"true":"false" );
+               this.is_vapi = file.is_external_package;
 
                string new_path = this.settings.path + package_name + "/";
-               bool dir_exists = FileUtils.test ( new_path, FileTest.EXISTS);
 
-               if ( !dir_exists ) {
-                       var rt = DirUtils.create ( new_path, 0777 );
-
-                       GLib.FileStream nav = GLib.FileStream.open ( new_path + "navi.html", "w" );
-                       this.write_navi_file ( nav, file );
-               }
+               var rt = DirUtils.create ( new_path, 0777 );
 
+               GLib.FileStream nav = GLib.FileStream.open ( new_path + "navi.html", "w" );
+               this.write_navi_file ( nav, file );
 
                this.current_path = new_path;
                file.visit_namespaces ( this );
                this.current_path = null;
        }
 
-
-//     private Gee.ArrayList<Namespace> namespaces = new Gee.ArrayList<Namespace> ();
-//  globale Funktionen
-//  globale Konstante
-//  globale Delegates
-//  globale Felder
-
-       private Gee.ArrayList<NamespaceBundle> namespaces = new Gee.ArrayList<NamespaceBundle> ();
-
-       private void add_namespace_bundle ( Namespace ns ) {
-               if ( ns.parent is Namespace )
-                       return ;
-
-               foreach ( NamespaceBundle bundle in this.namespaces ) {
-                       if ( bundle.name == ns.name ) {
-                               bundle.merge_namespace ( ns );
-                               return ;
-                       }
-               }
-
-               NamespaceBundle bundle = new NamespaceBundle ( this.current_path, this.get_link(ns), ns.name );
-               this.namespaces.add ( bundle );
-               bundle.merge_namespace ( ns );
-       }
-
-       private void write_navi_namespace_bundle_path_navigation ( NamespaceBundle nsbundle, GLib.FileStream navi, Basic mself = null ) {
-               Gee.ArrayList<NamespaceBundle> parents = new Gee.ArrayList<NamespaceBundle> ();
-               for ( NamespaceBundle nsb = nsbundle.parent; nsb != null ; nsb = nsb.parent ) {
-                       parents.insert ( 0, nsb );
-               }
-
-               this.write_top_element ( navi );
-
-               foreach ( NamespaceBundle nsb in parents ) {
-                       navi.printf ( "<ul class=\"%s\">\n", css_navi );
-                       this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, nsb.path + "navi.html", nsb.name );
-                       navi.puts ( "</ul>\n" );
-                       navi.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
-               }
-
-
-               navi.printf ( "<ul class=\"%s\">\n", css_navi );
-               if ( mself == null ) {
-                       this.write_navi_entry_html_template ( navi, css_navi_namespace, nsbundle.name );
-               }
-               else {
-                       this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, nsbundle.path + "navi.html", nsbundle.name );
-               }
-               navi.puts ( "</ul>\n" );
-               navi.printf ( "\n<hr class=\"%s\">\n", css_navi_hr );
-
-               navi.printf ( "<ul class=\"%s\">\n", css_navi );
-               foreach ( NamespaceBundle nsb in nsbundle.subnamespaces ) {
-                       this.write_navi_entry_html_template_with_link ( navi, css_navi_namespace, nsb.link, (nsb.name == null)? "Global Namespace" : nsb.name );
-               }
-
-               this.write_navi_child_classes_without_childs_collection ( navi, nsbundle.classes, mself );
-               this.write_navi_child_interfaces_without_childs_collection ( navi, nsbundle.interfaces, mself );
-               this.write_navi_child_structs_without_childs_collection ( navi, nsbundle.structs, mself );
-               this.write_navi_child_enums_without_childs_collection ( navi, nsbundle.enums, mself );
-               this.write_navi_child_error_domains_without_childs_collection ( navi, nsbundle.errordomains, mself );
-               this.write_navi_child_delegates_collection ( navi, nsbundle.delegates, mself );
-               this.write_navi_child_methods_collection ( navi, nsbundle.methods, mself );
-               this.write_navi_child_fields_collection ( navi, nsbundle.fields, mself );
-               this.write_navi_child_constants_collection ( navi, nsbundle.constants, mself );
-               navi.puts ( "</ul>\n" );
-       }
-
-       private void write_navi_namespace_bundle ( NamespaceBundle nsbundle, Basic mself = null ) {
-               foreach ( NamespaceBundle subnsbundle in nsbundle.subnamespaces ) {
-                       this.write_navi_namespace_bundle ( subnsbundle );
-               }
-
-               foreach ( Delegate del in nsbundle.delegates ) {
-                       GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + del.name + "/navi.html", "w" );
-                       this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, del );
-               }
-               foreach ( Method m in nsbundle.methods ) {
-                       GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + m.name + "/navi.html", "w" );
-                       this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, m );
-               }
-               foreach ( Field f in nsbundle.fields ) {
-                       GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + f.name + "/navi.html", "w" );
-                       this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, f );
-               } 
-               foreach ( Constant c in nsbundle.constants ) {
-                       GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + c.name + "/navi.html", "w" );
-                       this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, c );
-               }
-
-
-               GLib.FileStream navi = GLib.FileStream.open ( nsbundle.path + "navi.html", "w" );
-               this.write_navi_namespace_bundle_path_navigation ( nsbundle, navi, mself );
-       }
-
-       ~HtmlDoclet () {
-               foreach ( NamespaceBundle nsbundle in this.namespaces ) {
-                       this.write_navi_namespace_bundle ( nsbundle );
-               }
-       }
-
        public void write_namespace_content ( GLib.FileStream file, Namespace ns ) {
                file.printf ( "<h1 class=\"%s\">%s:</h1>\n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name() );
                file.printf ( "<hr class=\"%s\" />\n", css_hr );
@@ -1268,24 +1066,15 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                        this.current_path = tmp;
                }
 
-               if ( !this.is_vapi ) {
-                       this.add_namespace_bundle ( ns );
-               }
-
-               bool dir_exists = FileUtils.test ( this.current_path, FileTest.EXISTS);
-               if ( !dir_exists ) {
-                       var rt = DirUtils.create ( this.current_path, 0777 );
+               var rt = DirUtils.create ( this.current_path, 0777 );
 
-                       if ( this.is_vapi ) {
-                               GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" );
-                               this.write_navi_child_namespaces ( navi, ns );
-                               navi = null;
-                       }
+               GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" );
+               this.write_navi_child_namespaces ( navi, ns );
+               navi = null;
 
-                       GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
-                       this.write_namespace_content ( file, ns );
-                       file = null;
-               }
+               GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" );
+               this.write_namespace_content ( file, ns );
+               file = null;
 
                // file:
                ns.visit_namespaces ( this );
@@ -1772,11 +1561,9 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                string path = this.current_path + constant.name + "/";
                var rt = DirUtils.create ( path, 0777 );
 
-               if ( this.is_vapi || constant.parent is Namespace == false ) {
-                       GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
-                       this.write_navi_constant ( navi, constant );
-                       navi = null;
-               }
+               GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
+               this.write_navi_constant ( navi, constant );
+               navi = null;
 
                GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
                this.write_constant_content ( file, constant, parent );
@@ -1817,11 +1604,9 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                }
                cname = null;
 
-               if ( this.is_vapi || field.parent is Namespace == false ) {
-                       GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
-                       this.write_navi_field ( navi, field );
-                       navi = null;
-               }
+               GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
+               this.write_navi_field ( navi, field );
+               navi = null;
 
                GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w");
                this.write_field_content ( file, field, parent );
@@ -1853,11 +1638,9 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                string path = this.current_path + del.name + "/";
                var rt = DirUtils.create ( path, 0777 );
 
-               if ( this.is_vapi || del.parent is Namespace == false ) {
-                       GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
-                       cname.puts ( del.get_cname() );
-                       cname = null;
-               }
+               GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
+               cname.puts ( del.get_cname() );
+               cname = null;
 
                GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
                this.write_navi_delegate ( navi, del );
@@ -1921,11 +1704,9 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper {
                string full_name = m.full_name ();
                var rt = DirUtils.create ( path, 0777 );
 
-               if ( this.is_vapi || m.parent is Namespace == false ) {
-                       GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
-                       cname.puts ( m.get_cname () );
-                       cname = null;
-               }
+               GLib.FileStream cname = GLib.FileStream.open ( path + "cname", "w" );
+               cname.puts ( m.get_cname () );
+               cname = null;
 
                GLib.FileStream navi = GLib.FileStream.open ( path + "navi.html", "w" );
                this.write_navi_method ( navi, m );
index 340b2d2e3d7f8b9554a1eb132929cb6a320052df..5ea636a23e8c73d624d15bd6a9b7cf9b4a05d858 100755 (executable)
@@ -117,7 +117,7 @@ public interface Valadoc.LinkHelper : Object {
                Valadoc.Basic pos = tag;
 
                while ( pos != null ) {
-                       if ( pos is Valadoc.File )
+                       if ( pos is Valadoc.Package )
                                return pos.name;
 
                        pos = pos.parent;
@@ -132,7 +132,7 @@ public interface Valadoc.LinkHelper : Object {
                GLib.StringBuilder str = new GLib.StringBuilder ( "" );
                Valadoc.Basic pos = tag;
 
-               if ( tag is Valadoc.File == false ) {
+               if ( tag is Valadoc.Package == false ) {
                        if ( tag is Valadoc.EnumValue || tag is Valadoc.ErrorCode ) {
                                str.append_unichar ( '#' );
                                str.append ( tag.name );
@@ -147,7 +147,7 @@ public interface Valadoc.LinkHelper : Object {
 
                                str.prepend ( "::" );
 
-                               if ( pos.parent is Valadoc.File )
+                               if ( pos.parent is Valadoc.Package )
                                        break;
 
                                pos = pos.parent;
index 824b05fa9a804310d70be43a23806e7c23bbe483..56326a4aae869f324dda53fa04b568e573a007b0 100755 (executable)
@@ -29,7 +29,7 @@ public static delegate Type Valadoc.DocletRegisterFunction ( );
 public abstract class Valadoc.Doclet : GLib.Object {
        public abstract void initialisation ( Settings settings );
 
-       public abstract void visit_file ( File file );
+       public abstract void visit_package ( Package pkg );
 
        public abstract void visit_namespace ( Namespace ns );
 
index f10500e8268e14d3e2f1e801606fca943101f04b..66115c5b35aee866997db3d70b7666d4e3ef4326 100755 (executable)
@@ -139,7 +139,7 @@ public class Valadoc.Basic : Object {
                        this._full_name = this.name;
                        Basic pos = this.parent;
 
-                       while ( pos is File == false ) {
+                       while ( pos is Package == false ) {
                                if ( pos.name != null )
                                        this._full_name = pos.name + "." + this._full_name;
 
@@ -248,7 +248,7 @@ public class Valadoc.Basic : Object {
                get {
                        Basic element = this;
                        while ( element != null ) {
-                               if ( element is File )
+                               if ( element is Package )
                                        return element.name;
 
                                element = element.parent;
@@ -258,15 +258,15 @@ public class Valadoc.Basic : Object {
        }
 
        // construct set -> creation method
-       public File? file {
+       public Package? file {
                get {
                        Valadoc.Basic ast = this;
-                       while ( ast is Valadoc.File == false ) {
+                       while ( ast is Valadoc.Package == false ) {
                                ast = ast.parent;
                                if ( ast == null )
                                        return null;
                        }
-                       return (Valadoc.File)ast;
+                       return (Valadoc.Package)ast;
                }
        }
 
@@ -4186,35 +4186,41 @@ public class Valadoc.Namespace : Basic, MethodHandler, FieldHandler, NamespaceHa
        }
 }
 
-public class Valadoc.File : Basic, NamespaceHandler {
+// rename to Package
+public class Valadoc.Package : Basic, NamespaceHandler {
        public Gee.ArrayList<Namespace> namespaces {
                default = new Gee.ArrayList<Namespace>();
                private set;
                private get;
        }
 
-       public bool is_package {
-               get {
-                       return this.vfile.external_package;
-               }
+       public bool is_external_package {
+                private set;
+                get;
        }
 
-       public File ( Valadoc.Settings settings, Vala.SourceFile vfile, Tree head ) {
+       public Package ( Valadoc.Settings settings, Vala.SourceFile vfile, Tree head ) {
                this.settings = settings;
-               this.vfile = vfile;
                this.head = head;
+
+               this.package_name = vfile.filename;
+               this.is_external_package = !( this.package_name.has_suffix ( ".vala" ) || this.package_name.has_suffix ( ".gs" ) );
        }
 
+       private string package_name;
+
        public override string?# name {
                get {
-                       return this.vfile.filename;
+                       return package_name;
                }
        }
 
+/*
        public Vala.SourceFile vfile {
                construct set;
                private get;
        }
+*/
 
        // internal
        public override weak Basic? search_element ( string[] params, int pos ) {
@@ -4237,15 +4243,23 @@ public class Valadoc.File : Basic, NamespaceHandler {
        }
 
        // internal
-       public bool is_file ( Vala.SourceFile vfile ) {
-               return ( vfile == this.vfile );
+       public bool is_package ( Vala.SourceFile vfile ) {
+               bool vheader = !( vfile.filename.has_suffix ( ".vala" ) || vfile.filename.has_suffix ( ".gs" ) );
+               if ( vheader == false && this.is_external_package == false ) {
+                       return true;
+               }
+               else if ( vheader == true && this.is_external_package == true ) {
+                       if ( vfile.filename == this.package_name )
+                               return true;
+               }
+               return false;
        }
 
        public void visit ( Doclet doclet ) {
                if ( !settings.to_doc ( this.name ) )
                        return ;
 
-               doclet.visit_file ( this );
+               doclet.visit_package ( this );
        }
 
        // internal
@@ -4271,7 +4285,7 @@ public class Valadoc.File : Basic, NamespaceHandler {
 
 
 public class Valadoc.Tree : Vala.CodeVisitor {
-       private Gee.ArrayList<File> files = new Gee.ArrayList<File>();
+       private Gee.ArrayList<Package> files = new Gee.ArrayList<Package>();
 
        public Valadoc.Settings settings {
                construct set;
@@ -4289,7 +4303,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
        }
 
        public void visit ( Doclet doclet ) {
-               foreach ( File file in this.files ) {
+               foreach ( Package file in this.files ) {
                        file.visit ( doclet );
                }
        }
@@ -4338,7 +4352,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        global_params[i+1] = params[i];
                }
 
-               foreach ( File f in this.files ) {
+               foreach ( Package f in this.files ) {
                        Basic element = f.search_element ( global_params, 0 );
                        if ( element != null )
                                return element;
@@ -4347,7 +4361,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
        }
 
        private weak Basic? search_symbol_in_namespaces ( Basic element, string[] params ) {
-               foreach ( File f in this.files ) {
+               foreach ( Package f in this.files ) {
                        Basic element = f.search_element ( params, 0 );
                        if ( element != null )
                                return element;
@@ -4395,7 +4409,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = vcl.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( vcl );
                ns.add_class ( vcl );
        }
@@ -4405,7 +4419,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = viface.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( viface );
                ns.add_interface ( viface );
        }
@@ -4415,7 +4429,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = vstru.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( vstru );
                ns.add_struct ( vstru );
        }
@@ -4425,7 +4439,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = vf.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( vf );
                ns.add_field ( vf );
        }
@@ -4435,7 +4449,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = vm.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( vm );
                ns.add_method ( vm );
        }
@@ -4445,7 +4459,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = vd.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( vd );
                ns.add_delegate ( vd );
        }
@@ -4455,7 +4469,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = venum.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( venum );
                ns.add_enum ( venum );
        }
@@ -4465,7 +4479,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = vc.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( vc );
                ns.add_constant ( vc );
        }
@@ -4475,7 +4489,7 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                        return ;
 
                Vala.SourceFile vfile = verrdom.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
                Namespace ns = file.get_namespace ( verrdom );
                ns.add_error_domain ( verrdom );
        }
@@ -4487,28 +4501,28 @@ public class Valadoc.Tree : Vala.CodeVisitor {
        }
 
        // internal
-       public File? find_file ( Vala.SourceFile vfile ) {
-               foreach ( File f in this.files ) {
-                       if ( f.is_file( vfile ) )
+       public Package? find_file ( Vala.SourceFile vfile ) {
+               foreach ( Package f in this.files ) {
+                       if ( f.is_package( vfile ) )
                                return f;
                }
                return null;
        }
 
        private void set_type_references ( ) {
-               foreach ( File f in this.files ) {
+               foreach ( Package f in this.files ) {
                        f.set_type_references( );
                }
        }
 
        private void inheritance ( ) {
-               foreach ( File f in this.files ) {
+               foreach ( Package f in this.files ) {
                        f.inheritance( );
                }
        }
 
        public void parse_comments ( Valadoc.Parser docparser ) {
-               foreach ( File f in this.files ) {
+               foreach ( Package f in this.files ) {
                        f.parse_comments( docparser );
                }
        }
@@ -4536,18 +4550,18 @@ public class Valadoc.Tree : Vala.CodeVisitor {
                }
 
                Vala.SourceFile vfile = vnode.source_reference.file;
-               File file = this.get_file ( vfile );
+               Package file = this.get_file ( vfile );
 
                return file.search_element_vala ( params, 0 );
        }
 
        // internal
-       public File get_file ( Vala.SourceFile vfile ) {
-               File file = this.find_file( vfile );
+       public Package get_file ( Vala.SourceFile vfile ) {
+               Package file = this.find_file( vfile );
                if ( file != null )
                        return file;
 
-               var tmp = new File ( this.settings,vfile, this ); 
+               var tmp = new Package ( this.settings,vfile, this ); 
                this.files.add ( tmp );
                return tmp;
        }
index dacbfa9db8774b0aa217f58d3c178a314003338d..43fa2d2c78783b7f917c07a8adf832e8ad0e5113 100755 (executable)
@@ -87,7 +87,7 @@ public class Valadoc.Langlet : Object {
        public virtual void write_namespace ( Valadoc.Namespace ns, void* ptr ) {
        }
 
-       public virtual void write_file ( Valadoc.File file, void* ptr ) {
+       public virtual void write_file ( Valadoc.Package file, void* ptr ) {
        }
 }