-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathopencascade.c
161 lines (124 loc) · 4.86 KB
/
opencascade.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* Autogenerated by /opt/linuxcnc/bin/halcompile on Sat Jun 26 14:45:26 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"
static int comp_id;
#ifdef MODULE_INFO
MODULE_INFO(linuxcnc, "component:opencascade:opencascade component");
MODULE_INFO(linuxcnc, "descr:\nopencascade component\n\nPreprocess slogan examples :\n/opt/linuxcnc/bin/halcompile --preprocess /opt/linuxcnc/src/hal/components/opencascade.comp\n/opt/linuxcnc/bin/halcompile --preprocess /home/user/Desktop/Linux-Embedded/linux-hal/halcompile-opencascade/opencascade.comp\n\nUsage :\n\nThis file can only be used for --preprocess purposes. Direct --compile will fail.\nThe makefile uses the preproccesed .c and .o file to produce the .so library.\n\nThen in halview : loadrt opencascade\n\n");
MODULE_INFO(linuxcnc, "author:Skynet 2021");
MODULE_INFO(linuxcnc, "license:GPLv2 or greater");
MODULE_INFO(linuxcnc, "pin:testpin_bit_out:bit:0:out:testpin:None:None");
MODULE_INFO(linuxcnc, "pin:testpin_bit_in:bit:0:in:testpin:None:None");
MODULE_INFO(linuxcnc, "pin:testpin_float_out:float:0:out:testpin:None:None");
MODULE_INFO(linuxcnc, "pin:testpin_float_in:float:0:in:testpin:None:None");
MODULE_INFO(linuxcnc, "param:testparam:float:0:rw:testpin: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 *testpin_bit_out;
hal_bit_t *testpin_bit_in;
hal_float_t *testpin_float_out;
hal_float_t *testpin_float_in;
hal_float_t testparam;
};
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_OUT, &(inst->testpin_bit_out), comp_id,
"%s.testpin-bit-out", prefix);
if(r != 0) return r;
r = hal_pin_bit_newf(HAL_IN, &(inst->testpin_bit_in), comp_id,
"%s.testpin-bit-in", prefix);
if(r != 0) return r;
r = hal_pin_float_newf(HAL_OUT, &(inst->testpin_float_out), comp_id,
"%s.testpin-float-out", prefix);
if(r != 0) return r;
r = hal_pin_float_newf(HAL_IN, &(inst->testpin_float_in), comp_id,
"%s.testpin-float-in", prefix);
if(r != 0) return r;
r = hal_param_float_newf(HAL_RW, &(inst->testparam), comp_id,
"%s.testparam", 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("opencascade");
if(comp_id < 0) return comp_id;
r = export("opencascade", 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 testpin_bit_out
#define testpin_bit_out (*__comp_inst->testpin_bit_out)
#undef testpin_bit_in
#define testpin_bit_in (0+*__comp_inst->testpin_bit_in)
#undef testpin_float_out
#define testpin_float_out (*__comp_inst->testpin_float_out)
#undef testpin_float_in
#define testpin_float_in (0+*__comp_inst->testpin_float_in)
#undef testparam
#define testparam (__comp_inst->testparam)
#line 39 "/home/user/Desktop/Linux-Embedded/linux-hal/halcompile-opencascade/opencascade.comp"
#include "rtapi_math.h"
#include "opencascade.h"
double ms;
double seconds;
double totalnsec;
struct data d; // Component wide data bucket
int init=0;
FUNCTION(_) {
totalnsec = totalnsec + period;
ms = totalnsec * 0.000001; // rtapi_print_msg(RTAPI_MSG_ERR,"totalms: %f \n", totalms);
seconds = totalnsec * 0.000000001; // rtapi_print_msg(RTAPI_MSG_ERR,"totalseconds: %f \n", totalseconds);
if(!init){
init_opencascade();
init=1;
}
d.x=12345;
meat(d); // give meat the value 12345.
}
static int __comp_get_data_size(void) { return 0; }