Kōtuku
  • Gallery
  • API
  • Wiki
  • GitHub
    •  Overview
        • BroadcastEvent()
        • GetEventID()
        • SubscribeEvent()
        • UnsubscribeEvent()
        • FieldName()
        • FindField()
        • AddInfoTag()
        • AnalysePath()
        • CompareFilePaths()
        • CopyFile()
        • CreateFolder()
        • CreateLink()
        • DeleteFile()
        • DeleteVolume()
        • IdentifyFile()
        • LoadFile()
        • MoveFile()
        • OpenDir()
        • ReadFileToBuffer()
        • ReadInfoTag()
        • ResolveGroupID()
        • ResolvePath()
        • ResolveUserID()
        • ScanDir()
        • SetDefaultPermissions()
        • SetVolume()
        • UnloadFile()
        • AllocResource()
        • CheckResourceExists()
        • FreeResource()
        • PinResource()
        • TrackResource()
        • UnpinResource()
        • AddMsgHandler()
        • ProcessMessages()
        • ScanMessages()
        • SendMessage()
        • UpdateMessage()
        • WaitForObjects()
        • AccessObject()
        • Action()
        • ActionList()
        • AsyncAction()
        • AsyncCancel()
        • AsyncPending()
        • AsyncWait()
        • CheckAction()
        • ClassDatabase()
        • CurrentContext()
        • FindClass()
        • FindObject()
        • FreeObject()
        • GetActionMsg()
        • GetClassID()
        • GetObjectPtr()
        • GetOwnerID()
        • InitObject()
        • ListChildren()
        • LockObject()
        • NewObject()
        • NotifySubscribers()
        • ParentContext()
        • QueueAction()
        • ReleaseObject()
        • ResolveClassID()
        • ResolveClassName()
        • SetName()
        • SetOwner()
        • SubscribeAction()
        • UnsubscribeAction()
        • AdjustLogLevel()
        • AllocateID()
        • CurrentTask()
        • GenCRC32()
        • GetResource()
        • GetSystemState()
        • GetThreadID()
        • PreciseTime()
        • RegisterFD()
        • SetLogCallback()
        • SetResource()
        • SetResourcePath()
        • SubscribeTimer()
        • UpdateTimer()
        • WaitTime()
        • WakeThread()
    • Audio
    • Config
    • Core
    • Display
    • Document
    • Font
    • HTTP
    • Network
    • Regex
    • SVG
    • Tiri
    • Vector
    • XML
    • XQuery
    • XRandR
      • Audio
      • MP3
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • LZMAStream
      • Script
      • Tiri
      • XML
      • XQuery
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Image
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetServer
      • NetSocket
      • Proxy
      • Gradient
      • GradientConic
      • GradientContour
      • GradientDiamond
      • GradientDiffusion
      • GradientDistal
      • GradientGouraud
      • GradientLinear
      • GradientMesh
      • GradientRadial
      • GradientVoronoi
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Kōtuku Objects
      • Kōtuku In Depth
      • Kōtuku Design Patterns
      • Coding With AI
      • Regex Manual
      • XML Comparisons
      • Tiri Reference Manual
      • Config API
      • Defer Syntax
      • GUI API
      • HTTP Server API
      • I/O API
      • JSON API
      • OAuth API
      • Options API
      • Proxy Server API
      • Tempus API
      • URL API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Origo
      • Flute / Unit Testing
      • Tuku
      • Embedded Document Format
      • TDL Reference Manual
      • TDL Tools
      • Action Reference Manual
      • System Error Codes

Core Module

The core library provides system calls and controls for the Kotuku system.

The Kotuku Core is a system library that provides a universal API that works on multiple platforms. It follows an object oriented design with granular resource tracking to minimise resource usage and memory leaks.

The portability of the core has been safe-guarded by keeping the functions as generalised as possible. When writing code for a target platform it will be possible for the application to be completely sandboxed if the host's system calls are avoided.

This documentation is intended for technical reference and is not suitable as an introductory guide to the framework.

Functions

Events

BroadcastEvent | GetEventID | SubscribeEvent | UnsubscribeEvent

Fields

FieldName | FindField

Files

AddInfoTag | AnalysePath | CompareFilePaths | CopyFile | CreateFolder | CreateLink | DeleteFile | DeleteVolume | IdentifyFile | LoadFile | MoveFile | OpenDir | ReadFileToBuffer | ReadInfoTag | ResolveGroupID | ResolvePath | ResolveUserID | ScanDir | SetDefaultPermissions | SetVolume | UnloadFile

Memory

AllocResource | CheckResourceExists | FreeResource | PinResource | TrackResource | UnpinResource

Messages

AddMsgHandler | ProcessMessages | ScanMessages | SendMessage | UpdateMessage | WaitForObjects

Objects

AccessObject | Action | ActionList | AsyncAction | AsyncCancel | AsyncPending | AsyncWait | CheckAction | ClassDatabase | CurrentContext | FindClass | FindObject | FreeObject | GetActionMsg | GetClassID | GetObjectPtr | GetOwnerID | InitObject | ListChildren | LockObject | NewObject | NotifySubscribers | ParentContext | QueueAction | ReleaseObject | ResolveClassID | ResolveClassName | SetName | SetOwner | SubscribeAction | UnsubscribeAction

System

AdjustLogLevel | AllocateID | CurrentTask | GenCRC32 | GetResource | GetSystemState | GetThreadID | PreciseTime | RegisterFD | SetLogCallback | SetResource | SetResourcePath | SubscribeTimer | UpdateTimer | WaitTime | WakeThread

Structures

ActionArray | ActionTable | ChildEntry | ClassRecord | ClipRectangle | ColourFormat | DateTime | DirInfo | Edges | FRGB | Field | FieldArray | FieldDef | FileFeedback | FileInfo | FunctionField | HSV | InputEvent | Message | ObjectSignal | OpenInfo | OpenTag | RGB16 | RGB32 | RGB8 | RGBPalette | ResourceRecord | SystemState | Unit | dcAudio | dcDeviceInput | dcKeyEntry | dcRequest

Classes

CompressedStream | Compression | Config | File | MetaClass | Module | Script | StorageDevice | Task | Thread | Time

Constants

AC | CCF | CONTYPE | EVG | FBK | IDTYPE | JET | JTYPE | LDF | LOC | MEM | MSF | MSGID | NF | OPF | PERMIT | PMF | RDF | RES | RFD | RP | RSF | TOI | VOLUME

AccessObject()

Grants exclusive access to objects via unique ID.

ERR AccessObject(OBJECTID Object, INT MilliSeconds, OBJECTPTR * Result)
ParameterDescription
ObjectThe unique ID of the target object.
MilliSecondsThe limit in milliseconds before a timeout occurs. The maximum limit is 60000, and 100 is recommended.
ResultA pointer storage variable that will store the resulting object address.

This function resolves an object ID to its address and acquires a lock on the object so that other threads cannot use it simultaneously.

If the Object is already locked, the function will wait until it becomes available. This must occur within the amount of time specified in the Milliseconds parameter. If the time expires, the function will return with an ERR::TimeOut error code. If successful, ERR::Okay is returned and a reference to the object's address is stored in the Result variable.

It is crucial that calls to AccessObject() are followed with a call to ReleaseObject() once the lock is no longer required. Calls to AccessObject() will also nest, so they must be paired with ReleaseObject() correctly.

It is recommended that C++ developers use the ScopedObjectLock class to acquire object locks rather than making direct calls to AccessObject(). The following example illustrates lock acquisition within a 1 second time limit:

{
   kt::ScopedObjectLock<OBJECTPTR> obj(my_object_id, 1000);
   if (lock.granted()) {
      obj.acDraw();
   }
}

Error Codes

OkayOperation successful.
CancelledThe thread has been requested to stop whilst sleeping.
ArgsInvalid arguments passed to function
LockFailedFailed to initialise the sleep record for the waiting thread.
TimeOutFunction timed-out before successful completion
MarkedForDeletionThe object is being removed and cannot be locked.
SystemLockedPart of the system is unreachable due to a persistent lock
NoMatchingObjectNo matching object was found for the given object ID
DoesNotExistThe object was removed while waiting for the lock.
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

Action()

This function is responsible for executing action routines.

ERR Action(AC Action, OBJECTPTR Object, APTR Parameters)
ParameterDescription
ActionAn action or method ID must be specified.
ObjectThe target object.
ParametersOptional parameter structure associated with Action.

This function is the key entry point for executing actions and method routines. An action is a predefined function call that can be called on any object, while a method is a function call that is specific to a class implementation. You can find a complete list of available actions and their associated details in the Kotuku Wiki. The actions and methods supported by any class will be referenced in their auto-generated documentation.

Here are two examples that demonstrate how to make an action call. The first performs an activation, which does not require any additional arguments. The second performs a move operation, which requires three additional arguments to be passed to the Action() function:

1. Action(AC::Activate, Image, nullptr);

2. struct acMove move = { 30, 15, 0 };
   Action(AC::Move, Window, &move);

In all cases, action calls in C++ can be simplified by using their corresponding stub functions:

1.  acActivate(Image);

2a. acMove(Window, 30, 15, 0);

2b. Window->move(30, 15, 0);

If the class of an object does not support the Action ID, an error code of ERR::NoSupport is returned. To test an object to see if its class supports an action, use the CheckAction() function.

Error Codes

OkayOperation successful.
NoActionThe Action is not supported by the object's supporting class.
AccessObjectAttempting to lock an object failed
NullArgsFunction call missing argument value(s)
NotifiedUnknown error code.
Core module documentation © Paul Manias 1996-2026

ActionList()

Returns the global action table.

void ActionList(kt::vector<ActionTable *> * Actions)
ParameterDescription
ActionsReceives pointers to the Core's static action records, indexed by action ID.

This function returns an array of all actions supported by the Core, including name, arguments and structure size. The ID of each action is indicated by its index within the array.

Index zero is an empty record because valid action IDs start from one rather than zero.

The Name field specifies the name of the action. The Args field refers to the action's argument definition structure, which lists the argument names and their relevant types. This is matched by the Size field, which indicates the byte-size of the action's related argument structure. If the action does not support arguments, the Args and Size fields will be set to NULL. The following illustrates two argument definition examples:

struct FunctionField argsCopyData[] = {
   { "Destination", FD_INT  },
   { nullptr, 0 }
};

struct FunctionField argsResize[] = {
   { "Width",  FD_DOUBLE },
   { "Height", FD_DOUBLE },
   { "Depth",  FD_DOUBLE },
   { nullptr, 0 }
};

The argument types that can be used by actions are limited to those listed in the following table:

NameDescription
FDF::INTA 32-bit integer value.
FDF::DOUBLEA 64-bit floating point value.
FDF::PTRA standard address space pointer.
FDF::OBJECTPTRA pointer to an object. This is defined as FD_PTR|FD_OBJECT and its convenience macro is FD_OBJECTPTR.
FDF::CPPSTRINGA C++ std::string, defined as FD_CPP|FD_STRING with the convenience macro FDF_CPPSTRING.
FDF::SPANA typed span describing contiguous callable array storage, defined as FD_CPP|FD_ARRAY with the convenience macro FDF_SPAN. Combine it with the element type and FD_MUTABLE when the span is writable.

Supplementary flags can be combined with the above types to provide additional information about the argument:

NameDescription
FD::MUTABLEThis flag indicates that the referenced memory is writable by the function. It is most commonly combined with FDF_SPAN for output buffers.
FD::RESULTThis flag indicates that the parameter is used for storing function output. Example: If the developer is required to supply a pointer to an int field in which the function will store a result, the correct argument definition will be FDF_RESULT|FDF_INT.
Core module documentation © Paul Manias 1996-2026

AddInfoTag()

Adds new tags to FileInfo structures.

ERR AddInfoTag(struct FileInfo * Info, STRVIEW Name, STRVIEW Value)
ParameterDescription
InfoPointer to a valid FileInfo structure.
NameThe name of the tag, which must be declared in camel-case.
ValueThe value to associate with the tag name. If empty, any existing tag with a matching Name will be removed.

This function adds file tags to FileInfo structures. It is intended for use by the Core and external drivers only. Tags allow extended attributes to be associated with a file, for example the number of seconds of audio in an MP3 file.

Error Codes

OkayOperation successful.
NullArgsFunction call missing argument value(s)
CreateResourceFailed to create a new resource
Core module documentation © Paul Manias 1996-2026

AddMsgHandler()

Adds a new message handler for processing incoming messages.

ERR AddMsgHandler(MSGID MsgType, FUNCTION * Routine, struct MsgHandler ** Handle)
ParameterDescription
MsgTypeThe message type that the handler will intercept. If zero, all incoming messages are passed to the handler.
RoutineRefers to the function that will handle incoming messages.
HandleThe resulting handle of the new message handler - retain for FreeResource().

This function allows handlers to be added for the interception of incoming messages. Message handling works as follows:

During a call to ProcessMessages(), each incoming message will be scanned to determine if a message handler is able to process that message. All handlers that accept the message type will be called with a copy of the message structure and any additional data. The message is then removed from the message queue.

When calling AddMsgHandler(), the MsgType acts as a filter so that only messages with the same type identifier will be passed to the handler. The Routine parameter must point to the function handler, which will follow this definition:

ERR handler(APTR Meta, MSGID MsgID, INT MsgType, APTR Message, INT MsgSize)

The handler must return ERR::Okay if the message was handled. This means that the message will not be passed to message handlers that are yet to receive the message. Throw ERR::NothingDone if the message has been ignored or ERR::Continue if the message was processed but may be analysed by other handlers. Throw ERR::Terminate to break the current ProcessMessages() loop. When using Tiri, this is best achieved with raise ERR_Terminate in the handler.

The handler will be identified by a unique pointer returned in the Handle parameter. This handle will be garbage collected or can be passed to FreeResource() once it is no longer required.

Error Codes

OkayMessage handler successfully processed.
LockFailed to lock a required resource
AllocMemoryFailed to create a new memory block
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

AdjustLogLevel()

Adjusts the base-line of all log messages.

INT AdjustLogLevel(INT Delta)
ParameterDescription
DeltaThe level of adjustment to make to new log messages. Zero is no change. The maximum level is +/- 9.

This function adjusts the detail level of all outgoing log messages. To illustrate, setting the Delta value to 1 would result in level 5 (API) log messages being bumped to level 6. If the user's maximum log level output is 5, no further API messages will be output until the base-line is reduced to normal.

The main purpose of AdjustLogLevel() is to reduce log noise. For instance, creating a new desktop window will result in a large number of new log messages. Raising the base-line by 2 before creating the window would eliminate the noise if the user has the log level set to 5 (API). Re-running the program with a log level of 7 or more would make the messages visible again.

A secondary use of this function is to increase the verbosity of log messages when debugging an area of interest. For instance, if a program is run with a warning level of 2 and we want to see the log output for a function at API level, call AdjustLogLevel() with a Delta of -3 to raise the base-line to 5.

