85 #include "usr_operators.h"
87 #include "../r_exec/init.h"
88 #include "auto_focus_callback.h"
98 std::cout <<
"> usr operators initialized" << std::endl;
103 uint16 GetOperatorCount() {
108 void GetOperatorName(
char *op_name) {
110 static uint16 op_index = 0;
114 std::string s =
"add";
115 memcpy(op_name, s.c_str(), s.length());
122 std::string s =
"sub";
123 memcpy(op_name, s.c_str(), s.length());
130 std::string s =
"mul";
131 memcpy(op_name, s.c_str(), s.length());
138 std::string s =
"div";
139 memcpy(op_name, s.c_str(), s.length());
146 std::string s =
"dis";
147 memcpy(op_name, s.c_str(), s.length());
155 uint16 GetProgramCount() {
160 void GetProgramName(
char *pgm_name) {
162 static uint16 pgm_index = 0;
164 if (pgm_index == 0) {
166 std::string s =
"test_program";
167 memcpy(pgm_name, s.c_str(), s.length());
180 if (pgm_index == 1) {
182 std::string s =
"auto_focus";
183 memcpy(pgm_name, s.c_str(), s.length());
191 uint16 GetCallbackCount() {
196 void GetCallbackName(
char *callback_name) {
198 static uint16 callback_index = 0;
200 if (callback_index == 0) {
202 std::string s =
"print";
203 memcpy(callback_name, s.c_str(), s.length());
209 void* GetUserOperatorFunction(
const char* function_name) {
210 if (strcmp(function_name,
"Init") == 0)
212 else if (strcmp(function_name,
"GetOperatorCount") == 0)
213 return (
void*)&GetOperatorCount;
214 else if (strcmp(function_name,
"GetOperatorName") == 0)
215 return (
void*)&GetOperatorName;
216 else if (strcmp(function_name,
"add") == 0)
217 return (
void*)&usr_operators::add;
218 else if (strcmp(function_name,
"sub") == 0)
219 return (
void*)&usr_operators::sub;
220 else if (strcmp(function_name,
"mul") == 0)
221 return (
void*)&usr_operators::mul;
222 else if (strcmp(function_name,
"div") == 0)
223 return (
void*)&usr_operators::div;
224 else if (strcmp(function_name,
"dis") == 0)
225 return (
void*)&usr_operators::dis;
226 else if (strcmp(function_name,
"GetProgramCount") == 0)
227 return (
void*)&GetProgramCount;
228 else if (strcmp(function_name,
"GetProgramName") == 0)
229 return (
void*)&GetProgramName;
230 else if (strcmp(function_name,
"test_program") == 0)
231 return (
void*)&test_program;
232 else if (strcmp(function_name,
"auto_focus") == 0)
233 return (
void*)&auto_focus;
234 else if (strcmp(function_name,
"GetCallbackCount") == 0)
235 return (
void*)&GetCallbackCount;
236 else if (strcmp(function_name,
"GetCallbackName") == 0)
237 return (
void*)&GetCallbackName;
238 else if (strcmp(function_name,
"print") == 0)
239 return (
void*)&usr_operators::print;