Skip to content
Shivter edited this page Aug 12, 2024 · 5 revisions

BXF - Batch Expanded Functions compiler

This compiler can take functions defined with #function <name> and closed with #end, and copy them to anywhere where they're called with @<name>. This basically introduces functions without calling. There is also an import feature. Examples:

  • #import test.bxf This imports all commands and functions from test.bxf. The imported functions will have a prefix of the file name. In this example: test.<function>
  • #import test.bxf as something The imported functions will have a specified prefix. In this example: something.<function> The imported scripts/libraries can also import other scripts/libraries.

Limitations/disadvantages

  • You can't put functions into functions.
  • The function can't invoke itself.
  • The function can't invoke other functions of this kind. (They can still call normal functions)
  • The compiled batch file might be larger than normal batch files if it's invoking a large function multiple times.
  • Compilation time can reach over 10 seconds when dealing with over 1000 lines or many imported libraries on a 3GHz processor. The compiler is single-threaded.

Advantages

  • Invoking functions is instant. Comparable to the speed of Macros.
  • If the function is invoked outside of parentheses, it can freely use % enclosed variables.
  • Unlike Macros, they don't have a 8192 character limit.
  • Everything is compiled into 1 batch file.

Clone this wiki locally