/* Autogenerated by /opt/linuxcnc/bin/halcompile on Sun Jun 13 16:30:04 2021 -- do not edit */
#include "rtapi.h"
#ifdef RTAPI
#include "rtapi_app.h"
#endif
#include "rtapi_string.h"
#include "rtapi_errno.h"
#include "hal.h"
#include "rtapi_math64.h"
#include "scurve.h"

static int comp_id;

#ifdef MODULE_INFO
MODULE_INFO(linuxcnc, "component:test:test component");
MODULE_INFO(linuxcnc, "descr:\nTest Component\n\nCompile slogan :\n/opt/linuxcnc/bin/halcompile --compile /opt/linuxcnc/src/hal/components/test.comp\n\nPreprocess slogan :\n/opt/linuxcnc/bin/halcompile --preprocess /opt/linuxcnc/src/hal/components/test.comp\n\nThen copy it to the rtlib.\n\nThen in halview : loadrt test\n\n");
MODULE_INFO(linuxcnc, "author:Skynet");
MODULE_INFO(linuxcnc, "license:GPLv2 or greater");
MODULE_INFO(linuxcnc, "pin:enable:bit:0:in::None:None");
MODULE_INFO(linuxcnc, "pin:value:float:0:out::None:None");
MODULE_INFO(linuxcnc, "funct:_:1:");
MODULE_LICENSE("GPLv2 or greater");
#endif // MODULE_INFO

struct __comp_state {
    struct __comp_state *_next;
    hal_bit_t *enable;
    hal_float_t *value;
};
struct __comp_state *__comp_first_inst=0, *__comp_last_inst=0;

static void _(struct __comp_state *__comp_inst, long period);
static int __comp_get_data_size(void);
#undef TRUE
#define TRUE (1)
#undef FALSE
#define FALSE (0)
#undef true
#define true (1)
#undef false
#define false (0)

static int export(char *prefix, long extra_arg) {
    char buf[HAL_NAME_LEN + 1];
    int r = 0;
    int sz = sizeof(struct __comp_state) + __comp_get_data_size();
    struct __comp_state *inst = hal_malloc(sz);
    memset(inst, 0, sz);
    r = hal_pin_bit_newf(HAL_IN, &(inst->enable), comp_id,
        "%s.enable", prefix);
    if(r != 0) return r;
    r = hal_pin_float_newf(HAL_OUT, &(inst->value), comp_id,
        "%s.value", prefix);
    if(r != 0) return r;
    rtapi_snprintf(buf, sizeof(buf), "%s", prefix);
    r = hal_export_funct(buf, (void(*)(void *inst, long))_, inst, 1, 0, comp_id);
    if(r != 0) return r;
    if(__comp_last_inst) __comp_last_inst->_next = inst;
    __comp_last_inst = inst;
    if(!__comp_first_inst) __comp_first_inst = inst;
    return 0;
}
int rtapi_app_main(void) {
    int r = 0;
    comp_id = hal_init("test");
    if(comp_id < 0) return comp_id;
    r = export("test", 0);
    if(r) {
        hal_exit(comp_id);
    } else {
        hal_ready(comp_id);
    }
    return r;
}

void rtapi_app_exit(void) {

    hal_exit(comp_id);
}

#undef FUNCTION
#define FUNCTION(name) static void name(struct __comp_state *__comp_inst, long period)
#undef EXTRA_SETUP
#define EXTRA_SETUP() static int extra_setup(struct __comp_state *__comp_inst, char *prefix, long extra_arg)
#undef EXTRA_CLEANUP
#define EXTRA_CLEANUP() static void extra_cleanup(void)
#undef fperiod
#define fperiod (period * 1e-9)
#undef enable
#define enable (0+*__comp_inst->enable)
#undef value
#define value (*__comp_inst->value)


#line 33 "/opt/linuxcnc/src/hal/components/test.comp"

#include "rtapi_math.h"

FUNCTION(_) {
    if(enable){
    }

        struct traject tr;
        tr.Vo=value;

        int k=myfirstapp();
        // Do something with k.

        float result;
        myfirstvoid(10,10,&result);
        value=result;

        struct line l;
        l.xs=0;
        l.xe=100;
        struct point p=myfirstreturn(l);
        value=p.x;

}

static int __comp_get_data_size(void) { return 0; }























