c2man: Fix the array reference syntax and the return value regexps.
This commit is contained in:
parent
f43762f6f8
commit
6fb1d75239
|
@ -629,7 +629,7 @@ sub process_comment($)
|
||||||
|
|
||||||
# When the function is exported twice we have the second name below the first
|
# When the function is exported twice we have the second name below the first
|
||||||
# (you see this a lot in ntdll, but also in some other places).
|
# (you see this a lot in ntdll, but also in some other places).
|
||||||
my $first_line = ${@{$comment->{TEXT}}}[1];
|
my $first_line = ${$comment->{TEXT}}[1];
|
||||||
|
|
||||||
if ( $first_line =~ /^(@|[A-Za-z0-9_]+) +(\(|\[)([A-Za-z0-9_]+)\.(([0-9]+)|@)(\)|\])$/ )
|
if ( $first_line =~ /^(@|[A-Za-z0-9_]+) +(\(|\[)([A-Za-z0-9_]+)\.(([0-9]+)|@)(\)|\])$/ )
|
||||||
{
|
{
|
||||||
|
@ -644,14 +644,14 @@ sub process_comment($)
|
||||||
my $alt_export = @{$spec_details->{EXPORTS}}[$alt_index];
|
my $alt_export = @{$spec_details->{EXPORTS}}[$alt_index];
|
||||||
@$alt_export[4] |= $FLAG_DOCUMENTED;
|
@$alt_export[4] |= $FLAG_DOCUMENTED;
|
||||||
$spec_details->{NUM_DOCS}++;
|
$spec_details->{NUM_DOCS}++;
|
||||||
${@{$comment->{TEXT}}}[1] = "";
|
${$comment->{TEXT}}[1] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@{$spec_details->{CURRENT_EXTRA}})
|
if (@{$spec_details->{CURRENT_EXTRA}})
|
||||||
{
|
{
|
||||||
# We have an extra comment that might be related to this one
|
# We have an extra comment that might be related to this one
|
||||||
my $current_comment = ${@{$spec_details->{CURRENT_EXTRA}}}[0];
|
my $current_comment = ${$spec_details->{CURRENT_EXTRA}}[0];
|
||||||
my $current_name = $current_comment->{COMMENT_NAME};
|
my $current_name = $current_comment->{COMMENT_NAME};
|
||||||
if ($comment->{COMMENT_NAME} =~ /^$current_name/ && $comment->{COMMENT_NAME} ne $current_name)
|
if ($comment->{COMMENT_NAME} =~ /^$current_name/ && $comment->{COMMENT_NAME} ne $current_name)
|
||||||
{
|
{
|
||||||
|
@ -822,12 +822,12 @@ sub process_comment($)
|
||||||
|
|
||||||
if ( $prototype =~ /(WINAPIV|WINAPI|__cdecl|PASCAL|CALLBACK|FARPROC16)/ )
|
if ( $prototype =~ /(WINAPIV|WINAPI|__cdecl|PASCAL|CALLBACK|FARPROC16)/ )
|
||||||
{
|
{
|
||||||
$prototype =~ s/^(.*?) (WINAPIV|WINAPI|__cdecl|PASCAL|CALLBACK|FARPROC16) (.*?)\( *(.*)/$4/;
|
$prototype =~ s/^(.*?)\s+(WINAPIV|WINAPI|__cdecl|PASCAL|CALLBACK|FARPROC16)\s+(.*?)\(\s*(.*)/$4/;
|
||||||
$comment->{RETURNS} = $1;
|
$comment->{RETURNS} = $1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$prototype =~ s/^(.*?)([A-Za-z0-9_]+)\( *(.*)/$3/;
|
$prototype =~ s/^(.*?)([A-Za-z0-9_]+)\s*\(\s*(.*)/$3/;
|
||||||
$comment->{RETURNS} = $1;
|
$comment->{RETURNS} = $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,7 +988,7 @@ sub process_extra_comment($)
|
||||||
|
|
||||||
if (@{$spec_details->{CURRENT_EXTRA}})
|
if (@{$spec_details->{CURRENT_EXTRA}})
|
||||||
{
|
{
|
||||||
my $current_comment = ${@{$spec_details->{CURRENT_EXTRA}}}[0];
|
my $current_comment = ${$spec_details->{CURRENT_EXTRA}}[0];
|
||||||
|
|
||||||
if ($opt_verbose > 0)
|
if ($opt_verbose > 0)
|
||||||
{
|
{
|
||||||
|
@ -1074,7 +1074,7 @@ sub process_index_files()
|
||||||
if (@{$spec_details->{CURRENT_EXTRA}})
|
if (@{$spec_details->{CURRENT_EXTRA}})
|
||||||
{
|
{
|
||||||
# We have an unwritten extra comment, write it
|
# We have an unwritten extra comment, write it
|
||||||
my $current_comment = ${@{$spec_details->{CURRENT_EXTRA}}}[0];
|
my $current_comment = ${$spec_details->{CURRENT_EXTRA}}[0];
|
||||||
process_extra_comment($current_comment);
|
process_extra_comment($current_comment);
|
||||||
@{$spec_details->{CURRENT_EXTRA}} = ();
|
@{$spec_details->{CURRENT_EXTRA}} = ();
|
||||||
}
|
}
|
||||||
|
@ -1470,7 +1470,7 @@ sub output_api_synopsis($)
|
||||||
my $biggest_length = 0;
|
my $biggest_length = 0;
|
||||||
for(my $i=0; $i < @{$comment->{PROTOTYPE}}; $i++)
|
for(my $i=0; $i < @{$comment->{PROTOTYPE}}; $i++)
|
||||||
{
|
{
|
||||||
my $line = ${@{$comment->{PROTOTYPE}}}[$i];
|
my $line = ${$comment->{PROTOTYPE}}[$i];
|
||||||
if ($line =~ /(.+?)([A-Za-z_][A-Za-z_0-9]*)$/)
|
if ($line =~ /(.+?)([A-Za-z_][A-Za-z_0-9]*)$/)
|
||||||
{
|
{
|
||||||
my $length = length $1;
|
my $length = length $1;
|
||||||
|
@ -1484,19 +1484,19 @@ sub output_api_synopsis($)
|
||||||
# Now pad the string with blanks
|
# Now pad the string with blanks
|
||||||
for(my $i=0; $i < @{$comment->{PROTOTYPE}}; $i++)
|
for(my $i=0; $i < @{$comment->{PROTOTYPE}}; $i++)
|
||||||
{
|
{
|
||||||
my $line = ${@{$comment->{PROTOTYPE}}}[$i];
|
my $line = ${$comment->{PROTOTYPE}}[$i];
|
||||||
if ($line =~ /(.+?)([A-Za-z_][A-Za-z_0-9]*)$/)
|
if ($line =~ /(.+?)([A-Za-z_][A-Za-z_0-9]*)$/)
|
||||||
{
|
{
|
||||||
my $pad_len = $biggest_length - length $1;
|
my $pad_len = $biggest_length - length $1;
|
||||||
my $padding = " " x ($pad_len);
|
my $padding = " " x ($pad_len);
|
||||||
${@{$comment->{PROTOTYPE}}}[$i] = $1.$padding.$2;
|
${$comment->{PROTOTYPE}}[$i] = $1.$padding.$2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(my $i=0; $i < @{$comment->{PROTOTYPE}}; $i++)
|
for(my $i=0; $i < @{$comment->{PROTOTYPE}}; $i++)
|
||||||
{
|
{
|
||||||
# Format the parameter name
|
# Format the parameter name
|
||||||
my $line = ${@{$comment->{PROTOTYPE}}}[$i];
|
my $line = ${$comment->{PROTOTYPE}}[$i];
|
||||||
my $comma = ($i == @{$comment->{PROTOTYPE}}-1) ? "" : ",";
|
my $comma = ($i == @{$comment->{PROTOTYPE}}-1) ? "" : ",";
|
||||||
$line =~ s/(.+?)([A-Za-z_][A-Za-z_0-9]*)$/ $fmt[0]$1$fmt[2]$2$fmt[3]$comma$fmt[1]/;
|
$line =~ s/(.+?)([A-Za-z_][A-Za-z_0-9]*)$/ $fmt[0]$1$fmt[2]$2$fmt[3]$comma$fmt[1]/;
|
||||||
print OUTPUT $line;
|
print OUTPUT $line;
|
||||||
|
|
Loading…
Reference in New Issue