aboutsummaryrefslogtreecommitdiffstats
path: root/docs/parse_xsfuncs.pl
diff options
context:
space:
mode:
authorTom Feist <shabble@cowu.be>2010-07-22 14:45:54 +0000
committerTom Feist <shabble@cowu.be>2010-07-22 14:45:54 +0000
commit5bb0f2351ac398b8df5ebc81093539e2f593e30c (patch)
treefa8b7c83642cd899676d7a062557e9d6d715bd5e /docs/parse_xsfuncs.pl
parentadded formats, and some copypasta from default.theme comments into theme (diff)
downloadirssi-scripts-5bb0f2351ac398b8df5ebc81093539e2f593e30c.tar.gz
irssi-scripts-5bb0f2351ac398b8df5ebc81093539e2f593e30c.zip
added messagelevel docs to irssi.pod, more stuff in guide, and a little script to dump .xs func definitions
Diffstat (limited to 'docs/parse_xsfuncs.pl')
-rwxr-xr-xdocs/parse_xsfuncs.pl55
1 files changed, 55 insertions, 0 deletions
diff --git a/docs/parse_xsfuncs.pl b/docs/parse_xsfuncs.pl
new file mode 100755
index 0000000..4ce196f
--- /dev/null
+++ b/docs/parse_xsfuncs.pl
@@ -0,0 +1,55 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Glib::ParseXSDoc;
+use File::Find;
+use Data::Dumper;
+
+my $home = $ENV{HOME};
+my $src_dir = "$home/sources/irssi/src/perl";
+$ENV{FORCE_DATA_DUMPER} = 1;
+print "=over\n\n";
+
+find(\&process_file, $src_dir);
+
+print "=back\n\n";
+
+sub process_file {
+ my $filename = $_;
+ return unless $filename =~ /\.xs$/;
+
+ my $filepath = $File::Find::name;
+# print "Processing file: $filepath\n";
+
+ my $parser = Glib::ParseXSDoc->new; #xsdocparse($filepath);
+
+ $parser->parse_file($filepath);
+ $parser->canonicalize_xsubs;
+ $parser->swizzle_pods;
+ $parser->preprocess_pods;
+ $parser->clean_out_empty_pods;
+
+ #print Dumper($parser->{data}), $/;
+ my $data = $parser->{data};
+ foreach my $package (keys %$data) {
+ #print "Package: $package\n";
+ my $subs = $data->{$package}->{xsubs};
+ foreach my $sub (@$subs) {
+ my $sub_name = $sub->{symname};
+ next if $sub_name =~ m/::$/;
+ print_msglevel($sub_name);
+ #print $sub->{symname}, $/;
+ }
+ }
+}
+
+sub print_msglevel {
+ my ($sym) = @_;
+ if ($sym =~ m/::MSGLEVEL/) {
+ $sym =~ s/^Irssi:://;
+ print "=item C<$sym>\n\n";
+ }
+}
+