sic_comm.h File Reference

See also:
sic_comm.c
More...

Include dependency graph for sic_comm.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define SIC_TASK_NULL   (NULL)

Typedefs

typedef void(*) sic_sighandler_t (int)
 platform independant definition of signal handler
typedef HANDLE task_t
 platform independant definition of task
typedef DWORD task_id_t
typedef global_struct sic_widget_def_t
typedef void(*) sic_modified_variable_listener_t (sic_widget_def_t *widget)
 Listener type for modified_variable event.
typedef void(*) sic_redraw_prompt_listener_t (command_line_t *command_line)
 Listener type for redraw_prompt event.

Enumerations

enum  sic_command_from_t { SIC_DEFAULT, SIC_KEYBOARD, SIC_SILENT_MODE }
 Enum to identify the type of caller which post a command. More...

Functions

void sic_create_comm_board ()
 Initialize a communication board for all sic IPC features.
void sic_destroy_comm_board ()
 Destroy the communication board from main process.
char ** sic_get_static_argv ()
 Get a static buffer for building argv.
int sic_execvp (char *argv[])
 Call execvp.
task_t sic_launch (int(*start_entry)(void *), void *data)
 Launch a procedure in a separate task.
int sic_terminate (task_t task)
 Terminate a task created with sic_launch.
void sic_on_exit ()
 Informs SIC that program will exit.
void sic_do_exit (int status)
 Exit in a clean way.
int sic_get_comm_id ()
 Returns the communication board id.
int sic_open_comm_board (int comm_board_id)
 Open the communication board.
void sic_close_comm_board ()
 Close the communication board from a child process.
task_id_t sic_get_task_id (task_t task)
 Get the unique identifier of a task.
task_t sic_get_master_task ()
 Get the master task.
task_id_t sic_get_master_task_id ()
 Get the master task id.
task_t sic_get_current_task ()
 Get the current task.
task_id_t sic_get_current_task_id ()
 Get the current task id.
void sic_set_ctrlc_handled (int handled)
 Set Ctrl+C handled flag.
void sic_send_ctrlc ()
 Stop the master task (sending a SIGINT).
void sic_post_prompt (const command_line_t *command_line)
 Enable prompt drawing (called by main process).
int sic_wait_prompt (command_line_t *command_line, int timeout)
 Wait to draw the prompt (called by keyboard process).
void sic_get_current_prompt (char prompt[])
 Get the current prompt in the communication board.
int sic_push_command_text (const char *text)
 Push a command to the communication board.
int sic_post_command_from (const command_line_t *command_line, sic_command_from_t from)
 Send a command to the communication board.
int sic_post_command (const command_line_t *command_line)
 Send a command to the communication board.
void sic_post_command_from_prompt (const command_line_t *command_line)
 Post a command after a call to sic_wait_prompt.
int sic_post_command_text_from (const char *text, sic_command_from_t from)
 Send a command to the communication board.
int sic_post_command_text (const char *text)
 Send a command to the communication board.
int sic_post_command_va (const char *args, va_list l)
 Send a command to the communication board with variable argument list.
int sic_post_command_args (const char *args,...)
 Send a command to the communication board with specified format.
void sic_wait_command (command_line_t *command_line, sic_command_from_t *from)
 Wait for a command in the communication board.
void sic_create_widget_board ()
 Create the widget definition board if necessary and start a widget definition task.
void sic_set_widget_global_infos (const char window_title[], const char help_filename[], const char returned_command[])
 Set global widget infos.
void sic_set_widget_returned_command (const char returned_command[])
 Set widget returned command.
void sic_get_widget_returned_command (char returned_command[])
 Get widget returned command.
void sic_set_widget_returned_code (int code)
 Set widget returned code.
int sic_get_widget_returned_code ()
 Get widget returned code.
void sic_add_modified_variable_listener (sic_modified_variable_listener_t l)
 Add a listener for the modified_variable event.
void sic_fire_modified_variable_event (const sic_widget_def_t *widget)
 Trigger a modified_variable event.
void sic_add_redraw_prompt_listener (sic_redraw_prompt_listener_t l)
 Add a listener for the redraw_prompt event.
void sic_fire_redraw_prompt_event (const command_line_t *command_line)
 Trigger a redraw_prompt event.
void sic_suspend_prompt ()
 Suspend the prompt to ensure output goes to a new line of the terminal.
int sic_add_widget_def (sic_widget_def_t *def)
 Add a widget definition.
