00001 #ifndef BORON_H
00002 #define BORON_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "urlan.h"
00024
00025
00026 #define BORON_VERSION_STR "0.2.3"
00027 #define BORON_VERSION 0x000203
00028
00029
00030 enum BoronDataType
00031 {
00032 UT_FUNC = UT_BI_COUNT,
00033 UT_CFUNC,
00034 UT_AFUNC,
00035 UT_PORT,
00036 UT_BORON_COUNT
00037 };
00038
00039
00040 enum BoronWordBindings
00041 {
00042 UR_BIND_FUNC = UR_BIND_USER,
00043 UR_BIND_OPTION
00044
00045
00046 };
00047
00048
00049 typedef int (*BoronCFunc)(UThread*,UCell*,UCell*);
00050 #define CFUNC(name) static int name( UThread* ut, UCell* a1, UCell* res )
00051 #define CFUNC_PUB(name) int name( UThread* ut, UCell* a1, UCell* res )
00052 #define CFUNC_OPTIONS a1[-1].id._pad0
00053
00054
00055 enum UserAccess
00056 {
00057 UR_ACCESS_DENY,
00058 UR_ACCESS_ALLOW,
00059 UR_ACCESS_ALWAYS
00060 };
00061
00062
00063 enum PortForm
00064 {
00065 UR_PORT_SIMPLE,
00066 UR_PORT_EXT,
00067 };
00068
00069
00070 enum PortOpenOptions
00071 {
00072 UR_PORT_READ = 0x01,
00073 UR_PORT_WRITE = 0x02,
00074 UR_PORT_NEW = 0x04,
00075 UR_PORT_NOWAIT = 0x08
00076 };
00077
00078
00079 enum PortSeek
00080 {
00081 UR_PORT_HEAD,
00082 UR_PORT_TAIL,
00083 UR_PORT_SKIP
00084 };
00085
00086
00087 typedef struct UPortDevice UPortDevice;
00088
00089 struct UPortDevice
00090 {
00091 int (*open) ( UThread*, const UPortDevice*, const UCell* from, int opt,
00092 UCell* res );
00093 void (*close)( UBuffer* );
00094 int (*read) ( UThread*, UBuffer*, UCell*, int part );
00095 int (*write)( UThread*, UBuffer*, const UCell* );
00096 int (*seek) ( UThread*, UBuffer*, UCell*, int where );
00097 int (*waitFD)( UBuffer* );
00098 };
00099
00100
00101 #ifdef __cplusplus
00102 extern "C" {
00103 #endif
00104
00105 UThread* boron_makeEnv( UDatatype** dtTable, unsigned int dtCount );
00106 void boron_freeEnv( UThread* );
00107 void boron_addCFunc( UThread*, BoronCFunc func, const char* sig );
00108 void boron_addPortDevice( UThread*, const UPortDevice*, UAtom name );
00109 UBuffer* boron_makePort( UThread*, const UPortDevice*, void* ext, UCell* res );
00110 void boron_setAccessFunc( UThread*, int (*func)( UThread*, const char* ) );
00111 int boron_requestAccess( UThread*, const char* msg, ... );
00112 void boron_bindDefault( UThread*, UIndex blkN );
00113 int boron_doBlock( UThread*, const UCell* blkC, UCell* res );
00114 int boron_doBlockN( UThread*, UIndex blkN, UCell* res );
00115 int boron_doCStr( UThread*, const char* cmd, int len );
00116 UCell* boron_result( UThread* );
00117 UCell* boron_exception( UThread* );
00118 void boron_reset( UThread* );
00119 int boron_throwWord( UThread*, UAtom atom );
00120 char* boron_cstr( UThread*, const UCell* strC, UBuffer* bin );
00121 char* boron_cpath( UThread*, const UCell* strC, UBuffer* bin );
00122
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126
00127
00128 #endif