2 # checknewapi - a perl script to check for new API's
3 # using two outputs from regview and dump the interscetion
6 # Copyright (c) 2005 Sun Microsystems, Inc.
11 die "usage: checknewapi <new_type_library> <reference_type_library> <buildinfodescr>\n";
14 -e
"$ARGV[0]" || die "ERROR: type library \"$ARGV[0]\" does not exist\n";
15 -e
"$ARGV[1]" || die "ERROR: reference type library \"$ARGV[1]\" does not exist\n";
20 $main::buildinfo
= "$ARGV[2]";
21 %{$main::reftypes
} = ();
22 %{$main::currenttypes
} = ();
23 %{$main::removedtypes
} = ();
25 open ( FILEIN
, "regview \"$ARGV[0]\" |" ) || die "could not use content of current typelibrary \"$ARGV[0]\", regview doesn't work\n";
29 open( CURRENT
, ">current_types.txt" ) || die "\nERROR: could not open current_types.txt for writing";
40 if ( $linebefore =~ m
#type class: published (.+)# )
44 } elsif ( $linebefore =~ m
#type class: (.+)# )
58 if ( (!$typeclass eq "") && ($_ =~ m
# *type name: \"([^\[.]+)\"#) )
64 if ( ! exists $main::currenttypes
->{$1} )
66 $main::currenttypes
->{$1} = { PUBLISHED
=> $published,
67 TYPECLASS
=> $typeclass,
69 # print "### $main::currenttypes->{$1}->{PUBLISHED} $main::currenttypes->{$1}->{TYPECLASS} $main::currenttypes->{$1}->{COUNT}\n";
77 open ( FILEIN
, "regview \"$ARGV[1]\" |" ) || die "could not use content of reference type library \"$ARGV[1]\", regview doesn't work\n";
81 open( REFERENCE
, ">reference_types.txt" ) || die "\nERROR: could not open reference_types.txt for writing";
93 if ( $linebefore =~ m
#type class: published (.+)# )
97 } elsif ( $linebefore =~ m
#type class: (.+)# )
111 if ( (!$typeclass eq "") && ($_ =~ m
# *type name: \"([^\[.]+)\"#) )
115 print REFERENCE
"$1\n";
117 if ( ! exists $main::reftypes
->{$1} )
119 $main::reftypes
->{$1}++;
121 if ( exists $main::currenttypes
->{$1} )
123 $main::currenttypes
->{$1}->{COUNT
}++;
124 # print "###### $main::currenttypes->{$1}->{PUBLISHED} $main::currenttypes->{$1}->{TYPECLASS} $main::currenttypes->{$1}->{COUNT}\n";
129 $main::removedtypes
->{$1} = { PUBLISHED
=> $published,
130 TYPECLASS
=> $typeclass };
133 print "ERROR: type $1 is only in reference type library, this can't be happen\n";
144 @typekeys = keys %{$main::currenttypes
};
145 $allunotypes = $#typekeys+1;
149 $draftspublished = 0;
150 foreach $i ( sort @typekeys )
152 if ( $main::currenttypes
->{$i}->{COUNT
} == 1 &&
153 !("$main::currenttypes->{$i}->{TYPECLASS}" eq "module"))
158 if ($main::currenttypes
->{$i}->{PUBLISHED
} == 1)
163 if ( $t =~ m
#drafts\.com.+#)
166 if ($main::currenttypes
->{$i}->{PUBLISHED
} == 1)
171 print "$main::currenttypes->{$i}->{TYPECLASS} = $t\n";
175 # count removed not yet published types
176 $removednotpublished = 0;
178 @removedtypekeys = keys %{$main::removedtypes
};
179 foreach $i ( sort @removedtypekeys )
181 $removednotpublished++;
184 print "removed not yet published $main::currenttypes->{$i}->{TYPECLASS} = $t\n";
187 print "\n=======================================================\n\n";
188 print "Summary [last check for $main::buildinfo]:\n\n";
189 print "Number of UNO types = $allunotypes\n";
190 print "Number of new UNO types = $newunotypes\n";
191 print "New and published types = $newpublished\n";
192 print "New and draft types = $draftscount\n";
193 print "New, draft and published = $draftspublished\n";
194 print "Removed and not published = $removednotpublished\n";