sb2obj
                                  ======

           Shortcut to quickly Qlib-compile a SBASIC program

For those of us who like to use a text editor, such as QD, to develop line
numberless SBASIC programs, and to test and compile them, perhaps
repeatedly during development, sb2obj is for you. It helps take some of the
hassle out of the process: Simply press a Hotkey to automatically add
line numbers, if needed, tokenise the program, if needed, and then compile
it!


Requirements:
=============

The Q_Liberator compiler is the primary requirement.

sb2obj also relies on the Qlib runtime.

This program was written with QD in mind; it may (or may not) work with
other editors, or it may work but require additional steps.

Hotkeys and FileInfo2 are useful, but not absolute requirements.


Configure:
==========

In some cases you need to configure sb2obj's Home Directory in the program
file itself using Config or MenuConfig. This should only be needed if you
set sb2obj up as a Thing as described below.

There is only one configuration item to set in this way, namely The Home
Directory. This is the directory where sb2obj's configuration file resides.

In most cases the Home Directory is detected automatically, so there is no
need to configure it. However, once it is configured sb2obj cannot detect it
automatically any more except by deleting the configured Home Directory
again.

The main sb2obj configuration is done in the sb2objXX_cfg file. This is a
plain text file and should reside in the same directory as sb2obj itself.

Make a copy of this file before you make any changes. The XX stands for
the config file's version nuber - not sb2obj's version number. Currently
it stands at 01, thus sb2obj01_cfg.

All keys in this file need to be present, and in the given order.

Every key nust be followed by an = symbol, followed by a value.

Anything after the first space after the value is considered to be a comment,
as are blank lines and any line that starts with a * symbol:

*                       sb2obj config file V01
*
qlib   = win2_bas_qlib_QLIB_obj         The Q_Liberator executable
outdir = *                              Default output = input directory
temp   = ram1_sbhtmxxx                  Location and name of temp file
first  = 1                              First line
step   = 1                              Step size


In detail:
----------

qlib   - Here spell out the full path and name of the Q_Liberator executable

outdir - The default output directory is the same as the target file's
         input directory. This is indicated by a single *

         If you wish the output object file to go to a fixed location you
         can fill in the directory name here.

temp   - If the file to be compiled is SBASIC source code it first needs
         to be tokenised. temp specifies the location and name for this
         temporary file. The file is deleted at the end of the
         compilation.

first  - If the source file doesnt have line numbers they are added by
         sb2obj. Here you can set the start line number. Ensure you have
         enough line numbers for the largest programs.

step   - Following on from the above, here you set the gap between one line
         number and the next.


Setup:
======

sb2obj has minimal error trapping as, if you set it up correctly, it doesnt
need it! So before you try it out you should have configured it, as
explained above.

sb2obj can be initiated in various ways:

        EX <path>sb2obj_obj [; '<filename>']

or better

        PRINT FEW(<path>sb2obj_obj [; '<filename>'])

where <path> is the program's location - ie the Home Directory - and
<filename> the optional name of the file to be compiled.

If no filename is supplied on the commandline an attempt is made to use
whatever is in the Stuffer Buffer. If that happens to be the name of an
SBASIC file, then that file is compiled.

A better way to execute sb2obj is to attach it to a Hotkey:

        ERT HOT_LOAD1('o', '<path>sb2obj_obj')

When you save a file in QD it puts the file name into the Stuffer Buffer.
If you have set up sb2obj as shown above, and you press ALT + o the file
will immediately be tokenised and compiled.

You can also set sb2obj up as a Thing instead:

        ERT HOT_CHP1('o', '<path>sb2obj_obj')

This has the same effect, except it is somewhat faster at the slight
expense of using a bit more memory.

However, in this case we need to tell the Hotkey system what sb2obj's Home
Directory is, otherwise it wont find its configuration file. To do that use
the QJump Config program or JMS'es MenuConfig.

Once sb2obj is set up as a Thing, it can also be invoked with:

        EXEP 'sb2obj' [; '<filename>']

Finally, you can set FileInfo2 to execute sb2obj on any SBASIC source file
(_bas) or tokenised file (_sav) from your favourite File Manager or other
FileInfo2-aware program. Qpac2's Files file manager works best for me.

See the FileInfo2 manual for details on how to set it up. Remember that if
you set sb2obj up as a Thing you can also activate it as a Thing from
FileInfo2.


File types:
===========

sb2obj can handle three basic types of source file:

1. Standard SBASIC source code with the usual line numbers
2. Standard SBASIC source code without line numbers
3. QSAVEd SBASIC files

So if you configure FileInfo2 to use sb2obj, remember to add it to both the
_bas and the _sav file extensions.

Note that sb2obj differentiates between SBASIC source code and tokenised
source code by the file extension, so if you use other extension names it
wont work unless you modify the program.


In use:
=======

Syntax errors may confuse the temporary interpreter sb2obj employs and
compilation will fail. However, I have yet to see this causing a system
crash after a number of years of use..

Make sure you know whats in the Stuffer Buffer before you press the
Hotkey! Its a neat solution when it works, but can end up compiling
something you didnt intend.. The FileInfo2 method is surer, but takes a
few extra steps.

However, as any QLer knows: Trust in God, but save your work regularly and
keep backups!


Program Status:
===============

V1.03, pjw, 2024 Nov 13, first release

               Conditions of use and DISCLAIMER as per Knoware.no

Generated by QuickHTM, 2024 Nov 13