PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <strings.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/filio.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/notify.h>
#include "string.h"
#include "genC.h"
#include "misc.h"
#include "linear.h"
#include "ri.h"
#include "database.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "properties.h"
#include "wpips-labels.h"
#include "wpips.h"
Go to the source code of this file.
Enumerations | |
enum | epips_input_automaton_states { epips_wait_for_begin , epips_wait_for_end } |
At initialization, we are waiting for an input command: More... | |
enum | { EPIPS_COMMAND_BUFFER_SIZE = 2000 } |
Functions | |
static void | send_text_to_emacs (char *some_text) |
Here are described all the functions used to send informations to emacs: More... | |
static void | send_command_to_emacs (char *command_title, char *command_content) |
The function that frames the command to emacs: More... | |
void | send_module_name_to_emacs (char *some_text) |
Here are all the methods used to send an object to Emacs: More... | |
void | send_the_names_of_the_available_modules_to_emacs (void) |
Tell Emacs about what are the modules available in the current workspace, if any: More... | |
void | send_prompt_user_to_emacs (char *some_text) |
void | send_user_error_to_emacs (char *some_text) |
void | send_user_log_to_emacs (char *some_text) |
void | send_user_warning_to_emacs (char *some_text) |
void | send_view_to_emacs (char *view_name, char *the_file_name) |
void | send_window_number_to_emacs (int number) |
void | send_notice_prompt_to_emacs (char *first_line,...) |
void | ask_emacs_to_open_a_new_daVinci_context () |
void | ask_emacs_to_display_a_graph (string file_name) |
static bool | epips_select_module (char *module_name) |
Here are described all the functions used to receive informations from emacs: More... | |
static void | epips_execute_and_display_something (char *view_label, char *module_name) |
Emacs said to display a sequential view: More... | |
static void | epips_sequential_view (char *module_name) |
Emacs said to display a sequential view: More... | |
static void | epips_execute_command (char *command_buffer) |
static void | trow_away_epips_input (char *entry_buffer, long int length) |
static void | add_command_to_buffer (char *entry_buffer, unsigned long int length) |
Copy a part of the entry_buffer in the command_buffer: More... | |
static char * | unframe_commands_from_emacs (char *entry_buffer, long int *length) |
Try to unframe one half of command sent by emacs. More... | |
static Notify_value | read_commands_from_emacs (Notify_client client, int fd) |
The function that accept commands from emacs: More... | |
void | initialize_emacs_mode () |
The function to initialize some things in the emacs mode: More... | |
Variables | |
bool | wpips_emacs_mode = 0 |
Here are all the stuff to interface Pips with Emacs. More... | |
static char | EMACS_AVAILABLE_MODULES_NAME [] = "AVAILABLE_MODULES" |
The title of the commands used by the emacs interface: More... | |
static char | EMACS_MODULE_NAME [] = "MODULE_NAME" |
static char | EMACS_PROMPT_USER [] = "PROMPT_USER" |
static char | EMACS_SEQUENTIAL_VIEW [] = "Sequential View" |
static char | EMACS_USER_ERROR [] = "USER_ERROR" |
static char | EMACS_USER_LOG [] = "USER_LOG" |
static char | EMACS_USER_WARNING [] = "USER_WARNING" |
static char | EMACS_WINDOW_NUMBER [] = "WINDOW_NUMBER" |
static char | EMACS_NEW_DAVINCI_CONTEXT [] = "NEW_DAVINCI_CONTEXT" |
static char | EMACS_VIEW_DAVINCI_GRAPH [] = "VIEW_DAVINCI_GRAPH" |
static char | epips_begin_of_command_token [] = "\200" |
The token to mark the begin and end of command. More... | |
static char | epips_end_of_command_token [] = "\201" |
static char | epips_receive_begin_of_command_token [] = "\202" |
static char | epips_receive_end_of_command_token [] = "\203" |
static epips_input_automaton_states | epips_input_automaton_state = epips_wait_for_begin |
static char | command_buffer [EPIPS_COMMAND_BUFFER_SIZE] |
static unsigned int | command_buffer_length |
At initialization, we are waiting for an input command:
Enumerator | |
---|---|
epips_wait_for_begin | |
epips_wait_for_end |
Definition at line 88 of file emacs.c.
|
static |
Copy a part of the entry_buffer in the command_buffer:
Definition at line 380 of file emacs.c.
References command_buffer, command_buffer_length, and pips_assert.
Referenced by unframe_commands_from_emacs().
void ask_emacs_to_display_a_graph | ( | string | file_name | ) |
Definition at line 243 of file emacs.c.
References EMACS_VIEW_DAVINCI_GRAPH, file_name, and send_command_to_emacs().
Referenced by wpips_display_graph_file_display().
void ask_emacs_to_open_a_new_daVinci_context | ( | ) |
Definition at line 236 of file emacs.c.
References EMACS_NEW_DAVINCI_CONTEXT, and send_command_to_emacs().
Referenced by wpips_display_graph_file_display().
|
static |
Emacs said to display a sequential view:
If module_name is not an empty string, we need to select this module first:
Display something only if an eventual module selection has been successful:
Definition at line 302 of file emacs.c.
References epips_select_module(), module_name(), and wpips_execute_and_display_something_from_alias().
Referenced by epips_sequential_view().
|
static |
Separate the command name from the content with a ":" :
Now we can choose what command to execute:
Definition at line 327 of file emacs.c.
References command_buffer, debug(), EMACS_MODULE_NAME, EMACS_SEQUENTIAL_VIEW, epips_select_module(), epips_sequential_view(), and user_warning.
Referenced by unframe_commands_from_emacs().
|
static |
Here are described all the functions used to receive informations from emacs:
Emacs said to select a module:
If there is no module...
Just to be sure that the selected module exist:
args_free zeroes also its length argument...
Something went wrong.
Definition at line 255 of file emacs.c.
References db_get_current_workspace_name(), db_get_module_list(), end_select_module_notify(), gen_array_full_free(), gen_array_item(), gen_array_nitems(), module_name(), prompt_user(), and user_warning.
Referenced by epips_execute_and_display_something(), and epips_execute_command().
|
static |
Emacs said to display a sequential view:
Definition at line 320 of file emacs.c.
References EMACS_SEQUENTIAL_VIEW, epips_execute_and_display_something(), and module_name().
Referenced by epips_execute_command().
void initialize_emacs_mode | ( | ) |
The function to initialize some things in the emacs mode:
An arbitrary number to identify the notify client function:
The commands from emacs are read from stdin.
Thus, we need to register stdin in the XView event Notifier:
The user query is redirected to Emacs:
pips_request_handler = epips_user_request;
Initialize the epips.el epips-window-number variable:
Ask for Emacs prettyprinting:
Ask Pips to display the declarations from the RI to have hypertext functions on the declarations:
Since the comments of the declarations are not in the RI, pick them in the text:
Definition at line 511 of file emacs.c.
References INITIAL_NUMBER_OF_WPIPS_WINDOWS, read_commands_from_emacs(), send_window_number_to_emacs(), set_bool_property(), and wpips_emacs_mode.
Referenced by wpips_main().
|
static |
The function that accept commands from emacs:
Nasty thing. In act, if stdin happens to close (for example I debugged the stuff with wpips -emacs < a), the notifier loop on read_commands_from_emacs(). Thus, in this case, we disinterest the notifier from stdin:
We have something to read:
OK, we have read something...
Try to parse until the buffer is empty:
Do not try a blocking read:
Definition at line 459 of file emacs.c.
References debug(), debug_off, debug_on, and unframe_commands_from_emacs().
Referenced by initialize_emacs_mode().
|
static |
The function that frames the command to emacs:
Separate the command name from the content with a ":" :
Definition at line 114 of file emacs.c.
References epips_begin_of_command_token, epips_end_of_command_token, and send_text_to_emacs().
Referenced by ask_emacs_to_display_a_graph(), ask_emacs_to_open_a_new_daVinci_context(), send_module_name_to_emacs(), send_prompt_user_to_emacs(), send_the_names_of_the_available_modules_to_emacs(), send_user_error_to_emacs(), send_user_log_to_emacs(), send_user_warning_to_emacs(), send_view_to_emacs(), and send_window_number_to_emacs().
void send_module_name_to_emacs | ( | char * | some_text | ) |
Here are all the methods used to send an object to Emacs:
Definition at line 128 of file emacs.c.
References EMACS_MODULE_NAME, and send_command_to_emacs().
Referenced by wpips_file_view().
void send_notice_prompt_to_emacs | ( | char * | first_line, |
... | |||
) |
Definition at line 220 of file emacs.c.
References send_prompt_user_to_emacs().
Referenced by continue_create_workspace_notify(), end_delete_workspace_notify(), and quit_notify().
void send_prompt_user_to_emacs | ( | char * | some_text | ) |
Definition at line 164 of file emacs.c.
References EMACS_PROMPT_USER, and send_command_to_emacs().
Referenced by prompt_user(), and send_notice_prompt_to_emacs().
|
static |
Here are described all the functions used to send informations to emacs:
Just send some raw text to emacs:
Definition at line 105 of file emacs.c.
References printf().
Referenced by send_command_to_emacs().
void send_the_names_of_the_available_modules_to_emacs | ( | void | ) |
Tell Emacs about what are the modules available in the current workspace, if any:
Definition at line 137 of file emacs.c.
References concatenate(), db_get_current_workspace_name(), db_get_module_list(), EMACS_AVAILABLE_MODULES_NAME, free(), gen_array_full_free(), gen_array_item(), gen_array_nitems(), send_command_to_emacs(), strdup(), and wpips_emacs_mode.
Referenced by close_workspace_notify(), end_create_workspace_notify(), end_open_workspace_notify(), execute_safe_apply_outside_the_notifyer(), and execute_wpips_execute_and_display_something_outside_the_notifyer().
void send_user_error_to_emacs | ( | char * | some_text | ) |
Definition at line 171 of file emacs.c.
References EMACS_USER_ERROR, and send_command_to_emacs().
Referenced by wpips_user_error_message().
void send_user_log_to_emacs | ( | char * | some_text | ) |
Definition at line 178 of file emacs.c.
References EMACS_USER_LOG, and send_command_to_emacs().
Referenced by wpips_user_log().
void send_user_warning_to_emacs | ( | char * | some_text | ) |
Definition at line 185 of file emacs.c.
References EMACS_USER_WARNING, and send_command_to_emacs().
Referenced by wpips_user_warning_message().
void send_view_to_emacs | ( | char * | view_name, |
char * | the_file_name | ||
) |
Send a complete file path since the current directory in Emacs is no the same a priori:
Definition at line 192 of file emacs.c.
References get_cwd(), pips_assert, and send_command_to_emacs().
Referenced by wpips_file_view().
void send_window_number_to_emacs | ( | int | number | ) |
Definition at line 209 of file emacs.c.
References a_string, EMACS_WINDOW_NUMBER, and send_command_to_emacs().
Referenced by initialize_emacs_mode(), and window_number_notify().
|
static |
By default, send what we do not understand to stderr:
I can't remember how to give an argument to %...c ...
Definition at line 363 of file emacs.c.
Referenced by unframe_commands_from_emacs().
|
static |
Try to unframe one half of command sent by emacs.
Thus needs an iterator outside.
Wait for a begin of command:
No begin of command:
Return an empty string:
Discard the begin of buffer:
Now we wait for an end of command:
Empty the command buffer:
Skip the begin token:
Look for an end of command:
No end of packet found yet. Add the content to the command buffer and keep waiting:
Go in the wait for begin state:
Skip the end token:
Definition at line 396 of file emacs.c.
References add_command_to_buffer(), command_buffer, command_buffer_length, debug(), epips_execute_command(), epips_input_automaton_state, epips_receive_begin_of_command_token, epips_receive_end_of_command_token, epips_wait_for_begin, epips_wait_for_end, and trow_away_epips_input().
Referenced by read_commands_from_emacs().
|
static |
Definition at line 374 of file emacs.c.
Referenced by add_command_to_buffer(), epips_execute_command(), and unframe_commands_from_emacs().
|
static |
Definition at line 375 of file emacs.c.
Referenced by add_command_to_buffer(), and unframe_commands_from_emacs().
|
static |
The title of the commands used by the emacs interface:
Definition at line 69 of file emacs.c.
Referenced by send_the_names_of_the_available_modules_to_emacs().
|
static |
Definition at line 70 of file emacs.c.
Referenced by epips_execute_command(), and send_module_name_to_emacs().
|
static |
Definition at line 77 of file emacs.c.
Referenced by ask_emacs_to_open_a_new_daVinci_context().
|
static |
Definition at line 71 of file emacs.c.
Referenced by send_prompt_user_to_emacs().
|
static |
Definition at line 72 of file emacs.c.
Referenced by epips_execute_command(), and epips_sequential_view().
|
static |
Definition at line 73 of file emacs.c.
Referenced by send_user_error_to_emacs().
|
static |
Definition at line 74 of file emacs.c.
Referenced by send_user_log_to_emacs().
|
static |
Definition at line 75 of file emacs.c.
Referenced by send_user_warning_to_emacs().
|
static |
Definition at line 78 of file emacs.c.
Referenced by ask_emacs_to_display_a_graph().
|
static |
Definition at line 76 of file emacs.c.
Referenced by send_window_number_to_emacs().
|
static |
The token to mark the begin and end of command.
Use some strings to be usually never used in ISO-8859-1:
Definition at line 82 of file emacs.c.
Referenced by send_command_to_emacs().
|
static |
Definition at line 83 of file emacs.c.
Referenced by send_command_to_emacs().
|
static |
Definition at line 95 of file emacs.c.
Referenced by unframe_commands_from_emacs().
|
static |
Definition at line 84 of file emacs.c.
Referenced by unframe_commands_from_emacs().
|
static |
Definition at line 85 of file emacs.c.
Referenced by unframe_commands_from_emacs().
bool wpips_emacs_mode = 0 |
Here are all the stuff to interface Pips with Emacs.
This variable is used to indicate wether wpips is in the Emacs mode:
Ronan, 23/05/1995. Include the label names: This variable is used to indicate wether wpips is in the Emacs mode: By default, wpips is not called from emacs. RK. .Ker yell@ cri. ensmp .fr
Definition at line 65 of file emacs.c.
Referenced by continue_create_workspace_notify(), create_edit_menu(), create_log_menu(), edit_close_notify(), edit_notify(), end_delete_workspace_notify(), initialize_emacs_mode(), notify_hpfc_file_view(), prompt_user(), quit_notify(), send_the_names_of_the_available_modules_to_emacs(), window_number_notify(), wpips_display_graph_file_display(), wpips_file_view(), wpips_main(), wpips_parse_arguments(), wpips_user_error_message(), wpips_user_log(), wpips_user_warning_message(), and wpips_view_marked_busy().