By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Done Add a .btm LIBRARY system

Add something similar to being able to load functions, but instead for accessing subroutine libraries:

Specify which libraries will be accessed.
LIB_NAME "Library Name" "Full path to library file, no wildcards"

LIB_NAME "Date Routines" "C:\Program Files\JPSoft\TCC\Date_Routines_Lib.btm"
LIB_NAME "Name Routines" "C:\Program Files\JPSoft\TCC\Name_Formatting_Routines_Lib.btm"

Specify which routines in the library are available to this btm
LIB_DEF /"Library Name declared in a LIB_NAME" "Routine #1", "Routine #2", "Routine #5"

LIB_DEF /"Name Routines" "Last_comma_First", "First_Mid_Last"

Call the pre-identified routine from the .btm
LIBRARY "Routine name" parm 1, parm 2

LIBRARY Last_comma_First "Harry", "Johnson"

Error: Library Routine MMDDYY_to_ISODATE undefined
(Even if the "Date Routines" library does have that subrou, because it wasn't identified in LIB_DEF)
You would probably want a different term than "undefined".
Last edited:
Reasons for LIB_DEF are so if you have the same routine name in more than one library file there won't be confusion.
Also, having such a "declaration" up front will help the programmer see what is actually accessible.
Try these ALIASES and see how they work for you:
alias LIB_NAME=`set %@unquote[%1]=%2`
alias LIB_DEF=`set %@unquote[%2]=%[%@unquote[%1]] %@unquote[%3]`
alias LIBRARY=`if %[%1].==. (echoerr Library Routine %1 undefined) else (gosub %[%1] %*)`

[R:\] LIB_NAME "Date Routines" "C:\Program Files\JPSoft\TCC\Date_Routines_Lib.btm"
[R:\] set Date*
Date Routines="C:\Program Files\JPSoft\TCC\Date_Routines_Lib.btm"
[R:\] set CCYY*
CCYYMMDD_to_ISODATE="C:\Program Files\JPSoft\TCC\Date_Routines_Lib.btm" ISODATE_to_YYMMDD
[R:\] library CCYYMMDD_to_ISODATE 1 2 3 4
gosub "C:\Program Files\JPSoft\TCC\Date_Routines_Lib.btm" ISODATE_to_YYMMDD  1 2 3 4

[R:\] library MMDD_to_ISODATE 1 2 3 4
Library Routine MMDD_to_ISODATE undefined

In my example, I did an echo gosub instead of an actual gosub, since gosub is only valid inside a batch script.
I'm not looking to do it with aliases. I previously pointed out that an alias can be set up that LIBRARY is used as a substitute for GOSUB.

Modern programming languages routinely include some form of command such as IMPORT that makes the contents of some other file available, usually a routine library. I'm basically asking to include that type of functionality, like functions and aliases can be imported. I think it's best not to just block import an entire library file because it could get confusing to the person referencing the file and create conflicts. Requiring individual routines to be "declared" (e.g., LIB_DEF) would reduce confusion and avoid situations where multiple library files have a routine with the same name.

That's one reason I didn't include LIB_DEF /All as an option.
Since the aliases I created define environment variables, you could save them and restore them using SET /R. You could prepend "LIB_" or something similar to distinguish them from other variables. My point of the ALIAS's is that you can achieve what you wanted rather simply without the need for an entire management system.
I'm suggesting an added feature to the language, that will make the language more in line with other modern languages, not a custom work-around.

The problem with any custom work-around is different people set them up differently and there's no reference, which severely limits availability and usefulness of other people's code and libraries. The only way to encourage a standard approach is to have it as a language feature.
I would like to see something like BASH has, that is, the .bashrc file is loaded upon startup. The .bashrc file can contain multi-line functions, which would stay in memory like TCC plugins do.

Or, like the Powershell Microsoft.PowerShell_profile.ps1 file, which does the same thing as .bashrc does.

Ref: BASH Startup Scripts

4Start/TCStart cannot have multiple-line functions. For example, in my PowerShell Profile I have;

function Get-ProgID
  param ($filter = '.')
  $ClsIdPath = "REGISTRY::HKey_Classes_root\clsid\*\progid"
  dir $ClsIdPath |
    foreach {if ($_.name -match '\\ProgID$') { $_.GetValue("") }} |
      where {$_ -match $filter}

Get-ProgID is now a function that I can call from the command line. Example;

Get-ProgID VBScript


I set this up as a new suggestion, since it's completely unrelated to a library addition.

It's set up as "MULTI-LINE IN-MEMORY FUNCTIONS", since that's really the request. It really wouldn't matter whether it's a start-up option or later. The same code that would be needed for multi-line in-memory functions later would be needed for them at startup.
Last edited:
The command description on page 410 of the manual should mention that TCC has a command-line switch that will prevent loading the default libraries.

Similar threads