#include "urlan.h"
Go to the source code of this file.
Data Structures | |
struct | UPortDevice |
The UPortDevice struct holds methods for a class of input/ouput device. More... | |
Defines | |
#define | CFUNC(name) static int name( UThread* ut, UCell* a1, UCell* res ) |
Macro to define C functions. | |
#define | CFUNC_OPTIONS a1[-1].id._pad0 |
Macro to get uint32_t option flags from inside a C function. | |
Enumerations | |
enum | PortForm { UR_PORT_SIMPLE, UR_PORT_EXT } |
These are the UBuffer::form values for port buffers. More... | |
Functions | |
UThread * | boron_makeEnv (UDatatype **dtTable, unsigned int dtCount) |
Make Boron environment and initial thread. | |
void | boron_freeEnv (UThread *) |
Destroy Boron environment. | |
void | boron_addCFunc (UThread *, BoronCFunc func, const char *sig) |
Add C function to the thread context. | |
void | boron_addPortDevice (UThread *, const UPortDevice *, UAtom name) |
Register port device. | |
UBuffer * | boron_makePort (UThread *, const UPortDevice *, void *ext, UCell *res) |
Create port buffer. | |
int | boron_requestAccess (UThread *, const char *msg,...) |
Request user permission to access a resource. | |
void | boron_bindDefault (UThread *, UIndex blkN) |
Bind block in thread dataStore to default contexts. | |
int | boron_doBlockN (UThread *, UIndex blkN, UCell *res) |
Evaluate block and get result. | |
int | boron_doCStr (UThread *, const char *cmd, int len) |
Evaluate C string. | |
UCell * | boron_result (UThread *) |
Get result of last boron_doCStr() call. | |
UCell * | boron_exception (UThread *) |
Get most recent exception. | |
void | boron_reset (UThread *) |
Reset thread after exception. | |
int | boron_throwWord (UThread *, UAtom atom) |
Append word cell to ur_errorBlock(). | |
char * | boron_cstr (UThread *, const UCell *strC, UBuffer *bin) |
Make null terminated UTF-8 string in binary buffer. | |
char * | boron_cpath (UThread *, const UCell *strC, UBuffer *bin) |
Make null terminated UTF-8 string in binary buffer. |
Macro to define C functions.
If the function takes multiple arguments, just index off of a1. For instance, the third argument is (a1+2).
ut | The ubiquitous thread pointer. | |
a1 | Pointer to argument cells. | |
res | Pointer to result cell. |
#define CFUNC_OPTIONS a1[-1].id._pad0 |
Macro to get uint32_t option flags from inside a C function.
Only use this if options were declared in the boron_addCFunc() sig.
enum PortForm |
These are the UBuffer::form values for port buffers.
UR_PORT_SIMPLE | Denotes that UBuffer::ptr is the UPortDevice pointer. |
UR_PORT_EXT | Denotes that UBuffer::ptr points to extension data and that the first member is the UPortDevice pointer. |
void boron_addPortDevice | ( | UThread * | ut, | |
const UPortDevice * | dev, | |||
UAtom | name | |||
) |
Register port device.
A single device struct may be added multiple times with different names.
dev | Pointer to UPortDevice. | |
name | Name of device. |
UBuffer* boron_makePort | ( | UThread * | ut, | |
const UPortDevice * | pdev, | |||
void * | ext, | |||
UCell * | res | |||
) |
Create port buffer.
pdev | Device pointer. | |
ext | Pointer to port extension data or zero. | |
res | Result port cell. |
The UBuffer::type is set to UT_PORT.
If ext is zero then the UBuffer::form is set to UR_PORT_SIMPLE and the UBuffer::ptr member is set to pdev. If ext is non-zero then the form is set to UR_PORT_EXT, ptr is set to ext, and pdev is copied to the start of ext.