using-libriscoslib
Skill4 starsChanged 8 months agoMITView on GitHub
Use the RISC_OSLib library from C-based RISC OS projects, including choosing the correct header include path and linking the exported library object in `Makefile,fe1`. Use when a task adds or reviews `#include "RISC_OSLib/..."` headers, `wimp_*`/other RISC_OSLib APIs, or `LIBS` entries for desktop applications and other RISC_OSLib-based code.
In this repository47 other files it gives its agents.
- allocating-resourcesSkill
- ci-testingSkill
- creating-pull-requestsSkill
- designing-modulesSkill
- porting-to-riscos-cSkill
- reading-assemblySkill
- riscos-commandsSkill
- riscos-desktop-fileractionSkill
- riscos-filer-likeSkill
- riscos-filesystemSkill
- riscos-graphics-convertersSkill
- riscos-network-dcistatisticsSkill
- riscos-network-resolverSkill
- riscos-outputSkill
- riscos-reSkill
- riscos-styleSkill
- riscos-throwbackSkill
- riscos-urls-fetchingSkill
- riscos-urls-launchingSkill
- riscos-wimp-appSkill
- riscos-wimpSkill
- riscos-wimp-templatesSkill
- updating-robe-skillsSkill
- using-bbcbasicSkill
- using-cmhgSkill
- using-ghSkill
- using-gitSkill
- using-libasmSkill
- using-libgcontextSkill
- using-liboslibSkill
- using-libtoolboxSkill
- using-makefilesSkill
- using-perlSkill
- using-stronghelpSkill
- using-toolbox-imagefilegadgetSkill
- using-tooltesterSkill
- writing-assemblySkill
- writing-assembly-testsSkill
- writing-cmodulesSkill
- writing-cplusplusSkill
- writing-cSkill
- writing-fortranSkill
- writing-oslib-defsSkill
- writing-pascalSkill
- writing-prminxmlSkill
- writing-pymodulesSkill
- writing-pyromaniac-integration-testsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 6 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Use this skill when a C project depends on the RISC_OSLib library.
- Distinctive: line 15
Read the relevant resource notes for the headers you are about to touch:
- Very specific: line 21
Ensure the makefile can resolve those headers through INCLUDES, which is normally -IC: by default in the standard project templates.
- Distinctive: line 28
Use the exported include path form:
- Distinctive: line 34
Do not include headers by their host filesystem paths.
- Very specific: line 36
When using RISC_OSLib/template.h, include RISC_OSLib/wimp.h first, because the template header relies on wimp_wind already being defined.
- Very specific: line 41
When a project uses RISC_OSLib, add the library to LIBS in Makefile,fe1 using the exported object name:
- Very specific: line 59
read back the task handle with wimpt_task()
- Very specific: line 64
When using wimpt_messages, terminate the wimp_msgaction array with wimp_MCLOSEDOWN, as documented by the RISC_OSLib header.
- Distinctive: line 66
Do not assume that an unterminated list is acceptable just because the first few entries appear to work.
- Very specific: line 88
call wimp_open_template(...) with the full application-relative path
- Very specific: line 89
call wimp_load_template(...) once with buf <= 0 to obtain the required template-buffer and indirected-workspace sizes
- Very specific: line 93
call wimp_load_template(...) again with the allocated pointers
- Very specific: line 94
call wimp_close_template() even on failure paths
- Very specific: line 96
Keep the template buffer and indirected workspace alive for as long as the created window exists.
- Distinctive: line 100
If the template name is being matched by name, use a writable aligned name buffer rather than a string literal.
- Very specific: line 120
Do not assume that a RISC_OSLib menu API will derive those values for you.
- Distinctive: line 121
When a menu or icon renders or behaves incorrectly, inspect the populated structure fields and packed flag values directly.
- Very specific: line 132
If the task receives wimp_EOPEN, pass the returned wimp_openstr back to wimp_open_wind() promptly.
- Very specific: line 138
When reviewing or repairing a RISC_OSLib project, check these first:
- Very specific: line 159
Use writing-c for general C style and structure.
- Very specific: line 160
Use riscos-wimp or riscos-wimp-app when the RISC_OSLib usage is specifically for desktop Wimp applications.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Using the library RISC_OSLib
Use this skill when a C project depends on the RISC_OSLib library.
Default workflow
- Confirm that the project is a C-based RISC OS component using
RISC_OSLibAPIs such aswimp_*. - Read the relevant resource notes for the headers you are about to touch:
resources/overview.mdfor the header map and major caveatsresources/wimp-ui.mdfor Wimp, template, menu, dialogue, help, and transfer helpersresources/text-editing.mdfortxt*andtxtedit*resources/system-graphics.mdfor OS, resources, fonts, sprites, Draw, printing, memory helpers, and utility wrappers
- Include headers with the exported include form
#include "RISC_OSLib/<header>.h". - Ensure the makefile can resolve those headers through
INCLUDES, which is normally-IC:by default in the standard project templates. - Link the exported library object explicitly in
Makefile,fe1throughLIBS. - For simple Wimp tasks, prefer the
wimpt_*helper layer fromRISC_OSLibrather than dropping straight to the lower-levelwimp_taskinitpath. - Rebuild after any header or link change to catch unresolved symbols immediately.
Include guidance
Use the exported include path form:
#include "RISC_OSLib/wimp.h"#include "RISC_OSLib/wimpt.h"#include "RISC_OSLib/os.h"
Do not include headers by their host filesystem paths.
When using RISC_OSLib/template.h, include RISC_OSLib/wimp.h first, because
the template header relies on wimp_wind already being defined.
Makefile linkage
When a project uses RISC_OSLib, add the library to LIBS in
Makefile,fe1 using the exported object name:
LIBS = C:RISC_OSLib.o.risc_oslibFor 32-bit application builds this resolves to the correct -32 variant
through the build system. If other libraries are already present, append
C:RISC_OSLib.o.risc_oslib to the existing LIBS list rather than replacing
them.
Wimp task startup through RISC_OSLib
For small desktop applications using RISC_OSLib, the practical startup path
is usually:
- call
wimpt_wimpversion(<minimum_version>) - register the required message list with
wimpt_messages(...) - call
wimpt_init(<task_name>) - read back the task handle with
wimpt_task() - enter the event loop with
wimpt_poll(...)
This keeps startup and polling aligned with the RISC_OSLib helper layer.
When using wimpt_messages, terminate the wimp_msgaction array with
wimp_MCLOSEDOWN, as documented by the RISC_OSLib header.
Do not assume that an unterminated list is acceptable just because the first
few entries appear to work.
wimpt_init returns the actual Wimp version. Check it against the minimum
version you requested before continuing into application setup.
Template loading
RISC_OSLib exposes both:
- the higher-level
template.hhelper layer - the lower-level
wimp_open_template,wimp_load_template, andwimp_close_templatecalls fromwimp.h
Be careful with the higher-level helper layer. The template.h comments
document an assumption that the template file is called Templates in the
application directory. If the real packaged path or lookup context matters,
prefer the explicit wimp_open_template("<App$Dir>.Templates") path instead
of assuming the helper's default lookup will resolve correctly.
For explicit template loading through wimp.h, a practical pattern is:
- call
wimp_open_template(...)with the full application-relative path - call
wimp_load_template(...)once withbuf <= 0to obtain the required template-buffer and indirected-workspace sizes - allocate persistent storage for both the template buffer and the indirected workspace
- call
wimp_load_template(...)again with the allocated pointers - call
wimp_close_template()even on failure paths
Keep the template buffer and indirected workspace alive for as long as the
created window exists. Do not free or overwrite them immediately after
wimp_create_wind().
If the template name is being matched by name, use a writable aligned name buffer rather than a string literal.
Structure-field usage
RISC_OSLib gives you C structures for Wimp objects, but many UI details are
still configured through explicit packed fields rather than high-level helper
functions.
In particular:
- menu title and work-area colours are set through the menu header fields such
as
tit_fcol,tit_bcol,work_fcol, andwork_bcol - menu item foreground and background colours come from the item's
iconflags, not the menu header colours - icon button types are encoded into the icon flags, for example with
(wimp_BCLICKDEBOUNCE << 12) - submenu dialogue windows are attached through the menu item's
submenufield even though the field type is expressed aswimp_menuptr
Do not assume that a RISC_OSLib menu API will derive those values for you.
When a menu or icon renders or behaves incorrectly, inspect the populated
structure fields and packed flag values directly.
For Wimp colour numbers used through RISC_OSLib structures, remember that
the logical Wimp palette maps 0 to white and 7 to black.
Open-window protocol
Even when a window came from a template or is only used as a menu submenu, normal Wimp open-window handling still applies.
If the task receives wimp_EOPEN, pass the returned wimp_openstr back to
wimp_open_wind() promptly. If you omit that handler, otherwise moveable
windows will not behave correctly when the user drags or reopens them.
Practical checks
When reviewing or repairing a RISC_OSLib project, check these first:
- headers included as host paths instead of
RISC_OSLib/... - calls to
wimp_*or otherRISC_OSLibAPIs with no matchingLIBSentry - abstract or guessed library names such as
libRISC_OSLibinstead of the exported objectC:RISC_OSLib.o.risc_oslib - application skeletons that compile but fail to link because the library was never added
wimpt_messageslists that are not terminated withwimp_MCLOSEDOWN- applications using
wimpt_initbut never checking the returned Wimp version - code including
template.hbeforewimp.h - template-loading code that relies on the
template.hdefaultTemplateslookup when an explicit application-relative path is safer - template buffers or indirected workspaces that are stack-allocated or freed too early
- menu or icon code that changes the wrong colour fields because it confuses
menu-header colours with item
iconflags - moveable windows or menu subwindows that never handle
wimp_EOPEN
Related skills
Use writing-c for general C style and structure.
Use riscos-wimp or riscos-wimp-app when the RISC_OSLib usage is
specifically for desktop Wimp applications.
Resource notes
The resources/ directory in this skill contains source-backed notes on the
public RISC_OSLib headers and the behaviour that is easy to miss from the
header comments alone. Use those notes instead of relying on the local
implementation sources being available to the next agent.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

