fromc
来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· 代码 · 共 51 行
TXT
51 行
#! /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 + =
减小字号Ctrl + -
显示快捷键?