Adjustments to the base-line are accumulative, so small increments of 1 or 2 are encouraged. To revert logging to the previous base-line, call this function again with a negation of the previously passed value.

Note: This function is complemented by the SetResource() function with the RES::LOG_LEVEL option, which permanently changes the log level for the duration of the program.

Result

Returns the absolute base-line value that was active prior to calling this function.

Core module documentation © Paul Manias 1996-2026

AllocResource()

Allocates a managed memory block on the heap.

ERR AllocResource(INT64 Size, MEM Flags, APTR * Address, struct ResourceManager * Manager)
ParameterDescription
SizeThe size of the memory block in bytes. Must be greater than zero.
FlagsOptional allocation flags controlling behaviour and ownership.
AddressPointer to store the address of the allocated memory block.
ManagerResource manager used to release the resource.

AllocResource() reserves an area of memory of Size bytes and tracks it using the supplied resource manager. If no Manager is provided, the default memory manager is used. The function returns a pointer to the allocated memory block in Address. The allocated memory is automatically associated with the current execution context, allowing it to be automatically cleaned up when the context is destroyed.

Example usage:

APTR address;
if (!AllocResource(1000, MEM::NIL, &address, nullptr)) {
   // Use memory block...
   FreeResource(address);
}

Memory blocks are automatically associated with their owning object context, enabling automatic cleanup when the owner is destroyed. This prevents memory leaks in object-oriented code.

Error Codes

OkayMemory block successfully allocated.
ArgsInvalid parameters (size <= 0 or Address is NULL).
AllocMemoryInsufficient memory available for the requested allocation.
Core module documentation © Paul Manias 1996-2026

AllocateID()

Generates unique ID's for general purposes.

INT AllocateID(IDTYPE Type)
ParameterDescription
TypeThe type of ID that is required.

This function generates unique ID's that can be used in other Core functions. A Type indicator is required and the resulting number will be unique to that Type only.

ID allocations are permanent, so there is no need to free the allocated ID once it is no longer required.

Result

A unique ID matching the requested type will be returned. This function can return zero if the Type is unrecognised, or if an internal error occurred.

Core module documentation © Paul Manias 1996-2026

AnalysePath()

Analyses paths to determine their type (file, folder or volume).

ERR AnalysePath(STRVIEW Path, LOC * Type)
ParameterDescription
PathThe path to analyse.
TypeThe result will be stored in the variable referred to by this parameter. The return types are DIRECTORY, FILE and VOLUME. Set this parameter to NULL if you are only interested in checking if the file exists.

This function will analyse a path and determine the type of file that the path is referring to. For instance, a path of user:documents/ would indicate a folder reference. A path of system: would be recognised as a volume. A path of user:documents/copyright.txt would be recognised as a file.

Ambiguous references are analysed to get the correct type - for example user:documents/helloworld could refer to a folder or file, so the path is analysed to check the file type. On exceptional occasions where the path could be interpreted as either a folder or a file, preference is given to the folder.

File path approximation is supported if the Path is prefixed with a ~ character (e.g. ~images:photo could be matched to photo.jpg in the same folder).

To check if a volume name is valid, call ResolvePath() first and then pass the resulting path to this function.

If the queried path does not exist, a fail code is returned. This behaviour makes the AnalysePath() function a good candidate for testing the validity of a path string.

Error Codes

OkayThe path was analysed and the result is stored in the Type variable.
FileNotFoundFile not found
NoSupportOperation not supported
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

AsyncAction()

Submit an action for asynchronous execution against an object.

ERR AsyncAction(AC Action, OBJECTPTR Object, APTR Args, FUNCTION * Callback)
ParameterDescription
ActionAn action or method ID must be specified here.
ObjectThe target object to execute the action against.
ArgsIf the action or method is documented as taking parameters, provide the correct parameter structure here.
CallbackOptional function called on the main thread after the action completes.

This function submits an action or method for asynchronous execution against Object. The runtime allocates a worker thread to execute the action; the caller does not manage threads directly. Please refer to the Action() function for general information on action execution.

To receive feedback of the action's completion, use the Callback parameter and supply a function. The prototype for the callback routine is callback(ACTIONID ActionID, OBJECTPTR Object, ERR Error, APTR Meta)

Actions targeting the same object are serialised through a per-object FIFO queue. If an async action is already in-flight for the given object, subsequent calls to AsyncAction() will queue the request rather than spawning a competing thread. The next queued action is dispatched after the current action's callback has been processed on the main thread (or immediately after the action completes if no callback was provided). Actions targeting different objects execute in parallel as independent workers. Any actions submitted during callback execution — including actions targeting the same object — are appended to the tail of the queue and do not preempt previously queued work.

Execution proceeds in two phases per action. During the 'worker phase', the worker thread holds an exclusive lock on the object and executes the action. On completion, ownership transfers directly to the main thread for the 'callback phase'. At no point between worker completion and callback return is the object available to another worker. Only after the callback returns does the next queued action begin.

Callbacks are processed when the main thread makes a call to ProcessMessages(), so as to maintain an orderly execution process within the application. It is crucial that the target object is not destroyed while actions are executing or queued. Use the Callback routine to receive notification of each action's completion. If an object is freed while actions are still queued, the remaining callbacks will be invoked with an ERR::DoesNotExist error and a NULL object pointer.

The 'Error' parameter in the callback reflects the error code returned by the action after it has been called. Note that if AsyncAction() fails, the callback will never be executed because the attempt will have been aborted.

This function is at its most effective when used to perform lengthy processes such as the loading and parsing of data.

NOTE: Tiri scripts must use the async.action|method() interfaces for asynchronous activity instead of this function.

Error Codes

OkayOperation successful.
InvalidDataThere is an error in the provided data
MarkedForDeletionA resource cannot be accessed as it is marked for deletion
MissingClassThe class could not be found in the system
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

AsyncCancel()

Drain the pending queue for listed objects without executing the remaining actions.

ERR AsyncCancel(kt::vector<OBJECTID> Objects)
ParameterDescription
ObjectsA list of object IDs to cancel.

Call AsyncCancel() to cancel all pending asynchronous actions for the listed objects. Each object's currently active async thread (if any) is interrupted via WakeThread() with Stop set to true, and the remaining action queue is drained without execution.

Callbacks for queued actions will receive ERR::DoesNotExist to indicate cancellation.

Error Codes

OkayOperation successful.
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

AsyncPending()

Return the number of queued and in-flight async actions for an object.

INT AsyncPending(OBJECTID Object)
ParameterDescription
ObjectThe object to query.

Call AsyncPending() to query the total number of asynchronous actions that are either currently executing or waiting in the queue for a given object. The returned count includes the in-flight action (if any) plus all queued actions that have not yet been dispatched.

A return value of zero indicates that no async activity is associated with the object.

Result

The number of pending async actions (in-flight + queued), or zero if none.

Core module documentation © Paul Manias 1996-2026

AsyncWait()

Block until all queued async actions for the listed objects have completed.

ERR AsyncWait(kt::vector<OBJECTID> Objects, INT Timeout)
ParameterDescription
ObjectsA list of object IDs to wait on.
TimeoutMaximum time to wait in milliseconds, or -1 for an indefinite wait.

Call AsyncWait() to suspend the current thread until every asynchronous action that is executing or queued against the listed objects has finished. Messages continue to be processed while waiting, so async completion callbacks fire normally.

Only one AsyncWait() call may be active at any time. If a second call is made while the first is still blocking, ERR::InUse is returned.

Error Codes

OkayAll async actions completed.
TerminateTermination requested
InUseAnother AsyncWait() call is already active.
TimeoutThe timeout expired before all actions completed.
SystemLockedPart of the system is unreachable due to a persistent lock
NullArgsFunction call missing argument value(s)
RecursionDetected an illegal attempt at recursion
OutsideMainThreadOperation permitted from the main thread only
Core module documentation © Paul Manias 1996-2026

BroadcastEvent()

Broadcast an event to all event listeners in the system.

ERR BroadcastEvent(APTR Event, INT EventSize)
ParameterDescription
EventPointer to an event structure.
EventSizeThe size of the Event structure, in bytes.

Use BroadcastEvent() to broadcast an event to all listeners for that event in the system. An event structure is required that must start with a 64-bit EventID acquired from GetEventID(), followed by any required data that is relevant to that event. Here are some examples:

typedef struct { EVENTID EventID; char Name[1]; } evVolumeCreated;
typedef struct { EVENTID EventID; OBJECTID TaskID; } evTaskCreated;
typedef struct { EVENTID EventID; OBJECTID TaskID; OBJECTID ProcessID; } evTaskRemoved;

Error Codes

OkayOperation successful.
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

CheckAction()

Checks objects to see whether or not they support certain actions.

ERR CheckAction(OBJECTPTR Object, AC Action)
ParameterDescription
ObjectThe target object.
ActionA registered action or method ID.

This function returns ERR::True if an object's class supports a given action ID. For example:

if (CheckAction(pic, AC::Query) IS ERR::True) {
   // The Query action is supported.
}

Error Codes

TrueThe object supports the specified action.
FalseThe action is not supported.
LostClassThe object has lost its class reference
OutOfRangeA value is outside of the valid range
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

CheckResourceExists()

Verifies the existence of a resource.

ERR CheckResourceExists(RESOURCEID ID)
ParameterDescription
IDThe unique identifier of the resource to verify.

CheckResourceExists() verifies whether a resource with the specified identifier still exists in the system's object or resource registry. This function is useful for defensive programming when working with resources such as memory or objects that may have been freed by other code paths. Objects that are terminating or awaiting deferred collection are reported as unavailable.

Error Codes

TrueThe resource exists and is valid.
FalseThe resource does not exist or has been freed.
Core module documentation © Paul Manias 1996-2026

ClassDatabase()

Returns an array of all classes known to the system.

ERR ClassDatabase(kt::vector<ClassRecord *> * Classes)
ParameterDescription
ClassesA pointer to an array of class records is returned here.

Call ClassDatabase() to obtain an array of all classes known to the system.

Error Codes

OkayOperation successful.
SystemLockedPart of the system is unreachable due to a persistent lock
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

CompareFilePaths()

Checks if two file paths refer to the same physical file.

ERR CompareFilePaths(STRVIEW PathA, STRVIEW PathB)
ParameterDescription
PathAFile location 1.
PathBFile location 2.

This function will test two file paths, checking if they refer to the same file in a storage device. It uses a string comparison on the resolved path names, then attempts a second test based on an in-depth analysis of file attributes if the string comparison fails. In the event of a match, ERR::Okay is returned. All other error codes indicate a mis-match or internal failure.

The targeted paths do not have to refer to an existing file or folder in order to match (i.e. match on string comparison succeeds).

Error Codes

OkayThe file paths refer to the same file.
TrueOperation successful.
FalseThe file paths refer to different files.
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

CopyFile()

Makes copies of folders and files.

ERR CopyFile(STRVIEW Source, STRVIEW Dest, FUNCTION * Callback)
ParameterDescription
SourceThe source location.
DestThe destination location.
CallbackOptional callback for receiving feedback during the operation.

This function is used to copy files and folders to new locations. When copying folders it will do so recursively, so as to copy all sub-folders and files within the location.

It is important that you are aware that different types of string formatting can give different results. The following examples illustrate:

Copying kotuku:makefile to kotuku:documents results in a file called kotuku:documents.

Copying kotuku:makefile to kotuku:documents/ results in a file called kotuku:documents/makefile.

Copying kotuku:images/ to kotuku:documents/ results in a folder at kotuku:documents/images and includes a copy of all folders and files found within the images folder.

Copying kotuku:images/ to kotuku:documents results in a folder at kotuku:documents (if the documents folder already exists, it receives additional content from the images folder).

This function will overwrite any destination file(s) that already exist.

The Source parameter should always clarify the type of location that is being copied. For example if copying a folder, a forward slash must terminate the string or it will be assumed that a file is the source.

The Callback parameter can be set with a function that matches this prototype:

INT Callback(FileFeedback *)

For each file that is processed during the copy operation, a &FileFeedback structure is passed that describes the source file and its target. The callback must return a constant value that can potentially affect file processing. Valid values are FFR::Okay (copy the file), FFR::Skip (do not copy the file) and FFR::Abort (abort the process completely and return ERR::Cancelled as an error code).

Error Codes

OkayThe source was copied to its destination successfully.
FailedA failure occurred during the copy process.
ArgsInvalid arguments passed to function
Core module documentation © Paul Manias 1996-2026

CreateFolder()

Makes new folders.

ERR CreateFolder(STRVIEW Path, PERMIT Permissions)
ParameterDescription
PathThe location of the folder.
PermissionsSecurity permissions to apply to the created Dir(s). Set to NULL if only the current user should have access.

This function creates new folders. You are required to specify the full path of the new folder. Standard permission flags can be passed to determine the new permissions to set against the newly created Dir(s). If no permission flags are passed, only the current user will have access to the new folder (assuming that the file system supports security settings on the given media). This function will create multiple folders if the complete path does not exist at the time of the call.

On Unix systems you can define the owner and group ID's for the new folder by calling the SetDefaultPermissions() function prior to CreateFolder().

Error Codes

OkayOperation successful.
NoSupportVirtual file system does not support folder creation.
FileExistsAn identically named file or folder already exists at the Path.
ResolvePathA call to ResolvePath() failed
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

CreateLink()

Creates symbolic links on supported file systems.

ERR CreateLink(STRVIEW From, STRVIEW To)
ParameterDescription
FromThe symbolic link will be created at the location specified here.
ToThe file that you are linking to is specified here.

Use the CreateLink() function to create symbolic links on supported file systems. The link connects a new file created at From to an existing file referenced at To. The To link is allowed to be relative to the From location - for instance, you can link documents:myfiles/newlink.txt to ../readme.txt or folder/readme.txt. The .. path component must be used when making references to parent folders.

The permission flags for the link are inherited from the file that you are linking to. If the file location referenced at From already exists as a file or folder, the function will fail with an ERR::FileExists error code.

This function does not automatically create folders in circumstances where new folders are required to complete the From link. You will need to call CreateFolder() to ensure that the necessary paths exist beforehand. If the file referenced at To does not exist, the link will be created without error, but any attempts to open the link will fail until the target file or folder exists.

Error Codes

OkayThe link was created successfully.
NoSupportThe file system or the host operating system does not support symbolic links.
MemoryGeneral memory error
LowCapacityThere is no room on the device to create the new link.
NoPermissionThe user does not have permission to create the link, or the file system is mounted read-only.
BufferOverflowOne or both of the provided arguments is too long.
FileExistsThe location referenced at From already exists.
ResolvePathA call to ResolvePath() failed
SystemCallA call to the host system has failed
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

CurrentContext()

Returns a pointer to the object that has the current context.

OBJECTPTR CurrentContext()

This function returns a pointer to the object that has the current context. Context is primarily used to manage resource allocations. Manipulating the context is sometimes necessary to ensure that a resource is tracked to the correct object.

To get the context of the caller (the client), use ParentContext().

Result

Returns an object pointer (of which the process has exclusive access to). Cannot return NULL except in the initial start-up and late shut-down sequence of the Core.

