4 Writes out a library file.
6 NOTES ON THE NEW FORMAT
8 Stores: class name, members, hierarchy
9 node types are not stored
16 zero or more members, each of
25 Unrecognized lines ignored.
30 <! KDOC Library HTML Reference File>
32 <BASE URL="http://www.kde.org/API/kdecore/">
34 <C NAME="KApplication" REF="KApplication.html">
36 <ME NAME="getConfig" REF="KApplication.html#getConfig">
54 use vars qw
/ $exe $lib $root $plang $outputdir $docpath $url $compress /;
62 ( $lib, $root, $plang, $outputdir, $docpath, $url,
64 my $outfile = "$outputdir/$lib.kalyptus";
65 $url = $docpath unless defined $url;
67 mkpath
( $outputdir ) unless -f
$outputdir;
70 open( LIB
, "| gzip -9 > \"$outfile.gz\"" )
71 || die "$exe: couldn't write to $outfile.gz\n";
75 open( LIB
, ">$outfile" )
76 || die "$exe: couldn't write to $outfile\n";
80 if ( defined $root->{LibDoc
} ) {
81 $libdesc="<LIBDESC>".$root->{LibDoc
}->{astNodeName
}."</LIBDESC>";
85 <! KDOC Library HTML Reference File>
86 <VERSION="$main::Version">
89 <LIBNAME>$lib</LIBNAME>
94 writeNode
( $root, "" );
100 my ( $n, $prefix ) = @_;
101 return if !exists $n->{Compound
};
102 return if exists $n->{Forward
} && !exists $n->{KidAccess
};
105 $prefix .= $n->{astNodeName
};
106 print LIB
"<C NAME=\"", $n->{astNodeName
},
107 "\" REF=\"$prefix.html\">\n";
110 print LIB
"<STATS>\n";
111 my $stats = $root->{Stats
};
112 foreach my $stat ( keys %$stats ) {
113 print LIB
"<STAT NAME=\"$stat\">",
114 $stats->{$stat},"</STAT>\n";
116 print LIB
"</STATS>\n";
119 if( exists $n->{Ancestors
} ) {
121 foreach $in ( @
{$n->{Ancestors
}} ) {
123 print LIB
"<IN NAME=\"",$in,"\">\n";
127 return if !exists $n->{Kids
};
131 foreach $kid ( @
{$n->{Kids
}} ) {
132 next if exists $kid->{ExtSource
}
133 || $kid->{Access
} eq "private";
135 if ( exists $kid->{Compound
} ) {
137 writeNode
( $kid, $prefix."::" );
140 writeNode
( $kid, "" );
145 $type = $kid->{NodeType
} eq "method" ?
148 print LIB
"<$type NAME=\"", $kid->{astNodeName
},
149 "\" REF=\"$prefix.html#", $kid->{astNodeName
}, "\">\n";
159 my( $rootsub, $name, $path, $relurl ) = @_;
160 $path = "." unless defined $path;
161 my $real = $path."/".$name.".kalyptus";
168 my $havecomp = -r
"$real.gz";
169 my $haveuncomp = -r
"$real";
172 open( LIB
, "$real" ) || die "Can't read lib $real\n";
177 warn "$exe: two libs exist: $real and $real.gz. "
181 open( LIB
, "gunzip < \"$real.gz\"|" )
182 || die "Can't read pipe gunzip < \"$real.gz\": $?\n";
190 #readOldLibrary( $root, $name, $path );
194 if( /<VER\w+\s+([\d\.]+)>/ ) {
195 # TODO: what do we do with the version number?
198 elsif ( /<BASE\s*URL\s*=\s*"(.*?)"/ ) {
200 $url .= "/" unless $url =~ m
:/$:;
202 my $test = kdocUtil
::makeRelativePath
( $relurl, $url );
205 elsif( /<PLANG\s*=\s*"(.*?)">/ ) {
206 $root = $rootsub->( $1 );
209 elsif ( /<C\s*NAME="(.*?)"\s*REF="(.*?)"\s*>/ ) {
211 $new = Ast
::New
( $1 );
212 $new->AddProp( "NodeType", "class" );
213 $new->AddProp( "Compound", 1 );
214 $new->AddProp( "ExtSource", $name );
216 # already escaped at this point!
217 $new->AddProp( "Ref", $url.$2 );
219 $root = $n = $rootsub->( "CXX" ) unless defined $root;
220 kdocAstUtil
::attachChild
( $n, $new );
224 elsif ( m
#<IN\s*NAME\s*=\s*"(.*?)"\s*># ) {
226 kdocAstUtil
::newInherit
( $n, $1 );
232 elsif ( m
#<(M\w*)\s+NAME="(.*?)"\s+REF="(.*?)"\s*># ) {
234 $new = Ast
::New
( $2 );
235 $new->AddProp( "NodeType", $1 eq "ME" ?
"method" : "var" );
236 $new->AddProp( "ExtSource", $name );
237 $new->AddProp( "Flags", "" );
238 $new->AddProp( "Ref", $url.$3 );
240 kdocAstUtil
::attachChild
( $n, $new );