⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mk-string-arrays.pl

📁 -
💻 PL
字号:
#******************************************************************************# $Id: mk-string-arrays.pl,v 1.4 1998/04/07 23:31:51 rousskov Exp $## File:		mk-strs.pl## Author:	Max Okumoto <okumoto@ucsd.edu>## Abstract:	This perl script parses enums and builds an array of#		printable strings.## Warning:	The parser is very simplistic, and will prob not work for#		things other than squid.#******************************************************************************$pat{'err_type'} = "err_type_str";$pat{'icp_opcode'} = "icp_opcode_str";$pat{'swap_log_op'} = "swap_log_op_str";$pat{'lookup_t'} = "lookup_t_str";$state = 0;	# start statewhile (<>) {	if ($state == 0) {		# Looking for start of typedef		if (/^typedef enum /) {			$count = 0;	# enum index			$state = 1;		}		next;	} elsif ($state == 1) {		# Looking for end of typedef		if (/^} /) {			($b, $t) = split(/[ \t;]/, $_);			if (defined($pat{$t})) {				print "const char *$pat{$t}\[\] = \n";				print "{\n";				for ($i = 0; $i < $count; $i++) {					printf "\t\"%s\"%s\n",						$ea[$i],						$i == $count - 1 ? '' : ',';				}				print "};\n";				print "\n";			}			$state = 0;		} else {			($e) = split(' ', $_);			$e =~ s/,//;			$ea[$count] = $e;			$count++;		}		next;	}}exit 0;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -