summaryrefslogtreecommitdiff
path: root/makedef.pl
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-12-16 18:31:17 +0100
committerYves Orton <demerphq@gmail.com>2022-12-24 01:17:22 +0100
commit69e2d40a60d6d9ad69498a1b5a45e53763ea04f3 (patch)
treed8601980c88b5c62ef168a85841f1e7e7810b3e3 /makedef.pl
parentd655b7ce0d9f884dc0965633e816e31c75a953a1 (diff)
downloadperl-69e2d40a60d6d9ad69498a1b5a45e53763ea04f3.tar.gz
regen/embed.pl - switch to using HeaderParser for code generation and etc.
HeaderParser was designed to replace the old grouping code in embed.pl and regen/embed_lib.pl, which is used to generate embed.h and proto.h and embedvar.h It can handle "elif" in embed.fnc, and produces more consistently structured and formatted and readable output than the old code. It also has much better logic to dedupe expressions. Adding or changing a constraint in embed.fnc should no longer have any "action at a distance" effects on the output for other functions which were not changed or obviously affected by the change. The old code assumed that sorting the constraints applying to a given function definition was acceptable, with the result that "elif" was impossible to support properly, and creating the problem that adding a new constraint which sorted into a different position could change a large amount of the output, making it hard to verify that the change was correct. The new logic should, once the initial normalization is applied, ensure that any further changes are minimal. This patch also includes a new tool regen/normalize_embed.pl which will be run by make regen, which consistently formats embed.fnc itself, which should make maintaining the file easier, especially during code splits and reorgs. Function definitions can be lifted out, moved to the end, with new constraints, and the `make regen` will put it all back into the correct place and order. A number of tools and tests which use embed_lib.pl to load embed.fnc data have necessarily been changed to use the new HeaderParser based logic.
Diffstat (limited to 'makedef.pl')
-rw-r--r--makedef.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/makedef.pl b/makedef.pl
index ffdf3e17a8..468c714830 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -749,11 +749,13 @@ unless ($Config{d_wcrtomb}) {
{
my %seen;
- my ($embed) = setup_embed($ARGS{TARG_DIR});
+ my ($embed_array) = setup_embed($ARGS{TARG_DIR});
my $excludedre = $define{'NO_MATHOMS'} ? qr/[emiIsb]/ : qr/[emiIs]/;
- foreach (@$embed) {
- my ($flags, $retval, $func, @args) = @$_;
+ foreach (@$embed_array) {
+ my $embed= $_->{embed}
+ or next;
+ my ($flags, $retval, $func, $args) = @{$embed}{qw(flags return_type name args)};
next unless $func;
if (($flags =~ /[AXC]/ && $flags !~ $excludedre)
|| (!$define{'NO_MATHOMS'} && $flags =~ /b/))