diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-03-21 15:52:39 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-03-21 15:52:39 +0100 |
commit | f9052d112f45825bc3ed11326dd3be63a8042333 (patch) | |
tree | 38c149baccc6a560ac99ce30ea07b38bf1cf4ba7 /src/log/create_wolfmsg.pl | |
parent | 70f67347bdb0d748879eb5d99199a380c445b236 (diff) | |
download | wolfbones-f9052d112f45825bc3ed11326dd3be63a8042333.tar.gz wolfbones-f9052d112f45825bc3ed11326dd3be63a8042333.tar.bz2 |
started to generate the MC file with the perl script
Diffstat (limited to 'src/log/create_wolfmsg.pl')
-rwxr-xr-x | src/log/create_wolfmsg.pl | 88 |
1 files changed, 74 insertions, 14 deletions
diff --git a/src/log/create_wolfmsg.pl b/src/log/create_wolfmsg.pl index 0beb3fb..c31b9df 100755 --- a/src/log/create_wolfmsg.pl +++ b/src/log/create_wolfmsg.pl @@ -72,25 +72,85 @@ MessageIdTypedef = DWORD EOF undef $/; + open CONTENT, "find .. -name '*.c' -exec cat {} \\; |"; my $code = <CONTENT>; close CONTENT; -print <<EOF; -MessageId = 0x100 -Severity = Error -Facility = Application -SymbolicName = WOLF_TEST_NO_PARAMS -Language = English -This is a test message without any parameters -It can be two lines though -. +open CONTENT, "find .. -name '*.c' -exec cat {} \\; | cpp -I../../include/wolf |"; +my $expanded_code = <CONTENT>; +close CONTENT; -MessageId = 0x101 -Severity = Error +for( ;; ) { + if( !( $code =~ /wolf_log\s*\(([^\;]*)/s ) ) { + last; + } + my $func = $1; + $code = $'; + + $expanded_code =~ /wolf_log\s*\(([^\;]*)/s; + my $expanded_func = $1; + $expanded_code = $'; +print $expanded_func . "\n"; + + if( $func =~ /\s*(WOLF_LOG_[^\, ]+)\s*\,\s*(WOLF_CATEGORY_[^\, ]+)\s*\,\s*(WOLF_MSG_[^\, ]+)\s*\,\s*_\(\s*"([^"]*)/ ) { + my $level = $1; + my $category = $2; + my $messageid = $3; + my $formatstr_c = $4; + + my $formatstr_win = $formatstr_c; + my $pos = 1; + while( $formatstr_win =~ s/%[sd]/%${pos}/ ) { $pos++ }; + + my $severity; + if( $level =~ /WOLF_LOG_((EMERG)|(ALERT)|(CRIT)|(ERR))/ ) { + $severity = "Error"; + } elsif( $level eq " WOLF_LOG_WARNING" ) { + $severity = "Warning"; + } else { + $severity = "Information"; + } + + print <<EOF; +MessageId = ??? +Severity = $severity Facility = Application -SymbolicName = WOLF_TEST_PARAMS -Language = English -This is a message with parameter %1 and parameter %2 +SymbolicName = $messageid +EOF + + my @langs = ( "English", "German" ); + my $lang; + foreach $lang ( @langs ) { + if( $lang eq "English" ) { + print <<EOF; +Language = $lang +$formatstr_win . EOF + } + } + } +# WOLF_LOG_EMERG, WOLF_CATEGORY_DAEMON, WOLF_MSG_DAEMON_PIPE_ATOMIC_WRITE_WRONG_OCTETS, +# _( "Unexpected number of octets %zd in atomar write to fd %d (expected %zd)" ), +# res, fd, data_len ) + +} + +#MessageId = 0x100 +#Severity = Error +#Facility = Application +#SymbolicName = WOLF_TEST_NO_PARAMS +#Language = English +#This is a test message without any parameters +#It can be two lines though +#. + +#MessageId = 0x101 +#Severity = Error +#Facility = Application +#SymbolicName = WOLF_TEST_PARAMS +#Language = English +#This is a message with parameter %1 and parameter %2 +#. +#EOF |