applets/c2english: improve text of function calls

This commit is contained in:
Pragmatic Software 2024-09-19 13:55:08 -07:00
parent 7da755d248
commit 6d10a146ed
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
3 changed files with 8 additions and 6 deletions

View File

@ -383,6 +383,8 @@ if (not $force and $ret != 0) {
# don't error about use of #error # don't error about use of #error
$output =~ s/^error: #error.*$//gm; $output =~ s/^error: #error.*$//gm;
$output =~ s/note: in definition of macro '[^']+'\s*//g;
$output =~ s/^\s+$//; $output =~ s/^\s+$//;
if (length $output) { if (length $output) {
@ -402,7 +404,7 @@ close $fh;
$output = `./c2eng.pl code2eng.c` if not defined $output; $output = `./c2eng.pl code2eng.c` if not defined $output;
if (not $has_function and not $has_main) { if (not $has_function and not $has_main) {
$output =~ s/Let .main. be a function \(taking no arguments\) and returning int.\s*When called, the function will.\s*(do nothing.)?//i; $output =~ s/Let .main. be a function \(taking no arguments\) returning int.\s*When called, the function will.\s*(do nothing.)?//i;
$output =~ s/\s*Return 0.\s*End of function .main..\s*//; $output =~ s/\s*Return 0.\s*End of function .main..\s*//;
$output =~ s/\s*Finally, return 0.$//; $output =~ s/\s*Finally, return 0.$//;
$output =~ s/\s*and then return 0.$/./; $output =~ s/\s*and then return 0.$/./;
@ -410,7 +412,7 @@ if (not $has_function and not $has_main) {
$output =~ s/^\s*(.)/\U$1/; $output =~ s/^\s*(.)/\U$1/;
$output =~ s/\.\s+(\S)/. \U$1/g; $output =~ s/\.\s+(\S)/. \U$1/g;
} elsif ($has_function and not $has_main) { } elsif ($has_function and not $has_main) {
$output =~ s/\s*Let `main` be a function \(taking no arguments\) and returning int.\s*When called, the function will do nothing.//; $output =~ s/\s*Let `main` be a function \(taking no arguments\) returning int.\s*When called, the function will do nothing.//;
$output =~ s/\s*Finally, return 0.$//; $output =~ s/\s*Finally, return 0.$//;
$output =~ s/\s*and then return 0.$/./; $output =~ s/\s*and then return 0.$/./;
} }

View File

@ -1375,7 +1375,7 @@ direct_declarator:
$item{declarator} $item{declarator}
} }
| '(' parameter_type_list ')' | '(' parameter_type_list ')'
{ "function (taking $item{parameter_type_list}) and returning" } { "function (taking $item{parameter_type_list}) returning" }
| '(' declarator array_declarator(s) ')' | '(' declarator array_declarator(s) ')'
{ $item{'declarator'} . join(' ', @{$item{'array_declarator(s)'}}) } { $item{'declarator'} . join(' ', @{$item{'array_declarator(s)'}}) }
| '(' declarator ')' | '(' declarator ')'
@ -1551,9 +1551,9 @@ direct_abstract_declarator:
| DAD '[' ']' | DAD '[' ']'
| DAD '[' array_qualifiers(?) assignment_expression(?) ']' | DAD '[' array_qualifiers(?) assignment_expression(?) ']'
| '(' ')' | '(' ')'
{ 'function taking unspecified arguments and returning' } { 'function (taking unspecified arguments) returning' }
| '(' parameter_type_list ')' | '(' parameter_type_list ')'
{ "function (taking $item{parameter_type_list}) and returning" } { "function (taking $item{parameter_type_list}) returning" }
| DAD '(' ')' | DAD '(' ')'
| DAD '(' parameter_type_list ')' | DAD '(' parameter_type_list ')'

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script # These are set by the /misc/update_version script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 4784, BUILD_REVISION => 4785,
BUILD_DATE => "2024-09-19", BUILD_DATE => "2024-09-19",
}; };