dgtools::recover 0.1

Detlef Groth, Schwielowsee, Germany

2020-03-22

dgtools - argvparse - recover - repo - shistory

NAME

dgtools::recover - debugging command

TABLE OF CONTENTS

SYNOPSIS

package require dgtools::recover
dgtools::recover
dgtools::recover_onerror
dgtools::recover_stop

DESCRIPTION

The dgtools::recover command allows to debug interactively errors pr problems in Tcl terminal programs in the same spirit as the R recover command.

COMMANDS

dgtools::recover

Manually jumps in debugging mode. This command can be placed into critical code fragments and then you can jump directly during debugging in this procedure. See the following example:

proc test {x} {
   set y $x
   incr y
   dgtools::recover
   incr x
   return $y
}
test 5

dgtools::recover_onerror

This replaces the error command, instead of reporting the error there will be an interactive terminal where you can debug all variables in the current procedure or method.

dgtools::recover_stop

This resets the error handling by the recover command to the normal error command.

EXAMPLE

The following example shows how you can jump into your own error calls in your code. As you normally report critical parts of your code with such error calls it allows you to jump directly into those places and debug them. Unfortunately, I don't know how to jump automatically into the error call of Tcl.

package require dgtools::recover
::dgtools::recover_onerror
proc test {x} {
  set y $x
  # the next line with the error 
  # will jump into the recover moce
  error "z does not exists"
  return $z
}
test 6

DOCUMENTATION

The script contains embedded the documentation in Markdown format. To extract the documentation you should use the following command line:

$ tclsh recover.tcl --man

The output of this command can be used to create a markdown document for conversion into a markdown document that can be converted thereafter into a html or pdf document. If, for instance, you have pandoc installed you could execute the following commands:

tclsh recover.tcl --man > recover.md
pandoc -i recover.md -s -o recover.html
pandoc -i recover.md -s -o recover.tex
pdflatex recover.tex

Alternatively if the Markdown package of tcllib is available you can convert the documentation as well directly to html using the --html flag:

$ tclsh recover.tcl --html

AUTHOR

The dgtools::recover command was written Detlef Groth, Schwielowsee, Germany.

COPYRIGHT

Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de

LICENSE

dgtools:recover package - debugging tool in spirit of R's recover function.

Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de

This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions.

This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.