?

Log in

Tera Term subroutines

A long time ago I inherited a big monolithic mess of Tera Term macro code. After a few years the code base had grown considerably and become extremely unwieldy. I finally decided that it was time to fix the problem and created some utility code that would allow me to make the code more modular (and make the code more reusable for other projects). The result is subroutine.ttl, licensed under the terms of the MIT license.

This creates something akin to a namespace and function notation for Tera Term macros:

callsub = 'logging:backup_logs'
include 'subroutine.ttl'

For this to work, just create a logging.ttl file, copy some boilerplate/hook code to the top of the file, and add a block of code like this:

:backup_logs
    ; The backup code goes here
return

Thanks to Tera Term's scope-less variables (or, from another point of view, global-only namespace) you can even "pass" arguments and "return" values. Enjoy!

Comments