]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/refactor.pl
16 if (/^#include (.*)$/) {
17 # print "Adding include: $1\n";
22 if (/chanservaddcommand\((.*)\)/) {
23 # print "Found \"addcommand\" stanza\n";
26 unless ($args =~ m!^\s*"([^"]+)"\s*,\s*([^,]+?)\s*,\s*(\d+)\s*,\s*([^, ]+)\s*,\s*"([^"]+)! ) {
27 print "Can't decode addcommand() args: $args\n";
30 # print "Command function is: $4\n";
38 if (/^int (.*?)\(.*;/) {
39 print "Found prototype for function: $1\n";
43 if (/^int (\S+)\s*\(.*{/) {
44 print "Found start of function declaration: $1\n";
45 unless (defined $cmdnames{$1}) {
46 print "Found function $1 without definition, skipping ...\n";
50 my $fname = $cmdnames{$1}.".c";
52 open CMDF
, ">".$fname;
54 print CMDF
"/* Automatically generated by refactor.pl.\n *\n *\n";
55 print CMDF
" * CMDNAME: $cmdnames{$1}\n";
56 print CMDF
" * CMDLEVEL: $cmdlevels{$1}\n";
57 print CMDF
" * CMDARGS: $cmdargs{$1}\n";
58 print CMDF
" * CMDDESC: $cmddesc{$1}\n";
59 print CMDF
" * CMDFUNC: $1\n";
60 print CMDF
" * CMDPROTO: $protos{$1}\n";
64 print CMDF
"#include $_\n";