summaryrefslogtreecommitdiff
path: root/src/perl/get-signals.pl
blob: 1f410dada4865959d034896629dcb9fcea12cba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/perl

print "/*\n";
print " * Autogenerated by get-signals.pl from ../../doc/signals.txt,\n";
print " * do not edit.\n";
print " */\n\n";
print "static PERL_SIGNAL_ARGS_REC perl_signal_args[] =\n{\n";

while (<STDIN>) {
	chomp;

	next if (!/^ "([^"]*)"(<.*>)?(?:,\s*(.*))?/);
	next if (/\.\.\./);
	next if (/\(/);

	$signal = $1;
	$_ = $3;

	s/GList \* of ([^,]*)/glistptr_\1/g;
	s/GSList of (\w+)s/gslist_\1/g;

	s/char \*[^,]*/string/g;
	s/ulong \*[^,]*/ulongptr/g;
	s/int \*[^,]*/intptr/g;
	s/int [^,]*/int/g;

	# core
        s/CHATNET_REC[^,]*/iobject/g;
        s/(?<!_)SERVER_REC[^,]*/iobject/g;
        s/RECONNECT_REC[^,]*/iobject/g;
	s/CHANNEL_REC[^,]*/iobject/g;
	s/QUERY_REC[^,]*/iobject/g;
	s/COMMAND_REC[^,]*/Irssi::Command/g;
	s/NICK_REC[^,]*/iobject/g;
	s/LOG_REC[^,]*/Irssi::Log/g;
	s/RAWLOG_REC[^,]*/Irssi::Rawlog/g;
	s/IGNORE_REC[^,]*/Irssi::Ignore/g;
	s/MODULE_REC[^,]*/Irssi::Module/g;

	# irc
	s/BAN_REC[^,]*/Irssi::Irc::Ban/g;
	s/NETSPLIT_REC[^,]*/Irssi::Irc::Netsplit/g;
	s/NETSPLIT_SERVER_REC[^,]*/Irssi::Irc::Netsplitserver/g;

	# irc modules
	s/DCC_REC[^,]*/siobject/g;
	s/AUTOIGNORE_REC[^,]*/Irssi::Irc::Autoignore/g;
	s/NOTIFYLIST_REC[^,]*/Irssi::Irc::Notifylist/g;
	s/CLIENT_REC[^,]*/Irssi::Irc::Client/g;

	# fe-common
	s/THEME_REC[^,]*/Irssi::UI::Theme/g;
	s/KEYINFO_REC[^,]*/Irssi::UI::Keyinfo/g;
	s/PROCESS_REC[^,]*/Irssi::UI::Process/g;
	s/TEXT_DEST_REC[^,]*/Irssi::UI::TextDest/g;
	s/WINDOW_REC[^,]*/Irssi::UI::Window/g;
	s/WI_ITEM_REC[^,]*/iobject/g;

	# perl
	s/PERL_SCRIPT_REC[^,]*/Irssi::Script/g;

	s/([\w\*:]+)(,|$)/"\1"\2/g;
	if ($_ eq "") {
		print "    { \"$signal\", { NULL } },\n";
	} else {
		print "    { \"$signal\", { $_, NULL } },\n";
	}
}

print "\n    { NULL }\n};\n";