The HTBasic Workshop is a set of programs and utilities designed to assist development in the HTBasic environment. These include the CSUB Toolkit, Numeric Compiler, Developer Utilities, LIF Transfer Utilities license, and the Advanced Math Library (Included in Development version from 9.0 on.)
Once built, a CSUB may be loaded into HTBasic with LOADSUB and deleted with DELSUB just as any other SUB program. CSUBs may be stored in a PROG file and loaded along with other subprograms. The CSUB toolkit is required for CSUB generation, but not for its execution. A Development or Application Runtime version of HTBasic is all that is required for execution.
HTBasic CSUB Toolkit
The CSUB Toolkit builds compiled subprograms for use with HTBasic. A compiled subprogram, or CSUB, runs directly on the processor hardware and accesses all of its power and functionality. Many functions can be performed with CSUBs that otherwise would be impossible with BASIC.
Features
- Produces Compiled C or Assembly subroutines (CSUBs)
- Fast numeric calculations and array subscripting
- Customized and specialized user routines
For the Windows Version CSUB Toolkit, CSUBs may be written in any language that handle C-type argument pointers and that produces a Windows DLL. The Microsoft C++ 32-bit compiler and linker may be used to develop C language CSUBs. The Microsoft Macro Assembler and linker may be used for assembly language CSUBs. The HTBasic CSUB utility combines an HTBasic SUB definition file and the DLL control information to create a PROG file. Separate versions are available for recent HTBasic for Windows releases and earlier HTBasic Legacy Versions.
DOS Version
For the DOS Version CSUB Toolkit, subprograms may be written in either C or 386/486 assembly language. The MetaWare High-C compiler and the Phar Lap 386|DOS-Extender SDK are required for development of C language CSUBs. Only the Phar Lap 386|DOS-Extender SDK is required to develop assembly language CSUBs. The HTBasic CSUB utility combines an HTBasic SUB definition file and the compiled and linked object file to create a PROG file.
Example Program Files
Several CSUB example program files are provided that demonstrate simple variable passing, array access speed, C language routines, assembly language routines, and multiple entry point routines.
Numeric Compiler
The HTBasic Numeric Compiler takes BASIC SUB programs and produces equivalent machine code subprograms (CSUBs). In addition, the Numeric Compiler can also generate EXE files which only require the HTBasic Application Runtime Version to execute. When the EXE program runs, the HTBasic Runtime Environment Manager loads and manages the compiled program.CSUBs produced by the Numeric Compiler are compatible with other BASIC SUBs. CSUBs can be loaded and executed alongside BASIC subprograms. LOAD, STORE, LOADSUB, DELSUB, CALL, ON event CALL, and CAT handle CSUBs in addition to interpreted SUBs.
The compiler uses common optimization methods to enhance program execution speed. It produces in-line math instructions for all math operators, making the resultant math routines faster than those produced by many other computer languages. When possible, operations are made on constants at compile-time rather than run-time.
This compiler is designed so the casual HTBasic user can produce fast, numerically-intensive subprograms. The user writes one or more SUBs in BASIC which contain the calculation intensive code in his program. The SUB or SUBs are then compiled, creating CSUBs which execute many times faster than the original BASIC. No additional programming skill is necessary.
The main goal of the compiler is speed of execution of numeric subprograms. Because the compiler is designed for numeric algorithms, there are limitations to what it can do. If care is taken in selecting specific SUBs for compilation, rather than compiling an entire program, very little effort is usually required. And the rewards are tremendous. Simple REAL operators are 20 to 35 times faster. More complex operators, like SIN, are 6 to 8 times faster. Some SUBs enjoy as much as a 56 times speed increase!
Features
-
Compiles HTBasic SUB programs
-
Produces fast machine code subroutines that execute in 32-bit protected mode
-
Optimizes constants at compile-time
-
Produces EXE files (requires Application Runtime Version) that are executable from the DOS prompt or Windows Program Manager (or DOS prompt)
Producing EXE Files
The Numeric Compiler can create an EXE file which contains an embedded BASIC program. This EXE file is directly executable from the Windows Program Manager (or a DOS prompt). A user does not need the compiler to execute the resultant PROG or EXE files. All that is required is a copy of the HTBasic Application Runtime Version.
HTBasic Developer Utilities
The HTBasic Developer Utilities consists of the programs SECURE, HTSAVE, and the LIF Transfer Utilities HPCAT, HPCOPY, and HPPURGE. These utility programs are used to secure a software developer’s programs, help change PROG files to a later release format, and LIF utilities to transfer previously written Rocky Mountain BASIC programs into HTBasic.
Features
- SECURE: Utility for PROG file security
- HTSAVE: Utility to create an ASCII file from PROG file
- HP COPY: Copies ASCII, BDAT, and ordinary files (DOS or HP-UX) between HP LIF diskettes and DOS disks
- HP CAT: Prints a catalogue of files on HP LIF diskette
- HP PURGE: Deletes files on HP LIF diskettes
SECURE
The SECURE utility makes an HTBasic PROG file suitable for distribution when the BASIC source needs to be protected. This utility removes the embedded program comment and variable name information, compresses the unused control table space, and sets the secure flag for all program lines. This makes the program difficult to examine, and almost impossible to change or modify. It also decreases the memory required to run the program. The removal of comments, remarks, variable names, I/O Path names, and Line Label names may be individually enabled or disabled with command-line switches. The COM area, SUB program, and DEF function names may also be scrambled to obscure their meaning.
HTSAVE
The HTxSAVE utilities create either a DOS ASCII or an HTBasic ASCII file from an HTBasic PROG file. It is the equivalent of the HTBasic SAVE command. Because this utility is a DOS program it may be used from the DOS command line or in a DOS batch file.
This is helpful when updating a large number of PROG files from an older release format to a newer release format. It makes it easy to create ASCII files from PROG files and saves the developer from having to manually LOAD and SAVE each of the PROG files from within HTBasic.
LIF Transfer Utilities
The HTBasic LIF Transfer Utilities (HPCAT, HPCOPY, HPPURGE) allow you to effortlessly port your current HP BASIC data and program files between HP Series 200/300 Workstations and PCs running HTBasic. LIF utilities are used to copy data files and programs stored in BDAT, ASCII, and HP-UX formats between LIF format floppy diskettes and DOS Disks. The LIF Transfer Utilities are not supported under Windows NT or Windows 2000.
A single license of the LIF utilities are included in the full development versions of HTBasic. This right-to-copy license is for developers to use with the Application Runtime License.
Advanced Math Library
The HTBasic Advanced Math Library is a collection of fast compiled subroutines for use in signal processing, numerical analysis, statistics, and data reduction. These library routines run much faster than equivalent BASIC subroutines because they are compiled for 386, 486, or Pentium-based computer systems. Incorporating any of these routines into BASIC programs will enhance their speed and save the user the task of writing the subroutines. Once loaded into an HTBasic program with the LOADSUB statement they become a part of the program and are stored and loaded from disk along with the user’s BASIC program. The Math Library routines are organized into the following four groups:
Statistics and Data Reduction
- Probability density functions and probability integrals for many probability distributions
- Mean, standard deviation, and variance of sets of data
- Curve fitting, using both linear regression and higher-order polynomial functions
- Polar/rectangular conversion of sequences of complex numbers
- Euclidean and other norms of data vectors
Signal Processing
- Fourier transforms and inverse Fourier transforms of both real and complex sequences
- Digital filtering, correlation, convolution, auto correlation, and power spectral density of sequences of data
- Windowing using cosine, triangular, and Bessel windows
- Built-in waveforms
Numerical Analysis
- Solutions to linear systems of equations having both real and complex coefficients
- Polynomial evaluation
- Polynomial derivatives and anti-derivatives
- Root finding for equations of the form f(x)=0
- Integration of functions
Higher Order Mathematical Functions
- Cylindrical and spherical Bessel and Hankel functions of real arguments of integer and half-integer order
- Error function and complementary error function of real and complex arguments and Dawson’s integral
- Airy and Kelvin functions of real arguments
- Elliptical integrals of real arguments
- Fresnel integral. Exponential, log, sine, and cosine integrals of real arguments
- Gamma and beta functions of real and complex arguments
- Incomplete gamma and beta functions of real arguments
- LeGendre, Hermite, and Chebyshev polynomials of real arguments and integer orders
Features
- Fast complied subroutines
- Statistics and Data Reduction
- Signal Processing
- Numerical Analysis
- Higher Mathematical Functions