void sic_set_widget_def (int index, const sic_widget_def_t *widget)
 Set a widget definition.
void sic_destroy_widget_board ()
 Destroy the widget definition board.
int sic_open_widget_board ()
 Open the widget definition board.
void sic_get_widget_global_infos (char window_title[], char help_filename[], char returned_command[])
 Get global widget infos.
void sic_get_widget_def (int index, sic_widget_def_t *widget)
 Get a widget definition.
void sic_close_widget_board ()
 Close the widget definition board from a child process.
void sic_post_widget_created ()
 Post a widget creation event.
void sic_wait_widget_created ()
 Wait for widget creation.


Detailed Description

See also:
sic_comm.c

Definition in file sic_comm.h.


Define Documentation

#define SIC_TASK_NULL   (NULL)

Definition at line 47 of file sic_comm.h.


Typedef Documentation

typedef void(*) sic_modified_variable_listener_t(sic_widget_def_t *widget)

Listener type for modified_variable event.

Definition at line 52 of file sic_comm.h.

typedef void(*) sic_redraw_prompt_listener_t(command_line_t *command_line)

Listener type for redraw_prompt event.

Definition at line 54 of file sic_comm.h.

typedef void(* ) sic_sighandler_t(int)

platform independant definition of signal handler

Definition at line 34 of file sic_comm.h.

typedef global_struct sic_widget_def_t

Definition at line 50 of file sic_comm.h.

typedef DWORD task_id_t

Definition at line 46 of file sic_comm.h.

typedef HANDLE task_t

platform independant definition of task

Definition at line 45 of file sic_comm.h.


Enumeration Type Documentation

enum sic_command_from_t

Enum to identify the type of caller which post a command.

Enumerator:
SIC_DEFAULT  command sent by an undefined caller
SIC_KEYBOARD  command sent by the keyboard
SIC_SILENT_MODE  command sent in silent mode (without echo)

Definition at line 57 of file sic_comm.h.


Function Documentation

void sic_add_modified_variable_listener ( sic_modified_variable_listener_t  l  ) 

Add a listener for the modified_variable event.

Parameters:
[in] l is the handler of the listener.

Definition at line 1339 of file .#sic_comm.c.1.1.2.16.

References sic_listener_handler_t::listener, sic_get_current_task(), SIC_MODIFIED_VARIABLE_EVENT, and sic_listener_handler_t::task.

Here is the call graph for this function:

void sic_add_redraw_prompt_listener ( sic_redraw_prompt_listener_t  l  ) 

Add a listener for the redraw_prompt event.

Parameters:
[in] l is the handler of the listener.

Definition at line 1374 of file .#sic_comm.c.1.1.2.16.

References sic_listener_handler_t::listener, sic_get_current_task(), SIC_REDRAW_PROMPT_EVENT, and sic_listener_handler_t::task.

Here is the call graph for this function:

int sic_add_widget_def ( sic_widget_def_t def  ) 

Add a widget definition.

Parameters:
[in] def is the widget definition.
Returns:
0 on success, -1 if no space available for new widget.

Definition at line 1416 of file .#sic_comm.c.1.1.2.16.

References SIC_MAX_WIDGET_ON_BOARD, sic_widget_board_t::widget_count, and sic_widget_board_t::widgets.

void sic_close_comm_board (  ) 

Close the communication board from a child process.

Definition at line 1032 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::comm_board_access, sic_comm_board_t::draw_prompt, sic_comm_board_t::listener_acquit, sic_comm_board_t::read_command, sic_destroy_widget_board(), sic_get_current_task(), sic_comm_board_t::widget_board_access, sic_comm_board_t::widget_created, and sic_comm_board_t::write_command.

Here is the call graph for this function:

void sic_close_widget_board (  ) 

Close the widget definition board from a child process.

Definition at line 1505 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::widget_board_access.

void sic_create_comm_board (  ) 

Initialize a communication board for all sic IPC features.

It must be called once by the main process.

Definition at line 700 of file .#sic_comm.c.1.1.2.16.