Core module documentation © Paul Manias 1996-2026

CurrentTask()

Returns the active Task object.

objTask * CurrentTask()

This function returns the Task object of the active process.

If there is a legitimate circumstance where there is no current task (e.g. if this function is called during Core initialisation) then the "system task" may be returned, which has ownership of Core resources.

Result

Returns a pointer to the current Task object or NULL if failure.

Core module documentation © Paul Manias 1996-2026

DeleteFile()

Deletes files and folders.

ERR DeleteFile(STRVIEW Path, FUNCTION * Callback)
ParameterDescription
PathString referring to the file or folder to be deleted. Folders must be denoted with a trailing slash.
CallbackOptional callback for receiving feedback during the operation.

This function will delete a file or folder when given a valid file location. The current user must have delete access to the given file. When deleting folders, all content will be scanned and deleted recursively. Individual deletion failures are ignored, although an error will be returned if the top-level folder still contains content on its deletion.

This function does not allow for the approximation of file names. To approximate a file location, open it as a File object or use ResolvePath() first.

The Callback parameter can be set with a function that matches the prototype INT Callback(*FileFeedback).

Prior to the deletion of any file, a FileFeedback structure is passed that describes the file's location. The callback must return a constant value that can potentially affect file processing. Valid values are FFR::Okay (delete the file), FFR::Skip (do not delete the file) and FFR::Abort (abort the process completely and return ERR::Cancelled as an error code).

Error Codes

OkayThe file or folder was deleted successfully.
FileThe location could not be opened for deletion.
NoSupportThe filesystem driver does not support deletion.
NoPermissionGeneral security violation
SystemLockedPart of the system is unreachable due to a persistent lock
ResolvePathA call to ResolvePath() failed
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

DeleteVolume()

Deletes volumes from the system.

ERR DeleteVolume(STRVIEW Name)
ParameterDescription
NameThe name of the volume.

This function deletes volume names from the system. Once a volume is deleted, any further references to it will result in errors unless the volume is recreated.

Error Codes

OkayThe volume was removed.
NoPermissionAn attempt to delete a system volume was denied.
SystemLockedPart of the system is unreachable due to a persistent lock
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

FieldName()

Resolves a field ID to its registered name.

CSTRING FieldName(UINT FieldID)
ParameterDescription
FieldIDThe unique field hash to resolve.

Resolves a field identifier to its name by checking the internal dictionary. The field must have previously been referenced by a class blueprint in order for its name to be registered.

If FieldID is not registered, the value is returned as a printable hex string.

Result

The name of the field is returned.

Core module documentation © Paul Manias 1996-2026

FindClass()

Returns the internal MetaClass for a given class ID.

objMetaClass * FindClass(CLASSID ClassID)
ParameterDescription
ClassIDA class ID such as one retrieved from ResolveClassName().

This function will find a specific class by ID and return its MetaClass. If the class is not already loaded, the internal dictionary is checked to discover a module binary registered with that ID. If this succeeds, the module is loaded into memory and the correct MetaClass will be returned.

In any event of failure, NULL is returned.

If the ID of a named class is not known, call ResolveClassName() first and pass the resulting ID to this function.

NOTE: To retrieve a list of all derived classes associated with a base-class, read the SubClasses field of the MetaClass.

Result

Returns a pointer to the MetaClass structure that has been found as a result of the search, or NULL if no matching class was found.

Core module documentation © Paul Manias 1996-2026

FindField()

Finds field descriptors for any class, by ID.

const struct Field * FindField(OBJECTPTR Object, UINT FieldID, OBJECTPTR * Target)
ParameterDescription
ObjectThe target object.
FieldIDThe hash of the field name to lookup.
Target(Optional) The object that represents the field is returned here (in case a field belongs to an integrated child object).

The FindField() function checks if an object supports a specified field by scanning its class descriptor for a FieldID. If a matching field is declared, its descriptor is returned. For example:

if (auto field = FindField(Display, strhash("width"), nullptr)) {
   log.msg("The field name is \"%s\".", field->Name);
}

The resulting Field structure is immutable.

Note: To lookup the field definition of a MetaClass, use the MetaClass⇒FindField() method.

Result

Returns a pointer to the Field descriptor, otherwise NULL if not found.

Core module documentation © Paul Manias 1996-2026

FindObject()

Searches for objects by name.

ERR FindObject(STRVIEW Name, CLASSID ClassID, OBJECTID * ObjectID)
ParameterDescription
NameThe name of an object to search for.
ClassIDOptional. Set to a class ID to filter the results down to a specific class type.
ObjectIDAn object id variable for storing the result.

The FindObject() function searches for all objects that match a given name and can filter by class.

The following example illustrates typical usage, and finds the most recent object created with a given name:

OBJECTID id;
FindObject("SystemPointer", CLASSID::POINTER, &id);

If FindObject() cannot find any matching objects then it will return an error code.

Error Codes

OkayAt least one matching object was found and stored in the ObjectID.
SearchNo objects matching the given name could be found.
EmptyStringA required string value contains no characters
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

FreeObject()

Terminates an object by its unique identifier.

ERR FreeObject(OBJECTID ObjectID)
ParameterDescription
ObjectIDThe unique identifier of the object to terminate.

FreeObject() starts the destruction process for the object identified by ObjectID. If the object is locked or strongly pinned, destruction is deferred until the final lock or pin is released. Once termination has started, new access through AccessObject() is rejected.

Error Codes

OkayThe object was terminated successfully.
InUseThe object is already terminating, or destruction has been deferred until it is unlocked.
AccessObjectThe object could not be accessed for destruction.
DoesNotExistThe object identifier is not registered.
Core module documentation © Paul Manias 1996-2026

FreeResource()

Safely deallocates resources allocated by AllocResource() and similar functions.

ERR FreeResource(RESOURCEID ID)
ParameterDescription
IDThe unique identifier of the resource to be freed.

FreeResource() provides safe deallocation of resources with comprehensive validation and cleanup. The function accepts resource identifiers for optimal safety, though C++ headers also provide pointer-based variants for convenience.

Object identifiers are detected in the object registry and dispatched to FreeObject(). All other identifiers are resolved through the non-object resource registry and its associated ResourceManager.

The deallocation process includes lock-aware deallocation that respects access counting, resource manager integration for managed memory blocks, and automatic cleanup of ownership tracking structures.

If a resource is pinned at the time of the call, it is marked for delayed collection. The final UnpinResource() performs the deferred destruction and returns the resource manager's result.

Error Codes

OkayThe resource was successfully freed.
TerminateTermination requested
InUseThe resource is pinned or another caller already owns its destruction.
DoesNotExistThe specified memory block identifier is not valid or already freed.
Core module documentation © Paul Manias 1996-2026

GenCRC32()

Generates 32-bit IEEE 802.3 CRC checksum values.

UINT GenCRC32(UINT CRC, APTR Data, UINT Length)
ParameterDescription
CRCIf streaming data to this function, this value must reflect the most recently returned CRC integer. Otherwise set to zero.
DataThe data to generate a CRC value for.
LengthThe length of the Data buffer.

This function is used internally for the generation of 32-bit CRC checksums compatible with IEEE 802.3. It is made available to clients to generate CRC values over any length of buffer space. This function may be called repeatedly by feeding it CRC values in a cycle, making it ideal for processing streamed data.

Note that string hashes in Kotuku use CRC-32C, which is incompatible with this function.

Result

Returns the computed 32 bit CRC value for the given data.

Core module documentation © Paul Manias 1996-2026

GetActionMsg()

Returns a message structure if called from an action that was executed by the message system.

struct Message * GetActionMsg(AC Action)
ParameterDescription
ActionAction identifier represented by the caller.

This function is for use by action and method support routines only. It will return a Message structure if the action currently under execution has been called directly from the ProcessMessages() function. In all other cases a NULL pointer is returned.

Only works when called from the main thread, which acts as the message dispatcher.

Result

A Message structure is returned if the function is called in valid circumstances, otherwise NULL.

Core module documentation © Paul Manias 1996-2026

GetClassID()

Returns the class ID of an ID-referenced object.

CLASSID GetClassID(OBJECTID Object)
ParameterDescription
ObjectThe object to be examined.

Call this function with any valid object ID to learn the identifier for its base class. This is the quickest way to retrieve the class of an object without having to gain exclusive access to the object first.

Note that if the object's pointer is already known, the quickest way to learn of its class is to call the classID() C++ method.

Result

Returns the base class ID of the object or zero if failure.

Core module documentation © Paul Manias 1996-2026

GetErrorMsg()

Translates error codes into human readable strings.

CSTRING GetErrorMsg(ERR Error)
ParameterDescription
ErrorThe error code to lookup.

The GetErrorMsg() function converts error codes into human readable strings. If the Error is invalid, a string of "Unknown error code" is returned.

Result

A human readable string for the error code is returned. By default error codes are returned in English, however if a translation table exists for the user's own language, the string will be translated.

Core module documentation © Paul Manias 1996-2026

GetEventID()

Generates unique event ID's suitable for event broadcasting.

INT64 GetEventID(EVG Group, STRVIEW SubGroup, STRVIEW Event)
ParameterDescription
GroupThe group to which the event belongs.
SubGroupThe sub-group to which the event belongs (case-sensitive).
EventThe name of the event (case-sensitive).

Use GetEventID() to generate a 64-bit event identifier. This identifier can be used for broadcasting and subscribing to events. Events are described in three parts - Group, SubGroup and the Event name, or in string format group.subgroup.event.

The Group is strictly limited to one of the following definitions:

NameDescription
EVG::ANDROIDAndroid specific events that do not already fit existing categories
EVG::APPCustom event dispatched from an application
EVG::AUDIOAudio system events
EVG::CLASSCustom event dispatched from a class that doesn't fit within the rest of the event framework
EVG::DISPLAYVideo display events
EVG::FILESYSTEMFile system events
EVG::GUIEvents generated by the Graphical User Interface
EVG::HARDWAREHardware device events that are not covered by other types
EVG::IOInput/Output events
EVG::NETWORKNetwork events
EVG::POWERPower Management - can also include app-specific events relating to resource management
EVG::SYSTEMSystem-wide events
EVG::USERUser activity events (such as user login)

The SubGroup and Event parameters are string-based and there are no restrictions on naming. If a SubGroup or Event name is NULL, this will act as a wildcard for subscribing to multiple events. For example, subscribing to the network group with SubGroup and Event set to NULL will allow for a subscription to all network events that are broadcast. A Group setting of zero is not allowed.

Result

The event ID is returned as a 64-bit integer.

Core module documentation © Paul Manias 1996-2026

GetObjectPtr()

Returns a direct pointer for any object ID.

OBJECTPTR GetObjectPtr(OBJECTID Object)
ParameterDescription
ObjectThe ID of the object to lookup.

This function translates an object ID to its respective address pointer.

Result

The address of the object is returned, or NULL if the ID does not relate to an object.

Core module documentation © Paul Manias 1996-2026

GetOwnerID()

Returns the unique ID of an object's owner.

OBJECTID GetOwnerID(OBJECTID Object)
ParameterDescription
ObjectThe ID of an object to query.

This function returns an identifier for the owner of any valid object. This is the fastest way to retrieve the owner of an object if only the ID is known.

If the object address is already known, use the ownerID() C++ class method instead of this function.

Result

Returns the ID of the object's owner. If the object does not have a owner (i.e. if it is untracked) or if the provided ID is invalid, this function will return 0.

Core module documentation © Paul Manias 1996-2026

GetResource()

Retrieves miscellaneous resource identifiers.

INT64 GetResource(RES Resource)
ParameterDescription
ResourceThe ID of the resource that you want to obtain.

The GetResource() function is used to retrieve miscellaneous resource and state information from the system core. Refer to the Resource identifier for the full list of available resource codes and their meaning.

C++ developers should use the GetResourcePtr() macro if a resource identifier is known to return a pointer.

Result

Returns the value of the resource that you have requested. If the resource ID is not known by the Core, NULL is returned.

Core module documentation © Paul Manias 1996-2026

GetSystemState()

Returns miscellaneous data values from the Core.

const struct SystemState * GetSystemState()

The GetSystemState() function is used to retrieve miscellaneous resource and environment values, such as resource paths, the Core's version number and the name of the host platform.

The state values in the structure are static and will not change during runtime.

Result

A read-only SystemState structure is returned.

Core module documentation © Paul Manias 1996-2026

GetThreadID()

Returns the UID of the current thread.

INT GetThreadID()

Returns a unique ID for the active thread. The ID has no relationship with the host operating system and is not re-used.

Result

A unique ID for the active thread is returned.

Core module documentation © Paul Manias 1996-2026

IdentifyFile()

Analyse a file and identify a class that can process it.

ERR IdentifyFile(STRVIEW Path, CLASSID Filter, CLASSID * Class, CLASSID * SubClass)
ParameterDescription
PathThe location of the object data.
FilterRestrict the search to classes in this subset, or use CLASSID::NIL to search all classes.
ClassMust refer to a CLASSID variable that will store the resulting class ID.
SubClassOptional argument that can refer to a variable that will store the resulting derived class ID (if the result is a base-class, this variable will receive a value of zero).

This function examines the relationship between file data and Kōtuku classes. For instance, a JPEG file would be identified as a datatype of the Image class. An MP3 file would be identified as a datatype of the Sound class.

The method involves analysing the Path's file extension and comparing it to the supported extensions of all available classes. If a class supports the file extension, the ID of that class will be returned. If the file extension is not listed in the class dictionary or if it is listed more than once, the first 80 bytes of the file's data will be loaded and checked against classes that can match against file header information. If a match is found, the ID of the matching class will be returned.

The ERR::Search code is returned if a suitable class does not match the targeted file.

Error Codes

OkayOperation successful.
SearchA suitable class could not be found for the data source.
FileNotFoundFile not found
ReadError reading data
VirtualVolumeResolvePath() failed to resolve the path because it is a virtual reference
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

InitObject()

Initialises an object so that it is ready for use.

ERR InitObject(OBJECTPTR Object)
ParameterDescription
ObjectThe object to initialise.

This function initialises objects so that they can be used for their intended purpose. Initialisation is compulsory, and a client may not call any actions or methods on an object until it has been initialised. Exceptions to this rule only apply to the GetKey() and SetKey() actions.

If the initialisation of an object fails due to a support problem (for example, if a PNG Image object attempts to load a JPEG file), the initialiser will search for a derived class that can handle the data. If a derived class that can support the object's configuration is available, the object's interface will be shared between both the base-class and the derived class.

If an object does not support the data or its configuration, an error code of ERR::NoSupport will be returned. Other appropriate error codes can be returned if initialisation fails.

Error Codes

OkayThe object was initialised.
LostClassThe object has lost its class reference
NoSupportOperation not supported
DoubleInitWarning - Attempt to initialise a resource twice
ObjectCorruptThe object structure is corrupt or has not been initialised
UseDerivedRequested to use a registered derived class (not an error)
Core module documentation © Paul Manias 1996-2026

