Menu

#145 Allow modification of command line args; "debug" and "trace" options

closed
nobody
None
5
2018-04-19
2016-03-13
GregJung
No

This modification is a non-IDL extension of the routine COMMAND_LINE_ARGS
which is nevertheless feasibly only used in interactive sessions. Two additional
keywords, /RESET and SET=[strarr] will, respectively, blank out the memory of
command_linbe_args and set them.
Internally, the command_line_args was held as avector(char *) which is not feasible for
flexible contents. So this is defined as vector(string).

gdl.cpp is also expanded with two boolean functions that test if the words "trace" or "debug" are
in the command line. So to print internal dialogue for debug and to turn it off:

// At the top of the file selected for debug/trace:
static bool trace_me;
static bool debug_me;
namespace lib {
    bool trace_arg();
    bool debug_arg();

  void help_item( std::ostream& os,
          BaseGDL* par, DString parString, bool doIndentation);
  void help_struct( std::ostream& os,  BaseGDL* par, int indent , bool debug );
}

// Then in the interesting section:
if(trace_arg()) 
    {   DPtr p0 = (*Tail)[0];
        std::printf(" tracing list.move : TAIL=%llu", p0);
        blah blah etc.
        }

The enhancement involves three files, gdl.cpp, basic_fun.cpp, and libinit.cpp;
the attached patch file contains patches for all three, concatenated. Only those changes
relevant to this are included in the patch file.
Line numbers should correspond pretty closely to current CVS (March 3, 2016).

1 Attachments

Related

Feature Requests: #145

Discussion

  • GregJung

    GregJung - 2016-03-13

    I can't edit the lead message so I'll just advise here, the patch file attached includes a whole subroutine
    I neglected to delete (routine_filepath) so either edit that out of the above file or
    use the file I attached to this reply.

     
  • Sylwester Arabas

    • status: open --> closed
     
    • GregJung

      GregJung - 2018-04-20

      As I have it now, the subroutine code is there but the libinit.cpp allows
      only the limited keyword
      input - the expanded functionality can be easily edited into usage, on a
      rebuild.

      trace_me = false; // trace_arg();

      when the code has previously invoked the debug trace, but is finished
      code, was a good solution.

      I greatly needed this stuff when I was developing the list and hash
      routines.

      On Thu, Apr 19, 2018 at 4:39 PM, Sylwester Arabas slayoo@users.sourceforge.net wrote:

      • status: open --> closed
      • Comment:

      Greg, thank you for the patch. I must say though that given this is
      non-IDL behaviour and it seems fully attainable with env vars, I would be
      reluctant to include it into GDL. It's not to say we should drop it, but
      let me just ask you to recreate the ticket on github if needed providing a
      valid use case. Thanks.


      Status: closed
      Group: Next Release (example)
      Created: Sun Mar 13, 2016 02:33 AM UTC by GregJung
      Last Updated: Sun Mar 13, 2016 03:12 AM UTC
      Owner: nobody
      Attachments:

      This modification is a non-IDL extension of the routine COMMAND_LINE_ARGS
      which is nevertheless feasibly only used in interactive sessions. Two
      additional
      keywords, /RESET and SET=[strarr] will, respectively, blank out the
      memory of
      command_linbe_args and set them.
      Internally, the command_line_args was held as avector(char *) which is
      not feasible for
      flexible contents. So this is defined as vector(string).

      gdl.cpp is also expanded with two boolean functions that test if the words
      "trace" or "debug" are
      in the command line. So to print internal dialogue for debug and to turn
      it off:

      // At the top of the file selected for debug/trace:static bool trace_me;static bool debug_me;namespace lib {
      bool trace_arg();
      bool debug_arg();

      void help_item( std::ostream& os,
      BaseGDL par, DString parString, bool doIndentation);
      void help_struct( std::ostream& os, BaseGDL
      par, int indent , bool debug );}
      // Then in the interesting section:if(trace_arg())
      { DPtr p0 = (*Tail)[0];
      std::printf(" tracing list.move : TAIL=%llu", p0);
      blah blah etc.
      }

      The enhancement involves three files, gdl.cpp, basic_fun.cpp, and
      libinit.cpp;
      the attached patch file contains patches for all three, concatenated. Only
      those changes
      relevant to this are included in the patch file.
      Line numbers should correspond pretty closely to current CVS (March 3,
      2016).


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/gnudatalanguage/feature-requests/145/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Feature Requests: #145

  • Sylwester Arabas

    Greg, thank you for the patch. I must say though that given this is non-IDL behaviour and it seems fully attainable with env vars, I would be reluctant to include it into GDL. It's not to say we should drop it, but let me just ask you to recreate the ticket on github if needed providing a valid use case. Thanks.

     

Log in to post a comment.

MongoDB Logo MongoDB