3D object library | CBDebugLib | CBLibrary | CBOSLib | CBUtilLib | Dynamic Areas tutorial | FontLib | Gordon Key library | Joystick emulation module | LongStr BASIC library | SF3KLib | SlidingHeap module | StreamLib
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.
Main features:
You can browse the source code on GitHub.
Release 8 (30 Jul 2022)
extern
keyword.
primitive_get_side()
to
stop a wrong warning from
GCC's -Warray-bounds
.
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.
You can browse the source code on GitHub.
Release 7 (17 Jun 2023)
debug_set_output
function to
return the previous mode.
do {}
while(0)
instead of if (0)
... so their
arguments needn't be valid and to prevent unintended
association with else
blocks.
"textarea.h"
.
debug_set_output
function.
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.
You can browse the source code on GitHub.
Release 63 (17 Jun 2023)
size_t
rather than unsigned
int
for the number of substitution parameters passed
to msg functions.
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.)
You can browse the source code on GitHub.
Release 7 (17 Jun 2023)
size_t
rather than unsigned
int
for the number of substitution parameters passed
to messagetrans functions.
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.
You can browse the source code on GitHub.
Release 9 (03 Dec 2023)
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
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.
You can browse the source code on GitHub.
Release 3 (28 Jul 2022)
typedef GKeyStatus
and function gkeycomp_compress()
.
(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).
The module is released under the GNU public licence, and comes with full source code. You can browse the source code on GitHub.
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
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.
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 once provided the core conversion routines used by SFtoSpr but has since become increasingly obsolescent.
Release 4 (01 Dec 2020)
sf_spr_to_planets
, sf_spr_to_sky
and sf_spr_to_tiles
now 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_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.
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.
You can browse the source code on GitHub.
Release 11 (28 Jul 2022)
extern
and
const
keywords.