References command_line_t::code, sic_comm_board_t::comm_board_access, sic_comm_board_t::command_line, sic_comm_board_t::draw_prompt, sic_comm_board_t::event_id, sic_comm_board_t::from, sic_comm_board_t::from_prompt, sic_comm_board_t::keyboard_task, command_line_t::line, sic_comm_board_t::listener_acquit, sic_comm_board_t::listener_count, sic_comm_board_t::master_task, command_line_t::nc, command_line_t::prompt, sic_comm_board_t::pushed_command_text, sic_comm_board_t::read_command, sic_get_current_task(), sic_get_current_task_id(), sic_open_comm_board(), SIC_TASK_NULL, sic_comm_board_t::trace_fd, sic_comm_board_t::widget_board_access, sic_comm_board_t::widget_board_id, sic_comm_board_t::widget_created, and sic_comm_board_t::write_command.

Here is the call graph for this function:

void sic_create_widget_board (  ) 

Create the widget definition board if necessary and start a widget definition task.

Definition at line 1269 of file .#sic_comm.c.1.1.2.16.

References sic_get_current_task_id(), sic_open_widget_board(), sic_comm_board_t::widget_board_id, and sic_widget_board_t::widget_count.

Here is the call graph for this function:

void sic_destroy_comm_board (  ) 

Destroy the communication board from main process.

Definition at line 740 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::comm_board_access, sic_comm_board_t::draw_prompt, sic_comm_board_t::listener_acquit, sic_comm_board_t::read_command, SIC_ASSERT, sic_close_comm_board(), sic_comm_board_t::widget_board_access, sic_comm_board_t::widget_created, and sic_comm_board_t::write_command.

Here is the call graph for this function:

void sic_destroy_widget_board (  ) 

Destroy the widget definition board.

Definition at line 1440 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::widget_board_id.

void sic_do_exit ( int  status  ) 

Exit in a clean way.

Parameters:
[in] status is the value returned to the calling process.

Definition at line 966 of file .#sic_comm.c.1.1.2.16.

References sic_on_exit().

Here is the call graph for this function:

int sic_execvp ( char *  argv[]  ) 

Call execvp.

If SIC_DEBUG_COMM flag is set and environnement variable SIC_DEBUG_GDB is set, exec gdb with supplied arguments inside a xterm.

Parameters:
[in] argv is an array of argument strings.
Returns:
0 on success, -1 otherwise.

Definition at line 816 of file .#sic_comm.c.1.1.2.16.

References MAX_ARGC, MAX_ARGV, and sic_do_exit().

Here is the call graph for this function:

void sic_fire_modified_variable_event ( const sic_widget_def_t widget  ) 

Trigger a modified_variable event.

Parameters:
[in] widget contains informations on the modified widget.

Definition at line 1359 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::modified_widget, sic_close_widget_board(), SIC_MODIFIED_VARIABLE_EVENT, and sic_open_widget_board().

Here is the call graph for this function:

void sic_fire_redraw_prompt_event ( const command_line_t command_line  ) 

Trigger a redraw_prompt event.

Parameters:
[in] command_line the prompt to draw.

Definition at line 1394 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::command_line, and SIC_REDRAW_PROMPT_EVENT.

int sic_get_comm_id (  ) 

Returns the communication board id.

Definition at line 978 of file .#sic_comm.c.1.1.2.16.

void sic_get_current_prompt ( char  prompt[]  ) 

Get the current prompt in the communication board.

Parameters:
[out] prompt is returned.

Definition at line 1172 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::command_line, PROMPT, and command_line_t::prompt.

task_t sic_get_current_task (  ) 

Get the current task.

Returns:
the task.

Definition at line 1096 of file .#sic_comm.c.1.1.2.16.

task_id_t sic_get_current_task_id (  ) 

Get the current task id.

Returns:
the id.

Definition at line 1110 of file .#sic_comm.c.1.1.2.16.

References sic_get_current_task(), and sic_get_task_id().

Here is the call graph for this function:

task_t sic_get_master_task (  ) 

Get the master task.

Returns:
the task.

Definition at line 1076 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::master_task.

task_id_t sic_get_master_task_id (  ) 

Get the master task id.

Returns:
the id.

Definition at line 1086 of file .#sic_comm.c.1.1.2.16.

References sic_get_master_task(), and sic_get_task_id().

Here is the call graph for this function:

char** sic_get_static_argv (  ) 

Get a static buffer for building argv.

Definition at line 796 of file .#sic_comm.c.1.1.2.16.

References MAX_ARGC, and MAX_ARGV.

task_id_t sic_get_task_id ( task_t  task  ) 

Get the unique identifier of a task.

Parameters:
[in] task is a task returned by a call to sic_launch.
Returns:
the identifier of task.

Definition at line 1062 of file .#sic_comm.c.1.1.2.16.