ListChildren()

Returns a list of all children belonging to an object.

ERR ListChildren(OBJECTID Object, kt::vector<ChildEntry> * List)
ParameterDescription
ObjectAn object to query.
ListMust refer to an array of ChildEntry structures.

The ListChildren() function returns a list of all children belonging to an object. The client must provide an empty vector of ChildEntry structures to host the results, which include unique object ID's and their class identifiers.

Note that any child objects marked with the LOCAL flag will be excluded because they are private members of the targeted object.

Error Codes

OkayZero or more children were found and listed.
LockFailedFailed to lock a required resource
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

LoadFile()

Loads files into a local cache for fast file processing.

ERR LoadFile(STRVIEW Path, LDF Flags, struct CacheFile ** Cache)
ParameterDescription
PathThe location of the file to be cached.
FlagsOptional flags are specified here.
CacheA pointer to a CacheFile structure is returned here if successful.

The LoadFile() function loads complete files into memory and caches the content for use by other areas of the system or application.

If the requested file has already been cached, the CacheFile structure is returned immediately. Note that if the file was previously cached but then modified, this will be treated as a cache miss and the file will be loaded into a new buffer.

File content will be loaded into a readable memory buffer that is referenced by the Data field of the CacheFile structure. A hidden null byte is appended at the end of the buffer to assist the processing of text files. Other pieces of information about the file can be derived from the CacheFile meta data.

Calls to LoadFile() must be matched with a call to UnloadFile() to decrement the cache counter. When the counter returns to zero, the file can be unloaded from the cache during the next resource collection phase.

Error Codes

OkayThe file was cached successfully.
SearchIf CHECK_EXISTS is specified, this failure indicates that the file is not cached.
ReadError reading data
CreateObjectA call to CreateObject() failed
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

LockObject()

Lock an object to prevent contention between threads.

ERR LockObject(OBJECTPTR Object, INT MilliSeconds)
ParameterDescription
ObjectThe address of the object to lock.
MilliSecondsThe total number of milliseconds to wait before giving up. If -1, the function will wait indefinitely.

Use LockObject() to gain exclusive access to an object at thread-level. This function provides identical behaviour to that of AccessObject(), but with a slight speed advantage as the object ID does not need to be resolved to an address. Calls to LockObject() will nest, and must be matched with a call to ReleaseObject() to unlock the object.

Be aware that while this function is faster than AccessObject(), it is unsafe if other threads could terminate the object without a suitable barrier in place.

If it is guaranteed that an object is not being shared between threads, object locking is unnecessary.

Error Codes

OkayOperation successful.
CancelledThe thread has been requested to stop and cannot pause.
LockFailedFailed to initialise the sleep record for the waiting thread.
TimeOutFunction timed-out before successful completion
MarkedForDeletionA resource cannot be accessed as it is marked for deletion
SystemLockedPart of the system is unreachable due to a persistent lock
DoesNotExistThe object was removed while waiting for the lock.
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

MoveFile()

Moves folders and files to new locations.

ERR MoveFile(STRVIEW Source, STRVIEW Dest, FUNCTION * Callback)
ParameterDescription
SourceThe source path.
DestThe destination path.
CallbackOptional callback for receiving feedback during the operation.

This function is used to move files and folders to new locations. It can also be used for renaming purposes and is able to move data from one type of media to another. When moving folders, any contents within the folder will also be moved across to the new location.

It is important that you are aware that different types of string formatting can give different results. The following examples illustrate:

Source               Destination          Result
kotuku:makefile     kotuku:documents    kotuku:documents
kotuku:makefile     kotuku:documents/   kotuku:documents/makefile
kotuku:images/      kotuku:documents/   kotuku:documents/images
kotuku:images/      kotuku:documents    kotuku:documents (Existing documents folder destroyed)

This function will overwrite the destination location if it already exists.

The Source argument should always clarify the type of location that is being copied - e.g. if you are copying a folder, you must specify a forward slash at the end of the string or the function will assume that you are moving a file.

The Callback parameter can be set with a function that matches this prototype:

INT Callback(*FileFeedback)

For each file that is processed during the move operation, a FileFeedback structure is passed that describes the source file and its target. The callback must return a constant value that can potentially affect file processing. Valid values are FFR::Okay (move the file), FFR::Skip (do not move the file) and FFR::Abort (abort the process completely and return ERR::Cancelled as an error code).

Error Codes

OkayOperation successful.
FailedGeneral failure
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

NewObject()

Creates new objects.

ERR NewObject(CLASSID ClassID, NF Flags, OBJECTPTR * Object)
ParameterDescription
ClassIDA class ID from system/register.h or generated by ResolveClassName().
FlagsOptional flags.
ObjectPointer to an address variable that will store a reference to the new object.

The NewObject() function is used to create new objects and register them for use within the Core. After creating a new object, the client can proceed to set the object's field values and initialise it with Init so that it can be used as intended.

The new object will be modeled according to the class blueprint indicated by ClassID. Pre-defined class ID's are defined in their documentation and the kotuku/system/register.h include file. ID's for unregistered classes can be computed using the ResolveClassName() function.

A pointer to the new object will be returned in the Object parameter. By default, object allocations are context sensitive and will be collected when their owner is terminated. It is possible to track an object to a different owner by using the SetOwner() function.

To destroy an object, call FreeResource().

Error Codes

OkayOperation successful.
MissingClassThe ClassID is invalid or refers to a class that is not installed.
AllocMemoryFailed to create a new memory block
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

NotifySubscribers()

Send a notification event to action subscribers.

void NotifySubscribers(OBJECTPTR Object, AC Action, APTR Args, ERR Error)
ParameterDescription
ObjectPointer to the object that is to receive the notification message.
ActionThe action ID for notification.
ArgsPointer to an action parameter structure that is relevant to the Action ID.
ErrorThe error code that is associated with the action result.

This function can be used by classes that need fine-tuned control over notification events, as managed by the SubscribeAction() function. Normally the Core will automatically notify subscribers after an action is executed. Using NotifySubscribers(), the client can instead manually notify subscribers during the execution of the action.

Another useful aspect is that the client can control the parameter values that are passed on to the subscribers.

NOTE: The use of NotifySubscribers() does not prevent the core from sending out an action notification as it normally would, which will cause duplication. To prevent this, the client must logical-or the return code of the action function with ERR::Notified, e.g. ERR::Okay|ERR::Notified.

In the following example the Surface class uses NotifySubscribers() to convert a Move event to a Redimension event. The parameter values are customised to support this, and the function returns ERR::Notified to prevent the core from sending out a Move notification.

ERR SURFACE_Move(extSurface *Self, struct acMove *Args)
{
   if (not Args) return ERR::NullArgs|ERR::Notified;

   ...

   struct acRedimension redimension = { Self->X, Self->Y, 0, Self->Width, Self->Height, 0 };
   NotifySubscribers(Self, AC::Redimension, &redimension, ERR::Okay);
   return ERR::Okay|ERR::Notified;
}
Core module documentation © Paul Manias 1996-2026

OpenDir()

Opens a folder for content scanning.

ERR OpenDir(STRVIEW Path, RDF Flags, struct DirInfo ** Info)
ParameterDescription
PathThe folder location to be scanned. Using an empty string will scan for volume names.
FlagsOptional flags.
InfoA DirInfo structure will be returned in the pointer referenced here.

The OpenDir() function is used to open a folder for scanning via the ScanDir() function. If the provided Path can be accessed, a DirInfo structure will be returned in the Info parameter, which will need to be passed to ScanDir(). Once the scanning process is complete, call the FreeResource() function.

When opening a folder, it is necessary to indicate the type of files that are of interest. If no flags are defined, the scanner will return file and folder names only. Only a subset of the available RDF flags may be used, specifically SIZE, DATE, PERMISSIONS, FILE, FOLDER, QUALIFY, TAGS.

Error Codes

OkayOperation successful.
EndOfSequenceThe end of the sequence has been reached
ArgsInvalid arguments passed to function
AllocMemoryFailed to create a new memory block
ResolvePathA call to ResolvePath() failed
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

ParentContext()

Returns the context of the client.

OBJECTPTR ParentContext()

This function is used to return the context of the caller (the client), as opposed to CurrentContext(), which returns the operating context. This feature is commonly used by methods that need to acquire a reference to the client for resource management reasons.

Note that this function can return NULL if called when running at process-level, although this would never be the case when called from an action or method.

Result

An object reference is returned, or NULL if there is no parent context.

Core module documentation © Paul Manias 1996-2026

PinResource()

Protects a resource from termination until a matching unpin.

ERR PinResource(RESOURCEID ResourceID)
ParameterDescription
ResourceIDThe unique identifier of the resource to pin.

PinResource() acquires a lifetime pin for a tracked non-object resource. Multiple callers may pin the same resource, but pinning does not serialise access to its contents or make mutation thread-safe. A successful pin prevents FreeResource() and the resource manager from releasing the resource until every acquired pin has been released with UnpinResource().

Error Codes

OkayOne lifetime pin was acquired.
OutOfRangeThe pin counter is saturated.
MarkedForDeletionDestruction is pending or already in progress.
DoesNotExistNo usable non-object resource with this identifier is registered.
NullArgsResourceID is zero.
Core module documentation © Paul Manias 1996-2026

PreciseTime()

Returns the current system time, in microseconds.

INT64 PreciseTime()

This function returns the current 'system time' in microseconds (1 millionth of a second). The value is monotonic if the host platform allows it (typically expressed as the amount of time that has elapsed since the system was switched on). The benefit of monotonic time is that it is unaffected by changes to the system clock, such as daylight savings adjustments or manual changes by the user.

Result

Returns the system time in microseconds. Could return zero in the extremely unlikely event of an error.

Core module documentation © Paul Manias 1996-2026

ProcessMessages()

Processes system messages that are queued in the task's message buffer.

ERR ProcessMessages(PMF Flags, INT Timeout)
ParameterDescription
FlagsOptional flags are specified here (clients should set a value of zero).
TimeoutA Timeout value, measured in milliseconds. If zero, the function will return as soon as all messages on the queue are processed. If less than zero, the function does not return until a request for termination is received or a user message requires processing.

The ProcessMessages() function is used to process the task's message queue. Messages are dispatched to message handlers in the order in which they arrived and the queue is emptied so that space is available for more messages.

Responding to incoming messages is a vital process - the queue is the standard means of communication between your task and the rest of the system and other tasks within it. Failing to call the ProcessMessages() function on a regular basis may cause a back-log of messages to be generated, as well as causing problems with areas such as the graphical interface. If an area of your program is likely to loop continuously for a measurable period of time without returning, consider calling ProcessMessages() at a rate of 50 times per second to ensure that incoming messages are processed.

User messages that are on the queue are passed to message handlers. If no message handler exists to interpret the message, then it is removed from the queue without being processed. Message handlers are added with the AddMsgHandler() function. If a message handler returns the error code ERR::Terminate, then ProcessMessages() will stop processing the queue and returns immediately with ERR::Okay.

If a message with a MSGID::QUIT ID is found on the queue, then the function returns immediately with the error code ERR::Terminate. The program must respond to the terminate request by exiting immediately.

Error Codes

OkayOperation successful.
TerminateA MSGID::QUIT message type was found on the message queue.
NoSupportOperation not supported
TimeoutFunction timed-out before successful completion
SystemLockedPart of the system is unreachable due to a persistent lock
AccessObjectAttempting to lock an object failed
RecursionDetected an illegal attempt at recursion
OutsideMainThreadOperation permitted from the main thread only
Core module documentation © Paul Manias 1996-2026

QueueAction()

Delay the execution of an action by adding the call to the message queue.

ERR QueueAction(AC Action, OBJECTID Object, APTR Args)
ParameterDescription
ActionThe ID of an action or method to execute.
ObjectThe target object.
ArgsThe relevant argument structure for the Action, or NULL if not required.

Use QueueAction() to execute an action by way of the local message queue. This means that the supplied Action and Args will be serialised into a message for the queue. This function then returns immediately.

The action will be executed on the next cycle of ProcessMessages() in line with the FIFO order of queued messages.

Error Codes

OkayOperation successful.
OutOfRangeThe Action ID is invalid.
MissingClassThe class could not be found in the system
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

ReadFileToBuffer()

Reads a file into a buffer.

ERR ReadFileToBuffer(STRVIEW Path, const std::span<int8_t> &Buffer, INT * Result)
ParameterDescription
PathThe path of the file.
BufferBuffer that will receive the file content.
ResultThe total number of bytes read into the Buffer will be returned here (optional).

This function provides a simple method for reading file content into a Buffer. In some cases this procedure may be optimised for the host platform, which makes it the fastest way to read file content in simple cases.

File path approximation is supported if the Path is prefixed with a ~ character (e.g. ~images:photo could be matched to photo.jpg in the same folder).

Error Codes

OkayOperation successful.
FileFile error, e.g. file not found
FileNotFoundFile not found
ArgsInvalid arguments passed to function
ReadError reading data
InvalidPathInvalid file or folder path detected
VirtualVolumeResolvePath() failed to resolve the path because it is a virtual reference
OpenFileThe file could not be opened
Core module documentation © Paul Manias 1996-2026

ReadInfoTag()

Read a named tag from a FileInfo structure.

ERR ReadInfoTag(struct FileInfo * Info, STRVIEW Name, STRVIEW * Value)
ParameterDescription
InfoPointer to a valid FileInfo structure.
NameThe name of the tag, which must be declared in camel-case as tags are case-sensitive.
ValueThe discovered string value is returned here if found.

ReadInfoTag() will read the value of a named tag in a FileInfo structure. The tag must have been added with AddInfoTag() or ERR::NotFound will be returned.

Error Codes

OkayOperation successful.
NotFoundA search routine in this function failed
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

RegisterFD()

Registers a file descriptor for monitoring when the task is asleep.

ERR RegisterFD(HOSTHANDLE FD, RFD Flags, void (*Routine)(HOSTHANDLE, APTR) , APTR Data)
ParameterDescription
FDThe file descriptor that is to be watched.
FlagsSet to at least one of READ, WRITE, EXCEPT, REMOVE.
RoutineThe routine that will read from the descriptor when data is detected on it. The prototype is void Routine(HOSTHANDLE FD, APTR Data).
DataUser specific data pointer that will be passed to the Routine. Separate data pointers apply to the read and write states of operation.

This function will register a file descriptor that will be monitored for activity when the task is sleeping. When activity occurs on the descriptor, the callback referenced in Routine will be called. The callback should read all information from the descriptor, as the process will not be able to sleep if data is back-logged.

The file descriptor should be configured as non-blocking before registration. Blocking descriptors may cause the program to hang if not handled carefully.

File descriptors support read and write states simultaneously, and a callback routine can be applied to either state. Set the RFD::READ flag to apply the Routine to the read callback and RFD::WRITE for the write callback. If neither flag is specified, RFD::READ is assumed. A file descriptor may have up to one subscription per flag, for example a read callback can be registered, followed by a write callback in a second call. Individual callbacks can be removed by combining the read/write flags with RFD::REMOVE.

