This is a basic example of how to use the Boron interpreter.
This is a basic example of how to use the Boron interpreter.
#include <stdio.h>
{
int i;
int count = ur_is(a1, UT_INT) ? ur_int(a1) : 1;
(void) ut;
for( i = 0; i < count; ++i )
printf( "Hello World\n" );
}
static const BoronCFunc myFuncs[] = { printHello };
static const char myFuncSpecs[] = "hello n";
int main()
{
if( ! ut )
return 255;
sizeof(myFuncSpecs)-1 );
return 0;
}
The Boron programmer interface.
UCell * boron_evalUtf8(UThread *, const char *script, int len)
Run script and put result in the last stack cell.
Definition eval.c:2127
#define CFUNC(name)
Macro to define C functions.
Definition boron.h:57
UThread * boron_makeEnv(UEnvParameters *)
Make Boron environment and initial thread.
Definition boron.c:748
UStatus boron_defineCFunc(UThread *, UIndex ctxN, const BoronCFunc *funcs, const char *spec, int slen)
Add C functions to context.
Definition boron.c:396
void boron_freeEnv(UThread *)
Destroy Boron environment.
Definition boron.c:894
UEnvParameters * boron_envParam(UEnvParameters *)
Initialize UEnvParameters structure to default Boron values.
Definition boron.c:714
#define ur_setId(c, t)
Set type and initialize the other 24 bits of UCellId to zero.
Definition urlan.h:701
@ UR_OK
Returned to indicate successful evaluation/operation.
Definition urlan.h:118
The UEnvParameters struct allows the user to override default buffer and structure sizes.
Definition urlan.h:497
The UThread struct stores the data specific to a thread of execution.
Definition urlan.h:309