Copyright © 2012 Leaf Mindcraft
This is an Acorn RISC OS software application that converts from BBC Basic Program Files to Acorn ANSI C Text Files, and is available for free download.
After having downloaded and unzipped the !BBC_C32 Application, drag the application to a suitable directory on your hard disc. Double click on the !BBC_C32 icon to load it onto the icon bar.
Double click on a BBC Basic file or drag it to the bar icon to enter its file name into the main 'SetUp' panel slot. Alternatively clicking on the bar icon brings up the main 'SetUp' panel and the BBC Basic file can be dragged to this panel, or the file name can be typed manually into the slot at the top of this panel.
Select options from the 'SetUp' panel and then click on the 'Run' icon. After a while a translated C Text file is offered for saving in the same directory as the BBC Basic, with the same name as the Basic file but prefixed by a capital 'C'.
Additional Help is available from the bar icon menu, or by using the Acorn facility !Help, present in the 'Apps' directory.
For information on compilation, please consult either the on-line or Impression manual.
For more Technical Information, please consult the text file 'TechNote' within !BBC_C32.
There was a major bug in previous versions (to do with arrays), which only came to light in upgrading to RISC OS 4.
Now with versions 8, it has been further enhanced by offering the choices either that the BBC Basic is using a Library or forms a Library in its own right.
The buttons to make these choices will now be found just off the bottom of the main 'SetUp' panel.
Also within !BBC_C32, please read the text file '!ReadMe' for conditions of use and for cost and address to apply to for your own licensed version.
The versions previously supplied were rather 'buggy' - you are now advised to use the 32-bit compatible version 8.73 available for download by clicking on the icon below. I have now been working on this for eighteen and a half years, right through a Mid-Life Crisis following redundancy, so if there are further bugs, I don't want to know any more!
Previous Versions 8.72 made procedure and function local variables available to sub-procedures and functions that share them. These versions were very memory hungry, and crashed with larger Basic programs. Version 8.73, that is much more conservative with memory, is now available for download.
Now Version 8.75 attempts to deal with GOTOs that are out of bounds of the calling PROCedure (C Function), that the C compiler doesn't seem to like (in most cases, where this isn't happening, you won't notice any difference), also slight bugs with logical equalities with MID$, LEFT$ and RIGHT$, and indirected control blocks in PROCedure and FN arguments cured.
Version 8.75c 'free's strings of their previous value when they are reassigned, and also selectively 'free's any Wimp Control blocks on exit from the converted C program. An additional option has been added to the 'SetUp' panel, to declare all global variables as 'static', for re-entrant Wimp programs.
Version 8.76 replaces the 'bbc_read' C Library Function, which mimics the BBC Basic construct 'READ', by inline code in the converted C source code, and attempts to cater for passing values from BBC Basic variable names embedded in DATA statements. Also, if there are variable names in array DIMs, where the actual values come from DATA statements, then these values are READ from the DATA statements, and result in these values being supplied to the '#define' statements, in the converted C source code, that are generated by !BBC_C32 to satisfy such variable DIM declarations.
Version 8.77b:- Some C compilers were 'choking' over the declaration of array arguments to library functions declared in "leaf.h". Both the call and declaration are now appropriately 'typed' ('casted') to prevent this.
Version 8.80. Now attempts to deal with 'variable' GOTOs and GOSUBs. (See 'TechNote' inside, and in 'Notes'.)
Version 8.90. Numerous 'bug fixes'. 'Syntax' errors, now only seem to be produced by genuine program 'slips' e.g. Poorly bracketed BBC Basic programming structures.
Version 8.90a. More 'bug fixes', in particular, 'memory runaway' problem, with large BBC Basic programs.
Version 8.92. FINAL bug fixes, in particular, a final argument to the C Library Function 'bbc_restore' that supplies the BBC Basic line separation.
NB 1. IF YOU GET MESSAGES ABOUT S.W.I.s BEING OUT OF RANGE, YOU NEED TO SET THE SYSTEM VARIABLE 'C$Path' TO POINT TO YOUR SHARED C LIBRARY FILE.
e.g. Command Needed for a Path 'my_path.' is of the form 'Set C$Path my_path.', either on the command line (Press F12), or in an Obey File (e.g. !Run).
NB 2. There should be a System Variable 'SharedCLibrary$Path' that has the Path of the Shared C Library in it. To access this value enclose it in angle brackets (< and >).
Alternatively, if you have the Acorn C and C++ compiler, either 26-bit or 32-bit, ('AcornC_C++', or 'AcornC\C++'), then running, or just viewing, the included application '!SetPaths' seems to do the trick.
NB 3. If you get the message '!BBC_C32 needs at least 10240K to start up', then open up the !BBC_C32 application (Hold down 'Shift' and double click over its icon), then get the internal 'Desc' text file into a text editor. In the first group of items in this file, you will find a 'wimpslot 10240k' statement. Edit this initial WimpSlot allocation to a size acceptable to your computer's amount of RAM available.
NB 4. With large BBC Basic programs, !BBC_C32 sometimes claims large amounts of memory, runs out of memory, and crashes. If you then run the BBC Basic through again, then often this doesn't happen again. Try, try, try again! (Now see below)
NB 5. I now seem to have cured the problem above. Now working on emulating EVAL, too. Watch this space!
NB 6. Gave up with EVAL! Note that both "leaf.h" and the Libraries altered to include the additional argument in the C Library Function 'bbc_restore'.
NB 7. Attempted to 'gild the lily' with Version 8.93, but only seemed to improve the estimate of the BBC Basic line separation, and alleviate the 'memory grabbing' behaviour somewhat.
NB 8. Version 8.94 attempts to deal with Wimp Control Blocks, in such a way to reduce Compiler errors.