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.
BroadcastEvent | GetEventID | SubscribeEvent | UnsubscribeEvent
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
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
CompressedStream | Compression | Config | File | MetaClass | Module | Script | StorageDevice | Task | Thread | Time
AC | CCF | CONTYPE | EVG | FBK | IDTYPE | JET | JTYPE | LDF | LOC | MEM | MSF | MSGID | NF | OPF | PERMIT | PMF | RDF | RES | RFD | RP | RSF | TOI | VOLUME
Grants exclusive access to objects via unique ID.
| Parameter | Description |
|---|---|
| Object | The unique ID of the target object. |
| MilliSeconds | The limit in milliseconds before a timeout occurs. The maximum limit is 60000, and 100 is recommended. |
| Result | A 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();
}
}
| Okay | Operation successful. |
|---|---|
| Cancelled | The thread has been requested to stop whilst sleeping. |
| Args | Invalid arguments passed to function |
| LockFailed | Failed to initialise the sleep record for the waiting thread. |
| TimeOut | Function timed-out before successful completion |
| MarkedForDeletion | The object is being removed and cannot be locked. |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| NoMatchingObject | No matching object was found for the given object ID |
| DoesNotExist | The object was removed while waiting for the lock. |
| NullArgs | Function call missing argument value(s) |
This function is responsible for executing action routines.
| Parameter | Description |
|---|---|
| Action | An action or method ID must be specified. |
| Object | The target object. |
| Parameters | Optional 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.
| Okay | Operation successful. |
|---|---|
| NoAction | The Action is not supported by the object's supporting class. |
| AccessObject | Attempting to lock an object failed |
| NullArgs | Function call missing argument value(s) |
| Notified | Unknown error code. |
Returns the global action table.
| Parameter | Description |
|---|---|
| Actions | Receives 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:
| Name | Description |
|---|---|
| FDF::INT | A 32-bit integer value. |
| FDF::DOUBLE | A 64-bit floating point value. |
| FDF::PTR | A standard address space pointer. |
| FDF::OBJECTPTR | A pointer to an object. This is defined as FD_PTR|FD_OBJECT and its convenience macro is FD_OBJECTPTR. |
| FDF::CPPSTRING | A C++ std::string, defined as FD_CPP|FD_STRING with the convenience macro FDF_CPPSTRING. |
| FDF::SPAN | A 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:
| Name | Description |
|---|---|
| FD::MUTABLE | This flag indicates that the referenced memory is writable by the function. It is most commonly combined with FDF_SPAN for output buffers. |
| FD::RESULT | This 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. |
Adds new tags to FileInfo structures.
| Parameter | Description |
|---|---|
| Info | Pointer to a valid FileInfo structure. |
| Name | The name of the tag, which must be declared in camel-case. |
| Value | The 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.
| Okay | Operation successful. |
|---|---|
| NullArgs | Function call missing argument value(s) |
| CreateResource | Failed to create a new resource |
Adds a new message handler for processing incoming messages.
| Parameter | Description |
|---|---|
| MsgType | The message type that the handler will intercept. If zero, all incoming messages are passed to the handler. |
| Routine | Refers to the function that will handle incoming messages. |
| Handle | The 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.
| Okay | Message handler successfully processed. |
|---|---|
| Lock | Failed to lock a required resource |
| AllocMemory | Failed to create a new memory block |
| NullArgs | Function call missing argument value(s) |
Adjusts the base-line of all log messages.
| Parameter | Description |
|---|---|
| Delta | The 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.
Returns the absolute base-line value that was active prior to calling this function.
Allocates a managed memory block on the heap.
| Parameter | Description |
|---|---|
| Size | The size of the memory block in bytes. Must be greater than zero. |
| Flags | Optional allocation flags controlling behaviour and ownership. |
| Address | Pointer to store the address of the allocated memory block. |
| Manager | Resource 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.
| Okay | Memory block successfully allocated. |
|---|---|
| Args | Invalid parameters (size <= 0 or Address is NULL). |
| AllocMemory | Insufficient memory available for the requested allocation. |
Generates unique ID's for general purposes.
| Parameter | Description |
|---|---|
| Type | The 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.
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.
Analyses paths to determine their type (file, folder or volume).
| Parameter | Description |
|---|---|
| Path | The path to analyse. |
| Type | The 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.
| Okay | The path was analysed and the result is stored in the Type variable. |
|---|---|
| FileNotFound | File not found |
| NoSupport | Operation not supported |
| NullArgs | Function call missing argument value(s) |
Submit an action for asynchronous execution against an object.
| Parameter | Description |
|---|---|
| Action | An action or method ID must be specified here. |
| Object | The target object to execute the action against. |
| Args | If the action or method is documented as taking parameters, provide the correct parameter structure here. |
| Callback | Optional 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.
| Okay | Operation successful. |
|---|---|
| InvalidData | There is an error in the provided data |
| MarkedForDeletion | A resource cannot be accessed as it is marked for deletion |
| MissingClass | The class could not be found in the system |
| NullArgs | Function call missing argument value(s) |
Drain the pending queue for listed objects without executing the remaining actions.
| Parameter | Description |
|---|---|
| Objects | A 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.
| Okay | Operation successful. |
|---|---|
| NullArgs | Function call missing argument value(s) |
Return the number of queued and in-flight async actions for an object.
| Parameter | Description |
|---|---|
| Object | The 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.
The number of pending async actions (in-flight + queued), or zero if none.
Block until all queued async actions for the listed objects have completed.
| Parameter | Description |
|---|---|
| Objects | A list of object IDs to wait on. |
| Timeout | Maximum 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.
| Okay | All async actions completed. |
|---|---|
| Terminate | Termination requested |
| InUse | Another AsyncWait() call is already active. |
| Timeout | The timeout expired before all actions completed. |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| NullArgs | Function call missing argument value(s) |
| Recursion | Detected an illegal attempt at recursion |
| OutsideMainThread | Operation permitted from the main thread only |
Broadcast an event to all event listeners in the system.
| Parameter | Description |
|---|---|
| Event | Pointer to an event structure. |
| EventSize | The 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;
| Okay | Operation successful. |
|---|---|
| NullArgs | Function call missing argument value(s) |
Checks objects to see whether or not they support certain actions.
| Parameter | Description |
|---|---|
| Object | The target object. |
| Action | A 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.
}
| True | The object supports the specified action. |
|---|---|
| False | The action is not supported. |
| LostClass | The object has lost its class reference |
| OutOfRange | A value is outside of the valid range |
| NullArgs | Function call missing argument value(s) |
Verifies the existence of a resource.
| Parameter | Description |
|---|---|
| ID | The 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.
| True | The resource exists and is valid. |
|---|---|
| False | The resource does not exist or has been freed. |
Returns an array of all classes known to the system.
| Parameter | Description |
|---|---|
| Classes | A pointer to an array of class records is returned here. |
Call ClassDatabase() to obtain an array of all classes known to the system.
| Okay | Operation successful. |
|---|---|
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| NullArgs | Function call missing argument value(s) |
Checks if two file paths refer to the same physical file.
| Parameter | Description |
|---|---|
| PathA | File location 1. |
| PathB | File 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).
| Okay | The file paths refer to the same file. |
|---|---|
| True | Operation successful. |
| False | The file paths refer to different files. |
| NullArgs | Function call missing argument value(s) |
Makes copies of folders and files.
| Parameter | Description |
|---|---|
| Source | The source location. |
| Dest | The destination location. |
| Callback | Optional 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).
| Okay | The source was copied to its destination successfully. |
|---|---|
| Failed | A failure occurred during the copy process. |
| Args | Invalid arguments passed to function |
Makes new folders.
| Parameter | Description |
|---|---|
| Path | The location of the folder. |
| Permissions | Security 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().
| Okay | Operation successful. |
|---|---|
| NoSupport | Virtual file system does not support folder creation. |
| FileExists | An identically named file or folder already exists at the Path. |
| ResolvePath | A call to ResolvePath() failed |
| NullArgs | Function call missing argument value(s) |
Creates symbolic links on supported file systems.
| Parameter | Description |
|---|---|
| From | The symbolic link will be created at the location specified here. |
| To | The 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.
| Okay | The link was created successfully. |
|---|---|
| NoSupport | The file system or the host operating system does not support symbolic links. |
| Memory | General memory error |
| LowCapacity | There is no room on the device to create the new link. |
| NoPermission | The user does not have permission to create the link, or the file system is mounted read-only. |
| BufferOverflow | One or both of the provided arguments is too long. |
| FileExists | The location referenced at From already exists. |
| ResolvePath | A call to ResolvePath() failed |
| SystemCall | A call to the host system has failed |
| NullArgs | Function call missing argument value(s) |
Returns a pointer to the object that has the current context.
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().
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.
Returns the active Task object.
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.
Returns a pointer to the current Task object or NULL if failure.
Deletes files and folders.
| Parameter | Description |
|---|---|
| Path | String referring to the file or folder to be deleted. Folders must be denoted with a trailing slash. |
| Callback | Optional 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).
| Okay | The file or folder was deleted successfully. |
|---|---|
| File | The location could not be opened for deletion. |
| NoSupport | The filesystem driver does not support deletion. |
| NoPermission | General security violation |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| ResolvePath | A call to ResolvePath() failed |
| NullArgs | Function call missing argument value(s) |
Deletes volumes from the system.
| Parameter | Description |
|---|---|
| Name | The 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.
| Okay | The volume was removed. |
|---|---|
| NoPermission | An attempt to delete a system volume was denied. |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| NullArgs | Function call missing argument value(s) |
Resolves a field ID to its registered name.
| Parameter | Description |
|---|---|
| FieldID | The 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.
The name of the field is returned.
Returns the internal MetaClass for a given class ID.
| Parameter | Description |
|---|---|
| ClassID | A 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.
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.
Finds field descriptors for any class, by ID.
| Parameter | Description |
|---|---|
| Object | The target object. |
| FieldID | The 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.
Returns a pointer to the Field descriptor, otherwise NULL if not found.
Searches for objects by name.
| Parameter | Description |
|---|---|
| Name | The name of an object to search for. |
| ClassID | Optional. Set to a class ID to filter the results down to a specific class type. |
| ObjectID | An 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.
| Okay | At least one matching object was found and stored in the ObjectID. |
|---|---|
| Search | No objects matching the given name could be found. |
| EmptyString | A required string value contains no characters |
| NullArgs | Function call missing argument value(s) |
Terminates an object by its unique identifier.
| Parameter | Description |
|---|---|
| ObjectID | The 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.
| Okay | The object was terminated successfully. |
|---|---|
| InUse | The object is already terminating, or destruction has been deferred until it is unlocked. |
| AccessObject | The object could not be accessed for destruction. |
| DoesNotExist | The object identifier is not registered. |
Safely deallocates resources allocated by AllocResource() and similar functions.
| Parameter | Description |
|---|---|
| ID | The 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.
| Okay | The resource was successfully freed. |
|---|---|
| Terminate | Termination requested |
| InUse | The resource is pinned or another caller already owns its destruction. |
| DoesNotExist | The specified memory block identifier is not valid or already freed. |
Generates 32-bit IEEE 802.3 CRC checksum values.
| Parameter | Description |
|---|---|
| CRC | If streaming data to this function, this value must reflect the most recently returned CRC integer. Otherwise set to zero. |
| Data | The data to generate a CRC value for. |
| Length | The 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.
Returns the computed 32 bit CRC value for the given data.
Returns a message structure if called from an action that was executed by the message system.
| Parameter | Description |
|---|---|
| Action | Action 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.
A Message structure is returned if the function is called in valid circumstances, otherwise NULL.
Returns the class ID of an ID-referenced object.
| Parameter | Description |
|---|---|
| Object | The 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.
Returns the base class ID of the object or zero if failure.
Translates error codes into human readable strings.
| Parameter | Description |
|---|---|
| Error | The 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.
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.
Generates unique event ID's suitable for event broadcasting.
| Parameter | Description |
|---|---|
| Group | The group to which the event belongs. |
| SubGroup | The sub-group to which the event belongs (case-sensitive). |
| Event | The 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:
| Name | Description |
|---|---|
| EVG::ANDROID | Android specific events that do not already fit existing categories |
| EVG::APP | Custom event dispatched from an application |
| EVG::AUDIO | Audio system events |
| EVG::CLASS | Custom event dispatched from a class that doesn't fit within the rest of the event framework |
| EVG::DISPLAY | Video display events |
| EVG::FILESYSTEM | File system events |
| EVG::GUI | Events generated by the Graphical User Interface |
| EVG::HARDWARE | Hardware device events that are not covered by other types |
| EVG::IO | Input/Output events |
| EVG::NETWORK | Network events |
| EVG::POWER | Power Management - can also include app-specific events relating to resource management |
| EVG::SYSTEM | System-wide events |
| EVG::USER | User 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.
The event ID is returned as a 64-bit integer.
Returns a direct pointer for any object ID.
| Parameter | Description |
|---|---|
| Object | The ID of the object to lookup. |
This function translates an object ID to its respective address pointer.
The address of the object is returned, or NULL if the ID does not relate to an object.
Returns the unique ID of an object's owner.
| Parameter | Description |
|---|---|
| Object | The 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.
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.
Retrieves miscellaneous resource identifiers.
| Parameter | Description |
|---|---|
| Resource | The 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.
Returns the value of the resource that you have requested. If the resource ID is not known by the Core, NULL is returned.
Returns miscellaneous data values from the Core.
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.
A read-only SystemState structure is returned.
Returns the UID of the current thread.
Returns a unique ID for the active thread. The ID has no relationship with the host operating system and is not re-used.
A unique ID for the active thread is returned.
Analyse a file and identify a class that can process it.
| Parameter | Description |
|---|---|
| Path | The location of the object data. |
| Filter | Restrict the search to classes in this subset, or use CLASSID::NIL to search all classes. |
| Class | Must refer to a CLASSID variable that will store the resulting class ID. |
| SubClass | Optional 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.
| Okay | Operation successful. |
|---|---|
| Search | A suitable class could not be found for the data source. |
| FileNotFound | File not found |
| Read | Error reading data |
| VirtualVolume | ResolvePath() failed to resolve the path because it is a virtual reference |
| NullArgs | Function call missing argument value(s) |
Initialises an object so that it is ready for use.
| Parameter | Description |
|---|---|
| Object | The 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.
| Okay | The object was initialised. |
|---|---|
| LostClass | The object has lost its class reference |
| NoSupport | Operation not supported |
| DoubleInit | Warning - Attempt to initialise a resource twice |
| ObjectCorrupt | The object structure is corrupt or has not been initialised |
| UseDerived | Requested to use a registered derived class (not an error) |
Returns a list of all children belonging to an object.
| Parameter | Description |
|---|---|
| Object | An object to query. |
| List | Must 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.
| Okay | Zero or more children were found and listed. |
|---|---|
| LockFailed | Failed to lock a required resource |
| NullArgs | Function call missing argument value(s) |
Loads files into a local cache for fast file processing.
| Parameter | Description |
|---|---|
| Path | The location of the file to be cached. |
| Flags | Optional flags are specified here. |
| Cache | A 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.
| Okay | The file was cached successfully. |
|---|---|
| Search | If CHECK_EXISTS is specified, this failure indicates that the file is not cached. |
| Read | Error reading data |
| CreateObject | A call to CreateObject() failed |
| NullArgs | Function call missing argument value(s) |
Lock an object to prevent contention between threads.
| Parameter | Description |
|---|---|
| Object | The address of the object to lock. |
| MilliSeconds | The 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.
| Okay | Operation successful. |
|---|---|
| Cancelled | The thread has been requested to stop and cannot pause. |
| LockFailed | Failed to initialise the sleep record for the waiting thread. |
| TimeOut | Function timed-out before successful completion |
| MarkedForDeletion | A resource cannot be accessed as it is marked for deletion |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| DoesNotExist | The object was removed while waiting for the lock. |
| NullArgs | Function call missing argument value(s) |
Moves folders and files to new locations.
| Parameter | Description |
|---|---|
| Source | The source path. |
| Dest | The destination path. |
| Callback | Optional 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).
| Okay | Operation successful. |
|---|---|
| Failed | General failure |
| NullArgs | Function call missing argument value(s) |
Creates new objects.
| Parameter | Description |
|---|---|
| ClassID | A class ID from system/register.h or generated by ResolveClassName(). |
| Flags | Optional flags. |
| Object | Pointer 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().
| Okay | Operation successful. |
|---|---|
| MissingClass | The ClassID is invalid or refers to a class that is not installed. |
| AllocMemory | Failed to create a new memory block |
| NullArgs | Function call missing argument value(s) |
Send a notification event to action subscribers.
| Parameter | Description |
|---|---|
| Object | Pointer to the object that is to receive the notification message. |
| Action | The action ID for notification. |
| Args | Pointer to an action parameter structure that is relevant to the Action ID. |
| Error | The 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;
}
Opens a folder for content scanning.
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.
| Okay | Operation successful. |
|---|---|
| EndOfSequence | The end of the sequence has been reached |
| Args | Invalid arguments passed to function |
| AllocMemory | Failed to create a new memory block |
| ResolvePath | A call to ResolvePath() failed |
| NullArgs | Function call missing argument value(s) |
Returns the context of the client.
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.
An object reference is returned, or NULL if there is no parent context.
Protects a resource from termination until a matching unpin.
| Parameter | Description |
|---|---|
| ResourceID | The 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().
| Okay | One lifetime pin was acquired. |
|---|---|
| OutOfRange | The pin counter is saturated. |
| MarkedForDeletion | Destruction is pending or already in progress. |
| DoesNotExist | No usable non-object resource with this identifier is registered. |
| NullArgs | ResourceID is zero. |
Returns the current system time, in microseconds.
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.
Returns the system time in microseconds. Could return zero in the extremely unlikely event of an error.
Processes system messages that are queued in the task's message buffer.
| Parameter | Description |
|---|---|
| Flags | Optional flags are specified here (clients should set a value of zero). |
| Timeout | A 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.
| Okay | Operation successful. |
|---|---|
| Terminate | A MSGID::QUIT message type was found on the message queue. |
| NoSupport | Operation not supported |
| Timeout | Function timed-out before successful completion |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| AccessObject | Attempting to lock an object failed |
| Recursion | Detected an illegal attempt at recursion |
| OutsideMainThread | Operation permitted from the main thread only |
Delay the execution of an action by adding the call to the message queue.
| Parameter | Description |
|---|---|
| Action | The ID of an action or method to execute. |
| Object | The target object. |
| Args | The 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.
| Okay | Operation successful. |
|---|---|
| OutOfRange | The Action ID is invalid. |
| MissingClass | The class could not be found in the system |
| NullArgs | Function call missing argument value(s) |
Reads a file into a buffer.
| Parameter | Description |
|---|---|
| Path | The path of the file. |
| Buffer | Buffer that will receive the file content. |
| Result | The 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).
| Okay | Operation successful. |
|---|---|
| File | File error, e.g. file not found |
| FileNotFound | File not found |
| Args | Invalid arguments passed to function |
| Read | Error reading data |
| InvalidPath | Invalid file or folder path detected |
| VirtualVolume | ResolvePath() failed to resolve the path because it is a virtual reference |
| OpenFile | The file could not be opened |
Read a named tag from a FileInfo structure.
| Parameter | Description |
|---|---|
| Info | Pointer to a valid FileInfo structure. |
| Name | The name of the tag, which must be declared in camel-case as tags are case-sensitive. |
| Value | The 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.
| Okay | Operation successful. |
|---|---|
| NotFound | A search routine in this function failed |
| NullArgs | Function call missing argument value(s) |
Registers a file descriptor for monitoring when the task is asleep.
| Parameter | Description |
|---|---|
| FD | The file descriptor that is to be watched. |
| Flags | Set to at least one of READ, WRITE, EXCEPT, REMOVE. |
| Routine | The routine that will read from the descriptor when data is detected on it. The prototype is void Routine(HOSTHANDLE FD, APTR Data). |
| Data | User 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.
| Okay | The FD was successfully registered. |
|---|---|
| Args | The FD was set to a value of -1. |
| NoSupport | The host platform does not support the provided FD. |
Release a locked object.
| Parameter | Description |
|---|---|
| Object | Pointer 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.
Resolve a valid CLASSID to its name.
| Parameter | Description |
|---|---|
| ID | The 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.
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.
Resolves any class name to a CLASSID UID.
| Parameter | Description |
|---|---|
| Name | The 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.
Returns the class ID identified from the class name, or NULL if the class could not be found.
Converts a group ID to its corresponding name.
| Parameter | Description |
|---|---|
| Group | The 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.
The group name is returned, or NULL if the ID cannot be resolved.
Converts volume-based paths into absolute paths applicable to the host platform.
| Parameter | Description |
|---|---|
| Path | The path to be resolved. |
| Flags | Optional flags. |
| Result | Refer 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.
| Name | Description |
|---|---|
| RSF::APPROXIMATE | Ignores file extensions for the purpose of file name matching. |
| RSF::CASE_SENSITIVE | For 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_VIRTUAL | If 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_SCAN | Do not perform more than one iteration when resolving the source file path. |
| RSF::NO_FILE_CHECK | Do not test for the existence of the targeted file or folder during the resolution process. |
| RSF::PATH | Use 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.
| Okay | The Path was resolved. |
|---|---|
| InvalidData | Volume resolution returned invalid path data. |
| Search | The given volume does not exist. |
| FileNotFound | The path was resolved, but the referenced file or folder does not exist (use NO_FILE_CHECK to avoid this error code). |
| InvalidPath | The path is malformed. |
| SystemLocked | The volume registry could not be accessed. |
| VirtualVolume | The path refers to a virtual volume (use CHECK_VIRTUAL to return Okay instead). |
| Loop | The volume refers back to itself. |
| LoadModule | A volume extension could not be loaded. |
Converts a user ID to its corresponding name.
| Parameter | Description |
|---|---|
| User | The 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.
The user name is returned, or NULL if the ID cannot be resolved.
Scans the content of a folder, by item.
| Parameter | Description |
|---|---|
| Info | Pointer 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.
| Okay | An item was successfully scanned from the folder. |
|---|---|
| EndOfSequence | There are no more items to scan. |
| InvalidData | There is an error in the provided data |
| Args | Invalid arguments passed to function |
| NoSupport | Operation not supported |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| NullArgs | Function call missing argument value(s) |
Scans a message queue for multiple occurrences of a message type.
| Parameter | Description |
|---|---|
| Handle | Pointer 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. |
| Type | The message type to filter for, or zero to scan all messages in the queue. |
| Buffer | Optional 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.
| Okay | Operation successful. |
|---|---|
| Search | No more messages are left on the queue, or no messages that match the given Type are on the queue. |
| Args | The supplied buffer is too large for the internal message interface. |
| OutOfRange | A value is outside of the valid range |
| NullArgs | Function call missing argument value(s) |
Add a message to the local message queue.
| Parameter | Description |
|---|---|
| Type | The message Type/ID being sent. Unique type ID's can be obtained from AllocateID(). |
| Flags | Optional flags. |
| Data | Optional 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().
| Okay | The message was successfully written to the message queue. |
|---|---|
| Args | Invalid arguments passed to function |
Forces the user and group permissions to be applied to new files and folders.
| Parameter | Description |
|---|---|
| User | User ID to apply to new files. |
| Group | Group ID to apply to new files. |
| Permissions | Permission 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.
Register a callback for log messages.
| Parameter | Description |
|---|---|
| Callback | Pointer to the log callback function to register. |
| DepthLimit | Maximum branch depth to forward to the callback. |
| LogLimit | Maximum 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.
Sets the name of an object.
| Parameter | Description |
|---|---|
| Object | The target object. |
| Name | The 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.
| Okay | Operation successful. |
|---|---|
| LockFailed | Failed to lock a required resource |
| NullArgs | Function call missing argument value(s) |
Changes object ownership dynamically.
| Parameter | Description |
|---|---|
| Object | The object to modify. |
| Owner | The 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:
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.
| Okay | Operation successful. |
|---|---|
| NoSupport | Operation not supported |
| SystemCorrupt | System corruption detected |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| OwnerPassThrough | Container pass through notification |
| NullArgs | Function call missing argument value(s) |
| Recursion | Detected an illegal attempt at recursion |
Updates a writable Core resource value.
| Parameter | Description |
|---|---|
| Resource | The writable resource identifier. |
| Value | The 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 code is dependent on the targeted resource.
Redefines the location of a system resource path.
| Parameter | Description |
|---|---|
| PathType | The ID of the resource path to set. |
| Path | The 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.
| Okay | Operation successful. |
|---|---|
| Args | Invalid arguments passed to function |
| NullArgs | Function call missing argument value(s) |
Create or modify a filesystem volume.
| Parameter | Description |
|---|---|
| Name | Required. The name of the volume. |
| Path | Required. 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. |
| Icon | An 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. |
| Label | An 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 ...). |
| Device | If the volume references the root of a device, specify a device name of portable, fixed, cd, network or usb. |
| Flags | Optional 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:
| Name | Description |
|---|---|
| VOLUME::HIDDEN | Hides the volume so that it will not show up when reading volumes from the root path :. |
| VOLUME::PRIORITY | If 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::REPLACE | If the volume already exists, all paths that are attached to it will be replaced with the new path setting. |
| VOLUME::SYSTEM | Identifies the volume as being created by the system (this flag is not for client use). |
| Okay | The volume was successfully added. |
|---|---|
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| NullArgs | A valid name and path string was not provided. |
Monitor action calls made against an object.
| Parameter | Description |
|---|---|
| Object | The target object. |
| Action | The ID of the action that will be monitored. Methods are not supported. |
| Callback | A 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.
| Okay | Operation successful. |
|---|---|
| Args | Invalid arguments passed to function |
| OutOfRange | The Action parameter is invalid. |
| NullArgs | Function call missing argument value(s) |
Subscribe to a system event.
| Parameter | Description |
|---|---|
| Event | An event identifier. |
| Callback | The function that will be subscribed to the event. |
| Handle | Pointer 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.
| Okay | Operation successful. |
|---|---|
| Args | Invalid arguments passed to function |
| AllocMemory | Failed to create a new memory block |
| NullArgs | Function call missing argument value(s) |
Subscribes an object or function to the timer service.
| Parameter | Description |
|---|---|
| Interval | The total number of seconds to wait between timer calls. |
| Callback | A callback function is required that will be called on each time cycle. |
| Subscription | Optional. 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.
| Okay | Operation successful. |
|---|---|
| Args | Invalid arguments passed to function |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| InvalidState | The subscriber is marked for termination. |
| NullArgs | Function call missing argument value(s) |
Assign a resource manager to an address, or update an existing one.
| Parameter | Description |
|---|---|
| ResourceID | Unique identifier for the resource to register or replace. |
| Address | Address of the resource, or NULL to preserve an existing address. |
| OwnerID | Optional owning resource ID, normally an object. Use 0 when the resource is not owned. |
| Manager | Resource 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.
| Okay | Operation successful. |
|---|---|
| InUse | Resource is in use |
| NullArgs | ResourceID is 0, or Manager is NULL when registering a new resource. |
Unloads files from the file cache.
| Parameter | Description |
|---|---|
| Cache | A pointer to a CacheFile structure returned from LoadFile(). |
This function unloads cached files that have been previously loaded with the LoadFile() function.
Releases a lifetime pin from a resource.
| Parameter | Description |
|---|---|
| ResourceID | The 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.
| Okay | One pin was released and any required deferred destruction succeeded. |
|---|---|
| ResourceNotLocked | The resource has no pin to release. |
| DoesNotExist | No usable non-object resource with this identifier is registered. |
| NullArgs | ResourceID is zero. |
Terminates action subscriptions.
| Parameter | Description |
|---|---|
| Object | The object that you are unsubscribing from. |
| Action | The ID of the action that will be unsubscribed, or zero for all actions. |
| Callback | The 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.
| Okay | Operation successful. |
|---|---|
| Args | Invalid arguments passed to function |
| NullArgs | Function call missing argument value(s) |
Removes an event subscription.
| Parameter | Description |
|---|---|
| Handle | An event handle returned from SubscribeEvent() |
Use UnsubscribeEvent() to remove an existing event subscription. A valid handle returned from the SubscribeEvent() function must be provided.
Updates the data of any message that is queued.
| Parameter | Description |
|---|---|
| Message | The ID of the message that will be updated. |
| Type | The type of the message. |
| Data | Optional 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.
| Okay | The message was successfully updated. |
|---|---|
| Search | The supplied Message ID does not refer to a message in the queue. |
| Args | The supplied data is too large for the internal message interface. |
| NullArgs | Function call missing argument value(s) |
Modify or remove a subscription created by SubscribeTimer().
| Parameter | Description |
|---|---|
| Subscription | The timer subscription to modify. |
| Interval | The 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.
| Okay | Operation successful. |
|---|---|
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| NullArgs | Function call missing argument value(s) |
| AlreadyLocked | Object or resource has already been locked |
Process incoming messages while waiting on objects to complete their activities.
| Parameter | Description |
|---|---|
| Flags | Optional flags are specified here. |
| Timeout | A 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. |
| ObjectSignals | A 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.
| Okay | Operation successful. |
|---|---|
| Terminate | Termination requested |
| ExceptionThreshold | Termination requested |
| Timeout | Function timed-out before successful completion |
| SystemLocked | Part of the system is unreachable due to a persistent lock |
| Recursion | Detected an illegal attempt at recursion |
| OutsideMainThread | Operation permitted from the main thread only |
| MessageOperation | A message queue operation has failed |
Waits for a specified amount of seconds.
| Parameter | Description |
|---|---|
| Seconds | The 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.
| Okay | Operation successful. |
|---|---|
| Cancelled | The thread has been requested to stop and cannot pause. |
| Terminate | Termination requested |
Interrupt a sleeping thread.
| Parameter | Description |
|---|---|
| Thread | The target thread's unique ID, as returned by GetThreadID(). |
| Stop | If 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.
| Okay | The thread was successfully interrupted. |
|---|---|
| Search | No thread with the given ID was found in the registry. |
Action identifiers
| Name | Description |
|---|---|
| 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 |
Class categories
| Name | Description |
|---|---|
| CCF::AUDIO | Audio classes interface with audio hardware and drivers for audio playback and recording purposes |
| CCF::COMMAND | Command classes perform specific procedures, like copying or moving a file, managing volumes or executing a program |
| CCF::DATA | Data classes parse, query and manipulate data |
| CCF::FILESYSTEM | FileSystem classes are based on file management and interaction with file based data |
| CCF::GRAPHICS | Graphics classes provide graphics management and drawing services |
| CCF::GUI | GUI classes are used in the development of graphical user interfaces |
| CCF::IO | I/O classes manage hardware and software based input and output |
| CCF::MISC | Miscellaneous classes do not fit into any of the other available categories |
| CCF::MULTIMEDIA | Classes that represent more than one media type, e.g. video files |
| CCF::NETWORK | Network classes interface with system drivers to simplify network communications |
| CCF::SYSTEM | System classes are designed to provide low-level services related to system management |
| CCF::TOOL | Tools provide interactive services for the user |
Console types
| Name | Description |
|---|---|
| CONTYPE::HANDLE | Redirected to a handle |
| CONTYPE::MANUAL | Console created manually |
| CONTYPE::NONE | No console available |
| CONTYPE::TERMINAL | Launched from a terminal |
Event categories
| Name | Description |
|---|---|
| EVG::ANDROID | Android specific events that do not already fit existing categories |
| EVG::APP | Custom event dispatched from an application |
| EVG::AUDIO | Audio system events |
| EVG::CLASS | Custom event dispatched from a class that doesn't fit within the rest of the event framework |
| EVG::DISPLAY | Video display events |
| EVG::FILESYSTEM | File system events |
| EVG::GUI | Events generated by the Graphical User Interface |
| EVG::HARDWARE | Hardware device events that are not covered by other types |
| EVG::IO | Input/Output events |
| EVG::NETWORK | Network events |
| EVG::POWER | Power Management - can also include app-specific events relating to resource management |
| EVG::SYSTEM | System-wide events |
| EVG::USER | User activity events (such as user login) |
Flags for file feedback.
| Name | Description |
|---|---|
| FBK::COPY_FILE | A file is to be, or has been copied. |
| FBK::DELETE_FILE | A file is to be, or has been deleted. |
| FBK::MOVE_FILE | A file is to be, or has been moved. |
Types for AllocateID()
| Name | Description |
|---|---|
| IDTYPE::FUNCTION | Function IDs are used to track FUNCTION types and are assigned to the function ID field. |
| IDTYPE::GLOBAL | Global IDs have no specific association with anything. |
| IDTYPE::MESSAGE | Message IDs are allocated for the purpose of sending uniquely identifiable messages between tasks. |
| IDTYPE::RESOURCE | Resource identifier for TrackResource() |
JET constants are documented in GetInputEvent()
| Name | Description |
|---|---|
| JET::ABS_XY | The X, Y values are defined as absolute coordinates, relative to the top-left of the display |
| JET::BUTTON_1 | Left 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_10 | Non-specific button assignment |
| JET::BUTTON_2 | Right mouse button; XBox X button, PS cross button |
| JET::BUTTON_3 | Middle mouse button; XBox Y button, PS triangle |
| JET::BUTTON_4 | Alt. mouse button 1; XBox B button, PS circle |
| JET::BUTTON_5 | Alt. mouse button 2 |
| JET::BUTTON_6 | Non-specific button assignment |
| JET::BUTTON_7 | Non-specific button assignment |
| JET::BUTTON_8 | Non-specific button assignment |
| JET::BUTTON_9 | Non-specific button assignment |
| JET::CROSSED_IN | This 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_OUT | This 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_XY | Controller tilted on the X/Y axis. Value indicates angle, -ve = left, +ve = right |
| JET::DEVICE_TILT_Z | Controller is rising or falling. Value expressed as 'speed', |
| JET::DISPLAY_EDGE | Recently supplied input occurred at the edge of the display |
| JET::PEN_TILT_XY | Pen tilt angle. 0 is pointing down directly with nib at bottom, 0.5 is 90 degrees, 1.0 is inversed (eraser at bottom) |
| JET::PRESSURE | Amount of pressure applied, ranges from 0 (none) to 1.0 (normal) and possibly higher if user presses hard enough |
| JET::WHEEL | Mouse wheel rotation - the value generally reflects the number of 'clicks' rotated on the wheel |
| JET::WHEEL_TILT | Some mouse wheels can be tilted to the left or right. Ranges from -1.0 to +1.0 |
JTYPE flags are used to categorise input types
| Name | Description |
|---|---|
| JTYPE::ANALOG | Analog movement (ranging from -1.0 to 1.0) |
| JTYPE::ANCHORED | Cursor has been anchored with LockCursor() |
| JTYPE::BUTTON | Input is a physical button or switch |
| JTYPE::CROSSING | Crossing events manage the entering and leaving of an area |
| JTYPE::DBL_CLICK | Set 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::DIGITAL | D-Pad or digital joystick source (restricted to +/- 1) |
| JTYPE::DRAGGED | Set if sufficient movement occurred between the original click and its point of release (usually requires a 3 or more pixel difference) |
| JTYPE::DRAG_ITEM | This special flag is set by the input system if the pointer is click-dragging an object at the time of the event |
| JTYPE::EXT_MOVEMENT | Extended 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::MOVEMENT | X/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::REPEATED | Input is a repeated entry (i.e. user is holding down a button and a repetition timer is being triggered) |
| JTYPE::SECONDARY | Indicates to the receiver of this message that it is not the primary/original recipient |
Flags for LoadFile()
| Name | Description |
|---|---|
| LDF::CHECK_EXISTS | Limits 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. |
AnalysePath() values
| Name | Description |
|---|---|
| LOC::DIRECTORY | The path refers to a folder. |
| LOC::FILE | The path refers to a file. |
| LOC::VOLUME | The path refers to a volume name. |
Memory flags
| Name | Description |
|---|---|
| MEM::NO_CLEAR | Do not clear the memory on allocation (saves time) |
Message flags.
| Name | Description |
|---|---|
| MSF::NO_DUPLICATE | If 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::UPDATE | If Type matches a queued message, update that message's data in place. |
Reserved message ID's that are handled internally.
| Name | Description |
|---|---|
| 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 |
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.
| Name | Description |
|---|---|
| NF::ASYNC_ACTIVE | Read-only indicator that asynchronous actions are queued or executing against this object. |
| NF::FREE | Read-only indicator for when the object is being freed. |
| NF::FREE_ON_UNLOCK | Set if FreeResource() was called on an object under lock conditions. Immediately collects when unlocked. |
| NF::INITIALISED | Read-only indicator if the object has been initialised. |
| NF::LOCAL | Classes can allocate local objects to stop them from being associated with the client. |
| NF::PRIVATE | |
| NF::RECLASSED | The object switched from the base-class to a derived class during initialisation. |
| NF::SIGNALLED | The object has been signalled and is awaiting processing. |
| NF::TIMER_SUB | The object is subscribed to a timer interval. |
| NF::UNTRACKED | An object created with this flag will not be tracked back to the object that created it. |
| Name | Description |
|---|---|
| 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 |
Permission flags
| Name | Description |
|---|---|
| PERMIT::ALL_DELETE | Synonym for EVERYONE_DELETE |
| PERMIT::ALL_EXEC | Synonym for EVERYONE_EXEC |
| PERMIT::ALL_READ | Synonym for EVERYONE_READ |
| PERMIT::ALL_WRITE | Synonym for EVERYONE_WRITE |
| PERMIT::ARCHIVE | Marks the file for future backup. The flag should be cleared after the backup has succeeded |
| PERMIT::DELETE | Owner can delete. If the file system does not support this, deletion is enabled via the WRITE flag |
| PERMIT::EVERYONE_ACCESS | Synonym for EVERYONE_READ | EVERYONE_WRITE | EVERYONE_EXEC | EVERYONE_DELETE |
| PERMIT::EVERYONE_DELETE | Synonym for DELETE | GROUP_DELETE | OTHERS_DELETE |
| PERMIT::EVERYONE_EXEC | Synonym for EXEC | GROUP_EXEC | OTHERS_EXEC |
| PERMIT::EVERYONE_READ | Synonym for READ | GROUP_READ | OTHERS_READ |
| PERMIT::EVERYONE_READWRITE | Synonym for EVERYONE_READ | EVERYONE_WRITE |
| PERMIT::EVERYONE_WRITE | Synonym for WRITE | GROUP_WRITE | OTHERS_WRITE |
| PERMIT::EXEC | User/Owner can execute |
| PERMIT::GROUP | Synonym for GROUP_READ | GROUP_WRITE | GROUP_EXEC | GROUP_DELETE |
| PERMIT::GROUPID | Allows executables to run with a set group id |
| PERMIT::GROUP_DELETE | Group members can delete |
| PERMIT::GROUP_EXEC | Group members can execute |
| PERMIT::GROUP_READ | Group members can read |
| PERMIT::GROUP_WRITE | Group members can write |
| PERMIT::HIDDEN | Recommends that the file is hidden from view by default |
| PERMIT::INHERIT | Inherit permissions from parent folder and logical OR them with preset permission flags |
| PERMIT::META | Synonym for HIDDEN | PASSWORD | OFFLINE | NETWORK |
| PERMIT::NETWORK | File is hosted on another machine |
| PERMIT::OFFLINE | File content for this networked file has not been cached on the local PC |
| PERMIT::OTHERS | Synonym for OTHERS_READ | OTHERS_WRITE | OTHERS_EXEC | OTHERS_DELETE |
| PERMIT::OTHERS_DELETE | Others can delete |
| PERMIT::OTHERS_EXEC | Others can execute |
| PERMIT::OTHERS_READ | Others can read |
| PERMIT::OTHERS_WRITE | Others can write |
| PERMIT::PASSWORD | File is password protected |
| PERMIT::READ | User/Owner has read access. This will not allow compiled code to be executed |
| PERMIT::USER | Synonym for READ | WRITE | EXEC | DELETE |
| PERMIT::USERID | Allows executables to run with a set user id |
| PERMIT::USER_EXEC | Synonym for EXEC |
| PERMIT::USER_READ | Synonym for READ |
| PERMIT::USER_WRITE | Synonym for WRITE |
| PERMIT::WRITE | User/Owner can write |
Flags for ProcessMessages
| Name | Description |
|---|---|
| PMF::ANY_SIGNAL | Return from WaitForObjects() when any monitored object is signalled. |
| PMF::EVENT_LOOP | Set if this is the program's main event loop. Should be accompanied with an infinite timeout. |
Flags for the OpenDir() function.
| Name | Description |
|---|---|
| RDF::DATE | Retrieve the date stamp of each file. |
| RDF::FILE | Read all files in the folder. |
| RDF::FILES | Read all files in the folder. |
| RDF::FOLDER | Read all folders/volumes in the folder. |
| RDF::FOLDERS | Read all folders/volumes in the folder. |
| RDF::LINK | Feedback only - file/folder is actually a link to another location. |
| RDF::PERMISSIONS | Get permission/security information. |
| RDF::QUALIFIED | Return fully qualified folder names (i.e. trailing slash or colon for each name). |
| RDF::QUALIFY | Return fully qualified folder names (i.e. trailing slash or colon for each name). |
| RDF::READ_ALL | Synonym for SIZE | DATE | PERMISSIONS | FILES | FOLDERS |
| RDF::READ_ONLY | Read-only (not permissions related, can indicate read-only media). |
| RDF::SIZE | Retrieve the byte size of each file. |
| RDF::STREAM | Path is connected via a stream, e.g. network connection. |
| RDF::TAGS | Receive additional information for each file, such as comments, author and copyright. The results are stored in the Tags field of each file. |
| RDF::TIME | Retrieve the date stamp of each file. |
| RDF::VIRTUAL | Path is to a virtual device. |
| RDF::VOLUME | Feedback only - indicates a volume. |
| Name | Description |
|---|---|
| RES::CPU_SPEED | The average top-speed of all CPU cores in Mhz. |
| RES::FREE_MEMORY | The total amount of free memory. |
| RES::FREE_SWAP | The total amount of free swap memory. |
| RES::JNI_ENV | Return the current JNI environment string. |
| RES::KEY_STATE | Maintains the state of key qualifiers such as caps-lock and the shift keys. |
| RES::LOG_DEPTH | The current depth of log messages. |
| RES::LOG_LEVEL | The current level of log detail (larger numbers indicate more detail). |
| RES::MAIN_THREAD | Read-only, returns true if called from the main thread. |
| RES::MAIN_THREAD_ID | Read-only, returns the ID of the main thread. |
| RES::MEMORY_USAGE | The total amount of memory used by the current process, in bytes. |
| RES::PRIVILEGED | This is set to true if the process has elevated privileges (such as superuser or administrative rights). |
| RES::PRIVILEGED_USER | If 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_STATE | Life-cycle stage of the running process |
| RES::STRUCT_DB | Returns a map of hashed struct names and corresponding struct sizes. |
| RES::TOTAL_MEMORY | The total amount of installed memory. |
| RES::TOTAL_SHARED_MEMORY | The total amount of shared memory in use (system wide). |
| RES::TOTAL_SWAP | The total amount of available swap space. |
| RES::WINDOWS_ICON | The Microsoft Windows resource icon ID for this process. |
Flags for RegisterFD()
| Name | Description |
|---|---|
| RFD::ALWAYS_CALL | Always call this FD's handler prior to the process going to sleep. |
| RFD::EXCEPT | Activate the callback if error conditions are pending. |
| RFD::READ | Activate the callback if there is data available to read. |
| RFD::RECALL | Set 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::REMOVE | Stop monitoring this file descriptor. |
| RFD::SOCKET | Identifies the file descriptor as a socket (Linux systems only). |
| RFD::WRITE | Activate the callback if there is room to write to the FD's buffer. |
Path types for SetResourcePath()
| Name | Description |
|---|---|
| RP::MODULE_PATH | An 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_PATH | Overrides the root path, which defaults to the location at which Kōtuku is installed. |
| RP::SYSTEM_PATH | The path of the system: volume, which otherwise defaults to [root]:system/. |
Flags for ResolvePath()
| Name | Description |
|---|---|
| RSF::APPROXIMATE | Ignores file extensions for the purpose of file name matching. |
| RSF::CASE_SENSITIVE | For 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_VIRTUAL | If 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_SCAN | Do not perform more than one iteration when resolving the source file path. |
| RSF::NO_FILE_CHECK | Do not test for the existence of the targeted file or folder during the resolution process. |
| RSF::PATH | Use the PATH environment variable to resolve the file name in the Path parameter. |
| Name | Description |
|---|---|
| TOI::ANDROID_ASSETMGR | |
| TOI::ANDROID_CLASS | |
| TOI::ANDROID_ENV | |
| TOI::LOCAL_CACHE | |
| TOI::LOCAL_STORAGE |
Options for SetVolume()
| Name | Description |
|---|---|
| VOLUME::HIDDEN | Hides the volume so that it will not show up when reading volumes from the root path :. |
| VOLUME::PRIORITY | If 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::REPLACE | If the volume already exists, all paths that are attached to it will be replaced with the new path setting. |
| VOLUME::SYSTEM | Identifies the volume as being created by the system (this flag is not for client use). |
| Field | Type | Description |
|---|---|---|
| Routine | APTR | Pointer to the function entry point |
| ActionCode | AC | Action identifier |
Structure for ActionList
| Field | Type | Description |
|---|---|---|
| Hash | UINT | Hash of the action name. |
| Size | INT | Byte-size of the structure for this action. |
| Name | CSTRING | Name of the action. |
| Args | const struct FunctionField * | List of fields that are passed to this action. |
Structure for ListChildren() function
| Field | Type | Description |
|---|---|---|
| ObjectID | OBJECTID | Object ID |
| ClassID | CLASSID | The class ID of the referenced object. |
Meta information for a class, as recorded in the class database.
| Field | Type | Description |
|---|---|---|
| ClassID | CLASSID | Unique class identifier (hash of Name) |
| ParentID | CLASSID | Parent class ID if this is a derived class |
| Category | CCF | Assigned category |
| Name | STRING | Name of the class |
| Path | STRING | Path to the class file |
| Extension | STRING | Wildcards for matching by file extension, e.g. jpeg|jpg |
| Header | STRING | File identification instruction, e.g. [0:$89504e470d0a1a0a] |
| Icon | STRING | Icon reference in group/name format |
| Description | STRING | File description |
Generic structure for rectangular clipping.
| Field | Type | Description |
|---|---|---|
| Left | INT | Left-most coordinate |
| Top | INT | Top coordinate |
| Right | INT | Right-most coordinate |
| Bottom | INT | Bottom coordinate |
| Field | Type | Description |
|---|---|---|
| RedShift | UINT8 | Right shift value for red (15/16 bit formats only) |
| GreenShift | UINT8 | Right shift value for green |
| BlueShift | UINT8 | Right shift value for blue |
| AlphaShift | UINT8 | Right shift value for alpha |
| RedMask | UINT8 | Unshifted mask value for red (ranges from 0x00 to 0xff) |
| GreenMask | UINT8 | Unshifted mask value for green |
| BlueMask | UINT8 | Unshifted mask value for blue |
| AlphaMask | UINT8 | Unshifted mask value for alpha |
| RedPos | UINT8 | Left shift/positional value for red |
| GreenPos | UINT8 | Left shift/positional value for green |
| BluePos | UINT8 | Left shift/positional value for blue |
| AlphaPos | UINT8 | Left shift/positional value for alpha |
| BitsPerPixel | UINT8 | Number of bits per pixel for this format. |
Generic structure for date-time management
| Field | Type | Description |
|---|---|---|
| Year | INT16 | Year |
| Month | INT8 | Month 1 to 12 |
| Day | INT8 | Day 1 to 31 |
| Hour | INT8 | Hour 0 to 23 |
| Minute | INT8 | Minute 0 to 59 |
| Second | INT8 | Second 0 to 59 |
| TimeZone | INT8 | TimeZone -13 to +13 |
Used by OpenDir() only
| Field | Type | Description |
|---|---|---|
| Info | struct FileInfo * | Pointer to a FileInfo structure |
Generic structure for declaring edge coordinates.
| Field | Type | Description |
|---|---|---|
| Left | INT | Left-most coordinate |
| Top | INT | Top coordinate |
| Right | INT | Right-most coordinate |
| Bottom | INT | Bottom coordinate |
32-bit floating point RGB colour components.
| Field | Type | Description |
|---|---|---|
| Red | FLOAT | Red component value |
| Green | FLOAT | Green component value |
| Blue | FLOAT | Blue component value |
| Alpha | FLOAT | Alpha component value |
Used to describe the public fields of a class.
| Field | Type | Description |
|---|---|---|
| Arg | INT64 | An option to complement the field type. Can be a pointer or an integer value |
| GetValue | FUNCTION * | A virtual function that will retrieve the value for this field |
| SetValue | FUNCTION * | A virtual function that will set the value for this field |
| WriteValue | FUNCTION * | An internal function for writing to this field |
| Name | CSTRING | The English name for the field, e.g. Width |
| FieldID | UINT | 32-bit hash from fieldhash() |
| Offset | UINT16 | Field offset within the object |
| Index | UINT16 | Field array index |
| Flags | UINT | Special flags that describe the field |
Used to construct class blueprints for the MetaClass.
| Field | Type | Description |
|---|---|---|
| Name | CSTRING | The name of the field, e.g. Width |
| GetField | APTR | void GetField(*Object, APTR Result); |
| SetField | APTR | ERR SetField(*Object, APTR Value); |
| Arg | INT64 | Can be a pointer or an integer value |
| Flags | UINT | Special flags that describe the field |
Used to define constants for field references.
| Field | Type | Description |
|---|---|---|
| Name | CSTRING | The name of the constant. |
| Value | INT | The value of the constant. |
| Field | Type | Description |
|---|---|---|
| Size | INT64 | Size of the file |
| Position | INT64 | Current seek position within the file if moving or copying |
| Path | STRING | Path to the file |
| Dest | STRING | Destination file/path if moving or copying |
| FeedbackID | FBK | Set to one of the FBK values |
| Reserved | INT8 | Reserved in case of future expansion |
Metadata for describing a file.
| Field | Type | Description |
|---|---|---|
| Size | INT64 | The size of the file's content. |
| Timestamp | INT64 | 64-bit time stamp - usable only for comparison (e.g. sorting). |
| Next | struct FileInfo * | Next structure in the list, or NULL. |
| Name | STRING | The name of the file. |
| Flags | RDF | Additional flags to describe the file. |
| Permissions | PERMIT | Standard permission flags. |
| UserID | INT | User ID (Unix systems only). |
| GroupID | INT | Group ID (Unix systems only). |
| Created | struct DateTime | The date/time of the file's creation. |
| Modified | struct DateTime | The date/time of the last file modification. |
Used by ActionTable and Function structures to declare lists of parameters.
| Field | Type | Description |
|---|---|---|
| Name | CSTRING | Name of the field |
| Type | UINT | Type of the field |
Colour structure for Hue, Saturation and Value/Light components.
| Field | Type | Description |
|---|---|---|
| Hue | DOUBLE | Between 0 and 359.999 |
| Saturation | DOUBLE | Between 0 and 1.0 |
| Value | DOUBLE | Between 0 and 1.0. Corresponds to Value, Lightness or Brightness |
| Alpha | DOUBLE | Alpha blending value from 0 to 1.0 |
| Field | Type | Description |
|---|---|---|
| Next | const struct InputEvent * | Next event in the chain |
| Value | DOUBLE | The value associated with the Type |
| Timestamp | INT64 | PreciseTime() of the recorded input |
| RecipientID | OBJECTID | Surface that the input message is being conveyed to |
| OverID | OBJECTID | Surface that is directly under the mouse pointer at the time of the event |
| AbsX | DOUBLE | Absolute horizontal position of mouse cursor (relative to the top left of the display) |
| AbsY | DOUBLE | Absolute vertical position of mouse cursor (relative to the top left of the display) |
| X | DOUBLE | Horizontal 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 |
| Y | DOUBLE | Vertical 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 |
| DeviceID | OBJECTID | The hardware device that this event originated from |
| Type | JET | JET constant that describes the event |
| Flags | JTYPE | Broad descriptors for the given Type (see JTYPE flags). Automatically defined when delivered to the pointer object |
| Mask | JTYPE | Mask to use for checking against subscribers |
Message header.
| Field | Type | Description |
|---|---|---|
| Time | INT64 | A timestamp acquired from PreciseTime() when the message was first passed to SendMessage(). |
| UID | INT | A unique identifier automatically created by SendMessage(). |
| Type | MSGID | A message type identifier as defined by the client. |
| Size | INT | The byte-size of the message data, or zero if no data is provided. |
Required in calls to WaitForObjects().
| Field | Type | Description |
|---|---|---|
| Object | OBJECTPTR | Reference to an object to monitor. |
Client options for passing to Kotuku on startup
| Field | Type | Description |
|---|---|---|
| Name | STRING | Program name |
| SystemPath | STRING | Path to system files |
| ModulePath | STRING | Path to module files |
| RootPath | STRING | Kotuku root directory |
| *Args | CSTRING | Command-line arguments |
| Options | const struct OpenTag * | Tag-list of additional options. Typecast to va_list |
| Flags | OPF | Client flags indicating the values that have been defined in this structure |
| MaxDepth | INT | Maximum debug depth |
| Detail | INT | Debug detail level (0 none - 9 trace) |
| ArgCount | INT | Total arguments in Args |
Tags for OpenInfo.Options
| Field | Type | Description |
|---|---|---|
| Tag | TOI | Tag identifier |
16-bit RGB colour value.
| Field | Type | Description |
|---|---|---|
| Red | UINT16 | Red component value |
| Green | UINT16 | Green component value |
| Blue | UINT16 | Blue component value |
| Alpha | UINT16 | Alpha component value |
32-bit RGB colour value.
| Field | Type | Description |
|---|---|---|
| Red | UINT | Red component value |
| Green | UINT | Green component value |
| Blue | UINT | Blue component value |
| Alpha | UINT | Alpha component value |
8-bit RGB colour value.
| Field | Type | Description |
|---|---|---|
| Red | UINT8 | Red component value |
| Green | UINT8 | Green component value |
| Blue | UINT8 | Blue component value |
| Alpha | UINT8 | Alpha component value |
| Field | Type | Description |
|---|---|---|
| AmtColours | INT | Total colours |
| Col | struct RGB8 | RGB Palette |
Unified resource management record
| Field | Type | Description |
|---|---|---|
| Address | APTR | Direct pointer to the resource (optional, can rely on ResourceID instead) |
| Manager | struct ResourceManager * | Reference to the resource manager for this record |
| ResourceID | RESOURCEID | Unique identifier |
| OwnerID | INT | Owner of the resource, could be another resource or object |
| PinCount | UINT | Number of active lifetime pins |
| CollectOnUnlock | BOOL | Collection is pending until the final resource pin is released |
| Terminating | BOOL | A FreeResource() call currently owns the destruction path |
Returned by the GetSystemState() function.
| Field | Type | Description |
|---|---|---|
| Platform | CSTRING | String-based field indicating the user's platform. Currently returns Native, Windows, OSX or Linux. |
| IDL | CSTRING | The Core module's compressed IDL string |
| OpenInfo | const struct OpenInfo * | The OpenInfo structure originally used to initialise the system |
| ConsoleFD | HOSTHANDLE | Internal |
| ConsoleType | CONTYPE | The console type for stdout and stderr, if any |
| Stage | INT16 | The 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. |
| ReleaseBuild | UINT8 | 1 = Release build, 0 = Debug build |
| StaticBuild | UINT8 | 1 = Static build, 0 = Dynamic build |
| Field | Type | Description |
|---|---|---|
| Value | DOUBLE | The unit value. |
| Type | UINT | Additional type information |
Data feed structure for Audio
| Field | Type | Description |
|---|---|---|
| Size | INT | Byte size of this structure |
| Format | INT | Format of the audio data |
| Field | Type | Description |
|---|---|---|
| Values | DOUBLE | The value(s) associated with the Type |
| Timestamp | INT64 | PreciseTime() of the recorded input |
| DeviceID | OBJECTID | The 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) |
| Flags | JTYPE | Broad descriptors for the given Type. Automatically defined when delivered to the pointer object |
| Type | JET | JET constant |
Data feed structure for Keypress
| Field | Type | Description |
|---|---|---|
| Flags | INT | Shift/Control/CapsLock... |
| Value | INT | ASCII value of the key A/B/C/D... |
| Timestamp | INT64 | PreciseTime() at which the keypress was recorded |
| Unicode | INT | Unicode value for pre-calculated key translations |
Data feed item request
| Field | Type | Description |
|---|---|---|
| Item | INT | Identifier for retrieval from the source |
| Preference | INT8 | Data preferences for the returned item(s) |