void sic_get_widget_def ( int  index,
sic_widget_def_t widget 
)

Get a widget definition.

Parameters:
[in] index of the widget.
[out] widget to be filled with the definition.

Definition at line 1497 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::widgets.

void sic_get_widget_global_infos ( char  window_title[],
char  help_filename[],
char  returned_command[] 
)

Get global widget infos.

Parameters:
[out] window_title must be of size TITLELENGTH
[out] help_filename must be of size HLPFILELNGTH
[out] returned_command must be of size COMMANDLENGTH

Definition at line 1484 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::help_filename, sic_widget_board_t::returned_command, and sic_widget_board_t::window_title.

int sic_get_widget_returned_code (  ) 

Get widget returned code.

Returns:
the id of the widget ending the dialog.

Definition at line 1329 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::returned_code.

void sic_get_widget_returned_command ( char  returned_command[]  ) 

Get widget returned command.

Parameters:
[out] returned_command. 

Definition at line 1309 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::returned_command.

task_t sic_launch ( int(*)(void *)  start_entry,
void *  data 
)

Launch a procedure in a separate task.

Parameters:
[in] start_entry is the procedure to launch.
[in] data is a pointer passed as argument to the procedure.

Definition at line 886 of file .#sic_comm.c.1.1.2.16.

References sic_perror().

Here is the call graph for this function:

void sic_on_exit (  ) 

Informs SIC that program will exit.

Definition at line 944 of file .#sic_comm.c.1.1.2.16.

References sic_close_comm_board(), and sic_destroy_comm_board().

Here is the call graph for this function:

int sic_open_comm_board ( int  comm_board_id  ) 

Open the communication board.

It must be called once by each child process.

Parameters:
[in] comm_board_id is the identifier of the communication board.
Returns:
0 on success, -1 otherwise.

Definition at line 990 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::comm_board_access, sic_comm_board_t::draw_prompt, sic_comm_board_t::listener_acquit, sic_comm_board_t::read_command, SIC_ASSERT, SIC_DEBUG_COMM, sic_comm_board_t::trace_fd, sic_comm_board_t::widget_board_access, sic_comm_board_t::widget_created, and sic_comm_board_t::write_command.

int sic_open_widget_board (  ) 

Open the widget definition board.

It must be called once by each child process.

Returns:
the count of widgets.

Definition at line 1460 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::widget_board_access, sic_comm_board_t::widget_board_id, and sic_widget_board_t::widget_count.

int sic_post_command ( const command_line_t command_line  ) 

Send a command to the communication board.

Parameters:
[in] command_line is the command.
Returns:
0 on success, -1 if timeout has been reached.

Definition at line 1183 of file .#sic_comm.c.1.1.2.16.

References SIC_DEFAULT, and sic_post_command_from().

Here is the call graph for this function:

int sic_post_command_args ( const char *  args,
  ... 
)

Send a command to the communication board with specified format.

Parameters:
[in] args is a format like printf first argument.
Returns:
0 on success, -1 if timeout has been reached.

Definition at line 1236 of file .#sic_comm.c.1.1.2.16.

References sic_post_command_va().

Here is the call graph for this function:

int sic_post_command_from ( const command_line_t command_line,
sic_command_from_t  from 
)

Send a command to the communication board.

Parameters:
[in] command_line is the command.
[in] from is the type of the caller.
Returns:
0 on success, -1 if timeout has been reached.

Definition at line 1280 of file sic_comm.c.

Referenced by sic_post_command(), and sic_post_command_text_from().

Here is the caller graph for this function:

void sic_post_command_from_prompt ( const command_line_t command_line  ) 

Post a command after a call to sic_wait_prompt.

Parameters:
[in] command_line is the command.

Definition at line 1193 of file .#sic_comm.c.1.1.2.16.

References SIC_KEYBOARD.

int sic_post_command_text ( const char *  text  ) 

Send a command to the communication board.

Parameters:
[in] text is the command.
Returns:
0 on success, -1 if timeout has been reached.

Definition at line 1204 of file .#sic_comm.c.1.1.2.16.

References command_line_t::code, command_line_t::line, MAXBUF, command_line_t::nc, command_line_t::prompt, SIC_DEFAULT, sic_post_command(), and sic_post_command_text_from().

Here is the call graph for this function:

int sic_post_command_text_from ( const char *  text,
sic_command_from_t  from 
)

Send a command to the communication board.