The capabilities of this function and FD handling in general is developed to suit the host platform. On POSIX compliant systems, standard file descriptors are used. In Microsoft Windows, object handles are used and blocking restrictions are not imposed.

Call the DeregisterFD() macro to simplify unsubscribing once the file descriptor is no longer needed or is destroyed.

Error Codes

OkayThe FD was successfully registered.
ArgsThe FD was set to a value of -1.
NoSupportThe host platform does not support the provided FD.
Core module documentation © Paul Manias 1996-2026

ReleaseObject()

Release a locked object.

void ReleaseObject(OBJECTPTR Object)
ParameterDescription
ObjectPointer to the object to be released.

Release a lock previously obtained from AccessObject() or LockObject(). Locks will nest, so a release is required for every lock that has been granted.

Core module documentation © Paul Manias 1996-2026

ResolveClassID()

Resolve a valid CLASSID to its name.

CSTRING ResolveClassID(CLASSID ID)
ParameterDescription
IDThe ID of the class that needs to be resolved.

This function will resolve a valid class ID to its equivalent name. The name is resolved by checking the class database, so the class must be registered in the database for this function to return successfully.

Registration is achieved by ensuring that the class is compiled into the build.

Result

Returns the name of the class, or NULL if the ID is not recognised. Standard naming conventions apply, so it can be expected that the string is capitalised and without spaces, e.g. NetSocket.

Core module documentation © Paul Manias 1996-2026

ResolveClassName()

Resolves any class name to a CLASSID UID.

CLASSID ResolveClassName(STRVIEW Name)
ParameterDescription
NameThe name of the class that requires resolution.

This function will resolve a class Name to its CLASSID UID and verifies that the class is installed. Class names are case insensitive.

Result

Returns the class ID identified from the class name, or NULL if the class could not be found.

Core module documentation © Paul Manias 1996-2026

ResolveGroupID()

Converts a group ID to its corresponding name.

CSTRING ResolveGroupID(INT Group)
ParameterDescription
GroupThe group ID.

This function converts group ID's obtained from the file system into their corresponding names. If the Group ID is invalid then NULL will be returned.

Result

The group name is returned, or NULL if the ID cannot be resolved.

Core module documentation © Paul Manias 1996-2026

ResolvePath()

Converts volume-based paths into absolute paths applicable to the host platform.

ERR ResolvePath(STRVIEW Path, RSF Flags, STRING * Result)
ParameterDescription
PathThe path to be resolved.
FlagsOptional flags.
ResultRefer to a string variable so that the resolved path can be stored. If NULL, ResolvePath() will work as normal and return a valid error code without the result string. The value is unchanged if the error code is not ERR::Okay.

This function will convert a file path to its resolved form, according to the host system. For example, a Linux system might resolve drive1:documents/readme.txt to /documents/readme.txt. A Windows system might resolve the path to c:\documents\readme.txt.

The resulting path is guaranteed to be absolute, meaning the use of sequences such as .., // and ./ will be eliminated.

If the path can be resolved to more than one file, ResolvePath() will attempt to discover the correct path by checking the validity of each possible location. For instance, if resolving a path of user:document.txt and the user: volume refers to both system:users/joebloggs/ and system:users/default/, the routine will check both directories for the existence of the document.txt file to determine the correct location. This approach can be problematic if the intent is to create a new file, in which case RSF::NO_FILE_CHECK will circumvent it.

When checking the file location, ResolvePath() requires an exact match to the provided file name. If the file name can be approximated (i.e. the file extension can be ignored) then use the RSF::APPROXIMATE flag.

To resolve the location of executable programs on Unix systems, use the RSF::PATH flag. This uses the PATH environment variable to resolve the file name specified in the Path parameter.

The resolved path will be copied to the string provided in the Result parameter. This will overwrite any existing content in the string.

NameDescription
RSF::APPROXIMATEIgnores file extensions for the purpose of file name matching.
RSF::CASE_SENSITIVEFor use on host systems that use case-insensitive file systems such as Windows; this option checks that the discovered file is a case-sensitive match to the Path.
RSF::CHECK_VIRTUALIf the volume referenced by Path is traced to another volume that is reserved by a virtual file system driver, ERR::VirtualVolume is returned. The volume is still resolved as far as possible and the resulting path will be returned by this function.
RSF::NO_DEEP_SCANDo not perform more than one iteration when resolving the source file path.
RSF::NO_FILE_CHECKDo not test for the existence of the targeted file or folder during the resolution process.
RSF::PATHUse the PATH environment variable to resolve the file name in the Path parameter.

If the path resolves to a virtual drive, it may not be possible to confirm whether the target file exists if the virtual driver does not support this check. This is common when working with network drives.

Error Codes

OkayThe Path was resolved.
InvalidDataVolume resolution returned invalid path data.
SearchThe given volume does not exist.
FileNotFoundThe path was resolved, but the referenced file or folder does not exist (use NO_FILE_CHECK to avoid this error code).
InvalidPathThe path is malformed.
SystemLockedThe volume registry could not be accessed.
VirtualVolumeThe path refers to a virtual volume (use CHECK_VIRTUAL to return Okay instead).
LoopThe volume refers back to itself.
LoadModuleA volume extension could not be loaded.
Core module documentation © Paul Manias 1996-2026

ResolveUserID()

Converts a user ID to its corresponding name.

CSTRING ResolveUserID(INT User)
ParameterDescription
UserThe user ID.

This function converts user ID's obtained from the file system into their corresponding names. If the User ID is invalid then NULL will be returned.

Result

The user name is returned, or NULL if the ID cannot be resolved.

Core module documentation © Paul Manias 1996-2026

ScanDir()

Scans the content of a folder, by item.

ERR ScanDir(struct DirInfo * Info)
ParameterDescription
InfoPointer to a DirInfo structure for storing scan results.

The ScanDir() function is used to scan for files and folders in a folder that you have opened using the OpenDir() function. The ScanDir() function is intended to be used in a simple loop, returning a single item for each function call that you make. The following code sample illustrates typical usage:

DirInfo *info;
if (not OpenDir(path, RDF::FILE|RDF::FOLDER, &info)) {
   while (not ScanDir(info)) {
      log.msg("File: %s", info->Name);
   }
   FreeResource(info);
}

For each item that you scan, you will be able to read the Info structure for information on that item. The DirInfo structure contains a FileInfo pointer that consists of the following fields:

The RDF flags that may be returned in the Flags field are VOLUME, FOLDER, FILE, LINK.

Error Codes

OkayAn item was successfully scanned from the folder.
EndOfSequenceThere are no more items to scan.
InvalidDataThere is an error in the provided data
ArgsInvalid arguments passed to function
NoSupportOperation not supported
SystemLockedPart of the system is unreachable due to a persistent lock
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

ScanMessages()

Scans a message queue for multiple occurrences of a message type.

ERR ScanMessages(INT * Handle, MSGID Type, const std::span<int8_t> &Buffer)
ParameterDescription
HandlePointer to a 32-bit value that must initially be set to zero. The ScanMessages() function will automatically update this variable with each call so that it can remember its analysis position.
TypeThe message type to filter for, or zero to scan all messages in the queue.
BufferOptional buffer that is large enough to hold a Message header and any message data.

Use the ScanMessages() function to scan the local message queue for information without affecting the state of the queue. To use this function effectively, make repeated calls to ScanMessages() to analyse the queue until it returns an error code other than ERR::Okay.

The following example illustrates a scan for MSGID::QUIT messages:

while (!ScanMessages(&handle, MSGID::QUIT, {})) {
   ...
}

Messages will often (but not always) carry data that is relevant to the message type. To retrieve this data a buffer must be supplied. If the Buffer is too small, the message data will be trimmed to fit without any further indication.

Error Codes

OkayOperation successful.
SearchNo more messages are left on the queue, or no messages that match the given Type are on the queue.
ArgsThe supplied buffer is too large for the internal message interface.
OutOfRangeA value is outside of the valid range
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

SendMessage()

Add a message to the local message queue.

ERR SendMessage(MSGID Type, MSF Flags, const std::span<const int8_t> &Data)
ParameterDescription
TypeThe message Type/ID being sent. Unique type ID's can be obtained from AllocateID().
FlagsOptional flags.
DataOptional data to copy to the message queue. An empty buffer sends a message without payload data.

The SendMessage() function will add a message to the end of the local message queue. Messages must be associated with a Type identifier and this can help the receiver process any accompanying Data. Some common message types are pre-defined, such as MSGID::QUIT. Custom messages should use a unique type ID obtained from AllocateID().

Error Codes

OkayThe message was successfully written to the message queue.
ArgsInvalid arguments passed to function
Core module documentation © Paul Manias 1996-2026

SetDefaultPermissions()

Forces the user and group permissions to be applied to new files and folders.

void SetDefaultPermissions(INT User, INT Group, PERMIT Permissions)
ParameterDescription
UserUser ID to apply to new files.
GroupGroup ID to apply to new files.
PermissionsPermission flags to be applied to new files.

By default, user, group and permission information for new files is inherited either from the system defaults or from the file source in copy operations. Use this function to override this behaviour with new default values. All threads of the process will be affected.

To revert behaviour to the default settings, set the User and/or Group values to -1 and the Permissions value to zero.

Core module documentation © Paul Manias 1996-2026

SetLogCallback()

Register a callback for log messages.

void SetLogCallback(APTR Callback, INT DepthLimit, INT LogLimit)
ParameterDescription
CallbackPointer to the log callback function to register.
DepthLimitMaximum branch depth to forward to the callback.
LogLimitMaximum message log level to forward to the callback.

This function registers Callback to observe log messages while logging is active. The callback must use the LOG_CALLBACK signature:

void Callback(CSTRING Header, CSTRING Message, INT Depth, INT MsgLevel, INT LogLevel)

The Header argument identifies the origin of the message. When the caller did not supply a header, Core derives one from the current action, method or application context. The Message argument contains the formatted log text. The header and message pointers are valid only for the duration of the callback call, so a callback must copy either string if it needs to retain it. Depth is the current branch depth, MsgLevel is the severity or detail level assigned to the message, and LogLevel is the effective active log level after baseline adjustment.

The DepthLimit and LogLimit parameters are used to reduce log noise. DepthLimit suppresses callbacks when the current branch depth is greater than the limit, and LogLimit suppresses callbacks when the message level is greater than the limit. Use a suitably large limit to receive all messages for that filter. Messages emitted from inside a log callback are not forwarded recursively to log callbacks on the same thread.

Passing NULL for Callback has no effect. Registering the same callback address again updates its DepthLimit and LogLimit values. Passing zero for both limits unregisters a matching callback if it exists. The number of unique callbacks that can be registered is limited; when all callback slots are in use, additional registrations are ignored.

Core module documentation © Paul Manias 1996-2026

SetName()

Sets the name of an object.

ERR SetName(OBJECTPTR Object, STRVIEW Name)
ParameterDescription
ObjectThe target object.
NameThe new name for the object, or an empty string to clear an existing name.

This function sets the name of an Object. This enhances log messages and allows the object to be found in searches. Note that the length of the Name will be limited to the MAX_NAME_LEN value in the core header file. Names exceeding the allowed length are trimmed to fit.

Object names are limited to alpha-numeric characters and the underscore symbol. Invalid characters are replaced with an underscore.

Error Codes

OkayOperation successful.
LockFailedFailed to lock a required resource
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

SetOwner()

Changes object ownership dynamically.

ERR SetOwner(OBJECTPTR Object, OBJECTPTR Owner)
ParameterDescription
ObjectThe object to modify.
OwnerThe new owner for the Object.

This function changes the ownership of an existing object. Ownership is an attribute that affects an object's placement within the object hierarchy as well as impacting on the resource tracking of the object in question. Internally, setting a new owner will cause three things to happen:

  1. The new owner's class will receive notification via the NewChild action. If the owner rejects the object by sending back an error, SetOwner() will fail immediately.
  2. The object's class will then receive notification via the NewOwner action.
  3. The resource tracking of the new owner will be modified so that the object is accepted as its child. This means that if and when the owning object is destroyed, the new child object will be destroyed with it.

If the Object does not support the NewOwner action, or the Owner does not support the NewChild action, then the process will not fail. It will continue on the assumption that neither party is concerned about ownership management.

Error Codes

OkayOperation successful.
NoSupportOperation not supported
SystemCorruptSystem corruption detected
SystemLockedPart of the system is unreachable due to a persistent lock
OwnerPassThroughContainer pass through notification
NullArgsFunction call missing argument value(s)
RecursionDetected an illegal attempt at recursion
Core module documentation © Paul Manias 1996-2026

SetResource()

Updates a writable Core resource value.

INT64 SetResource(RES Resource, INT64 Value)
ParameterDescription
ResourceThe writable resource identifier.
ValueThe value to assign to the resource.

SetResource() updates Core state selected by a RES identifier. The following identifiers are writable:

  • LOG_LEVEL sets the logging detail from 0 (disabled) to 9 (maximum detail). Values outside this range are ignored.
  • LOG_DEPTH sets the logging branch depth for the current thread. This controls indentation of subsequent log output.
  • PRIVILEGED_USER enables elevated Unix privileges when Value is non-zero and releases one level of privilege when it is zero. Elevation is available only when the process was launched with suitable privileges. Calls may be nested; privileges are released after the corresponding number of disable requests. On non-Unix platforms this identifier has no effect.
  • WINDOWS_ICON sets the Microsoft Windows resource icon ID for the process.
  • CONSOLE_FD and JNI_ENV update internal host integration values.

Other RES identifiers are read-only or unsupported by this function.

For PRIVILEGED_USER, the result is an ERR value indicating whether the request succeeded. All other supported resources return 0. Unsupported identifiers also return 0 after writing a warning to the log.

Result

Result code is dependent on the targeted resource.

Core module documentation © Paul Manias 1996-2026

SetResourcePath()

Redefines the location of a system resource path.

ERR SetResourcePath(RP PathType, STRVIEW Path)
ParameterDescription
PathTypeThe ID of the resource path to set.
PathThe new location to set for the resource path.

The SetResourcePath() function changes the default locations of the Core's resource paths.

To read a resource path, use the GetSystemState() function.

Error Codes

OkayOperation successful.
ArgsInvalid arguments passed to function
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

SetVolume()

Create or modify a filesystem volume.

ERR SetVolume(STRVIEW Name, STRVIEW Path, STRVIEW Icon, STRVIEW Label, STRVIEW Device, VOLUME Flags)
ParameterDescription
NameRequired. The name of the volume.
PathRequired. The path to be associated with the volume. If setting multiple paths, separate each path with a semi-colon character. Each path must terminate with a forward slash to denote a folder.
IconAn icon can be associated with the volume so that it has graphical representation when viewed in the UI. The required icon string format is category/name.
LabelAn optional label or short comment may be applied to the volume. This may be useful if the volume name has little meaning to the user (e.g. drive1, drive2 ...).
DeviceIf the volume references the root of a device, specify a device name of portable, fixed, cd, network or usb.
FlagsOptional flags.

