On 1 January 2016 at 14:36, Eli Zaretskii <[email protected]> wrote: > Can you tell a few words about the design of the XSParagraph code and > how it's supposed to work? (If there's an explanation available > somewhere, please just point to it.) I'd like to have a high-level > view of this stuff when I dig into this. (Please note that I know > next to nothing about Perl.)
There's the non-XS specific overview. Paragraph is one of about three different formatting types; the others are Line and Unformatted. These are used according to the context in the Texinfo source the text appears. Text is fed into the formatter object, and whatever comes out is appended to the output Info file. The paragraph formatter keeps count of how long the current line is. It may have a pending space that is at the end of the line, and if the next word that is added is too long to fit in what's left of the line, the pending space is thrown away, and the new word starts a new line. There are also various settings that can be set for the formatter, for example to stop multiple spaces being collapsed to one, or to prohibit line breaks. About XS specifically, the code in XSParagraph.xs is converted by a program called xsubpp to C code; XS is a kind of interface language between C and Perl. When that C code is compiled, it produces a library that can be dynamically loaded by the Perl interpreter, and there is interpreted Perl code to cause this to happen in tp/Texinfo/Convert/Paragraph.pm. The aim is to find the module bootstrap function in the loaded library: only that bootstrap function is run initially, and when it's run it makes all the other functions available to the Perl interpreted code by adding the functions to the module namespace. Those are a few facts, is there something else you need to get a more complete picture?
