basalt

examples/ai/features_host.c

#include "system.h"
#include "features.c"
static Word linked_feature(External *e,const Word *args) {
    static const BasaltAPI api={1,buffer_view,buffer_copy};
    if(!e->call && !strcmp(e->path,"./features.so")) {
        if(!strcmp(e->name,"FeatureWidth")) e->call=FeatureWidth;
        if(!strcmp(e->name,"FeatureCount")) e->call=FeatureCount;
        if(!strcmp(e->name,"TrainCount")) e->call=TrainCount;
        if(!strcmp(e->name,"LabelAt")) e->call=LabelAt;
        if(!strcmp(e->name,"FeatureAt")) e->call=FeatureAt;
    }
    if(!e->call) system_fail("unknown feature extension");
    return e->call(&api,args,e->count);
}
#define external_call linked_feature
#include "head-generated.c"