3 # Usage: ./enum2debug.pl isakmp.h >vpnc-debug.c 2>vpnc-debug.h
12 print STDERR
<< 'EOF';
13 /* Automatically generated with enum2debug.pl: Don't edit! */
15 struct debug_strings
{
20 extern const char
*val_to_string
(unsigned
int, const struct debug_strings
*);
25 /* Automatically generated with enum2debug.pl: Don't edit! */
29 #include "vpnc-debug.h"
32 const char
*val_to_string
(unsigned
int val
, const struct debug_strings
*dstrings
)
34 static const char
*unknown
= " (unknown)";
35 static const char
*na
= "";
41 for (i
= 0; dstrings
[i
].id
!= 0 || dstrings
[i
].string
!= NULL
; i
++)
42 if (dstrings
[i
].id
== val
)
43 return dstrings
[i
].string
;
50 if (/^enum\W+(\w+)\W*/) {
51 print STDERR
"extern const struct debug_strings $1_array[];\n";
52 print "const struct debug_strings $1_array[] = {\n";
54 } elsif ($in_enum && /^}/) {
55 print "\t{ 0,\t(const char *) 0 }\n};\n\n";
57 } elsif (/^\s*\/\
*.*\
*\
/\s*$/) {
59 } elsif ($in_enum && /^\W*(\w+)\W*/) {
60 print "\t{ $1,\t\" ($1)\" },\n";