TURBO, the SuperBasic compiler, has been updated and released for almost a year. Simon Goodwin is the original author with a few others contributing to the final released product, by Digital Precision. George Gwilt has taken the source code and updated the program to work on the newer QDOS and SMSQ/E systems.
TURBO comes in the following packages:
- TURBO Toolkit 3.31
- TURBO 4.10
- TURBO and TURBO ToolKit manuals
- TURBO Config
- TurboPTR
- TURBO Utilities
- Task Commander
TURBO Toolkit (TTK) has been updated by Mark Knight and must be loaded for TURBO to run. The manuals for TURBO and TURBO Toolkit have been updated to reflect the new versions. TURBO Config and TurboPTR are new tools written by George Gwilt. TURBO Utilities is a collection of tools for use with TURBO compiled programs. Task Commander is a tool that allows a TURBO compiled program to become a KEYWORD.
Like Qliberator, TURBO compiles off a program already loaded into SuperBasic. Unlike Qlib, a work file does not need to be created first.
TURBO is comprised of two parts, the parser and the code generator. They are two separate executables, but are linked when using the CHARGE TTK keyword. The parser has the main user interface to TURBO. In the parser the user can change various compile options, including where the destination executable will go and the runtime name of the executable (as displayed by the JOBS command).
A lot of the compile options can be set within the SuperBasic program itself, using TTK keywords starting with TURBO_, like TURBO_taskn, TURBO_buffersz, TURBO_objfil, and TURBO_repfil.
Other commands like IMPLICIT$ and IMPLICIT% inform TURBO how to treat variables. ‘IMPLICIT% var1, var2’ tells TURBO to treat these variables as interger variables (var1%, var2%). By default, SuperBasic variables are treated as floating point, but TURBO knows that most variables do not need to be floating point and that most programmers do not take the time to use the percent sign in their programs. The IMPLICIT% allows the programmer to continue to not use the percent sign, but tells TURBO to handle the variable as an integer, thereby saving space (integers are smaller than floats) and runtime.
Major Differences with Qlib:
1 – No Linking of Extensions (Toolkits)
TURBO does not support the linking of SuperBasic extensions into an executable. With Qlib, the extension can be linked and become part of the executable. The major reason for doing this is to include commercial extensions (like Qmenu, and QPTR), into an executable without having to distribute the extension separately. If an extension has to be distributed separately, then a license fee is usually required by the owner of the extension.
It is also done not to require that an extension is loaded before the executable is run. If you have an extension that you think the user will rarely use and not want to install, linking into the executable makes it transparent to the user.
The downside is that if the extension gets updated, then the older version will stay in the executable. Keeping the extension out of the executable will allow the extension to be updated and not require a recompile. Some older QL programs are rendered inoperable due to an older extension clashing with SMSQ/E.
2 – Fussier about SuperBasic
Qlib can compile almost any SuperBasic that would run on the QL. TURBO is fussier about what SuperBasic code it will compile.
An example is how file names are used. In SuperBasic a file name does not need to have quotes around it. In TURBO, they are needed.
Qlib - open #3,win1_file_ext TURBO - open #3,'win1_file_ext'
Plus TURBO has a number of keywords (from TURBO Toolkit) that help TURBO know more about the application. They have a tendency to give the program a more TURBO feel. With Qlib, any compiler directives are put in REMark statements and not using keywords.
3 – Executable Speed
The major benefit that TURBO has over Qlib, is that resultant executable is faster than one compiled by Qlib. I had no first hand knowledge of this difference so I decided to compile a program with both Qlib and TURBO and compile the time it took to run the program. For the test I used the Ratcliff/Obershelp Pattern Matching algorithm as listed in QHJ #1. The main function is percent_alike(). The program I wrote called the fuction 1000 times, using the arguments of Pennsylvania and Pencilvania. Since I was using a Q40 as a test machine, I needed the program to run long enough to give me some meaningfull numbers. 1000 times turned out to be long enough.
Here is a table of the results:
SBASIC 12 secs. Qlib 8 secs. TURBO 5 secs.
The test program is below:
100 LET x = DATE
110 OPEN #3,scr_100x100a100x100
120 BORDER #3,2,2: INK #3,4: PAPER #3,0 : CLS #3
130 FOR l = 1 to 1000
140 LET wordpercent = percent_alike("pennsylvania",
"pencilvaneya")
150 END FOR l
160 LET y = DATE
170 PRINT #3,"Time : ";y-x
180 FOR z = 1 TO 4000 : LET test = COS(z) : END FOR z
190 CLOSE #3
200 DEFine FuNction percent_alike(a$,b$)
210 LOCal total
220 total = num_alike(a$,b$)
230 RETURN int( total/(LEN(a$)+LEN(b$))*100)
240 END DEFine percent_alike
250 DEFine FuNction num_alike (a$, b$)
260 LOCal total, temp$, a1, a2, b1, b2, large$
270 total = 0
280 IF a$=b$ THEN RETURN LEN(a$)*2
290 IF LEN(a$)=1 AND LEN(b$)=1 THEN RETURN 0
300 IF LEN(a$) > LEN(b$) THEN
310 temp$ = a$
320 a$ = b$
330 b$ = temp$
340 ENDIF
350 IF LEN(a$)=1 THEN RETURN (a$ INSTR b$)
360 large$ = find_gt_com$ (a$, b$)
370 IF large$ = "" THEN RETURN 0
380 length = LEN(large$)
390 total = length*2
400 a1 = large$ INSTR a$
410 a2 = a1 + length
420 b1 = large$ INSTR b$
430 b2 = b1 + length
440 IF (a1>1) OR (b1>1) THEN
450 total = total+num_alike (a$(1 TO (a1-1)), b$(1 TO (b1-1)))
460 ENDIF
470 IF (a2<>LEN(a$)+1) OR (b2<>LEN(b$)+1) THEN
480 total = total+num_alike (a$(a2 TO), b$(b2 TO))
490 ENDIF
500 RETURN total
510 END DEFine percent_alike
520 DEFine FuNction find_gt_com$ (a$, b$)
530 LOCAL temp$, i, j, temp, large$
540 IF LEN(a$) > LEN(b$) THEN
550 temp$ = a$
560 a$ = b$
570 b$ = temp$
580 ENDIF
590 LET large$=""
600 FOR i = 1 TO LEN(a$)
610 FOR j = i TO LEN(a$)
620 temp = a$(i TO j) INSTR b$
630 IF (temp<>0) AND (LEN(a$(i TO j))>LEN(large$))
THEN large$=a$(i to j)
640 END FOR j
650 END FOR i
660 RETURN large$
670 END DEFINE find_gt_com
In general, using TURBO takes a little more work than using Qliberator. Both can compile simple progams without any changes. TURBO gives the programmer a little more control over the end product with a variety of commands that control how the executable is compiled. The end result is that TURBO is more powerful than Qliberator, but the power comes at the price of needing to know more about TURBO to get to that power.
The TURBO manuals do a pretty good job of documenting TURBO and the use of the various TURBO Toolkit commands. In some places it does go into a little too much detail for the average programmer.
Converting from Qlib to TURBO can take time and be a little painfull. For some there may not be a need to convert over, as QLib may be working just fine for them. But, as TURBO keeps being updated, the Qlib user may hit a problem with Qlib on newer platforms. Plus, I think there is an advantage to using a freeware compiler.