On Tue, Jun 23, 2026 at 11:51:20PM +0200, Patrice Dumas wrote:
> > I looked at HTML.pm to see if I could see how this module was implemented
> > in C as part of the program.  I noticed there were two modules, one called
> > HTML.pm, the other called HTMLNonXS.pm.
> 
> The HTMLNonXS.pm has all the functions that have an XS interface and
> are not needed when the XS interface is loaded
> (tta/perl/XSTexinfo/convert/ConvertHTMLXS.xs).  HTML.pm has the
> functions do not have an XS interface, and in practice need to be
> defined even when the XS interface is loaded.  There is no other logic
> behind that organization, one should consider that the Perl module is
> the union of the two files.  This organization makes managing the XS
> interface much easier, and sometime can help finding if some functions
> are better in the XS interface or not. 

What I still don't understand is why most of HTML.pm needs to be loaded
even if the XS modules are used.  HTML.pm has for example 
_convert_email_command,
which is part of the conversion code.  This should not be used if the XS modules
are used, so could be described as "non-XS" code.  If I understand correctly,
_convert_email_command is not HTMLNonXS.pm because it does not directly have
an XSUB defined in ConvertHTMLXS.xs.

If this split is useful, then there might be a better naming convention
or structure.  Maybe a fourfold split, like HTML.pm / HTMLPublic.pm /
HTMLNonXS.pm / HTMLPublicNonXS.pm.

HTMLNonXS.pm could contain the pure Perl conversion code like
_convert_email_command as mentioned, while HTMLPublicNonXS.pm would
contain the functions for use by other parts of the code and the API,
as HTMLNonXS.pm currently is.  HTML.pm and/or HTMLPublic.pm would load
the HTML XS modules or the non-XS modules as required.

(Another idea: HTMLPrivate.pm / HTML.pm / HTMLPrivateNonXS.pm / HTMLNonXS.pm.
HTML.pm would be the "public" module.)

Does that make sense?

> > Compare HTML.pm and HTMLNonXS.pm with Texinfo/Convert/Paragraph.pm and
> > Texinfo/Convert/ParagraphNonXS.pm.  Paragraph.pm is a very short module.
> > Whatever the relationship is between HTML.pm and HTMLNonXS.pm, it is clearly
> > different from the relationship between Paragraph.pm and ParagraphNonXS.pm.
> 
> That is because all the functions in Paragraph have an XS interface.
> Another different case is Indices, in that case the longest file is
> Indices.pm, because there are only few XS interfaces, the Perl functions
> are mainly called from other modules.

Reply via email to