SetVolume() is used to create or modify a volume that is associated with one or more paths. If the named volume already exists, it possible to append more paths or replace them entirely. Volume changes that are made with this function will only apply to the current process, and are lost after the program closes.

Flags that may be passed are as follows:

NameDescription
VOLUME::HIDDENHides the volume so that it will not show up when reading volumes from the root path :.
VOLUME::PRIORITYIf the volume already exists, the path will be inserted at the beginning of the path list so that it has priority over the others.
VOLUME::REPLACEIf the volume already exists, all paths that are attached to it will be replaced with the new path setting.
VOLUME::SYSTEMIdentifies the volume as being created by the system (this flag is not for client use).

Error Codes

OkayThe volume was successfully added.
SystemLockedPart of the system is unreachable due to a persistent lock
NullArgsA valid name and path string was not provided.
Core module documentation © Paul Manias 1996-2026

SubscribeAction()

Monitor action calls made against an object.

ERR SubscribeAction(OBJECTPTR Object, AC Action, FUNCTION * Callback)
ParameterDescription
ObjectThe target object.
ActionThe ID of the action that will be monitored. Methods are not supported.
CallbackA C/C++ function to callback when the action is triggered.

The SubscribeAction() function allows a client to receive a callback each time that an action is executed on an object. This strategy is referred to as "action monitoring" and is often used for responding to UI events and the termination of objects.

Subscriptions are context sensitive, so the Callback will execute in the space attributed to to the caller.

The following example illustrates how to listen to a Surface object's Redimension action and respond to resize events:

SubscribeAction(surface, AC::Redimension, C_FUNCTION(notify_resize, meta_ptr));

The template below illustrates how the Callback function should be constructed:

void notify_resize(OBJECTPTR Object, ACTIONID Action, ERR Result, APTR Parameters, APTR CallbackMeta)
{
   auto Self = (objClassType *)CurrentContext();

   // Code here...
   if ((!Result) and (Parameters)) {
      auto resize = (struct acRedimension *)Parameters;
   }
}

The Object is the original subscription target, as-is the Action ID. The Result is the error code that was generated at the end of the action call. If this is not set to ERR::Okay, assume that the action did not have an effect on state. The Parameters are the original arguments provided by the client - be aware that these can legitimately be NULL even if an action specifies a required parameter structure. Notice that because subscriptions are context sensitive, CurrentContext() can be used to get a reference to the object that initiated the subscription.

To terminate an action subscription, use the UnsubscribeAction() function. Matching each subscription with an unsubscription remains good practice because it releases the subscription record immediately. If a subscriber is freed without unsubscribing, the record degrades safely: the subscriber's object header is weakly pinned for the lifetime of the record, dispatch recognises the freed subscriber and skips the callback, and the stale record is swept once the notification pass completes. Until that sweep occurs, the subscriber's header remains allocated in zombie form.

Error Codes

OkayOperation successful.
ArgsInvalid arguments passed to function
OutOfRangeThe Action parameter is invalid.
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

SubscribeEvent()

Subscribe to a system event.

ERR SubscribeEvent(INT64 Event, FUNCTION * Callback, APTR * Handle)
ParameterDescription
EventAn event identifier.
CallbackThe function that will be subscribed to the event.
HandlePointer to an address that will receive the event handle.

Use the SubscribeEvent() function to listen for system events. An event ID (obtainable from GetEventID()) must be provided, as well as a reference to a function that will be called each time that the event is broadcast.

An event handle will be returned in the Handle parameter to identify the subscription. This must be retained to later unsubscribe from the event with the UnsubscribeEvent() function.

The prototype for the Callback function is Function(APTR Event, LONG Size, APTR CallbackMeta), where Event is the event structure that matches to the subscribed EventID.

Error Codes

OkayOperation successful.
ArgsInvalid arguments passed to function
AllocMemoryFailed to create a new memory block
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

SubscribeTimer()

Subscribes an object or function to the timer service.

ERR SubscribeTimer(DOUBLE Interval, FUNCTION * Callback, APTR * Subscription)
ParameterDescription
IntervalThe total number of seconds to wait between timer calls.
CallbackA callback function is required that will be called on each time cycle.
SubscriptionOptional. The subscription will be assigned an identifier that is returned in this parameter.

This function creates a new timer subscription that will be called at regular intervals for the calling object.

A callback function must be provided that follows this prototype: ERR Function(OBJECTPTR Subscriber, INT64 Elapsed, INT64 CurrentTime)

The Elapsed parameter is the total number of microseconds that have elapsed since the last call. The CurrentTime parameter is set to the PreciseTime() value just prior to the Callback being called. The callback function can return ERR::Terminate at any time to cancel the subscription. All other error codes are ignored. Tiri callbacks should use raise ERR_Terminate to perform the equivalent of this behaviour.

To change the interval, call UpdateTimer() with the new value. To release a timer subscription, call UpdateTimer() with the resulting Subscription handle and an Interval of zero.

Timer management is provisioned by the ProcessMessages() function. Failure to regularly process incoming messages will lead to unreliable timer cycles. It should be noted that the smaller the Interval that has been used, the more imperative regular message checking becomes. Prolonged processing inside a timer routine can also impact on other timer subscriptions that are waiting to be processed.

Error Codes

OkayOperation successful.
ArgsInvalid arguments passed to function
SystemLockedPart of the system is unreachable due to a persistent lock
InvalidStateThe subscriber is marked for termination.
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

TrackResource()

Assign a resource manager to an address, or update an existing one.

ERR TrackResource(RESOURCEID ResourceID, APTR Address, RESOURCEID OwnerID, struct ResourceManager * Manager)
ParameterDescription
ResourceIDUnique identifier for the resource to register or replace.
AddressAddress of the resource, or NULL to preserve an existing address.
OwnerIDOptional owning resource ID, normally an object. Use 0 when the resource is not owned.
ManagerResource manager used to release the resource.

TrackResource() registers a resource identifier with the memory manager so that later calls to FreeResource() can dispatch cleanup through the supplied ResourceManager. If the resource identifier is already registered, the existing record is updated with the non-zero values provided by the caller.

The supplied address and manager are retained as references only. They must remain valid for as long as the resource is tracked, or until the record is replaced or removed. When an OwnerID names an object, the resource is added directly to that object's resource list so it can be removed during object cleanup. Use RESOURCEID_INHERIT to preserve the existing owner when updating a resource, or to inherit the current context when registering a new resource.

A unique ResourceID can be obtained from AllocateID() by using IDTYPE::RESOURCE.

Error Codes

OkayOperation successful.
InUseResource is in use
NullArgsResourceID is 0, or Manager is NULL when registering a new resource.
Core module documentation © Paul Manias 1996-2026

UnloadFile()

Unloads files from the file cache.

void UnloadFile(struct CacheFile * Cache)
ParameterDescription
CacheA pointer to a CacheFile structure returned from LoadFile().

This function unloads cached files that have been previously loaded with the LoadFile() function.

Core module documentation © Paul Manias 1996-2026

UnpinResource()

Releases a lifetime pin from a resource.

ERR UnpinResource(RESOURCEID ResourceID)
ParameterDescription
ResourceIDThe unique identifier of the resource to unpin.

UnpinResource() releases one pin previously acquired with PinResource(). If FreeResource() requested collection while the resource was pinned, the caller releasing the final pin performs the deferred manager call and receives its result. A failed deferred collection restores the resource to a live, retryable state.

Error Codes

OkayOne pin was released and any required deferred destruction succeeded.
ResourceNotLockedThe resource has no pin to release.
DoesNotExistNo usable non-object resource with this identifier is registered.
NullArgsResourceID is zero.
Core module documentation © Paul Manias 1996-2026

UnsubscribeAction()

Terminates action subscriptions.

ERR UnsubscribeAction(OBJECTPTR Object, AC Action, FUNCTION * Callback)
ParameterDescription
ObjectThe object that you are unsubscribing from.
ActionThe ID of the action that will be unsubscribed, or zero for all actions.
CallbackThe original callback reference, or NULL to affect all registrations for the Object/Action combo.

The UnsubscribeAction() function will terminate subscriptions made by SubscribeAction(). The removal of subscriptions is context sensitive, so the context of the original SubscribeAction() call must be matched by UnsubscribeAction().

To terminate multiple subscriptions in a single call, set the Action parameter to zero.

Unsubscribing releases the subscription record (and the weak pin it holds on the subscriber) immediately. A subscriber that is freed without unsubscribing is tolerated - its remaining records are swept lazily the next time each subscribed action is dispatched - but explicit unsubscription remains the recommended practice.

Error Codes

OkayOperation successful.
ArgsInvalid arguments passed to function
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

UnsubscribeEvent()

Removes an event subscription.

void UnsubscribeEvent(APTR Handle)
ParameterDescription
HandleAn event handle returned from SubscribeEvent()

Use UnsubscribeEvent() to remove an existing event subscription. A valid handle returned from the SubscribeEvent() function must be provided.

Core module documentation © Paul Manias 1996-2026

UpdateMessage()

Updates the data of any message that is queued.

ERR UpdateMessage(INT Message, MSGID Type, const std::span<const int8_t> &Data)
ParameterDescription
MessageThe ID of the message that will be updated.
TypeThe type of the message.
DataOptional replacement data for the message. An empty buffer leaves the existing payload unchanged.

The UpdateMessage() function provides a facility for updating the content of existing messages on the local queue. The client must provide the ID of the message to update and the new message Type and/or Data to set against the message. Non-empty Data replaces the complete existing payload, while an empty buffer leaves that payload unchanged.

Error Codes

OkayThe message was successfully updated.
SearchThe supplied Message ID does not refer to a message in the queue.
ArgsThe supplied data is too large for the internal message interface.
NullArgsFunction call missing argument value(s)
Core module documentation © Paul Manias 1996-2026

UpdateTimer()

Modify or remove a subscription created by SubscribeTimer().

ERR UpdateTimer(APTR Subscription, DOUBLE Interval)
ParameterDescription
SubscriptionThe timer subscription to modify.
IntervalThe new interval for the timer (measured in seconds), or zero to remove.

This function complements SubscribeTimer(). It can change the interval for an existing timer subscription, or remove it if the Interval is set to zero.

Error Codes

OkayOperation successful.
SystemLockedPart of the system is unreachable due to a persistent lock
NullArgsFunction call missing argument value(s)
AlreadyLockedObject or resource has already been locked
Core module documentation © Paul Manias 1996-2026

WaitForObjects()

Process incoming messages while waiting on objects to complete their activities.

ERR WaitForObjects(PMF Flags, INT Timeout, struct ObjectSignal * ObjectSignals)
ParameterDescription
FlagsOptional flags are specified here.
TimeoutA time-out value measured in milliseconds. If this value is negative then no time-out applies and the function will not return until an incoming message or signal breaks it.
ObjectSignalsA null-terminated array of objects to monitor for signals.

WaitForObjects() acts as a front-end to ProcessMessages(), with an ability to wait for a list of objects that are expected to signal an end to their activities. An object can be signalled via the Signal() action, or via termination. By default, this function will only return once ALL of the objects are signalled or a time-out occurs. Use the PMF::ANY_SIGNAL flag to return once ANY of the objects are signalled.

It is guaranteed that the message queue will be consumed by ProcessMessages() at least once before this function returns.

Note that if an object has been signalled prior to entry to this function, its signal flag will be cleared and the object will not be monitored.

If this function is called recursively, the state of the earlier call will be preserved so that it will not be affected by subsequent calls.

Error Codes

OkayOperation successful.
TerminateTermination requested
ExceptionThresholdTermination requested
TimeoutFunction timed-out before successful completion
SystemLockedPart of the system is unreachable due to a persistent lock
RecursionDetected an illegal attempt at recursion
OutsideMainThreadOperation permitted from the main thread only
MessageOperationA message queue operation has failed
Core module documentation © Paul Manias 1996-2026

WaitTime()

Waits for a specified amount of seconds.

ERR WaitTime(DOUBLE Seconds)
ParameterDescription
SecondsThe number of seconds to wait for. Fractional values are supported for sub-second precision.

This function waits for a period of time as specified by the Seconds parameter. While waiting, your process will continue to process incoming messages in order to prevent the process' message queue from developing a back-log.

WaitTime() can return earlier than the indicated timeout if a message handler returns ERR::Terminate, or if a MSGID::QUIT message is sent to the task's message queue.

For non-main threads, the sleep can be interrupted by another thread calling WakeThread().

NOTE: If the thread is in a stopping state, e.g. from WakeThread(), this function will return immediately.

Error Codes

OkayOperation successful.
CancelledThe thread has been requested to stop and cannot pause.
TerminateTermination requested
Core module documentation © Paul Manias 1996-2026

WakeThread()

Interrupt a sleeping thread.

ERR WakeThread(INT Thread, INT Stop)
ParameterDescription
ThreadThe target thread's unique ID, as returned by GetThreadID().
StopIf true, the target thread will be put into a stopping state.

Call WakeThread() to interrupt a thread that is blocked in WaitTime() or similar, where supported. The target thread will return from as soon as it is able to acquire its internal lock. If the target thread is not currently sleeping, a pending interrupt is recorded so that its next sleep cycle will return immediately.

If Stop is set to true then the target thread will be put into a stopping state. This will cause all future sleep attempts in the target thread to be cancelled.

Error Codes

OkayThe thread was successfully interrupted.
SearchNo thread with the given ID was found in the registry.
Core module documentation © Paul Manias 1996-2026

AC Type

Action identifiers

NameDescription
AC::Activate
AC::Clear
AC::Clipboard
AC::CopyData
AC::DataFeed
AC::Deactivate
AC::Disable
AC::DragDrop
AC::Draw
AC::END
AC::Enable
AC::Flush
AC::Focus
AC::Free
AC::FreeWarning
AC::GetKey
AC::Hide
AC::Init
AC::Lock
AC::LostFocus
AC::Move
AC::MoveToBack
AC::MoveToFront
AC::MoveToPoint
AC::New
AC::NewChild
AC::NewOwner
AC::Next
AC::Prev
AC::Query
AC::Read
AC::Redimension
AC::Redo
AC::Refresh
AC::Rename
AC::Reset
AC::Resize
AC::SaveImage
AC::SaveSettings
AC::SaveToObject
AC::Seek
AC::SetField
AC::SetKey
AC::Show
AC::Signal
AC::Undo
AC::Unlock
AC::Write
Core module documentation © Paul Manias 1996-2026

CCF Type

Class categories

NameDescription
CCF::AUDIOAudio classes interface with audio hardware and drivers for audio playback and recording purposes
CCF::COMMANDCommand classes perform specific procedures, like copying or moving a file, managing volumes or executing a program
CCF::DATAData classes parse, query and manipulate data
CCF::FILESYSTEMFileSystem classes are based on file management and interaction with file based data
CCF::GRAPHICSGraphics classes provide graphics management and drawing services
CCF::GUIGUI classes are used in the development of graphical user interfaces
CCF::IOI/O classes manage hardware and software based input and output
CCF::MISCMiscellaneous classes do not fit into any of the other available categories
CCF::MULTIMEDIAClasses that represent more than one media type, e.g. video files
CCF::NETWORKNetwork classes interface with system drivers to simplify network communications
CCF::SYSTEMSystem classes are designed to provide low-level services related to system management
CCF::TOOLTools provide interactive services for the user
Core module documentation © Paul Manias 1996-2026

