3 # Usage: ./enum2debug.pl isakmp.h >vpnc-debug.c 2>vpnc-debug.h
10 print STDERR
<< 'EOF';
11 /* Automatically generated with enum2debug.pl: Don't edit! */
13 struct debug_strings
{
18 extern const char
*val_to_string
(unsigned
int, const struct debug_strings
*);
23 /* Automatically generated with enum2debug.pl: Don't edit! */
27 #include "vpnc-debug.h"
30 const char
*val_to_string
(unsigned
int val
, const struct debug_strings
*dstrings
)
32 static const char
*unknown
= " (unknown)";
33 static const char
*na
= "";
39 for (i
= 0; dstrings
[i
].id
!= 0 || dstrings
[i
].string
!= NULL
; i
++)
40 if (dstrings
[i
].id
== val
)
41 return dstrings
[i
].string
;
48 if (/^enum\W+(\w+)\W*/) {
49 print STDERR
"extern const struct debug_strings $1_array[];\n";
50 print "const struct debug_strings $1_array[] = {\n";
52 } elsif ($in_enum && /^}/) {
53 print "\t{ 0,\t(const char *) 0 }\n};\n\n";
55 } elsif (/^\s*\/\
*.*\
*\
/\s*$/) {
57 } elsif ($in_enum && /^\W*(\w+)\W*/) {
58 print "\t{ $1,\t\" ($1)\" },\n";