Skip to main content

Debugging TCC Library Functions

Take Command v22 is primarily a UI and usability update, but we also added some major features. One of those features is library functions, which are similar to batch files but which are loaded into RAM and can be called as if they are internal commands. (See the LIBRARY internal command in the v22 help for more details.) Library functions can be used as very fast common subroutines for your batch files, or for complex multi-line aliases.

The TCC LIBRARY internal command will load / display / delete library functions, which are similar to batch files but which are loaded into RAM and can be called as if they are internal commands. Library functions are read from files, with the syntax:

functionname {
command1
command2

}

The opening brace { must be on the same line as the function name (separated by a space), and the closing brace } must be on a line by itself. Library functions can call aliases, internal or external commands, batch files, or other library functions.

When TCC starts, it will automatically load any library function files in the LIBRARY subdirectory of the TCC installation directory. The TCC parser will look for a matching library function name before looking for plugins, internal commands, external commands, or batch files.

As your library functions become more complex, how can you debug them? In v22 of Take CommandTCC, and CMDebug, the batch debugger allows you to step into and debug library functions. When the execution pointer is on the line calling the library function, click on the “Step Into” icon on the toolbar (or F11 on the keyboard). The debugger window will replace the batch file source with the library function source. You can then do anything while debugging the library function that you can do when debugging batch files – set breakpoints, evaluate or modify variables, define watch lists, step into additional library functions, etc.

We have also removed the nesting limit on batch files and library functions in TCC v22, up to the limits of your RAM.

We are very excited about the possibilities of library functions. If you have ideas on how to make them better, please let us know on the JP Software Suggestions Forum