Several bug fixes and additions.
This commit is contained in:
parent
56a19923e8
commit
0e397febb0
|
@ -118,7 +118,7 @@ foreach my $file (@files) {
|
||||||
|
|
||||||
local $_;
|
local $_;
|
||||||
foreach (split(/\n/, $documentation)) {
|
foreach (split(/\n/, $documentation)) {
|
||||||
if(/^ \*\s*(\w+)\s*[\(\[]\s*(\w+)\.\s*(\@|\d+)\s*[\)\]]/m) {
|
if(/^\s*\*\s*(\w+|\@)\s*[\(\[]\s*(\w+)\s*\.\s*(\@|\d+)\s*[\)\]]/) {
|
||||||
my $external_name = $1;
|
my $external_name = $1;
|
||||||
my $module = lc($2);
|
my $module = lc($2);
|
||||||
my $ordinal = $3;
|
my $ordinal = $3;
|
||||||
|
|
|
@ -38,7 +38,7 @@ my %options_long = (
|
||||||
|
|
||||||
"local" => { default => 1, description => "local fixup" },
|
"local" => { default => 1, description => "local fixup" },
|
||||||
"documentation" => { default => 1, parent => "local", description => "documentation fixup" },
|
"documentation" => { default => 1, parent => "local", description => "documentation fixup" },
|
||||||
"documentation-ordinal" => { default => 0, parent => "documentation", description => "documentation ordinal fixup" },
|
"documentation-ordinal" => { default => 1, parent => "documentation", description => "documentation ordinal fixup" },
|
||||||
"documentation-missing" => { default => 0, parent => "documentation", description => "documentation missing fixup" },
|
"documentation-missing" => { default => 0, parent => "documentation", description => "documentation missing fixup" },
|
||||||
"documentation-name" => { default => 1, parent => "documentation", description => "documentation name fixup" },
|
"documentation-name" => { default => 1, parent => "documentation", description => "documentation name fixup" },
|
||||||
"stub" => { default => 0, parent => "local", description => "stub fixup" },
|
"stub" => { default => 0, parent => "local", description => "stub fixup" },
|
||||||
|
@ -76,6 +76,12 @@ sub get_all_module_internal_ordinal {
|
||||||
|
|
||||||
my @entries = ();
|
my @entries = ();
|
||||||
foreach my $winapi (@winapis) {
|
foreach my $winapi (@winapis) {
|
||||||
|
my @name = (); {
|
||||||
|
my $name = $winapi->function_external_name($internal_name);
|
||||||
|
if(defined($name)) {
|
||||||
|
@name = split(/ & /, $name);
|
||||||
|
}
|
||||||
|
}
|
||||||
my @module = (); {
|
my @module = (); {
|
||||||
my $module = $winapi->function_internal_module($internal_name);
|
my $module = $winapi->function_internal_module($internal_name);
|
||||||
if(defined($module)) {
|
if(defined($module)) {
|
||||||
|
@ -89,10 +95,14 @@ sub get_all_module_internal_ordinal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $name;
|
||||||
my $module;
|
my $module;
|
||||||
my $ordinal;
|
my $ordinal;
|
||||||
while(defined($module = shift @module) && defined($ordinal = shift @ordinal)) {
|
while(defined($name = shift @name) &&
|
||||||
push @entries, [$module, $ordinal];
|
defined($module = shift @module) &&
|
||||||
|
defined($ordinal = shift @ordinal))
|
||||||
|
{
|
||||||
|
push @entries, [$name, $module, $ordinal];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +115,7 @@ sub get_all_module_external_ordinal {
|
||||||
my @entries = ();
|
my @entries = ();
|
||||||
foreach my $winapi (@winapis) {
|
foreach my $winapi (@winapis) {
|
||||||
my @name = (); {
|
my @name = (); {
|
||||||
my $name = $winapi->function_external_name($external_name);
|
my $name = $winapi->function_internal_name($external_name);
|
||||||
if(defined($name)) {
|
if(defined($name)) {
|
||||||
@name = split(/ & /, $name);
|
@name = split(/ & /, $name);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +136,7 @@ sub get_all_module_external_ordinal {
|
||||||
my $name;
|
my $name;
|
||||||
my $module;
|
my $module;
|
||||||
my $ordinal;
|
my $ordinal;
|
||||||
while(# defined($name = shift @name) &&
|
while(defined($name = shift @name) &&
|
||||||
defined($module = shift @module) &&
|
defined($module = shift @module) &&
|
||||||
defined($ordinal = shift @ordinal))
|
defined($ordinal = shift @ordinal))
|
||||||
{
|
{
|
||||||
|
@ -188,7 +198,19 @@ foreach my $file (@c_files) {
|
||||||
my @argument_documentations = @$refargument_documentations;
|
my @argument_documentations = @$refargument_documentations;
|
||||||
my $statements = shift;
|
my $statements = shift;
|
||||||
|
|
||||||
if($linkage eq "static" || $linkage eq "extern") {
|
if($linkage eq "static" || $linkage eq "extern" || !defined($statements)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @external_names = ();
|
||||||
|
foreach my $winapi (@winapis) {
|
||||||
|
my $external_names = $winapi->function_external_name($internal_name);
|
||||||
|
if(defined($external_names)) {
|
||||||
|
push @external_names, split(/\s*&\s*/, $external_names);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($#external_names < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,18 +236,28 @@ foreach my $file (@c_files) {
|
||||||
my $calling_convention16 = translate_calling_convention16($calling_convention);
|
my $calling_convention16 = translate_calling_convention16($calling_convention);
|
||||||
my $calling_convention32 = translate_calling_convention32($calling_convention);
|
my $calling_convention32 = translate_calling_convention32($calling_convention);
|
||||||
|
|
||||||
my @external_names = ();
|
my $documention_modified = 0;
|
||||||
foreach my $winapi (@winapis) {
|
|
||||||
my $external_names = $winapi->function_external_name($internal_name);
|
|
||||||
if(defined($external_names)) {
|
|
||||||
push @external_names, split(/\s*&\s*/, $external_names);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(options->documentation_ordinal && $documentation) {
|
if(($documentation && !$documention_modified) &&
|
||||||
|
(options->documentation_name || options->documentation_ordinal))
|
||||||
|
{
|
||||||
local $_;
|
local $_;
|
||||||
|
|
||||||
|
my %found_external_names;
|
||||||
|
|
||||||
|
foreach my $external_name (@external_names) {
|
||||||
|
$found_external_names{$external_name} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $line3;
|
||||||
|
my $search;
|
||||||
|
my $replace;
|
||||||
|
|
||||||
|
my $count = 0;
|
||||||
|
my $line2 = $line - 1;
|
||||||
foreach (split(/\n/, $documentation)) {
|
foreach (split(/\n/, $documentation)) {
|
||||||
if(/^(\s*\*\s*(\w+)\s*)(\s*(?:[\(\[]\s*\w+(?:\s*\.\s*\S*\s*)?[\)\]])+)(.*?)$/m) {
|
$line2++;
|
||||||
|
if(/^(\s*\*\s*(\w+|\@)\s*)((?:\s*[\(\[]\s*\w+(?:\s*\.\s*[^\s\)\]]*\s*)?[\)\]])+)(.*?)$/) {
|
||||||
my $part1 = $1;
|
my $part1 = $1;
|
||||||
my $external_name = $2;
|
my $external_name = $2;
|
||||||
my $part3 = $3;
|
my $part3 = $3;
|
||||||
|
@ -234,161 +266,100 @@ foreach my $file (@c_files) {
|
||||||
$part4 =~ s/\s*$//;
|
$part4 =~ s/\s*$//;
|
||||||
|
|
||||||
my @entries = ();
|
my @entries = ();
|
||||||
while($part3 =~ s/^\s*([\(\[]\s*(\w+)(?:\s*\.\s*(\S*)\s*)?[\)\]])//) {
|
while($part3 =~ s/^\s*([\(\[]\s*(\w+)(?:\s*\.\s*([^\s\)\]]*)\s*)?[\)\]])//) {
|
||||||
push @entries, [$1, lc($2), $3];
|
push @entries, [$1, $2, $3];
|
||||||
}
|
}
|
||||||
|
|
||||||
my $replaced = 0;
|
my $found = 0;
|
||||||
my $replace = "";
|
foreach my $external_name2 (@external_names) {
|
||||||
foreach my $entry (@entries) {
|
if($external_name eq $external_name2) {
|
||||||
(my $part, my $module, my $ordinal) = @$entry;
|
$found_external_names{$external_name2} = 1;
|
||||||
foreach my $entry2 (get_all_module_external_ordinal($external_name)) {
|
$found = 1;
|
||||||
(my $external_name2, my $module2, my $ordinal2) = @$entry2;
|
|
||||||
|
|
||||||
if(defined($module2) && $module eq $module2 &&
|
|
||||||
(!defined($ordinal) || (defined($ordinal2) && $ordinal ne $ordinal2)))
|
|
||||||
{
|
|
||||||
if(defined($ordinal)) {
|
|
||||||
if($part =~ s/\U$module\E\s*.\s*\Q$ordinal\E/\U$module2\E.$ordinal2/) {
|
|
||||||
$replaced++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if($part =~ s/\U$module\E/\U$module2\E.$ordinal2/) {
|
|
||||||
$replaced++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($replace) { $replace .= "\n"; }
|
|
||||||
$replace .= "$part1$part$part4";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($replaced > 0) {
|
|
||||||
$substitute_line{$_}{search} = "^\Q$_\E\$";
|
|
||||||
$substitute_line{$_}{replace} = "$replace";
|
|
||||||
}
|
|
||||||
} elsif(/^(\s*\*\s*)(\w+)\s*$/m) {
|
|
||||||
my $part1 = $1;
|
|
||||||
my $external_name = $2;
|
|
||||||
if($internal_name eq $external_name) {
|
|
||||||
foreach my $entry (get_all_module_external_ordinal($external_name)) {
|
|
||||||
(my $external_name2, my $module, my $ordinal) = @$entry;
|
|
||||||
|
|
||||||
# FIXME: Not correct
|
|
||||||
$substitute_line{$_}{search} = "^\Q$_\E\$";
|
|
||||||
$substitute_line{$_}{replace} = "$part1$external_name (\U$module\E.$ordinal)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(options->documentation_name && $documentation) {
|
|
||||||
local $_;
|
|
||||||
|
|
||||||
my @entries = ();
|
|
||||||
foreach (split(/\n/, $documentation)) {
|
|
||||||
if(/^(\s*\*\s*(\w+)\s*)(\s*(?:[\(\[]\s*\w+(?:\s*\.\s*\S+\s*)?[\)\]])+)(.*?)$/m) {
|
|
||||||
my $part1 = $1;
|
|
||||||
my $external_name2 = $2;
|
|
||||||
my $part3 = $3;
|
|
||||||
my $part4 = $4;
|
|
||||||
|
|
||||||
$part4 =~ s/\s*$//;
|
|
||||||
|
|
||||||
push @entries, [$part1, $external_name2, $part3, $part4];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my @missing_external_names = ();
|
|
||||||
foreach my $external_name (@external_names) {
|
|
||||||
my $found = 0;
|
|
||||||
foreach my $entry (@entries) {
|
|
||||||
my $part1 = $entry->[0];
|
|
||||||
my $external_name2 = $entry->[1];
|
|
||||||
my $part3 = $entry->[2];
|
|
||||||
my $part4 = $entry->[3];
|
|
||||||
|
|
||||||
if($external_name eq $external_name2) {
|
|
||||||
$found = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!$found) {
|
|
||||||
push @missing_external_names, $external_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $external_name (@missing_external_names) {
|
|
||||||
my $internal_name2 = $internal_name;
|
|
||||||
my $external_name2 = $external_name;
|
|
||||||
|
|
||||||
if($internal_name =~ /^(.*?)$external_name(.*?)$/) {
|
|
||||||
my $prefix = $1;
|
|
||||||
my $suffix = $2;
|
|
||||||
|
|
||||||
my $part1;
|
|
||||||
my $part3;
|
|
||||||
my $external_name2;
|
|
||||||
my $part4;
|
|
||||||
|
|
||||||
foreach my $entry (@entries) {
|
|
||||||
$part1 = $entry->[0];
|
|
||||||
$external_name2 = $entry->[1];
|
|
||||||
$part3 = $entry->[2];
|
|
||||||
$part4 = $entry->[3];
|
|
||||||
|
|
||||||
if($internal_name =~ /^(.*?)$external_name(.*?)$/) {
|
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (split(/\n/, $documentation)) {
|
my $replaced = 0;
|
||||||
if(/\Q$external_name\E/) {
|
my $replace2 = "";
|
||||||
if($suffix =~ /^16$/) {
|
foreach my $entry (@entries) {
|
||||||
$substitute_line{$_}{search} = "\Q$internal_name\E";
|
my $part12 = $part1;
|
||||||
$substitute_line{$_}{replace} = "$external_name";
|
(my $part32, my $module, my $ordinal) = @$entry;
|
||||||
last;
|
|
||||||
} elsif($suffix =~ /^[AW]$/) {
|
|
||||||
$substitute_line{$_}{search} = "^\Q$_\E\$";
|
|
||||||
|
|
||||||
# FIXME: Not correct
|
foreach my $entry2 (get_all_module_internal_ordinal($internal_name)) {
|
||||||
my $replace = "";
|
(my $external_name2, my $module2, my $ordinal2) = @$entry2;
|
||||||
|
|
||||||
$part3 =~ /^\s*[\(\[]\s*(\w+)(?:\s*\.\s*(\S*)\s*)?[\)\]]/;
|
|
||||||
my $module = lc($1);
|
|
||||||
my $ordinal = $2;
|
|
||||||
|
|
||||||
foreach my $entry2 (get_all_module_external_ordinal($external_name)) {
|
if(options->documentation_name && lc($module) eq $module2 &&
|
||||||
(my $external_name2, my $module2, my $ordinal2) = @$entry2;
|
$external_name ne $external_name2)
|
||||||
|
{
|
||||||
my $part12 = $part1;
|
if(!$found && $part12 =~ s/\b\Q$external_name\E\b/$external_name2/) {
|
||||||
$part12 =~ s/[AW](\s*)$/ $1/;
|
$external_name = $external_name2;
|
||||||
|
$replaced++;
|
||||||
my $part32 = $part3;
|
|
||||||
|
|
||||||
if($module ne $module2 || $ordinal ne $ordinal2) {
|
|
||||||
$part32 =~ s/\U$module\E\s*.\s*\Q$ordinal\E/\U$module2\E.$ordinal2/;
|
|
||||||
$replace = "$part12$part32$part4";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($replace) {
|
if(options->documentation_ordinal &&
|
||||||
$replace .= "\n$part1$part3$part4";
|
$external_name eq $external_name2 &&
|
||||||
$substitute_line{$_}{replace} = $replace;
|
lc($module) eq $module2 &&
|
||||||
last;
|
($#entries > 0 || !defined($ordinal) || ($ordinal ne $ordinal2)))
|
||||||
|
{
|
||||||
|
if(defined($ordinal)) {
|
||||||
|
if($part32 =~ s/\Q$module\E\s*.\s*\Q$ordinal\E/\U$module2\E.$ordinal2/ || $#entries > 0) {
|
||||||
|
$replaced++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($part32 =~ s/\Q$module\E/\U$module2\E.$ordinal2/ || $#entries > 0) {
|
||||||
|
$replaced++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if($replace2) { $replace2 .= "\n"; }
|
||||||
|
$replace2 .= "$part12$part32$part4";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
output->write("$external_name missing\n");
|
if($replaced > 0) {
|
||||||
|
$line3 = $line2;
|
||||||
|
$search = "^\Q$_\E\$";
|
||||||
|
$replace = $replace2;
|
||||||
|
}
|
||||||
|
$count++;
|
||||||
|
} elsif(/^(\s*\*\s*)(\w+|\@)\s*$/) {
|
||||||
|
my $part1 = $1;
|
||||||
|
my $external_name = $2;
|
||||||
|
if($internal_name eq $external_name) {
|
||||||
|
foreach my $entry (get_all_module_internal_ordinal($internal_name)) {
|
||||||
|
(my $external_name2, my $module, my $ordinal) = @$entry;
|
||||||
|
|
||||||
|
$line3 = $line2;
|
||||||
|
$search = "^\Q$_\E\$";
|
||||||
|
$replace = "$part1$external_name2 (\U$module\E.$ordinal)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(defined($line3) && defined($search) && defined($replace)) {
|
||||||
|
if($count > 1 || $#external_names >= 1) {
|
||||||
|
output->write("multiple entries (fixup not supported)\n");
|
||||||
|
# output->write("s/$search/$replace/\n");
|
||||||
|
} else {
|
||||||
|
$substitute_line{$line3}{search} = $search;
|
||||||
|
$substitute_line{$line3}{replace} = $replace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(options->documentation_missing) {
|
||||||
|
foreach my $external_name (keys(%found_external_names)) {
|
||||||
|
if(!$found_external_names{$external_name}) {
|
||||||
|
output->write("$external_name missing (fixup not supported)\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(options->documentation_missing && !$documentation) {
|
if(0 && !$documentation) {
|
||||||
# FIXME: Not correct
|
# FIXME: Not correct
|
||||||
|
|
||||||
my $external_name;
|
my $external_name;
|
||||||
|
@ -495,22 +466,22 @@ foreach my $file (@c_files) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $search = $substitute_line{$_}{search};
|
my $search = $substitute_line{$.}{search};
|
||||||
my $replace = $substitute_line{$_}{replace};
|
my $replace = $substitute_line{$.}{replace};
|
||||||
|
|
||||||
if(defined($search) && defined($replace)) {
|
if(defined($search) && defined($replace)) {
|
||||||
my $modified2 = 0;
|
my $modified2 = 0;
|
||||||
if(options->modify) {
|
if(s/$search/$replace/) {
|
||||||
if(s/$search/$replace/) {
|
if(options->modify) {
|
||||||
$modified = 1;
|
$modified = 1;
|
||||||
$modified2 = 1;
|
|
||||||
}
|
}
|
||||||
|
$modified2 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!options->modify || !$modified2) {
|
if(!options->modify || !$modified2) {
|
||||||
my $search2;
|
my $search2;
|
||||||
my $replace2;
|
my $replace2;
|
||||||
if(options->modify && !$modified2) {
|
if(!$modified2) {
|
||||||
$search2 = "unmatched search";
|
$search2 = "unmatched search";
|
||||||
$replace2 = "unmatched replace";
|
$replace2 = "unmatched replace";
|
||||||
} else {
|
} else {
|
||||||
|
@ -569,7 +540,7 @@ foreach my $file (@c_files) {
|
||||||
if(s/$search/$replace/) {
|
if(s/$search/$replace/) {
|
||||||
if(options->modify) {
|
if(options->modify) {
|
||||||
$modified = 1;
|
$modified = 1;
|
||||||
} else {
|
} else {
|
||||||
output->write("$file: search : '$search'\n");
|
output->write("$file: search : '$search'\n");
|
||||||
output->write("$file: replace: '$replace'\n");
|
output->write("$file: replace: '$replace'\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,6 @@ dlls/odbc32
|
||||||
% dlls/ole32/compobj.spec
|
% dlls/ole32/compobj.spec
|
||||||
|
|
||||||
dlls/ole32
|
dlls/ole32
|
||||||
files
|
|
||||||
|
|
||||||
% dlls/ole32/ole2.spec
|
% dlls/ole32/ole2.spec
|
||||||
|
|
||||||
|
@ -210,7 +209,6 @@ dlls/ole32
|
||||||
% dlls/ole32/ole2nls.spec
|
% dlls/ole32/ole2nls.spec
|
||||||
|
|
||||||
dlls/ole32
|
dlls/ole32
|
||||||
ole
|
|
||||||
|
|
||||||
% dlls/ole32/ole2prox.spec
|
% dlls/ole32/ole2prox.spec
|
||||||
|
|
||||||
|
|
|
@ -76,14 +76,12 @@ sub new {
|
||||||
# skip comments
|
# skip comments
|
||||||
if(/^dnl/) { next; }
|
if(/^dnl/) { next; }
|
||||||
|
|
||||||
if(/^AC_CHECK_HEADERS\(\s*(.*?)\)\s*$/) {
|
if(/^AC_CHECK_HEADERS\(\s*([^,\)]*)(?:,|\))?/) {
|
||||||
my @arguments = split(/,/,$1);
|
foreach my $name (split(/\s+/, $1)) {
|
||||||
foreach my $name (split(/\s+/, $arguments[0])) {
|
|
||||||
$$conditional_headers{$name}++;
|
$$conditional_headers{$name}++;
|
||||||
}
|
}
|
||||||
} elsif(/^AC_CHECK_FUNCS\(\s*(.*?)\)\s*$/) {
|
} elsif(/^AC_CHECK_FUNCS\(\s*([^,\)]*)(?:,|\))?/) {
|
||||||
my @arguments = split(/,/,$1);
|
foreach my $name (split(/\s+/, $1)) {
|
||||||
foreach my $name (split(/\s+/, $arguments[0])) {
|
|
||||||
$$conditional_functions{$name}++;
|
$$conditional_functions{$name}++;
|
||||||
}
|
}
|
||||||
} elsif(/^AC_FUNC_ALLOCA/) {
|
} elsif(/^AC_FUNC_ALLOCA/) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ HTASK16 *
|
||||||
IMalloc16 *
|
IMalloc16 *
|
||||||
LPCLSID
|
LPCLSID
|
||||||
LPDWORD
|
LPDWORD
|
||||||
LPFILETIME
|
|
||||||
LPMALLOC16 *
|
LPMALLOC16 *
|
||||||
LPMESSAGEFILTER
|
LPMESSAGEFILTER
|
||||||
LPMESSAGEFILTER *
|
LPMESSAGEFILTER *
|
||||||
|
|
|
@ -694,6 +694,15 @@ sub function_external_calling_convention {
|
||||||
return $$function_external_calling_convention{$name};
|
return $$function_external_calling_convention{$name};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub function_internal_name {
|
||||||
|
my $self = shift;
|
||||||
|
my $function_internal_name = \%{$self->{FUNCTION_INTERNAL_NAME}};
|
||||||
|
|
||||||
|
my $name = shift;
|
||||||
|
|
||||||
|
return $$function_internal_name{$name};
|
||||||
|
}
|
||||||
|
|
||||||
sub function_external_name {
|
sub function_external_name {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
|
my $function_external_name = \%{$self->{FUNCTION_EXTERNAL_NAME}};
|
||||||
|
|
|
@ -46,7 +46,7 @@ sub parse_c_file {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$statements = "";
|
$statements = undef;
|
||||||
};
|
};
|
||||||
my $function_end = sub {
|
my $function_end = sub {
|
||||||
&$function_found_callback($line_number,$debug_channels,$documentation,$linkage,$return_type,
|
&$function_found_callback($line_number,$debug_channels,$documentation,$linkage,$return_type,
|
||||||
|
@ -55,6 +55,7 @@ sub parse_c_file {
|
||||||
$function = "";
|
$function = "";
|
||||||
};
|
};
|
||||||
my %regs_entrypoints;
|
my %regs_entrypoints;
|
||||||
|
my @comment_lines = ();
|
||||||
my @comments = ();
|
my @comments = ();
|
||||||
my $level = 0;
|
my $level = 0;
|
||||||
my $extern_c = 0;
|
my $extern_c = 0;
|
||||||
|
@ -72,11 +73,11 @@ sub parse_c_file {
|
||||||
if($lookahead) {
|
if($lookahead) {
|
||||||
$lookahead = 0;
|
$lookahead = 0;
|
||||||
$_ .= "\n" . $line;
|
$_ .= "\n" . $line;
|
||||||
|
$lookahead_count++;
|
||||||
} else {
|
} else {
|
||||||
$_ = $line;
|
$_ = $line;
|
||||||
$lookahead_count = 0;
|
$lookahead_count = 0;
|
||||||
}
|
}
|
||||||
$lookahead_count++;
|
|
||||||
print " $level($lookahead_count): $line\n" if $options->debug >= 2;
|
print " $level($lookahead_count): $line\n" if $options->debug >= 2;
|
||||||
print "*** $_\n" if $options->debug >= 3;
|
print "*** $_\n" if $options->debug >= 3;
|
||||||
} else {
|
} else {
|
||||||
|
@ -91,7 +92,12 @@ sub parse_c_file {
|
||||||
}
|
}
|
||||||
|
|
||||||
# remove C comments
|
# remove C comments
|
||||||
if(s/^(.*?)(\/\*.*?\*\/)(.*)$/$1 $3/s) { push @comments, $2; $again = 1; next }
|
if(s/^(.*?)(\/\*.*?\*\/)(.*)$/$1 $3/s) {
|
||||||
|
push @comment_lines, $.;
|
||||||
|
push @comments, $2;
|
||||||
|
$again = 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
if(/^(.*?)\/\*/s) {
|
if(/^(.*?)\/\*/s) {
|
||||||
$lookahead = 1;
|
$lookahead = 1;
|
||||||
next;
|
next;
|
||||||
|
@ -126,6 +132,7 @@ sub parse_c_file {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $documentation_line;
|
||||||
my $documentation;
|
my $documentation;
|
||||||
my @argument_documentations = ();
|
my @argument_documentations = ();
|
||||||
{
|
{
|
||||||
|
@ -137,7 +144,11 @@ sub parse_c_file {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defined($comments[$n]) && $n >= 0) {
|
if(defined($comments[$n]) && $n >= 0) {
|
||||||
|
my @lines = split(/\n/, $comments[$n]);
|
||||||
|
|
||||||
|
$documentation_line = $comment_lines[$n] - scalar(@lines) + 1;
|
||||||
$documentation = $comments[$n];
|
$documentation = $comments[$n];
|
||||||
|
|
||||||
for(my $m=$n+1; $m <= $#comments; $m++) {
|
for(my $m=$n+1; $m <= $#comments; $m++) {
|
||||||
if($comments[$m] =~ /^\/\*\*+\/$/ ||
|
if($comments[$m] =~ /^\/\*\*+\/$/ ||
|
||||||
$comments[$m] =~ /^\/\*\s*(?:\!)?defined/) # FIXME: Kludge
|
$comments[$m] =~ /^\/\*\s*(?:\!)?defined/) # FIXME: Kludge
|
||||||
|
@ -211,6 +222,10 @@ sub parse_c_file {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!defined($statements)) {
|
||||||
|
$statements = "";
|
||||||
|
}
|
||||||
|
|
||||||
if($line !~ /^\s*$/) {
|
if($line !~ /^\s*$/) {
|
||||||
$statements .= "$line\n";
|
$statements .= "$line\n";
|
||||||
}
|
}
|
||||||
|
@ -223,10 +238,14 @@ sub parse_c_file {
|
||||||
((__cdecl|__stdcall|CDECL|VFWAPIV|VFWAPI|WINAPIV|WINAPI|CALLBACK)\s+)?
|
((__cdecl|__stdcall|CDECL|VFWAPIV|VFWAPI|WINAPIV|WINAPI|CALLBACK)\s+)?
|
||||||
(\w+(\(\w+\))?)\s*\(([^\)]*)\)\s*(\{|\;)/sx)
|
(\w+(\(\w+\))?)\s*\(([^\)]*)\)\s*(\{|\;)/sx)
|
||||||
{
|
{
|
||||||
$line_number = $. - $lookahead_count;
|
my @lines = split(/\n/, $&);
|
||||||
|
my $function_line = $. - scalar(@lines) + 1;
|
||||||
|
|
||||||
|
# FIXME: Should be separate for documentation and function
|
||||||
|
$line_number = $documentation_line;
|
||||||
|
|
||||||
$_ = $'; $again = 1;
|
$_ = $'; $again = 1;
|
||||||
|
|
||||||
if($11 eq "{") {
|
if($11 eq "{") {
|
||||||
$level++;
|
$level++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue