Robotran C Documentation
Functions | Variables
mbs_message.c File Reference
#include "mbs_message.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

Functions

void mbs_msg_default (char *msg)
 
void mbs_warning_msg_default (char *msg)
 
void mbs_error_msg_default (char *msg)
 Low-level error function terminating the process if an error is raised. More...
 
void mbs_error_msg_continue (char *msg)
 Low-level error function allowing process to continue if an error is raised. More...
 
void mbs_set_msg_fct_ptr (mbs_msg_fct_ptr msg_fct)
 Set the function that send messages. More...
 
void mbs_set_warning_msg_fct_ptr (mbs_msg_fct_ptr msg_fct)
 Set the function that send warning messages. More...
 
void mbs_set_error_msg_fct_ptr (mbs_msg_fct_ptr msg_fct)
 Set the function that send error messages. More...
 
char * mbs_concatenate_to_char (char *msg, va_list arg)
 Generate a string containing the message and the optionnal formatted value. More...
 
void mbs_msg (char *msg,...)
 Send a message. More...
 
void mbs_warning_msg (char *msg,...)
 Send a warning message. More...
 
void mbs_error_msg (char *msg,...)
 Send an error message. More...
 

Variables

mbs_msg_fct_ptr mbs_msg_ptr = mbs_msg_default
 
mbs_msg_fct_ptr mbs_warning_msg_ptr = mbs_warning_msg_default
 
mbs_msg_fct_ptr mbs_error_msg_ptr = mbs_error_msg_default
 

Function Documentation

◆ mbs_concatenate_to_char()

char* mbs_concatenate_to_char ( char *  msg,
va_list  arg 
)

Generate a string containing the message and the optionnal formatted value.

The returned char* must be freed.

Parameters
msgthe string containing the message to send. It can optionally contain format tag (with %). The corresponding additional parameters must be passed to the function.
Returns
A string containing the message and all the formatted variable.

◆ mbs_error_msg()

void mbs_error_msg ( char *  msg,
  ... 
)

Send an error message.

Send the error message passed by the user. Default behaviour is to print the message prefixed with MBS-ERROR to the console and to stop the application. This behaviour may be overidden using the mbs_set_warning_msg_fct function.

  • msg the string containing the message to send. It can optionally contain format tag (with %). The corresponding additional parameters must be passed to the function.

◆ mbs_error_msg_continue()

void mbs_error_msg_continue ( char *  msg)

Low-level error function allowing process to continue if an error is raised.

This function is not used by default, to use it assign it as default with the function mbs_set_error_msg_fct_ptr().

Parameters
msgthe string containing the message to send.

◆ mbs_error_msg_default()

void mbs_error_msg_default ( char *  msg)

Low-level error function terminating the process if an error is raised.

This function is used by default.

Parameters
msgthe string containing the message to send.

◆ mbs_msg()

void mbs_msg ( char *  msg,
  ... 
)

Send a message.

Send the message passed by the user. Default behaviour is to print the message to the console. This behaviour may be overidden using the mbs_set_msg_fct function.

  • msg the string containing the message to send. It can optionally contain format tag (with %). The corresponding additional parameters must be passed to the function.

◆ mbs_msg_default()

void mbs_msg_default ( char *  msg)

◆ mbs_set_error_msg_fct_ptr()

void mbs_set_error_msg_fct_ptr ( mbs_msg_fct_ptr  msg_fct)

Set the function that send error messages.

  • msg_fct the new message function

◆ mbs_set_msg_fct_ptr()

void mbs_set_msg_fct_ptr ( mbs_msg_fct_ptr  msg_fct)

Set the function that send messages.

  • msg_fct the new message function

◆ mbs_set_warning_msg_fct_ptr()

void mbs_set_warning_msg_fct_ptr ( mbs_msg_fct_ptr  msg_fct)

Set the function that send warning messages.

  • msg_fct the new message function

◆ mbs_warning_msg()

void mbs_warning_msg ( char *  msg,
  ... 
)

Send a warning message.

Send the message passed by the user. Default behaviour is to print the message prefixed with MBS-WARNING to the console. This behaviour may be overidden using the mbs_set_warning_msg_fct function.

  • msg the string containing the message to send. It can optionally contain format tag (with %). The corresponding additional parameters must be passed to the function.

◆ mbs_warning_msg_default()

void mbs_warning_msg_default ( char *  msg)

Variable Documentation

◆ mbs_error_msg_ptr

◆ mbs_msg_ptr

◆ mbs_warning_msg_ptr