Parameters:
[in] text is the command.
[in] from is the type of the caller.
Returns:
0 on success, -1 if timeout has been reached.

Definition at line 1313 of file sic_comm.c.

References sic_post_command_from().

Referenced by sic_post_command_text().

Here is the call graph for this function:

Here is the caller graph for this function:

int sic_post_command_va ( const char *  args,
va_list  l 
)

Send a command to the communication board with variable argument list.

Parameters:
[in] args is a format like printf first argument.
Returns:
0 on success, -1 if timeout has been reached.

Definition at line 1222 of file .#sic_comm.c.1.1.2.16.

References MAXBUF, and sic_post_command_text().

Here is the call graph for this function:

void sic_post_prompt ( const command_line_t command_line  ) 

Enable prompt drawing (called by main process).

Definition at line 1140 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::command_line, and sic_comm_board_t::draw_prompt.

void sic_post_widget_created (  ) 

Post a widget creation event.

Definition at line 1514 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::widget_created.

int sic_push_command_text ( const char *  text  ) 

Push a command to the communication board.

Parameters:
[in] text is the command.
Returns:
0 on success, -1 if a command has already been pushed.

Definition at line 1203 of file .#sic_comm.c.1.1.2.18.

References MAXBUF, sic_comm_board_t::pushed_command_text, and sic_comm_board_t::read_command.

void sic_send_ctrlc (  ) 

Stop the master task (sending a SIGINT).

Definition at line 1128 of file .#sic_comm.c.1.1.2.16.

References sic_do_exit(), and sic_get_master_task().

Here is the call graph for this function:

void sic_set_ctrlc_handled ( int  handled  ) 

Set Ctrl+C handled flag.

Parameters:
[in] handled 1 if true, 0 otherwise.

Definition at line 1120 of file .#sic_comm.c.1.1.2.16.

void sic_set_widget_def ( int  index,
const sic_widget_def_t widget 
)

Set a widget definition.

Parameters:
[in] index of the widget.
[in] widget to defined.

Definition at line 1432 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::widgets.

void sic_set_widget_global_infos ( const char  window_title[],
const char  help_filename[],
const char  returned_command[] 
)

Set global widget infos.

Parameters:
[in] window_title. 
[in] help_filename. 
[in] returned_command. 

Definition at line 1287 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::help_filename, sic_widget_board_t::returned_command, and sic_widget_board_t::window_title.

void sic_set_widget_returned_code ( int  code  ) 

Set widget returned code.

Parameters:
[in] code is the id of the widget ending the dialog.

Definition at line 1319 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::returned_code.

void sic_set_widget_returned_command ( const char  returned_command[]  ) 

Set widget returned command.

Parameters:
[in] returned_command. 

Definition at line 1299 of file .#sic_comm.c.1.1.2.16.

References sic_widget_board_t::returned_command.

void sic_suspend_prompt (  ) 

Suspend the prompt to ensure output goes to a new line of the terminal.

Definition at line 1405 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::command_line, and command_line_t::line.

int sic_terminate ( task_t  task  ) 

Terminate a task created with sic_launch.

Parameters:
[in] task is a task returned by a call to sic_launch.
Returns:
0 on success, -1 otherwise.

Definition at line 925 of file .#sic_comm.c.1.1.2.16.

References sic_pwarning().

Here is the call graph for this function:

void sic_wait_command ( command_line_t command_line,
sic_command_from_t from 
)

Wait for a command in the communication board.

Parameters:
[out] command_line contains the command.
[out] from informs about the sender of the command.

Definition at line 1371 of file sic_comm.c.

References sic_comm_board_t::command_line, sic_comm_board_t::from, command_line_t::line, command_line_t::prompt, sic_comm_board_t::pushed_command_text, sic_comm_board_t::read_command, SIC_DEFAULT, and sic_comm_board_t::write_command.

int sic_wait_prompt ( command_line_t command_line,
int  timeout 
)

Wait to draw the prompt (called by keyboard process).

Parameters:
[out] command_line contains the prompt and optionally a command line.
[in] timeout given in milliseconds.
Returns:
0 on success, -1 if timeout has been reached.

Definition at line 1154 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::command_line, and sic_comm_board_t::draw_prompt.

void sic_wait_widget_created (  ) 

Wait for widget creation.

Definition at line 1523 of file .#sic_comm.c.1.1.2.16.

References sic_comm_board_t::widget_created.


Generated on Tue Mar 13 15:20:28 2007 for SIC by  doxygen 1.5.1