Boron 0.1.0

boron_mini.c

This is a basic example of how to use the Boron interpreter.

00001 #include <stdio.h>
00002 #include "boron.h"
00003 
00004 
00005 CFUNC(printHello)
00006 {
00007     int i;
00008     int count = ur_is(a1, UT_INT) ? ur_int(a1) : 1;
00009     (void) ut;
00010 
00011     for( i = 0; i < count; ++i )
00012         printf( "Hello World\n" );
00013 
00014     ur_setId(res, UT_UNSET);
00015     return UR_OK;
00016 }
00017 
00018 
00019 int main()
00020 {
00021     UThread* ut = boron_makeEnv( 0, 0 );            // Startup.
00022     if( ! ut )
00023         return 255;
00024 
00025     boron_addCFunc( ut, printHello, "hello n" );    // Add our cfunc!.
00026     boron_doCStr( ut, "hello 3", -1 );              // Invoke it.
00027     boron_freeEnv( ut );                            // Cleanup.
00028     return 0;
00029 }

Generated on 27 Jan 2012 by Doxygen 1.5.1