📄 fromc
字号:
#! /usr/local/bin/perl5## Convert ANSI-C style function prototypes into the wrappergen input format, # which is# <num of functions># <function return type># <function name># <number of args># <type># <argname># <blank># <type># <argname># ...## For simplicity, this reads from standard input and writes to standard output# The last thing written is the number of functions.$num_functions = 0;while (<>) { if (/([^\(]*)\s* ([A-Za-z0-9_]*)\((.*)\)\s*;/) { $ftype = $1; $fname = $2; $args = $3; $num_functions++; print "$ftype\n"; print "$fname\n"; @arglist = split(/,/,$args); $nargs = $#arglist + 1; print "$nargs\n"; for (@arglist) { $arg = $_; # separate arg type from name# @pieces = split(/\s/, $arg );# $argname = $pieces[$#pieces];# $#pieces = $#pieces - 1;# $argtype = join(' ',@pieces ); /(.*[\s\*])([A-Za-z_0-9]*)/; $argtype = $1; $argname = $2; $argtype =~ s/^\s*//; print "$argtype\n"; print "$argname\n\n"; } } else { print "Unrecognized line $_"; } }print "$num_functions\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -