提交 657d5b14 authored 作者: Michael S Collins's avatar Michael S Collins

Update chan vars script to handle all of the api_on_xx vars

上级 9a4efc00
......@@ -93,9 +93,11 @@ while(<FILEIN>) {
my @RECIN = split /#define /,$_;
# debug
#print "$RECIN[1] \n";
no warnings;
$RECIN[1] =~ s/"//g; # strip quote chars
my ($key, $val) = split /\s/,$RECIN[1];
$switch_types{$key} = $val;
use warnings;
}
close(FILEIN);
......@@ -264,6 +266,55 @@ while(<FILEIN>){
}
close(FILEIN);
## Handle the switch_channel_api_on vars...
$datafile = $tmpdir . "/api-on-vars.txt";
open(FILEIN,'<',$datafile) or die "$datafile - $!\n";
while(<FILEIN>){
chomp;
next unless m/\.c(pp)?:/; # only c and cpp files for now
my @RECIN = split /(\.c(pp)?)/,$_; # split on file name.c or name.cpp
my ($filename,$dir,$ext) = fileparse($RECIN[0]);
$filename .= $RECIN[1]; # append .c or .cpp
# debug
#print "$filename\n";
# trim off the srcdir from beginning of string
my $reldir = substr $dir, $srcdirlen;
#print "$filename $dir $ext ($reldir)\n";
if ( ! exists( $source_files{$filename} ) ) {
$source_files{ $filename } = $site . $reldir . $filename . '?r=HEAD';
}
## Extract line number for this occurrence in this source file
my $linenum = 0;
if ( $RECIN[3] =~ m/:(\d+):/ ) {
$linenum = $1;
}
my @temp = split /,\s*/,$_;
my $channel_variable_name = $temp[1];
## Clean off quotes, parens, semicolons...
$channel_variable_name =~ s/"|;|\)//g;
if ( exists( $switch_types{$channel_variable_name} ) ) {
## This isn't actually a channel variable name but rather a def from switch_types.h
$channel_variable_name = $switch_types{$channel_variable_name};
}
## Skip obvious exceptions...
next if $channel_variable_name =~ m/$obvious_exceptions/;
## populate the hash for this variable, filename and line num & set/get
push @{ $channel_vars{$channel_variable_name}{$filename} }, [$linenum, 'api_on'];
push @{ $source_idx{$filename}{$channel_variable_name} }, [$linenum, 'api_on'];
# Debug
#print "var: $channel_variable_name\n";
}
close(FILEIN);
#debug
#print dump(\%channel_vars);
#foreach (sort keys %channel_vars) { print "'$_'\n"; }
......
......@@ -15,7 +15,7 @@
SRCDIR=/usr/src/freeswitch/src
#SRCDIR=/Users/michaelcollins/workspace/fs/freeswitch/src
TMPDIR=/tmp
HTMLDIR=/usr/local/freeswitch/htdocs
HTMLFILE=/var/www/chanvars.html
# Grep the variables, then grep the aliases in the header files
echo "Searching source tree for channel variable set/get..."
......@@ -25,6 +25,9 @@ grep -rn "[sg]et_variable_partner(" $SRCDIR/* | grep -v Binary | grep -v svn >>
echo "Searching source tree for switch_channel_execute_on statements..."
grep -rn "switch_channel_execute_on(" $SRCDIR/* | grep -v Binary > $TMPDIR/execute-on-vars.txt
echo "Searching source tree for switch_channel_api_on statements..."
grep -rn "switch_channel_api_on(" $SRCDIR/* | grep -v Binary > $TMPDIR/api-on-vars.txt
echo "Searching source tree for event_get_header channel variables... "
grep -rn "switch_event_get_header(var_event" $SRCDIR/* | grep -v Binary > $TMPDIR/event-vars.txt
......@@ -33,5 +36,5 @@ grep -n "_VARIABLE" $SRCDIR/include/*h > $TMPDIR/header-defs.txt
grep -rn "_VARIABLE" $SRCDIR/mod/* >> $TMPDIR/header-defs.txt
# launch perl script here
echo "Creating HTML file in $TMPDIR directory"
./create-chanvars-html-page.pl --srcdir=$SRCDIR --tmpdir=$TMPDIR --htmldir=$HTMLDIR
echo "Creating HTML file in $HTMLFILE"
#./create-chanvars-html-page.pl --srcdir=$SRCDIR --tmpdir=$TMPDIR --htmlfile=$HTMLFILE
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论