aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorTom Feist <shabble@cowu.be>2010-07-13 20:12:31 +0000
committerTom Feist <shabble@cowu.be>2010-07-13 20:12:31 +0000
commit5f20c8d6f2c4b37c028d075a5fc048c92991ea64 (patch)
treebcff000c271a722ef9f6a633be9dc5794cff5788 /docs
parentstarted marking up signals for auto-generation (diff)
downloadirssi-scripts-5f20c8d6f2c4b37c028d075a5fc048c92991ea64.tar.gz
irssi-scripts-5f20c8d6f2c4b37c028d075a5fc048c92991ea64.zip
reformatting of signals into more useful format for parsing, work on teh signal generator
Diffstat (limited to 'docs')
-rw-r--r--docs/Signals.pm596
-rwxr-xr-xdocs/buildsignals.pl168
2 files changed, 669 insertions, 95 deletions
diff --git a/docs/Signals.pm b/docs/Signals.pm
index 1fadc32..c8f74de 100644
--- a/docs/Signals.pm
+++ b/docs/Signals.pm
@@ -15,19 +15,19 @@ See L<Irssi/"Signals">
=begin irssi_signal_types
-=head SIGNAL ARGUMENT TYPES
+START OF SIGNAL TYPES
=over
-=item C<GList * of ([^,]*)> C<glistptr_$1>
+=item C<GList \* of ([^,]*)> C<glistptr_$1>
-=item C<GSList * of (\w+)s> C<gslist_$1>
+=item C<GSList \* of (\w+)s> C<gslist_$1>
-=item C<char *> C<string>
+=item C<char \*> C<string>
-=item C<ulong *> C<ulongptr>
+=item C<ulong \*> C<ulongptr>
-=item C<int *> C<intptr>
+=item C<int \*> C<intptr>
=item C<int> C<int>
@@ -92,6 +92,7 @@ See L<Irssi/"Signals">
=back
+END OF SIGNAL TYPES
=end irssi_signal_types
@@ -110,17 +111,35 @@ Arguments are passed to signal handlers in the usual way, via C<@_>.
=item C<"gui exit">
-I<None>
+=over
+
+=item I<None>
+
+=back
=item C<"gui dialog">
-string C<$type>, string C<$text>
+=over
+
+=item string C<$type>
+
+=item string C<$text>
+
+=back
=item C<"send command">
-C<string $command>,
-L<Irssi::Server> C<$server>,
-L<Irssi::Windowitem> C<$window_item>
+=over
+
+=item C<string $command>,
+
+=item L<Irssi::Server> C<$server>,
+
+=item L<Irssi::Windowitem> C<$window_item>
+
+=back
+
+This is sent when a command is entered via the GUI, or by scripts via L<Irssi::command>.
=back
@@ -130,11 +149,29 @@ B<TODO: What are CHAT_PROTOCOL_REC types?>
=over 4
-=item C<"chat protocol created"> CHAT_PROTOCOL_REC
+=item C<"chat protocol created">
-=item C<"chat protocol updated"> CHAT_PROTOCOL_REC
+=over
-=item C<"chat protocol destroyed"> CHAT_PROTOCOL_REC
+=item CHAT_PROTOCOL_REC C<$protocol>
+
+=back
+
+=item C<"chat protocol updated">
+
+=over
+
+=item CHAT_PROTOCOL_REC C<$protocol>
+
+=back
+
+=item C<"chat protocol destroyed">
+
+=over
+
+=item CHAT_PROTOCOL_REC C<$protocol>
+
+=back
=back
@@ -142,9 +179,23 @@ B<TODO: What are CHAT_PROTOCOL_REC types?>
=over 4
-=item C<"channel created"> L<Irssi::Channel>, int C<$automatic>
+=item C<"channel created">
+
+=over
-=item C<"channel destroyed"> L<Irssi::Channel> C<$channel>
+=item L<Irssi::Channel> C<$channel>
+
+=item int C<$automatic>
+
+=back
+
+=item C<"channel destroyed">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
+
+=back
=back
@@ -152,9 +203,21 @@ B<TODO: What are CHAT_PROTOCOL_REC types?>
=over 4
-=item C<"chatnet created"> CHATNET_REC
+=item C<"chatnet created">
+
+=over
-=item C<"chatnet destroyed"> CHATNET_REC
+=item CHATNET_REC C<$chatnet>
+
+=back
+
+=item C<"chatnet destroyed">
+
+=over
+
+=item CHATNET_REC C<$chatnet>
+
+=back
=back
@@ -162,25 +225,81 @@ B<TODO: What are CHAT_PROTOCOL_REC types?>
=over 4
-=item C<"commandlist new">, L<Irssi::Command> C<$cmd>
+=item C<"commandlist new">
+
+=over
+
+=item L<Irssi::Command> C<$cmd>
+
+=back
+
+=item C<"commandlist remove">
+
+=over
+
+=item L<Irssi::Command> C<$cmd>
+
+=back
+
+=item C<"error command">
+
+=over
+
+=item int C<$err>
+
+=item string C<$cmd>
+
+=back
+
+=item C<"send command">
+
+=over
+
+=item string C<$args>
+
+=item L<Irssi::Server> C<$server>
+
+=item L<Irssi::Windowitem> C<$witem>
+
+=back
+
+=item C<"send text">
+
+=over
+
+=item string C<$line>
+
+=item L<Irssi::Server> C<$server>
+
+=item L<Irssi::Windowitem> C<$witem>
+
+=back
+
+=item C<"command "<cmd>>
-=item C<"commandlist remove"> L<Irssi::Command> C<$cmd>
+=over
-=item C<"error command"> int C<$err>, string C<$cmd>
+=item string C<$args>
-=item C<"send command"> string C<$args>,
- L<Irssi::Server> C<$server>, L<Irssi::Windowitem> C<$witem>
+=item L<Irssi::Server> C<$server>
-=item C<"send text"> string C<$line>, L<Irssi::Server> C<$server>,
- L<Irssi::Windowitem> C<$witem>
+=item L<Irssi::Windowitem> C<$witem>
-=item C<"command "<cmd>> string C<$args>, L<Irssi::Server> C<$server>,
- L<Irssi::Windowitem> C<$witem>
+=back
B<TODO: check this "cmd" out?>
-=item C<"default command"> string C<$args>, L<Irssi::Server> C<$server>,
- L<Irssi::Windowitem> C<$witem>
+=item C<"default command">
+
+=over
+
+=item string C<$args>
+
+=item L<Irssi::Server> C<$server>
+
+=item L<Irssi::Windowitem> C<$witem>
+
+=back
=back
@@ -188,11 +307,29 @@ B<TODO: check this "cmd" out?>
=over 4
-=item C<"ignore created"> L<Irssi::Ignore> C<$ignore>
+=item C<"ignore created">
+
+=over
+
+=item L<Irssi::Ignore> C<$ignore>
+
+=back
+
+=item C<"ignore destroyed">
+
+=over
-=item C<"ignore destroyed"> L<Irssi::Ignore> C<$ignore>
+=item L<Irssi::Ignore> C<$ignore>
+
+=back
+
+=item C<"ignore changed">
+
+=over
-=item C<"ignore changed"> L<Irssi::Ignore> C<$ignore>
+=item L<Irssi::Ignore> C<$ignore>
+
+=back
=back
@@ -200,21 +337,71 @@ B<TODO: check this "cmd" out?>
=over 4
-=item C<"log new"> L<Irssi::Log> C<$log>
+=item C<"log new">
+
+=over
+
+=item L<Irssi::Log> C<$log>
+
+=back
+
+=item C<"log remove">
+
+=over
+
+=item L<Irssi::Log> C<$log>
+
+=back
+
+=item C<"log create failed">
+
+=over
+
+=item L<Irssi::Log> C<$log>
+
+=back
+
+=item C<"log locked">
+
+=over
+
+=item L<Irssi::Log> C<$log>
+
+=back
+
+=item C<"log started">
+
+=over
+
+=item L<Irssi::Log> C<$log>
+
+=back
+
+=item C<"log stopped">
-=item C<"log remove"> L<Irssi::Log> C<$log>
+=over
+
+=item L<Irssi::Log> C<$log>
+
+=back
-=item C<"log create failed"> L<Irssi::Log> C<$log>
+=item C<"log rotated">
-=item C<"log locked"> L<Irssi::Log> C<$log>
+=over
-=item C<"log started"> L<Irssi::Log> C<$log>
+=item L<Irssi::Log> C<$log>
-=item C<"log stopped"> L<Irssi::Log> C<$log>
+=back
-=item C<"log rotated"> L<Irssi::Log> C<$log>
+=item C<"log written">
-=item C<"log written"> L<Irssi::Log> C<$log>, string C<$line>
+=over
+
+=item L<Irssi::Log> C<$log>
+
+=item string C<$line>
+
+=back
=back
@@ -224,11 +411,39 @@ B<TODO: what are these types?>
=over 4
-=item "module loaded", MODULE_REC, MODULE_FILE_REC
+=item C<"module loaded">
-=item "module unloaded", MODULE_REC, MODULE_FILE_REC
+=over
-=item "module error", int error, char *text, char *rootmodule, char *submodule
+=item MODULE_REC C<$module>
+
+=item MODULE_FILE_REC C<$module_file>
+
+=back
+
+=item C<"module unloaded">
+
+=over
+
+=item MODULE_REC C<$module>
+
+=item MODULE_FILE_REC C<$module_file>
+
+=back
+
+=item C<"module error">
+
+=over
+
+=item int C<$error>
+
+=item string C<$text>
+
+=item string C<$root_module>
+
+=item string C<$sub_module>
+
+=back
=back
@@ -236,100 +451,323 @@ B<TODO: what are these types?>
=over 4
-=item C<"nicklist new"> L<Irssi::Channel> C<$channel>, L<Irssi::Nick> C<$nick>
+=item C<"nicklist new">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
-=item "nicklist remove", CHANNEL_REC, NICK_REC
+=item L<Irssi::Nick> C<$nick>
-=item "nicklist changed", CHANNEL_REC, NICK_REC, char *old_nick
+=back
+
+=item C<"nicklist remove">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
+
+=item L<Irssi::Nick> C<$nick>
+
+=back
+
+=item C<"nicklist changed">
+
+=over
-=item "nicklist host changed", CHANNEL_REC, NICK_REC
+=item L<Irssi::Channel> C<$channel>
-=item "nicklist gone changed", CHANNEL_REC, NICK_REC
+=item L<Irssi::Nick> C<$nick>
-=item "nicklist serverop changed", CHANNEL_REC, NICK_REC
+=item string C<$old_nick>
=back
-=head3 pidwait.c:
+=item C<"nicklist host changed">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
+
+=item L<Irssi::Nick> C<$nick>
+
+=back
+
+=item C<"nicklist gone changed">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
+
+=item L<Irssi::Nick> C<$nick>
+
+=back
+
+=item C<"nicklist serverop changed">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
+
+=item L<Irssi::Nick> C<$nick>
+
+=back
+
+=back
+
+=head3 F<pidwait.c>:
=over 4
-=item "pidwait", int pid, int status
+=item C<"pidwait">
+
+=over
+
+=item int C<$pid>
+
+=item int C<$status>
=back
-=head3 queries.c:
+=back
+
+=head3 F<queries.c>:
=over 4
-=item "query created", QUERY_REC, int automatic
+=item C<"query created">
+
+=over
+
+=item L<Irssi::Query> C<$query>
-=item "query destroyed", QUERY_REC
+=item int C<$automatic>
-=item "query nick changed", QUERY_REC, char *orignick
+=back
+
+=item C<"query destroyed">
+
+=over
+
+=item L<Irssi::Query> C<$query>
+
+=back
+
+=item C<"query nick changed">
+
+=over
+
+=item L<Irssi::Query> C<$query>
-=item "window item name changed", WI_ITEM_REC
+=item string C<$original_nick>
-=item "query address changed", QUERY_REC
+=back
+
+=item C<"window item name changed">
+
+=over
-=item "query server changed", QUERY_REC, SERVER_REC
+=item L<Irssi::Windowitem> C<$witem>
=back
+=item C<"query address changed">
+
+=over
-=head3 rawlog.c:
+=item L<Irssi::Query> C<$query>
+
+=back
+
+=item C<"query server changed">
+
+=over
+
+=item L<Irssi::Query> C<$query>
+
+=item L<Irssi::Server> C<$server>
+
+=back
+
+=back
+
+
+=head3 F<rawlog.c>:
=over 4
-=item "rawlog", RAWLOG_REC, char *data
+=item C<"rawlog">
+
+=over
+
+=item L<Irssi::Rawlog> C<$raw_log>
+
+=item string C<$data>
+
+=back
=back
-=head3 server.c:
+=head3 F<server.c>:
=over 4
-=item "server looking", SERVER_REC
+=item C<"server looking">
+
+=over
+
+=item L<Irssi::Server> C<$server>
+
+=back
+
+=item C<"server connected">
+
+=over
+
+=item L<Irssi::Server> C<$server>
+
+=back
+
+
+=item C<"server connecting">
+
+=over
+
+=item L<Irssi::Server> C<$server>
+
+=item ulongptr C<$ip>
+
+=back
+
+=item C<"server connect failed">
-=item "server connected", SERVER_REC
+=over
-=item "server connecting", SERVER_REC, ulong *ip
+=item L<Irssi::Server> C<$server>
-=item "server connect failed", SERVER_REC
+=back
-=item "server disconnected", SERVER_REC
+=item C<"server disconnected">
-=item "server quit", SERVER_REC, char *msg
+=over
-=item "server sendmsg", SERVER_REC, char *target, char *msg, int target_type
+=item L<Irssi::Server> C<$server>
=back
-=head3 settings.c:
+=item C<"server quit">
+
+=over
+
+=item L<Irssi::Server> C<$server>
+
+=item string C<$message>
+
+=back
+
+=item C<"server sendmsg">
+
+=over
+
+=item L<Irssi::Server> C<$server>
+
+=item string C<$target>
+
+=item string C<$message>
+
+=item int C<$target_type>
+
+=back
+
+=back
+
+=head3 F<settings.c>:
=over 4
-=item "setup changed"
+=item C<"setup changed">
+
+=over
+
+=item I<None>
+
+=back
+
+=item C<"setup reread">
+
+=over
+
+=item string C<$fname>
-=item "setup reread", char *fname
+=back
+
+=item C<"setup saved">
+
+=over
+
+=item string C<$fname>
-=item "setup saved", char *fname, int autosaved
+=item int C<$autosaved>
+
+=back
=back
=head2 IRC Core
-=head3 bans.c:
+=head3 F<bans.c>:
+
+=over 4
+
+=item C<"ban type changed">
+
+=over
+
+=item string C<$bantype>
+
+=back
+
+=back
- "ban type changed", char *bantype
+=head3 F<channels>, F<nicklist>:
-=head3 channels, nicklist:
+B<TODO: are these actual files? .c?>
+
+=over 4
+
+=item C<"channel joined">
+
+=over
- "channel joined", CHANNEL_REC
- "channel wholist", CHANNEL_REC
- "channel sync", CHANNEL_REC
+=item L<Irssi::Channel> C<$channel>
- "channel topic changed", CHANNEL_REC
+=back
+
+=item C<"channel wholist">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
+
+=back
+
+=item C<"channel sync">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
+
+=back
+
+=item C<"channel topic changed">
+
+=over
+
+=item L<Irssi::Channel> C<$channel>
+
+=back
+
+=back
=head3 ctcp.c:
diff --git a/docs/buildsignals.pl b/docs/buildsignals.pl
index 11cd74a..5409ae2 100755
--- a/docs/buildsignals.pl
+++ b/docs/buildsignals.pl
@@ -2,19 +2,28 @@
use strict;
use warnings;
-
+#use Pod::Simple::Debug (3);
use Data::Dumper;
package Pod::Simple::IrssiSignalParser;
use base qw/Pod::Simple::PullParser/;
+use Carp qw/cluck/;
use Data::Dumper;
+sub new {
+ my $self = __PACKAGE__->SUPER::new(@_);
+
+ $self->{__type_mapping} = {};
+ $self->{__signals} = {};
+
+ return bless $self, __PACKAGE__;
+}
sub run {
my $self = shift;
- my ($seen_start, $seen_end) = (0,0);
+ # my ($seen_start, $seen_end) = (0,0);
my $text_token;
Token:
@@ -22,21 +31,157 @@ sub run {
while(my $token = $self->get_token()) {
#print "PRocessing token: $token\n";
- if (!$seen_start && $token->is_start) {
+ if ($token->is_start) {
if ($token->tag eq 'Data') {
- print "Start Data token: $token\n";
+ print "Start Data token: ", $token->dump, "\n";
$text_token = $self->get_token;
+ print "next token: ", $text_token->dump, "\n";
- if ($text_token->is_text && $text_token->text =~ /START/) {
- print "Found start!\n\n";
- $seen_start = 1;
+ if ($text_token->is_text && $text_token->text =~ /START OF (.*)$/) {
+ print "Found start of $1!\n\n";
+ my $type = $1;
+
+ if ($type eq 'SIGNAL TYPES') {
+ $self->process_types;
+ } elsif ($type eq 'SIGNAL DEFINITIONS') {
+ $self->process_definitions;
+ }
}
}
}
}
}
+sub process_types {
+ my $self = shift;
+
+ my $list_ended = 0;
+ my $list_started = 0;
+
+ print "Processing signal types\n";
+
+ while (!$list_ended) {
+
+ my $token = $self->get_token;
+
+ if (!$list_started) {
+ if ($token->is_start && $token->tag eq 'over-text') {
+ $list_started = 1;
+ } else {
+ next;
+ }
+ } else {
+ if ($token->is_end && $token->tag eq 'over-text') {
+ $list_ended = 1;
+ } else {
+ $self->unget_token($token);
+ # do tag processing here
+ print "Processing token ", $token->dump, $/;
+ $self->process_type_entry;
+ }
+ }
+ }
+
+ print "Done Processing signal types\n";
+
+}
+
+sub validate_token {
+ my ($self, $token, $expected, $type) = @_;
+
+ unless ($token->type eq $type && $token->is_tag($expected)) {
+ cluck "Eeek. Expected $expected: $type, got $token->type";
+
+ # cluck("Invalid token. " # on line " . $token->attr('start_line')
+ # . "expected $expected $type, got " . $token->tag
+ # . " " . $token->type . " : " . $token->dump);
+
+ }
+}
+
+sub process_type_entry {
+ my $self = shift;
+
+ my $token = $self->get_token;
+ $self->validate_token($token, 'item-text', 'start');
+
+ $token = $self->get_token;
+ $self->validate_token($token, 'C', 'start');
+
+ $token = $self->get_token;
+ my $c_type = $token->text;
+
+ $token = $self->get_token;
+ $self->validate_token($token, 'C', 'end');
+
+ $token = $self->get_token; # consume the separator whitespace.
+ die "incorrect separator" unless $token->text =~ /^\s+$/;
+
+ $token = $self->get_token;
+ $self->validate_token($token, 'C', 'start');
+
+ $token = $self->get_token;
+ my $perl_type = $token->text;
+
+ $token = $self->get_token;
+ $self->validate_token($token, 'C', 'end');
+
+ $token = $self->get_token;
+ $self->validate_token($token, 'item-text', 'end');
+
+ print "*** Creating mapping for $c_type => $perl_type\n";
+ $self->{__type_mapping}->{$c_type} = $perl_type;
+}
+
+sub process_definitions {
+ my $self = shift;
+
+ my $list_ended = 0;
+ my $list_started = 0;
+
+ print "Processing signal definitions\n";
+
+ while (!$list_ended) {
+
+ my $token = $self->get_token;
+ $list_ended = 1 unless $token;
+
+ if (!$list_started) {
+ if ($token->is_start && $token->tag eq 'over-text') {
+ $list_started = 1;
+ } else {
+ next;
+ }
+ } else {
+ if ($token->is_end && $token->tag eq 'over-text') {
+ $list_ended = 1;
+ } else {
+ $self->unget_token($token);
+ # do tag processing here
+ print "Processing token ", $token->dump, $/;
+ $self->process_def_entry;
+ }
+ }
+ }
+
+ print "Done Processing signal defs\n";
+
+}
+
+sub process_def_entry {
+ my $self = shift;
+ my $token;
+ print "Processing definition entry\n";
+ while ($token = $self->get_token()) {
+
+ last if $token->is_end && $token->tag eq 'item-text';
+ }
+ #$self->unget_token($token);
+ print "Done Processing definition entry\n";
+
+}
+
package main;
my $input_file = $ARGV[0] // 'Signals.pm';
@@ -45,12 +190,3 @@ my $parser = Pod::Simple::IrssiSignalParser->new;
$parser->accept_targets('irssi_signal_defs', 'irssi_signal_types');
my $tree = $parser->parse_file($input_file);
-
-# if ($type eq 'Data' && $text =~ /START OF SIGNAL DEFINITIONS/) {
-# $seen_start = 1;
-# }
-
-# if ($type eq 'Data' && $text =~ /END OF SIGNAL DEFINITIONS/) {
-# $seen_end = 1;
-# }
-