]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mk-string-arrays.pl
2 ## Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 ## Squid software is distributed under GPLv2+ license and includes
5 ## contributions from numerous individuals and organizations.
6 ## Please see the COPYING and CONTRIBUTORS files for details.
9 #******************************************************************************
12 # Author: Max Okumoto <okumoto@ucsd.edu>
14 # Abstract: This perl script parses enums and builds an array of
17 # Warning: The parser is very simplistic, and will prob not work for
18 # things other than squid.
19 #******************************************************************************
21 $pat{'err_type'} = "err_type_str";
22 $pat{'icp_opcode'} = "icp_opcode_str";
23 $pat{'swap_log_op'} = "swap_log_op_str";
24 $pat{'lookup_t'} = "lookup_t_str";
26 $state = 0; # start state
29 # Looking for start of typedef
30 if (/^typedef enum /) {
31 $count = 0; # enum index
36 } elsif ($state == 1) {
37 # Looking for end of typedef
39 ($b, $t) = split(/[ \t;]/, $_);
40 if (defined($pat{$t})) {
41 print "const char *$pat{$t}\[\] = \n";
43 for ($i = 0; $i < $count; $i++) {
44 printf "\t\"%s\"%s\n",
46 $i == $count - 1 ?
'' : ',';
53 ($e) = split(' ', $_);