CBLibrary | Dynamic Areas tutorial | FontLib | Joystick emulation module | Loader demo | LongStr BASIC library | SlidingHeap module
These programming resources are intended for ARM powered computers running RISC OS. The title and icon of each package are linked to the relevant Zip archive for download. On RISC OS computers Zip files may be opened using SparkPlug, SparkFS (commercial) or Infozip.
(Also available without source code - smaller download.)
This is yet another C library for RISC OS. Actually, it is more like a personal collection of modules that happen to be common to many of my applications. It has a large number of external dependencies, including most of the libraries supplied with the Acorn C/C++ development suite.
I do not seriously expect many other programmers to use CBLibrary, but it has to be in the public domain in order that the programs that use it can meaningfully be released under the GNU General Public Licence.
The most interesting library modules are probably 'Drag', 'Entity', 'Loader2', 'Saver', 'Scheduler', 'PseudoFlex' and 'DirIter'. The first four provide a complete implementation of the data transfer, drag and drop, and clipboard protocols described in the RISC OS 3 PRM and application notes 240 and 241. The 'Scheduler' module is a system for managing null events and scheduling functions to be called in the future. The 'PseudoFlex' module usurps Acorn's flex library and redirects calls to Simon P. Bullen's fortified memory allocation shell (for debugging). The 'DirIter' module is a nicer way of traversing the objects in a directory tree.
Release 44 (7th May 2012)
malloc and
free.
_swix function is the
only notable omission.
decode_load_exec for
decoding filing system objects' load and execution
addresses into date stamp and file type.
STRING_OR_NULL macro substitutes an
empty string for a null pointer.
drag_initialise, entity_initialise,
Pal256_initialise,
scheduler_initialise and
ViewsMenu_create (to reduce inter-module
dependencies) conditional upon CBLIB_OBSOLETE.
"Err_Rec.h" as a
proxy for "Err.h" to facilitate compilation of
very old software.
RoundRobin_resume,
RoundRobin_suspend and
RoundRobin_deregister functions return
NULL to facilitate compilation of very old
software.
sprintf/snprintf buffer
overflow/truncation.
err_check[_rep],
err_check_fatal[_rep] and
ON_ERR_RPT[_RTN|_RTN_V] functions and macros to
accept pointers to const-qualified OS error
blocks even if CBLIB_OBSOLETE is defined. To
avoid qualifier-losing casts, this cannot be done to macros
that do not consume their input, such as
ON_ERR_RTN_E.
memset call in the
sf_sky_to_lone_spr function.
A short introduction to using dynamic areas in BASIC programs, including two small example programs.
Release 1 (8th May 1999)
This is a sample application which attempts to demonstrate various aspects of using outline fonts in a WIMP application. It is assumed that the user is reasonably familiar with the basic principles of writing multi-tasking WIMP applications. Harriet has tried to hide away as much of the 'workings' as she can in the FONT_Lib library file.
February 2000
(Note: requires APCS-32 supporting C library)
It is difficult for games programmers to implement support for joysticks without access to actual hardware. This module has been written to help - specifically, to allow me to test the new joystick support in Star Fighter 3000.
The cost of an interface and a decent joystick to go with it is quite expensive. If, like me, you are too miserly to pay for the real thing, this module may provide the solution. It allows games to be tested against a 'virtual' (emulated) joystick, which is controlled using the numeric keypad. Not particularly useful for playing games, but for testing purposes certainly far better than nothing.
Various emulation modes are supported, including "switched" (emulates an Atari-type joystick), "analogue" (emulates a PC-type joystick) and "damped" (uses a gradual decay function to make keyboard control of an analogue stick easier).
Version 2.01 (15th March 2003)
(Note: example application requires Toolbox modules)
The Loader component is part of CBLibrary, which is distributed separately from this demo, with source code under the Lesser General Public License. You will need to obtain CBLibrary in order to recompile this demo or use Loader in your own programs. Acorn's Flex, Toolbox and Event libraries are also a requirement.
Essentially a layer on top of Eventlib's message handlers, Loader centrally handles incoming data transfers for all parts of your application. A client-supplied handler function is called when a data transfer is successfully concluded.
The client application registers an interest in listening for certain file types dragged to particular areas of the user interface. This approach fits well with an object-oriented programming style, as listeners may be registered when a Toolbox object is created or shown and deregistered when it is deleted or hidden.
This example application is supplied with full source code. There is also extensive documentation as an HTML/EasiWriter document.
Version 0.15 (28th October 2006)
LoaderFinishedHandler function
arguments to include the drop coordinates, for
compatibility with recent versions of CBLibrary.
In BBC BASIC, it is impossible to use text strings of greater than 255 characters in length. This can be frustrating if you want to allow for long file paths in your program, or you need to manipulate some data that originated in a less restricted environment.
My LongStr library is quite slow and was hastily written, but
it does a fair job of bypassing this limit. Virtually all
BASIC's string handling keywords (with the
exception of INSTR) are replicated by equivalent
library functions.
The library functions are described in some detail in the accompanying documentation, which also contains guidelines and advice for use. There is also an example program.
Release 6 (11th September 2003)
record%'.
ls_',
to increase their uniqueness and make it easier to avoid
name clashes.
The SlidingHeap module creates and manages a sliding heap of blocks of memory claimed from a program's Wimpslot as necessary, thus avoiding the fragmentation caused by repeatedly claiming and releasing memory from the RMA. The order of blocks in the heap may change and their location will vary as other blocks grow and shrink. It is rather like Acorn C's 'flex' library, but is suitable for use from BASIC/ARM code programs.
This new release of SlidingHeap has been reconstructed from a disassembly, in the absence of the original source code. Apart from being 32-bit compatible (for use on RISC OS 5) other improvements include a new SWI to increase the maximum number of blocks.
The module is distributed under the GNU Public Licence with full source code, demonstration programs and extensive documentation in both text and StrongHelp format.
Steven Haslam (32-bit compatibility by Christopher Bazley, much additional work by Harriet Bazley)
Module: Version 2.12 (13th October 2002)
BASIC support library: 3rd December 2002
SlidingHeap_ExtendBlock now rounds requested
block sizes up to the nearest word, just as
SlidingHeap_NewBlock always has.... Optimised this
to use single BIC in place of AND NOT
construction.
SlidingHeap_ScrapBlock (as far as I know, never
called during entire history of module) dealing with the
possibility of non-word-aligned blocks.