Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex perl-需要在.c文件内的模板中添加函数参数列表_Regex_Perl - Fatal编程技术网

Regex perl-需要在.c文件内的模板中添加函数参数列表

Regex perl-需要在.c文件内的模板中添加函数参数列表,regex,perl,Regex,Perl,这是我最初的问题 我现在有点问题。我尝试了很长时间,但无法修复它 pChainCtrl pChainName pDef pChainCtrl pArgs pChainCtrl pChainCtrl name pChainTable 这些是一些函数的参数,需要将它们添加到“@param[in]” C文件的一部分 /** ********************************************************************************

这是我最初的问题

我现在有点问题。我尝试了很长时间,但无法修复它

pChainCtrl 
pChainName 
pDef 

pChainCtrl 
pArgs 

pChainCtrl
pChainCtrl 
name 
pChainTable
这些是一些函数的参数,需要将它们添加到“@param[in]”

C文件的一部分

/**
********************************************************************************
 *  @fn ChainCtrlSetJpgSnapshotFile                                             
 *  @brief
 *  @param[in ]    //arguments needs to be added here                 
 *  @return
********************************************************************************
*/
eErrorT ChainCtrlSetJpgSnapshotFile(ChainCtrlT* pChainCtrl, RouteListItemT* pRoute, char * dst_chain, char *jpg_file_path)
{
  ............
}

/**
********************************************************************************
 *  @fn ChainCtrlSetBgFile                                                      
 *  @brief
 *  @param[in ]         //arguments needs to be added here
 *  @return
********************************************************************************
*/
eErrorT ChainCtrlSetBgFile(ChainCtrlT* pChainCtrl, RouteListItemT* pRoute, char * dst_chain, char *bg_file_path)
{
  ....
}
/**
********************************************************************************
 *  @fn ChainCtrlSetColorBar                                                    
 *  @brief
 *  @param[in ]    //arguments needs to be added here                       
 *  @return
********************************************************************************
*/
eErrorT ChainCtrlSetColorBar(ChainCtrlT* pChainCtrl, RouteListItemT* pRoute, char * dst_chain,Boolean bOnOff)
{
  ..........
}
我尝试了user@mpapec共享的代码

但它只在第一个函数中添加参数

use strict;
use warnings;

open(my $FILE4, "<", "chaincontroller.c") or die $!;
my $tl = do { local $/; <$FILE4> };
$tl =~ s|\s+$||mg;

open (my $FILE3, "<", "functions2.txt") or die $!;
my @array1 = map [ split ],
  do { local $/ = ""; <$FILE3> };

for my $arg (@array1) {
  my $s = $tl;
  $s =~ s|(param.+)|"$1   ". join "\n                 ", @$arg |e;
  print $s;
}
使用严格;
使用警告;

打开(my$FILE4,“尝试将
for
循环替换为

$tl =~ s{(\@param.+)}{
  "$1   ". join "\n                 ", @{ shift @array1 };
}ge;
print $tl;

作品完美!!!我很感激你在如此复杂的问题上帮助了我这么多次,以至于回复太快。