This is a collection of C libraries and other resources for software developers. Some are specific to RISC OS; others should be portable to any platform with a ISO standard-compliant C library. 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.
This C library is designed for use by programs that process 3D models in the simple object geometry format developed by Wavefront for their Advanced Visualizer software. It should have minimal dependencies on other libraries and must not include any platform-specific code.
It is used by two of my programs, namely ChocToObj and SF3KtoObj.
Release 8 (30 Jul 2022)
primitive_get_side()to stop a wrong warning from GCC's
This C library provides debugging facilities for RISC OS software development. It has a large number of external dependencies, including most of the libraries supplied with the Acorn C/C++ development suite.
Its most useful feature is the ability to usurp calls to Acorn's flex library functions and redirect them to Simon P. Bullen's fortified memory allocation shell. This allows debugging of out-of-bounds memory accesses and simulation of allocation failure.
Similarly, calls to many functions in the Toolbox and Wimp libraries can be intercepted in order to simulate them returning an error value. This allows stress-testing of application programs.
Release 5 (28 Jul 2022)
#includecommands to ensure that everything declared by the original Toolbox library headers is declared before defining macro versions of library functions (since it's impossible to do so afterwards).
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.
Four library modules 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.
Other useful functionality: a null event manager that can schedule functions to be called back at timed intervals, iterator objects for traversing a directory tree, and a list of user data with methods to enumerate unsaved data or find data by file name.
Release 62 (30 Jul 2022)
_scheduler_client_has_callback(). This allows use of
scheduler_register()(for the same client) in a
entity2_dispose_all()to avoid leaks if the client doesn't call
notify_closed()function of the deiconizer (which failed for unknown UI object classes, including Menu).
_drag_send_dragging_msg()if the client passed a bounding box.
err_check_fatal()and the function
ON_ERR_RPT()macro as a simple call to
err_check()that discards its result, since
err_check()is now defined
err_check_rep()to share instead of duplicating code to handle error suppression/recording.
fancy_error()to use an internal buffer allocated by
messagetrans_error_lookup()instead of by its caller (for simpler usage).
externkeyword from headers.
CONTAINER_OF()in scheduler code instead of assuming
This C library provides type-safe veneers to miscellaneous OS-specific functionality not provided by the Wimp and Toolbox libraries supplied with Acorn C/C++. It has minimal dependencies on other libraries and does not include any code or interfaces that could usefully be used on other platforms. It does not dynamically allocate memory.
RISC OS functionality exposed:
(Basically all of the stuff that application programmers actually use.)
Release 6 (01 Aug 2022)
wimp_drag_box2()for drag operations within windows.
wimp_auto_scroll()for automatic scrolling of windows.
os_sprite_op_flip_y()for flipping sprites horizontally or vertically.
os_sprite_op_plot_trans_matrix_sprite()for plotting transformed sprites.
os_sprite_op_plot_sprite()for plotting sprites with no scaling or colour translation.
os_plot()are within sensible ranges.
_kernel_swi_regsdeclarations where suitable.
constscale factors and colour translation table to be used with
This C library provides miscellaneous additional functionality not found in the standard C library such as linked lists, string buffers and case-insensitive string comparisons. It should have minimal dependencies on other libraries and must not include any platform-specific code.
Release 6 (14 Aug 2022)
intfor array indices and return Boolean success/failure instead of -1.
INTDICT_FOR_EACHmacros now require an extra parameter to make it clearer when the limit variable shadows another variable declaration.
LINKEDLIST_FOR_EACH_SAFEmacro now requires an extra parameter to make it clear when the next item pointer shadows another variable declaration.
strdupwhen passed a null pointer.
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.
This is a C library for compressing or decompressing data using the same algorithm used by old 4th Dimension and Fednet games such as 'Chocks Away', 'Stunt Racer 2000' and 'Star Fighter 3000'. It should have minimal dependencies on other libraries and must not include any platform-specific code.
It is used by many of my programs, including ChocToObj, SF3KtoObj and various Star Fighter 3000 editing utilities.
Release 3 (28 Jul 2022)
typedef GKeyStatusand function
(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)
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
INSTR) are replicated by equivalent
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)
ls_', to increase their uniqueness and make it easier to avoid name clashes.
This C library provides functions to convert between RISC OS sprites and Star Fighter 3000 bitmap formats, as well as definitions relating to the game's file formats.
It depends on CBOSLib (by the same author) but only for definitions relating to a sprite area. Whether that dependency is necessary or desirable is debatable but all software that uses the functionality of SF3KLib currently depends on CBOSLib anyway. Sprite files are unlikely to be used on other platforms.
This library provides the core conversion routines used by SFtoSpr.
Release 4 (01 Dec 2020)
sf_spr_to_tilesnow pass the actual sprite name to the query callback function instead of the expected name (prefix).
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_ExtendBlocknow rounds requested block sizes up to the nearest word, just as
SlidingHeap_NewBlockalways has.... Optimised this to use single
BICin 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.
The purpose of this C library is to provide a uniform interface to read from or write to streams of different types. Several implementations are provided, including for compressed and uncompressed input/output. The interface is similar to that provided by the standard C library in order to ease porting of existing code.
Support for reading or writing data compressed using the same algorithm used by old 4th Dimension and Fednet games such as 'Chocks Away', 'Stunt Racer 2000' and Star Fighter 3000 relies on another C library, GKeyLib, by the same author.
This library is used by several of my programs, including ChocToObj and SF3KtoObj.
Release 11 (28 Jul 2022)