PIPS
|
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <signal.h>
#include <sys/wait.h>
#include <errno.h>
#include "genC.h"
#include "constants.h"
#include "misc.h"
Go to the source code of this file.
Functions | |
static string | read_answer_from_daVinci () |
static void | parse_daVinci_answer () |
static void | send_command_to_daVinci (string command_format,...) |
Send a command to daVinci with an à la printf syntax: More... | |
static void | monitor_daVinci (int sig, int code, struct sigcontext *scp, char *addr) |
void | start_daVinci_if_not_running () |
void | create_daVinci_new_context () |
void | send_graph_to_daVinci (string graph_file_name) |
main () | |
Variables | |
pid_t | daVinci_pid = 0 |
All the stuff to use the graph viewer daVinci from PIPS. More... | |
int | daVinci_current_context = 0 |
The daVinci context control: More... | |
int | daVinci_next_context_to_create = 0 |
void(* | old_SIGCHLD_handler )() = NULL |
To process some eventual handler somewhere else: More... | |
FILE * | write_to_daVinci_stream |
The pipes to communicate with daVinci: More... | |
int | read_from_daVinci_fd |
void create_daVinci_new_context | ( | ) |
Definition at line 259 of file daVinci_wrapper.c.
References daVinci_next_context_to_create, printf(), read_answer_from_daVinci(), send_command_to_daVinci(), and start_daVinci_if_not_running().
Referenced by send_graph_to_daVinci().
main | ( | void | ) |
Definition at line 280 of file daVinci_wrapper.c.
References exit, printf(), read_answer_from_daVinci(), safe_system(), and send_graph_to_daVinci().
Not about daVinci, pass to the old handler:
If the calling process is stopped, pid = 0:
Well, daVinci is no longer here...
Restore the old handler:
Else, the process may have stopped: nothing to do.
Definition at line 162 of file daVinci_wrapper.c.
References daVinci_pid, debug_off, debug_on, old_SIGCHLD_handler, and pips_debug.
Referenced by start_daVinci_if_not_running().
|
static |
I love scanf-based parser... :-)
Definition at line 116 of file daVinci_wrapper.c.
References buffer, daVinci_current_context, malloc(), pips_debug, read_answer_from_daVinci(), and user_warning.
Referenced by start_daVinci_if_not_running().
|
static |
Allocate some place the first time:
A "\n" is used by daVinci to end answers:
Not optimized: read characters one by one...
End of answer found:
Deal with some '\' forms in strings:
Else, '\' -> '\', '"' -> '"' without doing anything.
No more place in the command buffer:
To mark the end to ease later parsing:
Definition at line 60 of file daVinci_wrapper.c.
References debug_off, debug_on, malloc(), pips_debug, and read_from_daVinci_fd.
Referenced by create_daVinci_new_context(), main(), parse_daVinci_answer(), and send_graph_to_daVinci().
|
static |
Send a command to daVinci with an à la printf syntax:
A "\n" is used by daVinci to end commands:
Definition at line 147 of file daVinci_wrapper.c.
References fprintf(), and write_to_daVinci_stream.
Referenced by create_daVinci_new_context(), and send_graph_to_daVinci().
void send_graph_to_daVinci | ( | string | graph_file_name | ) |
Send the graph:
Definition at line 268 of file daVinci_wrapper.c.
References create_daVinci_new_context(), printf(), read_answer_from_daVinci(), and send_command_to_daVinci().
Referenced by main().
void start_daVinci_if_not_running | ( | ) |
It is not necessary to start another daVinci:
Create the 2 pipes to communicate with daVinci.
Hum, need some portability adjustment for SVR4...
This is the child:
Connect the PIPS pipes to stdin and stdout of daVinci:
Hum, the PIPS parent will go on...
The parent:
Install the handler to monitor daVinci:
Wait for the OK stuff.
Definition at line 199 of file daVinci_wrapper.c.
References daVinci_pid, debug_off, debug_on, monitor_daVinci(), old_SIGCHLD_handler, parse_daVinci_answer(), pips_debug, pips_internal_error, read_from_daVinci_fd, and write_to_daVinci_stream.
Referenced by create_daVinci_new_context().
int daVinci_current_context = 0 |
The daVinci context control:
Definition at line 49 of file daVinci_wrapper.c.
Referenced by parse_daVinci_answer().
int daVinci_next_context_to_create = 0 |
Definition at line 50 of file daVinci_wrapper.c.
Referenced by create_daVinci_new_context().
pid_t daVinci_pid = 0 |
All the stuff to use the graph viewer daVinci from PIPS.
Ronan To monitor if we have already running daVinci: .Ker yell@ cri. ensmp .fr
Definition at line 46 of file daVinci_wrapper.c.
Referenced by monitor_daVinci(), and start_daVinci_if_not_running().
void( * old_SIGCHLD_handler) () | ( | ) | = NULL |
To process some eventual handler somewhere else:
Definition at line 53 of file daVinci_wrapper.c.
Referenced by monitor_daVinci(), and start_daVinci_if_not_running().
int read_from_daVinci_fd |
Definition at line 57 of file daVinci_wrapper.c.
Referenced by read_answer_from_daVinci(), and start_daVinci_if_not_running().
FILE* write_to_daVinci_stream |
The pipes to communicate with daVinci:
Definition at line 56 of file daVinci_wrapper.c.
Referenced by send_command_to_daVinci(), and start_daVinci_if_not_running().