mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-22 13:54:59 +02:00
prod/doc/hmac.pl: allow self-referential macros (not general recursion)
This commit is contained in:
parent
838b8e1ace
commit
2386f1f7b5
@ -198,7 +198,8 @@ sub define_macro
|
||||
die "NAME parameter is missing" unless defined $name;
|
||||
$d =~ s/$BM/<MACRO/gi;
|
||||
$d =~ s|$EM|</MACRO>|gi;
|
||||
$mac{$name} = $d;
|
||||
# $mac{$name} = $d;
|
||||
$mac{$name} = &expand_macro_list($d, $name);
|
||||
$args{$name} = { %arg };
|
||||
}
|
||||
else {
|
||||
@ -214,14 +215,14 @@ sub define_macro
|
||||
# Expand first macro
|
||||
#
|
||||
|
||||
sub expand_macro
|
||||
sub expand_macro_list
|
||||
{
|
||||
local ($in) = @_;
|
||||
local ($in, @mac) = @_;
|
||||
local ($a,$b,$c);
|
||||
local ($mac, $done, $prm, %arg);
|
||||
|
||||
undef $a;
|
||||
for $mac (keys %mac) {
|
||||
for $mac (@mac) {
|
||||
if ($in =~ /<$mac\b(("[^"]*"|[^>])*)>/is) {
|
||||
($a,$b,$c) = ($`,$1,$') if length $` < length $a || !defined $a;
|
||||
}
|
||||
@ -259,3 +260,11 @@ sub expand_macro
|
||||
}
|
||||
return $in;
|
||||
}
|
||||
|
||||
|
||||
sub expand_macro
|
||||
{
|
||||
local ($in) = @_;
|
||||
|
||||
return &expand_macro_list($in, keys %mac);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user