CONTYPE Type

Console types

NameDescription
CONTYPE::HANDLERedirected to a handle
CONTYPE::MANUALConsole created manually
CONTYPE::NONENo console available
CONTYPE::TERMINALLaunched from a terminal
Core module documentation © Paul Manias 1996-2026

EVG Type

Event categories

NameDescription
EVG::ANDROIDAndroid specific events that do not already fit existing categories
EVG::APPCustom event dispatched from an application
EVG::AUDIOAudio system events
EVG::CLASSCustom event dispatched from a class that doesn't fit within the rest of the event framework
EVG::DISPLAYVideo display events
EVG::FILESYSTEMFile system events
EVG::GUIEvents generated by the Graphical User Interface
EVG::HARDWAREHardware device events that are not covered by other types
EVG::IOInput/Output events
EVG::NETWORKNetwork events
EVG::POWERPower Management - can also include app-specific events relating to resource management
EVG::SYSTEMSystem-wide events
EVG::USERUser activity events (such as user login)
Core module documentation © Paul Manias 1996-2026

FBK Type

Flags for file feedback.

NameDescription
FBK::COPY_FILEA file is to be, or has been copied.
FBK::DELETE_FILEA file is to be, or has been deleted.
FBK::MOVE_FILEA file is to be, or has been moved.
Core module documentation © Paul Manias 1996-2026

IDTYPE Type

Types for AllocateID()

NameDescription
IDTYPE::FUNCTIONFunction IDs are used to track FUNCTION types and are assigned to the function ID field.
IDTYPE::GLOBALGlobal IDs have no specific association with anything.
IDTYPE::MESSAGEMessage IDs are allocated for the purpose of sending uniquely identifiable messages between tasks.
IDTYPE::RESOURCEResource identifier for TrackResource()
Core module documentation © Paul Manias 1996-2026

JET Type

JET constants are documented in GetInputEvent()

NameDescription
JET::ABS_XYThe X, Y values are defined as absolute coordinates, relative to the top-left of the display
JET::BUTTON_1Left mouse button; XBox A button, PS square button. Value is pressure sensitive, ranging between 0 - 1.0 (0 is released, 1.0 is fully depressed)
JET::BUTTON_10Non-specific button assignment
JET::BUTTON_2Right mouse button; XBox X button, PS cross button
JET::BUTTON_3Middle mouse button; XBox Y button, PS triangle
JET::BUTTON_4Alt. mouse button 1; XBox B button, PS circle
JET::BUTTON_5Alt. mouse button 2
JET::BUTTON_6Non-specific button assignment
JET::BUTTON_7Non-specific button assignment
JET::BUTTON_8Non-specific button assignment
JET::BUTTON_9Non-specific button assignment
JET::CROSSED_INThis message is sent by the input system when the mouse pointer enters an area for the first time. The message value refers to the object ID of the container being monitored for movement
JET::CROSSED_OUTThis message is sent by the input system when the mouse pointer leaves an area. The message value refers to the object ID of the container being monitored for movement
JET::DEVICE_TILT_XYController tilted on the X/Y axis. Value indicates angle, -ve = left, +ve = right
JET::DEVICE_TILT_ZController is rising or falling. Value expressed as 'speed',
JET::DISPLAY_EDGERecently supplied input occurred at the edge of the display
JET::PEN_TILT_XYPen tilt angle. 0 is pointing down directly with nib at bottom, 0.5 is 90 degrees, 1.0 is inversed (eraser at bottom)
JET::PRESSUREAmount of pressure applied, ranges from 0 (none) to 1.0 (normal) and possibly higher if user presses hard enough
JET::WHEELMouse wheel rotation - the value generally reflects the number of 'clicks' rotated on the wheel
JET::WHEEL_TILTSome mouse wheels can be tilted to the left or right. Ranges from -1.0 to +1.0
Core module documentation © Paul Manias 1996-2026

JTYPE Type

JTYPE flags are used to categorise input types

NameDescription
JTYPE::ANALOGAnalog movement (ranging from -1.0 to 1.0)
JTYPE::ANCHOREDCursor has been anchored with LockCursor()
JTYPE::BUTTONInput is a physical button or switch
JTYPE::CROSSINGCrossing events manage the entering and leaving of an area
JTYPE::DBL_CLICKSet by the input system if the Type is a button and the button has been clicked in quick succession so as to be classed as a double-click
JTYPE::DIGITALD-Pad or digital joystick source (restricted to +/- 1)
JTYPE::DRAGGEDSet if sufficient movement occurred between the original click and its point of release (usually requires a 3 or more pixel difference)
JTYPE::DRAG_ITEMThis special flag is set by the input system if the pointer is click-dragging an object at the time of the event
JTYPE::EXT_MOVEMENTExtended or indirect movement information. This covers all types of movement that are unconnected to coordinate positioning - mouse wheel movement and pen tilt are two such examples
JTYPE::MOVEMENTX/Y coordinate movement only. Movement such as the wheel mouse spinning is not covered by this type as it does not influence the coordinate system
JTYPE::REPEATEDInput is a repeated entry (i.e. user is holding down a button and a repetition timer is being triggered)
JTYPE::SECONDARYIndicates to the receiver of this message that it is not the primary/original recipient
Core module documentation © Paul Manias 1996-2026

LDF Type

Flags for LoadFile()

NameDescription
LDF::CHECK_EXISTSLimits the routine to checking the file cache for the existence of the file. If found, the relevant cache entry is returned. The open count is not incremented by this action (it is therefore unnecessary to follow-up with a call to UnloadFile()). If no up-to-date cache entry is available, ERR::Search is returned.
Core module documentation © Paul Manias 1996-2026

LOC Type

AnalysePath() values

NameDescription
LOC::DIRECTORYThe path refers to a folder.
LOC::FILEThe path refers to a file.
LOC::VOLUMEThe path refers to a volume name.
Core module documentation © Paul Manias 1996-2026

MEM Type

Memory flags

NameDescription
MEM::NO_CLEARDo not clear the memory on allocation (saves time)
Core module documentation © Paul Manias 1996-2026

MSF Type

Message flags.

NameDescription
MSF::NO_DUPLICATEIf the Type parameter matches a message already inside the queue, the new message will not be added and the function will immediately return with ERR::Okay.
MSF::UPDATEIf Type matches a queued message, update that message's data in place.
Core module documentation © Paul Manias 1996-2026

MSGID Type

Reserved message ID's that are handled internally.

NameDescription
MSGID::ACTION
MSGID::BREAK
MSGID::COMMAND
MSGID::CORE_END
MSGID::DEBUG
MSGID::EVENT
MSGID::FREE
MSGID::QUIT
MSGID::THREAD_ACTION
MSGID::THREAD_CALLBACK
MSGID::TIRI_THREAD_CALLBACK
MSGID::VALIDATE_PROCESS
MSGID::WAIT_FOR_OBJECTS
Core module documentation © Paul Manias 1996-2026

NF Type

Flags that can be passed to NewObject(). If a flag needs to be stored with the object, it must be specified in the lower word.

NameDescription
NF::ASYNC_ACTIVERead-only indicator that asynchronous actions are queued or executing against this object.
NF::FREERead-only indicator for when the object is being freed.
NF::FREE_ON_UNLOCKSet if FreeResource() was called on an object under lock conditions. Immediately collects when unlocked.
NF::INITIALISEDRead-only indicator if the object has been initialised.
NF::LOCALClasses can allocate local objects to stop them from being associated with the client.
NF::PRIVATE
NF::RECLASSEDThe object switched from the base-class to a derived class during initialisation.
NF::SIGNALLEDThe object has been signalled and is awaiting processing.
NF::TIMER_SUBThe object is subscribed to a timer interval.
NF::UNTRACKEDAn object created with this flag will not be tracked back to the object that created it.
Core module documentation © Paul Manias 1996-2026

OPF Type

NameDescription
OPF::ARGS
OPF::DETAIL
OPF::MAX_DEPTH
OPF::MODULE_PATH
OPF::OPTIONS
OPF::PRIVILEGED
OPF::ROOT_PATH
OPF::SCAN_MODULES
OPF::SHOW_ERRORS
OPF::SHOW_IO
OPF::SHOW_MEMORY
OPF::SYSTEM_PATH
Core module documentation © Paul Manias 1996-2026

PERMIT Type

Permission flags

NameDescription
PERMIT::ALL_DELETESynonym for EVERYONE_DELETE
PERMIT::ALL_EXECSynonym for EVERYONE_EXEC
PERMIT::ALL_READSynonym for EVERYONE_READ
PERMIT::ALL_WRITESynonym for EVERYONE_WRITE
PERMIT::ARCHIVEMarks the file for future backup. The flag should be cleared after the backup has succeeded
PERMIT::DELETEOwner can delete. If the file system does not support this, deletion is enabled via the WRITE flag
PERMIT::EVERYONE_ACCESSSynonym for EVERYONE_READ | EVERYONE_WRITE | EVERYONE_EXEC | EVERYONE_DELETE
PERMIT::EVERYONE_DELETESynonym for DELETE | GROUP_DELETE | OTHERS_DELETE
PERMIT::EVERYONE_EXECSynonym for EXEC | GROUP_EXEC | OTHERS_EXEC
PERMIT::EVERYONE_READSynonym for READ | GROUP_READ | OTHERS_READ
PERMIT::EVERYONE_READWRITESynonym for EVERYONE_READ | EVERYONE_WRITE
PERMIT::EVERYONE_WRITESynonym for WRITE | GROUP_WRITE | OTHERS_WRITE
PERMIT::EXECUser/Owner can execute
PERMIT::GROUPSynonym for GROUP_READ | GROUP_WRITE | GROUP_EXEC | GROUP_DELETE
PERMIT::GROUPIDAllows executables to run with a set group id
PERMIT::GROUP_DELETEGroup members can delete
PERMIT::GROUP_EXECGroup members can execute
PERMIT::GROUP_READGroup members can read
PERMIT::GROUP_WRITEGroup members can write
PERMIT::HIDDENRecommends that the file is hidden from view by default
PERMIT::INHERITInherit permissions from parent folder and logical OR them with preset permission flags
PERMIT::METASynonym for HIDDEN | PASSWORD | OFFLINE | NETWORK
PERMIT::NETWORKFile is hosted on another machine
PERMIT::OFFLINEFile content for this networked file has not been cached on the local PC
PERMIT::OTHERSSynonym for OTHERS_READ | OTHERS_WRITE | OTHERS_EXEC | OTHERS_DELETE
PERMIT::OTHERS_DELETEOthers can delete
PERMIT::OTHERS_EXECOthers can execute
PERMIT::OTHERS_READOthers can read
PERMIT::OTHERS_WRITEOthers can write
PERMIT::PASSWORDFile is password protected
PERMIT::READUser/Owner has read access. This will not allow compiled code to be executed
PERMIT::USERSynonym for READ | WRITE | EXEC | DELETE
PERMIT::USERIDAllows executables to run with a set user id
PERMIT::USER_EXECSynonym for EXEC
PERMIT::USER_READSynonym for READ
PERMIT::USER_WRITESynonym for WRITE
PERMIT::WRITEUser/Owner can write
Core module documentation © Paul Manias 1996-2026

PMF Type

Flags for ProcessMessages

NameDescription
PMF::ANY_SIGNALReturn from WaitForObjects() when any monitored object is signalled.
PMF::EVENT_LOOPSet if this is the program's main event loop. Should be accompanied with an infinite timeout.
Core module documentation © Paul Manias 1996-2026

RDF Type

Flags for the OpenDir() function.

NameDescription
RDF::DATERetrieve the date stamp of each file.
RDF::FILERead all files in the folder.
RDF::FILESRead all files in the folder.
RDF::FOLDERRead all folders/volumes in the folder.
RDF::FOLDERSRead all folders/volumes in the folder.
RDF::LINKFeedback only - file/folder is actually a link to another location.
RDF::PERMISSIONSGet permission/security information.
RDF::QUALIFIEDReturn fully qualified folder names (i.e. trailing slash or colon for each name).
RDF::QUALIFYReturn fully qualified folder names (i.e. trailing slash or colon for each name).
RDF::READ_ALLSynonym for SIZE | DATE | PERMISSIONS | FILES | FOLDERS
RDF::READ_ONLYRead-only (not permissions related, can indicate read-only media).
RDF::SIZERetrieve the byte size of each file.
RDF::STREAMPath is connected via a stream, e.g. network connection.
RDF::TAGSReceive additional information for each file, such as comments, author and copyright. The results are stored in the Tags field of each file.
RDF::TIMERetrieve the date stamp of each file.
RDF::VIRTUALPath is to a virtual device.
RDF::VOLUMEFeedback only - indicates a volume.
Core module documentation © Paul Manias 1996-2026

RES Type

NameDescription
RES::CPU_SPEEDThe average top-speed of all CPU cores in Mhz.
RES::FREE_MEMORYThe total amount of free memory.
RES::FREE_SWAPThe total amount of free swap memory.
RES::JNI_ENVReturn the current JNI environment string.
RES::KEY_STATEMaintains the state of key qualifiers such as caps-lock and the shift keys.
RES::LOG_DEPTHThe current depth of log messages.
RES::LOG_LEVELThe current level of log detail (larger numbers indicate more detail).
RES::MAIN_THREADRead-only, returns true if called from the main thread.
RES::MAIN_THREAD_IDRead-only, returns the ID of the main thread.
RES::MEMORY_USAGEThe total amount of memory used by the current process, in bytes.
RES::PRIVILEGEDThis is set to true if the process has elevated privileges (such as superuser or administrative rights).
RES::PRIVILEGED_USERIf this value is set to 1, the process will operate in privileged mode (typically this enables full administrator rights). This feature will only work for Unix processes that are granted admin rights when launched. Setting the Value to 0 reverts to the user's permission settings. SetResource() will return an error code indicating the level of success.
RES::PROCESS_STATELife-cycle stage of the running process
RES::STRUCT_DBReturns a map of hashed struct names and corresponding struct sizes.
RES::TOTAL_MEMORYThe total amount of installed memory.
RES::TOTAL_SHARED_MEMORYThe total amount of shared memory in use (system wide).
RES::TOTAL_SWAPThe total amount of available swap space.
RES::WINDOWS_ICONThe Microsoft Windows resource icon ID for this process.
Core module documentation © Paul Manias 1996-2026

RFD Type

Flags for RegisterFD()

