Re: New Feature : Divert2 to custom named file

Denis Valois <[email protected]> Fri, 27 Jan 2023 19:33:35 +0100
Newsgroups gmane.comp.gnu.m4.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------i67YTU1RTxJxttSZkGgSLe2V
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello André,

If I understand well, the function you request is already available.

Ref GM4 documentation section "10.2 Undiverting output".
It states "As a GNU extension, diversions may contain non-numeric 
strings, which are treated as the names of files to copy into the output 
without expansion. A warning is issued if a file could not be opened."

In short, you divert as usual, into one or several divnum.  Then after 
you undivert into your specific files.

Regards,

Denis/

On 27/01/2023 16:44, André Miville wrote:
> Hello
> I would like to have a divert2 function where one could write to a 
> file, not a temp file.
> I use M4 for CPPP C prepreprocessing
> For instance one could use the divert2 function to transform a 
> matrix.m4 into a matrix.h and a matrix.c
>
> I am quite confused by sources and can't manage to do it by myself, 
> anyone to help me ?
>
> Cordially
> André

-- 
Denis Valois/
PGP KeyID 0xB5418E1A

--------------i67YTU1RTxJxttSZkGgSLe2V
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hello André,<br>
    <br>
    If I understand well, the function you request is already available.<br>
    <br>
    Ref GM4 documentation section "10.2 Undiverting output".<br>
    It states "As a GNU extension, diversions may contain non-numeric
    strings, which are treated as the names of files to copy into the
    output without expansion. A warning is issued if a file could not be
    opened."<br>
    <br>
    In short, you divert as usual, into one or several divnum.  Then
    after you undivert into your specific files.<br>
    <br>
    Regards,<br>
    <br>
    Denis/<br>
    <br>
    <div class="moz-cite-prefix">On 27/01/2023 16:44, André Miville
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:DB9P192MB14665563DA109D9216B44960D8CC9@DB9P192MB1466.EURP192.PROD.OUTLOOK.COM">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div style="font-family: Calibri, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255); --darkreader-inline-color: #e8e6e3;
        --darkreader-inline-bgcolor: #181a1b;"
        data-darkreader-inline-color=""
        data-darkreader-inline-bgcolor="" class="elementToProof">
        Hello<br>
        I would like to have a divert2 function where one could write to
        a file, not a temp file.</div>
      <div style="font-family: Calibri, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255); --darkreader-inline-color: #e8e6e3;
        --darkreader-inline-bgcolor: #181a1b;"
        data-darkreader-inline-color=""
        data-darkreader-inline-bgcolor="" class="elementToProof">
        I use M4 for CPPP C prepreprocessing<br>
      </div>
      <div style="font-family: Calibri, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255); --darkreader-inline-color: #e8e6e3;
        --darkreader-inline-bgcolor: #181a1b;"
        data-darkreader-inline-color=""
        data-darkreader-inline-bgcolor="" class="elementToProof
        ContentPasted0">
        For instance one could use the divert2 function to transform a
        matrix.m4 into a matrix.h and a matrix.c</div>
      <div style="font-family: Calibri, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255); --darkreader-inline-color: #e8e6e3;
        --darkreader-inline-bgcolor: #181a1b;"
        data-darkreader-inline-color=""
        data-darkreader-inline-bgcolor="" class="elementToProof
        ContentPasted0">
        <br>
      </div>
      <div style="font-family: Calibri, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255); --darkreader-inline-color: #e8e6e3;
        --darkreader-inline-bgcolor: #181a1b;"
        data-darkreader-inline-color=""
        data-darkreader-inline-bgcolor="" class="elementToProof
        ContentPasted0">
        I am quite confused by sources and can't manage to do it by
        myself, anyone to help me ?</div>
      <div style="font-family: Calibri, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255); --darkreader-inline-color: #e8e6e3;
        --darkreader-inline-bgcolor: #181a1b;"
        data-darkreader-inline-color=""
        data-darkreader-inline-bgcolor="" class="elementToProof
        ContentPasted0">
        <br>
      </div>
      <div style="font-family: Calibri, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255); --darkreader-inline-color: #e8e6e3;
        --darkreader-inline-bgcolor: #181a1b;"
        data-darkreader-inline-color=""
        data-darkreader-inline-bgcolor="" class="elementToProof
        ContentPasted0">
        Cordially<br>
        André<br>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Denis Valois/
PGP KeyID 0xB5418E1A</pre>
  </body>
</html>

--------------i67YTU1RTxJxttSZkGgSLe2V--