Branch: refs/heads/davem/xs_refactor2
  Home:   https://github.com/Perl/perl5
  Commit: 79e08979db21bc0e329edeebd943b1512b3a0956
      
https://github.com/Perl/perl5/commit/79e08979db21bc0e329edeebd943b1512b3a0956
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: improve internal heredoc quoting

There is a private function, Q(), which (among other things), deletes a
leading /^#/ from each line.

This allows for code like this in ParseXS.pm:

           print Q(<<"EOF");
    #$extern
    #XS_EUPXS(XS_$self->{xsub_func_full_C_name}); /* prototype to pass 
-Wmissing-prototypes */
    #XS_EUPXS(XS_$self->{xsub_func_full_C_name})
    #[[
    #    dVAR; dXSARGS;
    EOF

which presumably in Olden Times allowed dumb text editor highlighters to
highlight the lines of the heredocs as code comments. Highlighters seem
smarter these days, and '#' is a terrible choice of character, as lots
of escaped lines start with '#if' etc. And it looks like a commented-out
line of perl code.

This commit changes it so that the escape is now a '|' preceded by
optional whitespace. The whitespace has to be the same for all lines of
the heredoc. That code above is now:

          print Q(<<"EOF");
            |$extern
            |XS_EUPXS(XS_$self->{xsub_func_full_C_name}); /* prototype to pass 
-Wmissing-prototypes */
            |XS_EUPXS(XS_$self->{xsub_func_full_C_name})
            |[[
            |    dVAR; dXSARGS;
    EOF

It's not perfect, but it makes some of the code easier to read.

This commit should produce no changes to output.


  Commit: 64639e840f656d806e455b8455269fbcc1189e7c
      
https://github.com/Perl/perl5/commit/64639e840f656d806e455b8455269fbcc1189e7c
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: simplify one heredoc

Almost all heredocs in ParseXS.pm use <<"EOF". There is one which uses
<<"MAKE_FETCHMETHOD_WORK". Change it to "EOF" for consistency.


  Commit: 9896768e662ef11879bb214f79a00978f28d12f7
      
https://github.com/Perl/perl5/commit/9896768e662ef11879bb214f79a00978f28d12f7
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: always use method calls.

There were still a few places doing:

    foo($self, ...);

This commit changes them to:

    $self->foo(...);

This shouldn't really make any difference until someone starts
sub-classing stuff, which is unlikely, but now at least not impossible,


  Commit: b355d9663b074f4b894b2fa42461695732ec13fb
      
https://github.com/Perl/perl5/commit/b355d9663b074f4b894b2fa42461695732ec13fb
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: rename PushXSStack() push_parse_stack()

$XSStack was recently renamed; this commit renames the corresponding
method call.


  Commit: 7c0bad39304a140246e0613ef42575d42945fad4
      
https://github.com/Perl/perl5/commit/7c0bad39304a140246e0613ef42575d42945fad4
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: don't use print_section() for BOOT output

The print_section() method reads input lines until the next keyword and
outputs them. It's intended for use with keywords like CODE: which just
copy lines from input to output verbatim (but with '#line' fixups).

ParseXS.pm was using print_section() to output deferred BOOT: lines into
the boot XSUB. This was hacky: it was faking up the contents of
$self->{line} etc.

Instead, output the lines directly and emit our own '#line' at the end
(the only useful thing print_section() was contributing).

Note that lines derived from BOOT: will already have had a '#line'
prepended at the time the lines were read in.


  Commit: 295eb7e2d1e85893019a1e4306fee402ecd612ca
      
https://github.com/Perl/perl5/commit/295eb7e2d1e85893019a1e4306fee402ecd612ca
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm

  Log Message:
  -----------
  ParseXS: store newlines in bootcode_later

@{$self->{bootcode_early} and @{$self->{bootcode_later} both hold lines
of code to insert later into the boot xsub. However the _early lines
have newlines, while the _later ones don't.

This commit changes it so that both sets of lines have newlines, for
consistency's sake.


  Commit: a6a0c656b4f36c315497b0fed2dae142a11e2074
      
https://github.com/Perl/perl5/commit/a6a0c656b4f36c315497b0fed2dae142a11e2074
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm

  Log Message:
  -----------
  delete @ExtUtils::ParseXS::Constants::InitFileCode

This 'constant' (actually a package var) doesn't really seem to serve any
useful purpose - it's always set to ().

All the other similar package 'constants' were removed in commits around
v5.15.0-503-g0adb6a1992; perhaps this one was just accidentally missed?

Also, the name of the object field it initialises has since been renamed;
if this commit is reverted for any reason, the var should be
renamed to:

    @ExtUtils::ParseXS::Constants::bootcode_early

or some such.


  Commit: 4ca319b04c86e2c59e31cbc01dd5cd53bcf23801
      
https://github.com/Perl/perl5/commit/4ca319b04c86e2c59e31cbc01dd5cd53bcf23801
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: add BOOT_handler() method.

Most XS keywords FOO are processed by a method called FOO_handler().
BOOT: was an exception.

This commit moves the code that was in process_file() which was handling
BOOT: directly, into a new BOOT_handler() method. The lines of code
themselves have just been cut and pasted, so there should be no
functional changes.


  Commit: e28f1c7b27cd64d8c7cb413d9676730f1e9d16fa
      
https://github.com/Perl/perl5/commit/e28f1c7b27cd64d8c7cb413d9676730f1e9d16fa
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: tidy some code in BOOT_handler()

Make a chunk of code easier to read by
1) making the if condition no longer postfix, and
2) using sprintf rather than string concatenation.

Should be no functional change.


  Commit: 30ecc4b23deff37064d9eb0f1b57c92841092cd3
      
https://github.com/Perl/perl5/commit/30ecc4b23deff37064d9eb0f1b57c92841092cd3
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm
    M dist/ExtUtils-ParseXS/t/110-assign_func_args.t

  Log Message:
  -----------
  ParseXS::Utilities: rename assign_func_args

The method ExtUtils::ParseXS::Utilities::assign_func_args()
doesn't actually do any assigning, and its name gives no clue as to
what func its referring to.

It actually generates a string containing a comma-separated list of
args to pass to the auto-called C function, if any.

So rename it to C_func_signature().

The new name is technically not 100% accurate, since the signature is
a properly of the C function rather than of the caller, but it's close
enough, and it mimics the name of the xsub_C_auto_function_signature
object field, which suffers from the same inaccuracy.


  Commit: 3a9f8a4da105a94248836b13a7b62e7f16e0c486
      
https://github.com/Perl/perl5/commit/3a9f8a4da105a94248836b13a7b62e7f16e0c486
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: rename process_keyword > process_keywords

The method process_keyword() actually processes as many matching
keywords as it can find. So rename it.


  Commit: 363977290d05386ba208ca35cdfee096dfe5a070
      
https://github.com/Perl/perl5/commit/363977290d05386ba208ca35cdfee096dfe5a070
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm

  Log Message:
  -----------
  ParseXS: add Constants::generic_xsub_keywords_alt

Add the 'constant' package var

    $ExtUtils::ParseXS::Constants::generic_xsub_keywords_alt

which represents a 'FOO|BAR|...' alternation of all the keywords which
can appear *anywhere* within an XSUB (as opposed to keywords like CODE
which can only appear in certain positions).

This makes it less likely that any future such keywords when added,
won't be added to *every* process_keywords() call.


  Commit: 2c4f568ecdb4246bcf8c8c9593c2dc41202ee020
      
https://github.com/Perl/perl5/commit/2c4f568ecdb4246bcf8c8c9593c2dc41202ee020
  Author: David Mitchell <da...@iabyn.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

  Log Message:
  -----------
  ParseXS: add 'use warnings'

It already has 'use strict', but not 'use warnings' for some reason.
Adding it doesn't seem to break anything.


Compare: https://github.com/Perl/perl5/compare/79e08979db21%5E...2c4f568ecdb4

To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to