Commit 86e25a34 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Change blc_command_add removing the need of const in the callback. WARNING...

Change blc_command_add removing the need of const in the callback. WARNING This affects all the function using it
parent 552c820c
......@@ -35,7 +35,7 @@ Few functions helping for pseudo realtime applications.
#define BLC_COMMAND_LOOP(period) for(blc_command_loop_init(period); blc_command_loop_start();blc_command_loop_end())
typedef enum {BLC_QUIT=0, BLC_RUN, BLC_PAUSE, BLC_STEPS} type_blc_status;
typedef void (*type_blc_command_cb)(char const *argument, void *user_data);
typedef void (*type_blc_command_cb)(char *argument, void *user_data);
/** Timer updated by blc_command_loop_start and blc_command_loop_end (i.e. BLC_LOOP_FOR(<period>))
It may be use by the application to get the absolute time in µs using blc_loop_timer.tv_sec*1000000+blc_loop_timer.tv_usec
......@@ -79,7 +79,7 @@ void blc_command_forward_blc_channels();
void blc_command_remove(const char *command_name);
///Interpret the command passed in string.
void blc_command_interpret_string(char const *input_string, size_t size);
void blc_command_interpret_string(char *input_string, size_t size);
///Wait a input from the user (this id blocking) and interprets it depending on the blc_command list.
void blc_command_interpret();
......
......@@ -118,9 +118,8 @@ void blc_command_remove(const char *command_name){
}
void blc_command_interpret_string(char const *input_string, size_t size){
char const*parameter;
void blc_command_interpret_string(char *input_string, size_t size){
char *parameter;
char *parameter2;
size_t parameter_size, parameter2_size;
......@@ -129,9 +128,7 @@ void blc_command_interpret_string(char const *input_string, size_t size){
if (forward_blc_channel){
if (input_string[0] && strchr("./^:", input_string[0])){ //it starts with ., ^ , / , :, it may be a blc_channel.
if (memchr(&input_string[1], '/', size)==0) // There is no / after the first char it is a blc_channel. NOTE: It may be an error with /usr /bin the user has to use /usr/ /bin/ etc.
{
if (memchr(&input_string[1], '/', size)==0){ // There is no / after the first char it is a blc_channel. NOTE: It may be an error with /usr /bin the user has to use /usr/ /bin/ etc.
SYSTEM_ERROR_CHECK(puts(input_string), -1, NULL);
SYSTEM_ERROR_CHECK(fflush(stdout), -1, NULL);
return;
......@@ -267,6 +264,4 @@ void blc_command_update_double_cb(char const *argument, void *double_pt){
else *(double*)double_pt=value;
}
}
END_EXTERN_C
......@@ -96,7 +96,7 @@ static void blc_command_send_to_stdout(char const *argument){
}
}
//We execute the argument and send it with prefix '&' to stdout if it is not a terminal
static void blc_command_send_to_all(char const *argument){
static void blc_command_send_to_all(char *argument){
blc_command_interpret_string(argument, strlen(argument));
if (blc_output_terminal==0){
if (argument) SYSTEM_ERROR_CHECK(printf("&%s", argument), -1, NULL);
......@@ -122,7 +122,7 @@ void blc_command_ask_quit(){
}
}
static void step_forward_cb(const char* steps_nb_str, void*){
static void step_forward_cb( char* steps_nb_str, void*){
int steps_nb, pos;
if (steps_nb_str){
if (sscanf(steps_nb_str, "%d%n", &steps_nb, &pos)!=1 || pos != (int)strlen(steps_nb_str) || steps_nb<1){
......
......@@ -143,10 +143,7 @@ void blc_program_add_option(char const **result, char letter, char const *long_o
tmp_program_option.help = help;
tmp_program_option.default_value = default_value;
program_options.push_back(tmp_program_option);
}
void blc_program_add_input_pipe_option(FILE *file, char letter, char const *long_option, char const *help, char* default_value)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment