Boron 0.1.0

boron.h File Reference

The Boron programmer interface. More...

#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

UThreadboron_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.
UBufferboron_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.
UCellboron_result (UThread *)
 Get result of last boron_doCStr() call.
UCellboron_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.

Detailed Description

The Boron programmer interface.


Define Documentation

#define CFUNC ( name   )     static int name( UThread* ut, UCell* a1, UCell* res )

Macro to define C functions.

If the function takes multiple arguments, just index off of a1. For instance, the third argument is (a1+2).

Parameters:
ut The ubiquitous thread pointer.
a1 Pointer to argument cells.
res Pointer to result cell.
Examples:
boron_mini.c.

#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.


Enumeration Type Documentation

enum PortForm

These are the UBuffer::form values for port buffers.

Enumerator:
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.


Function Documentation

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.

Parameters:
dev Pointer to UPortDevice.
name Name of device.

UBuffer* boron_makePort ( UThread ut,
const UPortDevice pdev,
void *  ext,
UCell res 
)

Create port buffer.

Parameters:
pdev Device pointer.
ext Pointer to port extension data or zero.
res Result port cell.
Returns:
UBuffer with type, form, and ptr initialized.
This is usually called from inside a UPortDevice::open method.

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.


Generated on 27 Jan 2012 by Doxygen 1.5.1