• Maple procedures

    From Nasser M. Abbasi@21:1/5 to Joe Riel on Fri Jan 27 08:50:49 2017
    On Wednesday, June 23, 2004 at 3:10:58 PM UTC-5, Joe Riel wrote:
    Axel Vogt wrote:

    I like that: before i had a dirty solution in Excel
    with copy & paste. But it was simple to remove just
    the _trailing 7 characters_ for lines of the body.

    Hmmm, that is simpler. It also points out an error in my previous
    version, lines with out line numbers are not properly indented. Here is
    the fix (apologies for multiple versions):

    PrintProc := proc(p::name,lines::{posint,posint..posint})
    local width;
    option `Copyright (C) 2004 by Joseph S. Riel. All rights reserved.`; description "Print like showstat, but without line numbers";
    width := interface('screenwidth'=infinity);
    try
    printf("%s",
    StringTools:-RegSubs(
    "\n ...." = "\n"
    ,debugopts('procdump'=
    `if`(nargs=1,p,[args]))))
    catch "procedure name expected":
    error "%1 is not a procedure name",p
    finally interface('screenwidth'=width)
    end try;
    NULL
    end:

    This works with procedures that have up to 999 numbered lines. It is
    unlikely that Maple procedures will be longer, however, if you need to
    handle them, use "\n( |[1-9])...." for the regexp, that will take you
    out to 9999. I haven't bothered testing beyond that.

    Joe Riel

    fyi,

    In Maple 2016, one can no longer use

    interface('screenwidth'=infinity)

    Error, (in interface) screenwidth must be an integer in the range 10..9999

    It must be a number.

    --Nasser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter Luschny@21:1/5 to All on Mon Jan 30 11:54:31 2017
    option `Copyright (C) 2004 by Joseph S. Riel. All rights reserved.`;

    Perhaps the author can make the procedure
    available under some CC-license?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)