NameDescription
RFD::ALWAYS_CALLAlways call this FD's handler prior to the process going to sleep.
RFD::EXCEPTActivate the callback if error conditions are pending.
RFD::READActivate the callback if there is data available to read.
RFD::RECALLSet if the subscriber needs to manually check for incoming/outgoing data. This is supported as a one-off check, so the flag will be disabled automatically when the subscriber is called.
RFD::REMOVEStop monitoring this file descriptor.
RFD::SOCKETIdentifies the file descriptor as a socket (Linux systems only).
RFD::WRITEActivate the callback if there is room to write to the FD's buffer.
Core module documentation © Paul Manias 1996-2026

RP Type

Path types for SetResourcePath()

NameDescription
RP::MODULE_PATHAn alternative path leading to the system modules (normally system:modules/). Introduced for platforms such as Android, where modules are stored in asset folders.
RP::ROOT_PATHOverrides the root path, which defaults to the location at which Kōtuku is installed.
RP::SYSTEM_PATHThe path of the system: volume, which otherwise defaults to [root]:system/.
Core module documentation © Paul Manias 1996-2026

RSF Type

Flags for ResolvePath()

NameDescription
RSF::APPROXIMATEIgnores file extensions for the purpose of file name matching.
RSF::CASE_SENSITIVEFor use on host systems that use case-insensitive file systems such as Windows; this option checks that the discovered file is a case-sensitive match to the Path.
RSF::CHECK_VIRTUALIf the volume referenced by Path is traced to another volume that is reserved by a virtual file system driver, ERR::VirtualVolume is returned. The volume is still resolved as far as possible and the resulting path will be returned by this function.
RSF::NO_DEEP_SCANDo not perform more than one iteration when resolving the source file path.
RSF::NO_FILE_CHECKDo not test for the existence of the targeted file or folder during the resolution process.
RSF::PATHUse the PATH environment variable to resolve the file name in the Path parameter.
Core module documentation © Paul Manias 1996-2026

TOI Type

NameDescription
TOI::ANDROID_ASSETMGR
TOI::ANDROID_CLASS
TOI::ANDROID_ENV
TOI::LOCAL_CACHE
TOI::LOCAL_STORAGE
Core module documentation © Paul Manias 1996-2026

VOLUME Type

Options for SetVolume()

NameDescription
VOLUME::HIDDENHides the volume so that it will not show up when reading volumes from the root path :.
VOLUME::PRIORITYIf the volume already exists, the path will be inserted at the beginning of the path list so that it has priority over the others.
VOLUME::REPLACEIf the volume already exists, all paths that are attached to it will be replaced with the new path setting.
VOLUME::SYSTEMIdentifies the volume as being created by the system (this flag is not for client use).
Core module documentation © Paul Manias 1996-2026

ActionArray Structure

FieldTypeDescription
RoutineAPTRPointer to the function entry point
ActionCodeACAction identifier
Core module documentation © Paul Manias 1996-2026

ActionTable Structure

Structure for ActionList

FieldTypeDescription
HashUINTHash of the action name.
SizeINTByte-size of the structure for this action.
NameCSTRINGName of the action.
Argsconst struct FunctionField *List of fields that are passed to this action.
Core module documentation © Paul Manias 1996-2026

ChildEntry Structure

Structure for ListChildren() function

FieldTypeDescription
ObjectIDOBJECTIDObject ID
ClassIDCLASSIDThe class ID of the referenced object.
Core module documentation © Paul Manias 1996-2026

ClassRecord Structure

Meta information for a class, as recorded in the class database.

FieldTypeDescription
ClassIDCLASSIDUnique class identifier (hash of Name)
ParentIDCLASSIDParent class ID if this is a derived class
CategoryCCFAssigned category
NameSTRINGName of the class
PathSTRINGPath to the class file
ExtensionSTRINGWildcards for matching by file extension, e.g. jpeg|jpg
HeaderSTRINGFile identification instruction, e.g. [0:$89504e470d0a1a0a]
IconSTRINGIcon reference in group/name format
DescriptionSTRINGFile description
Core module documentation © Paul Manias 1996-2026

ClipRectangle Structure

Generic structure for rectangular clipping.

FieldTypeDescription
LeftINTLeft-most coordinate
TopINTTop coordinate
RightINTRight-most coordinate
BottomINTBottom coordinate
Core module documentation © Paul Manias 1996-2026

ColourFormat Structure

FieldTypeDescription
RedShiftUINT8Right shift value for red (15/16 bit formats only)
GreenShiftUINT8Right shift value for green
BlueShiftUINT8Right shift value for blue
AlphaShiftUINT8Right shift value for alpha
RedMaskUINT8Unshifted mask value for red (ranges from 0x00 to 0xff)
GreenMaskUINT8Unshifted mask value for green
BlueMaskUINT8Unshifted mask value for blue
AlphaMaskUINT8Unshifted mask value for alpha
RedPosUINT8Left shift/positional value for red
GreenPosUINT8Left shift/positional value for green
BluePosUINT8Left shift/positional value for blue
AlphaPosUINT8Left shift/positional value for alpha
BitsPerPixelUINT8Number of bits per pixel for this format.
Core module documentation © Paul Manias 1996-2026

DateTime Structure

Generic structure for date-time management

FieldTypeDescription
YearINT16Year
MonthINT8Month 1 to 12
DayINT8Day 1 to 31
HourINT8Hour 0 to 23
MinuteINT8Minute 0 to 59
SecondINT8Second 0 to 59
TimeZoneINT8TimeZone -13 to +13
Core module documentation © Paul Manias 1996-2026

DirInfo Structure

Used by OpenDir() only

FieldTypeDescription
Infostruct FileInfo *Pointer to a FileInfo structure
Core module documentation © Paul Manias 1996-2026

Edges Structure

Generic structure for declaring edge coordinates.

FieldTypeDescription
LeftINTLeft-most coordinate
TopINTTop coordinate
RightINTRight-most coordinate
BottomINTBottom coordinate
Core module documentation © Paul Manias 1996-2026

FRGB Structure

32-bit floating point RGB colour components.

FieldTypeDescription
RedFLOATRed component value
GreenFLOATGreen component value
BlueFLOATBlue component value
AlphaFLOATAlpha component value
Core module documentation © Paul Manias 1996-2026

Field Structure

Used to describe the public fields of a class.

FieldTypeDescription
ArgINT64An option to complement the field type. Can be a pointer or an integer value
GetValueFUNCTION *A virtual function that will retrieve the value for this field
SetValueFUNCTION *A virtual function that will set the value for this field
WriteValueFUNCTION *An internal function for writing to this field
NameCSTRINGThe English name for the field, e.g. Width
FieldIDUINT32-bit hash from fieldhash()
OffsetUINT16Field offset within the object
IndexUINT16Field array index
FlagsUINTSpecial flags that describe the field
Core module documentation © Paul Manias 1996-2026

FieldArray Structure

Used to construct class blueprints for the MetaClass.

FieldTypeDescription
NameCSTRINGThe name of the field, e.g. Width
GetFieldAPTRvoid GetField(*Object, APTR Result);
SetFieldAPTRERR SetField(*Object, APTR Value);
ArgINT64Can be a pointer or an integer value
FlagsUINTSpecial flags that describe the field
Core module documentation © Paul Manias 1996-2026

FieldDef Structure

Used to define constants for field references.

FieldTypeDescription
NameCSTRINGThe name of the constant.
ValueINTThe value of the constant.
Core module documentation © Paul Manias 1996-2026

FileFeedback Structure

FieldTypeDescription
SizeINT64Size of the file
PositionINT64Current seek position within the file if moving or copying
PathSTRINGPath to the file
DestSTRINGDestination file/path if moving or copying
FeedbackIDFBKSet to one of the FBK values
ReservedINT8Reserved in case of future expansion
Core module documentation © Paul Manias 1996-2026

FileInfo Structure

Metadata for describing a file.

FieldTypeDescription
SizeINT64The size of the file's content.
TimestampINT6464-bit time stamp - usable only for comparison (e.g. sorting).
Nextstruct FileInfo *Next structure in the list, or NULL.
NameSTRINGThe name of the file.
FlagsRDFAdditional flags to describe the file.
PermissionsPERMITStandard permission flags.
UserIDINTUser ID (Unix systems only).
GroupIDINTGroup ID (Unix systems only).
Createdstruct DateTimeThe date/time of the file's creation.
Modifiedstruct DateTimeThe date/time of the last file modification.
Core module documentation © Paul Manias 1996-2026

FunctionField Structure

Used by ActionTable and Function structures to declare lists of parameters.

FieldTypeDescription
NameCSTRINGName of the field
TypeUINTType of the field
Core module documentation © Paul Manias 1996-2026

HSV Structure

Colour structure for Hue, Saturation and Value/Light components.

FieldTypeDescription
HueDOUBLEBetween 0 and 359.999
SaturationDOUBLEBetween 0 and 1.0
ValueDOUBLEBetween 0 and 1.0. Corresponds to Value, Lightness or Brightness
AlphaDOUBLEAlpha blending value from 0 to 1.0
Core module documentation © Paul Manias 1996-2026

InputEvent Structure

FieldTypeDescription
Nextconst struct InputEvent *Next event in the chain
ValueDOUBLEThe value associated with the Type
TimestampINT64PreciseTime() of the recorded input
RecipientIDOBJECTIDSurface that the input message is being conveyed to
OverIDOBJECTIDSurface that is directly under the mouse pointer at the time of the event
AbsXDOUBLEAbsolute horizontal position of mouse cursor (relative to the top left of the display)
AbsYDOUBLEAbsolute vertical position of mouse cursor (relative to the top left of the display)
XDOUBLEHorizontal position relative to the surface that the pointer is over - unless a mouse button is held or pointer is anchored - then the coordinates are relative to the click-held surface
YDOUBLEVertical position relative to the surface that the pointer is over - unless a mouse button is held or pointer is anchored - then the coordinates are relative to the click-held surface
DeviceIDOBJECTIDThe hardware device that this event originated from
TypeJETJET constant that describes the event
FlagsJTYPEBroad descriptors for the given Type (see JTYPE flags). Automatically defined when delivered to the pointer object
MaskJTYPEMask to use for checking against subscribers
Core module documentation © Paul Manias 1996-2026

Message Structure

Message header.

FieldTypeDescription
TimeINT64A timestamp acquired from PreciseTime() when the message was first passed to SendMessage().
UIDINTA unique identifier automatically created by SendMessage().
TypeMSGIDA message type identifier as defined by the client.
SizeINTThe byte-size of the message data, or zero if no data is provided.
Core module documentation © Paul Manias 1996-2026

ObjectSignal Structure

Required in calls to WaitForObjects().

FieldTypeDescription
ObjectOBJECTPTRReference to an object to monitor.
Core module documentation © Paul Manias 1996-2026

OpenInfo Structure

Client options for passing to Kotuku on startup

FieldTypeDescription
NameSTRINGProgram name
SystemPathSTRINGPath to system files
ModulePathSTRINGPath to module files
RootPathSTRINGKotuku root directory
*ArgsCSTRINGCommand-line arguments
Optionsconst struct OpenTag *Tag-list of additional options. Typecast to va_list
FlagsOPFClient flags indicating the values that have been defined in this structure
MaxDepthINTMaximum debug depth
DetailINTDebug detail level (0 none - 9 trace)
ArgCountINTTotal arguments in Args
Core module documentation © Paul Manias 1996-2026

OpenTag Structure

Tags for OpenInfo.Options

FieldTypeDescription
TagTOITag identifier
Core module documentation © Paul Manias 1996-2026

RGB16 Structure

16-bit RGB colour value.

FieldTypeDescription
RedUINT16Red component value
GreenUINT16Green component value
BlueUINT16Blue component value
AlphaUINT16Alpha component value
Core module documentation © Paul Manias 1996-2026

RGB32 Structure

32-bit RGB colour value.

FieldTypeDescription
RedUINTRed component value
GreenUINTGreen component value
BlueUINTBlue component value
AlphaUINTAlpha component value
Core module documentation © Paul Manias 1996-2026

RGB8 Structure

8-bit RGB colour value.

FieldTypeDescription
RedUINT8Red component value
GreenUINT8Green component value
BlueUINT8Blue component value
AlphaUINT8Alpha component value
Core module documentation © Paul Manias 1996-2026

RGBPalette Structure

FieldTypeDescription
AmtColoursINTTotal colours
Colstruct RGB8RGB Palette
Core module documentation © Paul Manias 1996-2026

ResourceRecord Structure

Unified resource management record

FieldTypeDescription
AddressAPTRDirect pointer to the resource (optional, can rely on ResourceID instead)
Managerstruct ResourceManager *Reference to the resource manager for this record
ResourceIDRESOURCEIDUnique identifier
OwnerIDINTOwner of the resource, could be another resource or object
PinCountUINTNumber of active lifetime pins
CollectOnUnlockBOOLCollection is pending until the final resource pin is released
TerminatingBOOLA FreeResource() call currently owns the destruction path
Core module documentation © Paul Manias 1996-2026

SystemState Structure

Returned by the GetSystemState() function.

FieldTypeDescription
PlatformCSTRINGString-based field indicating the user's platform. Currently returns Native, Windows, OSX or Linux.
IDLCSTRINGThe Core module's compressed IDL string
OpenInfoconst struct OpenInfo *The OpenInfo structure originally used to initialise the system
ConsoleFDHOSTHANDLEInternal
ConsoleTypeCONTYPEThe console type for stdout and stderr, if any
StageINT16The current operating stage. -1 = Initialising, 0 indicates normal operating status; 1 means that the program is shutting down; 2 indicates a program restart; 3 is for mode switches.
ReleaseBuildUINT81 = Release build, 0 = Debug build
StaticBuildUINT81 = Static build, 0 = Dynamic build
Core module documentation © Paul Manias 1996-2026

Unit Structure

FieldTypeDescription
ValueDOUBLEThe unit value.
TypeUINTAdditional type information
Core module documentation © Paul Manias 1996-2026

dcAudio Structure

Data feed structure for Audio

FieldTypeDescription
SizeINTByte size of this structure
FormatINTFormat of the audio data
Core module documentation © Paul Manias 1996-2026

dcDeviceInput Structure

FieldTypeDescription
ValuesDOUBLEThe value(s) associated with the Type
TimestampINT64PreciseTime() of the recorded input
DeviceIDOBJECTIDThe hardware device that this event originated from (note: This ID can be to a private/inaccessible object, the point is that the ID is unique)
FlagsJTYPEBroad descriptors for the given Type. Automatically defined when delivered to the pointer object
TypeJETJET constant
Core module documentation © Paul Manias 1996-2026

dcKeyEntry Structure

Data feed structure for Keypress

FieldTypeDescription
FlagsINTShift/Control/CapsLock...
ValueINTASCII value of the key A/B/C/D...
TimestampINT64PreciseTime() at which the keypress was recorded
UnicodeINTUnicode value for pre-calculated key translations
Core module documentation © Paul Manias 1996-2026

dcRequest Structure

Data feed item request

FieldTypeDescription
ItemINTIdentifier for retrieval from the source
PreferenceINT8Data preferences for the returned item(s)
Core module documentation © Paul Manias 1996-2026