diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-09 14:18:25 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-09 14:18:25 -0200 |
commit | 4d5786425fa4ca4c81cc73ff8cc95b110bec3abd (patch) | |
tree | 6bd074fffca3ed5666b72efb78274a8c46490728 /v4l/scripts | |
parent | 4999986941b04646308b89772f8053dbe202060c (diff) | |
download | mediapointer-dvb-s2-4d5786425fa4ca4c81cc73ff8cc95b110bec3abd.tar.gz mediapointer-dvb-s2-4d5786425fa4ca4c81cc73ff8cc95b110bec3abd.tar.bz2 |
Improved #if parsing to accept other syntaxes
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l/scripts')
-rwxr-xr-x | v4l/scripts/gentree.pl | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl index e58d410c2..bd1ee94e2 100755 --- a/v4l/scripts/gentree.pl +++ b/v4l/scripts/gentree.pl @@ -71,7 +71,7 @@ sub filter_source ($$) { # if ($line =~ m/[\$]Id:/) { # next; # } - if ($line =~ /^#ifdef MM_KERNEL/) { + if ($line =~ /^\s*#\s*ifdef\s+MM_KERNEL/) { chomp($line); $state{$level} = "if"; $if{$level} = $mmkernel; @@ -79,7 +79,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#ifdef _COMPAT_H/) { + if ($line =~ /^\s*#\s*ifdef\s+_COMPAT_H/) { chomp($line); $state{$level} = "if"; $if{$level} = 0; @@ -100,7 +100,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#ifdef\sSTV0297_CS2/) { + if ($line =~ /^\s*#\s*ifdef\s+STV0297_CS2/) { chomp($line); $state{$level} = "if"; $if{$level} = 0; @@ -108,7 +108,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#ifndef\sBROKEN_XAWTV/) { + if ($line =~ /^\s*#\s*ifndef\s+BROKEN_XAWTV/) { chomp($line); $state{$level} = "if"; $if{$level} = 1; @@ -116,7 +116,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#ifndef\sSTV0297_CS2/) { + if ($line =~ /^\s*#\s*ifndef\s+STV0297_CS2/) { chomp($line); $state{$level} = "if"; $if{$level} = 1; @@ -124,7 +124,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#if 0/) { + if ($line =~ /^\s*#\s*if\s+0/) { chomp($line); $state{$level} = "if"; $if{$level} = 0; @@ -140,7 +140,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#if 1/) { + if ($line =~ /^\s*#\s*if\s+1/) { chomp($line); $state{$level} = "if"; $if{$level} = 1; @@ -148,7 +148,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#if.*HAVE_VIDEO_BUF_DVB/) { + if ($line =~ /^\s*#\s*if.*HAVE_VIDEO_BUF_DVB/) { chomp($line); $state{$level} = "if"; $if{$level} = 1; @@ -156,7 +156,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#if.*CONFIG_XC3028/) { + if ($line =~ /^\s*#\s*if.*CONFIG_XC3028/) { chomp($line); $state{$level} = "if"; $if{$level} = 0; @@ -164,7 +164,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#if.*I2C_CLASS_TV_ANALOG/) { + if ($line =~ /^\s*#\s*if.*I2C_CLASS_TV_ANALOG/) { chomp($line); $state{$level} = "if"; $if{$level} = 1; @@ -172,7 +172,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#ifndef.\s*I2C_DF_DUMMY/) { + if ($line =~ /^\s*#\s*ifndef.\s*I2C_DF_DUMMY/) { chomp($line); $state{$level} = "if"; $if{$level} = 1; @@ -180,7 +180,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#ifndef.\s*I2C_PEC/) { + if ($line =~ /^\s*#\s*ifndef.\s*I2C_PEC/) { chomp($line); $state{$level} = "if"; $if{$level} = 0; @@ -188,7 +188,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#ifdef.\s*I2C_PEC/) { + if ($line =~ /^\s*#\s*ifdef.\s*I2C_PEC/) { chomp($line); $state{$level} = "if"; $if{$level} = 1; @@ -196,7 +196,7 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#if.*I2C_CLASS_TV_DIGITAL/) { + if ($line =~ /^\s*#\s*if.*I2C_CLASS_TV_DIGITAL/) { chomp($line); $state{$level} = "if"; $if{$level} = 1; @@ -204,47 +204,47 @@ sub filter_source ($$) { $level++; next; } - if ($line =~ /^#if.*BTTV_VERSION_CODE/) { + if ($line =~ /^\s*#\s*if.*BTTV_VERSION_CODE/) { chomp($line); $line =~ s@^#if\s*@@; $line =~ s@BTTV_VERSION_CODE@\$CODE@; - $line =~ s@KERNEL_VERSION\((\d+),\s*(\d+),\s*(\d+)\)@ - sprintf("%d",$1*65536 + $2*256 + $3) @e; + $line =~ s@KERNEL_VERSION\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)@ + sprintf("%d",$1*65536 + $2*256 + $3) @eg; $if{$level} = eval $line; $state{$level} = "if"; print STDERR "/* BP #if BTTV_VERSION_CODE state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG; $level++; next; } - if ($line =~ /^#if.*LINUX_VERSION_CODE/) { + if ($line =~ /^\s*#\s*if.*LINUX_VERSION_CODE/) { chomp($line); $line =~ s@^#if\s*@@; $line =~ s@LINUX_VERSION_CODE@\$CODE@; print STDERR "/* BP orig: ($line) */\n" if $DEBUG; - $line =~ s@KERNEL_VERSION\((\d+),\s*(\d+),\s*(\d+)\)@ - sprintf("%d",$1*65536 + $2*256 + $3) @e; + $line =~ s@KERNEL_VERSION\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)@ + sprintf("%d",$1*65536 + $2*256 + $3) @eg; $if{$level} = eval $line; $state{$level} = "if"; print STDERR "/* BP #if LINUX_VERSION_CODE state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG; $level++; next; } - if ($line =~ /^#if\s/) { + if ($line =~ /^\s*#\s*if\s/) { $state{$level} = "ifother"; $if{$level} = 1; print STDERR "/* BP $line state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG; $level++; } - if ($line =~ /^#ifdef/) { + if ($line =~ /^\s*#\s*ifdef/) { $state{$level} = "ifother"; $if{$level} = 1; print STDERR "/* BP $line state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG; $level++; } - if ($line =~ /^#ifndef/) { + if ($line =~ /^\s*#\s*ifndef/) { $state{$level} = "ifother"; $if{$level} = 1; print STDERR "/* BP $line state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG; @@ -252,13 +252,13 @@ print STDERR "/* BP orig: ($line) */\n" if $DEBUG; } if ($level) { - if ($state{$level-1} eq "if" && $line =~ /^#else/) { + if ($state{$level-1} eq "if" && $line =~ /^\s*#\s*else/) { $state{$level-1} = "else"; print STDERR "/* BP #else state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG; next; } } - if ($line =~ /^#endif/) { + if ($line =~ /^\s*#\s*endif/) { if ($level) { $level--; |