PIPS
xv_edit2.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/text.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "database.h"
#include "misc.h"
#include "pipsdbm.h"
#include "resources.h"
#include "constants.h"
#include "top-level.h"
#include "wpips.h"
#include "wpips-labels.h"
#include "wpips_view_menu_layout.h"
+ Include dependency graph for xv_edit2.c:

Go to the source code of this file.

Macros

#define DONT_TOUCH_WINDOW_ADDRESS   0
 

Functions

void edit_notify (Menu menu, Menu_item menu_item)
 
void current_selection_notify (Menu menu, Menu_item menu_item)
 
void dont_touch_window_notify (Panel_item item, int value, Event *event)
 
char * compute_title_string (int window_number)
 
int alloc_first_initialized_window (bool the_same_as_previous)
 Find the first free window if any. More...
 
bool wpips_view_marked_busy (char *title_module_name, char *title_label, char *icon_name, char *icon_title)
 Mark a wpips or epips window as busy: More...
 
void wpips_file_view (char *file_name, char *title_module_name, char *title_label, char *icon_name, char *icon_title)
 Display a file in a wpips or epips window: More...
 
void wpips_display_graph_file_display (wpips_view_menu_layout_line *menu_line)
 Use daVinci to display a graph information: More...
 
void wpips_display_plain_file (wpips_view_menu_layout_line *menu_line)
 Use some text viewer to display the resource: More...
 
void wpips_display_WP65_file (wpips_view_menu_layout_line *menu_line)
 Mainly a hack to display 2 files in only one method for WP65... More...
 
void execute_wpips_execute_and_display_something_outside_the_notifyer ()
 To execute something and display some Pips output with wpips or epips, called outside the notifyer: More...
 
void wpips_execute_and_display_something_outside_the_notifyer (wpips_view_menu_layout_line *menu_line)
 
void wpips_execute_and_display_something (char *resource_name)
 To execute something and display some Pips output with wpips or epips: More...
 
void wpips_execute_and_display_something_from_alias (char *alias_name)
 To execute something and display some Pips output with wpips or epips by knowing its alias: More...
 
void view_notify (Menu menu, Menu_item menu_item)
 
void edit_close_notify (Menu menu, Menu_item menu_item)
 
void disable_menu_item (Menu_item item)
 
void enable_menu_item (Menu_item item)
 
void apply_on_each_view_item (void(*function_to_apply_on_each_menu_item)(Menu_item), void(*function_to_apply_on_each_panel_item)(Panel_item))
 
void disable_view_selection ()
 
void enable_view_selection ()
 
void create_edit_window ()
 
void create_edit_menu ()
 

Variables

static wpips_view_menu_layout_line wpips_view_menu_layout []
 Include the label names: More...
 
static Textsw edit_textsw [MAX_NUMBER_OF_WPIPS_WINDOWS]
 
static Panel_item check_box [MAX_NUMBER_OF_WPIPS_WINDOWS]
 
static bool dont_touch_window [MAX_NUMBER_OF_WPIPS_WINDOWS]
 
int number_of_wpips_windows = INITIAL_NUMBER_OF_WPIPS_WINDOWS
 
static Menu_item current_selection_mi
 
static Menu_item close_menu_item
 
static Menu_item sequential_view_menu_item
 
Menu_item edit_menu_item
 
Menu view_menu
 The menu "View" on the main panel: More...
 
static wpips_view_menu_layout_lineexecute_wpips_execute_and_display_something_outside_the_notifyer_menu_line = NULL
 To pass the view name to execute_wpips_execute_and_display_something_outside_the_notifyer(): More...
 

Macro Definition Documentation

◆ DONT_TOUCH_WINDOW_ADDRESS

#define DONT_TOUCH_WINDOW_ADDRESS   0

Definition at line 186 of file xv_edit2.c.

Function Documentation

◆ alloc_first_initialized_window()

int alloc_first_initialized_window ( bool  the_same_as_previous)

Find the first free window if any.

If called with TRUE, giive the same as the previous choosen one.

Skip windows with modified text inside :

Skip windows with a retain attribute :

Definition at line 211 of file xv_edit2.c.

212 {
213  static int next = 0;
214  static int candidate = 0;
215  int i;
216 
217  if (the_same_as_previous)
218  return candidate;
219 
220  for(i = next; i < next + number_of_wpips_windows; i++) {
221  candidate = i % number_of_wpips_windows;
222  /* Skip windows with modified text inside : */
223  if ((bool)xv_get(edit_textsw[candidate], TEXTSW_MODIFIED))
224  continue;
225  /* Skip windows with a retain attribute : */
226  if ((bool)xv_get(check_box[candidate], PANEL_VALUE))
227  continue;
228 
229  next = candidate + 1;
230  return candidate;
231  }
232  candidate = NO_TEXTSW_AVAILABLE;
233 
234  return candidate;
235 }
#define NO_TEXTSW_AVAILABLE
Definition: gpips-local.h:32
static Panel_item check_box[MAX_NUMBER_OF_WPIPS_WINDOWS]
Definition: xv_edit2.c:75
static Textsw edit_textsw[MAX_NUMBER_OF_WPIPS_WINDOWS]
Definition: xv_edit2.c:74
int number_of_wpips_windows
Definition: xv_edit2.c:77

References check_box, edit_textsw, NO_TEXTSW_AVAILABLE, and number_of_wpips_windows.

Referenced by edit_notify(), wpips_file_view(), and wpips_view_marked_busy().

+ Here is the caller graph for this function:

◆ apply_on_each_view_item()

void apply_on_each_view_item ( void(*)(Menu_item)  function_to_apply_on_each_menu_item,
void(*)(Panel_item)  function_to_apply_on_each_panel_item 
)

Skip the "current_selection_mi" and "close" Menu_items:

Skip the title item:

Now walk through the options panel:

Only on the PANEL_CHOICE_STACK:

Definition at line 572 of file xv_edit2.c.

574 {
575  int i;
576 
577  /* Skip the "current_selection_mi" and "close" Menu_items: */
578  for(i = (int) xv_get(view_menu, MENU_NITEMS); i > 0; i--) {
579  Menu_item menu_item = (Menu_item) xv_get(view_menu, MENU_NTH_ITEM, i);
580  /* Skip the title item: */
581  if (!(bool) xv_get(menu_item, MENU_TITLE)
582  && menu_item != current_selection_mi
583  && menu_item != close_menu_item
584  && xv_get(menu_item, MENU_NOTIFY_PROC) != NULL)
585  function_to_apply_on_each_menu_item(menu_item);
586  }
587 
588  /* Now walk through the options panel: */
589  {
590  Panel_item panel_item;
591 
592  PANEL_EACH_ITEM(options_panel, panel_item)
593  /* Only on the PANEL_CHOICE_STACK: */
594  if ((Panel_item_type) xv_get(panel_item, PANEL_ITEM_CLASS) ==
595  PANEL_BUTTON_ITEM)
596  function_to_apply_on_each_panel_item(panel_item);
597  PANEL_END_EACH
598  }
599 }
static Menu_item close_menu_item
Definition: xv_edit2.c:80
static Menu_item current_selection_mi
Definition: xv_edit2.c:79
Menu view_menu
The menu "View" on the main panel:
Definition: xv_edit2.c:85
Panel options_panel
Definition: xv_props.c:69

References close_menu_item, current_selection_mi, options_panel, and view_menu.

Referenced by disable_view_selection(), and enable_view_selection().

+ Here is the caller graph for this function:

◆ compute_title_string()

char* compute_title_string ( int  window_number)

xv_set will copy the string.

Definition at line 197 of file xv_edit2.c.

198 {
199  char title_string_beginning[] = "Xview Pips Display Facility # ";
200  static char title_string[sizeof(title_string_beginning) + 4];
201 
202  (void) sprintf(title_string, "%s%d",
203  title_string_beginning, window_number + 1);
204  /* xv_set will copy the string. */
205  return title_string;
206 }
GtkWidget * window_number
Definition: gtk_status.c:75

References window_number.

Referenced by wpips_file_view(), and wpips_view_marked_busy().

+ Here is the caller graph for this function:

◆ create_edit_menu()

void create_edit_menu ( )

Make sense only if we have XView edit windows:

Now add all the view entries:

Just a separator:

Make sense only if we have XView edit windows:

Just a separator:

Definition at line 649 of file xv_edit2.c.

650 {
651  wpips_view_menu_layout_line * current_view;
652 
654  xv_create(NULL, MENUITEM,
655  MENU_STRING, "No Selection",
656  MENU_NOTIFY_PROC, current_selection_notify,
657  MENU_INACTIVE, TRUE,
658  MENU_RELEASE,
659  NULL);
660 
661  close_menu_item =
662  xv_create(NULL, MENUITEM,
663  MENU_STRING, "Close",
664  MENU_NOTIFY_PROC, edit_close_notify,
665  MENU_INACTIVE, TRUE,
666  MENU_RELEASE,
667  NULL);
668 
670  xv_create(NULL, MENUITEM,
671  MENU_STRING, SEQUENTIAL_VIEW,
672  MENU_NOTIFY_PROC, view_notify,
673  NULL);
674 
675  view_menu =
676  xv_create(XV_NULL, MENU_COMMAND_MENU,
677  MENU_GEN_PIN_WINDOW, main_frame, "View & Edit Menu",
678  MENU_TITLE_ITEM, "Viewing or editing a module ",
679  NULL);
680 
681  if (! wpips_emacs_mode) {
682  /* Make sense only if we have XView edit windows: */
683  xv_set(view_menu, MENU_APPEND_ITEM, current_selection_mi,
684  NULL);
685  }
686  /* Now add all the view entries: */
687  for (current_view = &wpips_view_menu_layout[0];
688  current_view->menu_entry_string != NULL;
689  current_view++) {
690  if (strcmp(current_view->menu_entry_string,
692  xv_set(view_menu,
693  /* Just a separator: */
695  NULL);
696  else
697  xv_set(view_menu,
698  MENU_ACTION_ITEM, current_view->menu_entry_string,
699  view_notify,
700  NULL);
701  }
702  if (! wpips_emacs_mode) {
703  /* Make sense only if we have XView edit windows: */
704  xv_set(view_menu, /* Just a separator: */
706  MENU_APPEND_ITEM, close_menu_item,
707  NULL);
708  }
709 
710  (void) xv_create(main_panel, PANEL_BUTTON,
711  PANEL_LABEL_STRING, "View",
712  PANEL_ITEM_MENU, view_menu,
713  NULL);
714 
715 }
bool wpips_emacs_mode
Here are all the stuff to interface Pips with Emacs.
Definition: emacs.c:65
#define SEQUENTIAL_VIEW
Definition: gpips-labels.h:33
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
Definition: gpips.c:60
The type describing a View menu entry:
Definition: wpips-local.h:84
#define WPIPS_MENU_SEPARATOR_ID
How it is specified in the layout .h:
Definition: wpips-local.h:96
Panel main_panel
Definition: wpips.c:63
#define WPIPS_MENU_SEPARATOR
Define the menu separator:
Definition: wpips-local.h:94
void view_notify(Menu menu, Menu_item menu_item)
Definition: xv_edit2.c:517
static wpips_view_menu_layout_line wpips_view_menu_layout[]
Include the label names:
Definition: xv_edit2.c:64
void current_selection_notify(Menu menu, Menu_item menu_item)
Definition: xv_edit2.c:175
static Menu_item sequential_view_menu_item
Definition: xv_edit2.c:81
void edit_close_notify(Menu menu, Menu_item menu_item)
Definition: xv_edit2.c:527

References close_menu_item, current_selection_mi, current_selection_notify(), edit_close_notify(), main_frame, main_panel, wpips_view_menu_layout_line_s::menu_entry_string, SEQUENTIAL_VIEW, sequential_view_menu_item, view_menu, view_notify(), wpips_emacs_mode, WPIPS_MENU_SEPARATOR, WPIPS_MENU_SEPARATOR_ID, and wpips_view_menu_layout.

+ Here is the call graph for this function:

◆ create_edit_window()

void create_edit_window ( )

Xv_Window window;

Definition at line 616 of file xv_edit2.c.

617 {
618  /* Xv_Window window; */
619  int i;
620 
621  for(i = 0; i < MAX_NUMBER_OF_WPIPS_WINDOWS; i++) {
622  Panel panel;
623 
624  edit_textsw[i] = xv_create(edit_frame[i], TEXTSW,
625  TEXTSW_DISABLE_CD, TRUE,
626  TEXTSW_DISABLE_LOAD, TRUE,
627  0);
628  window_fit(edit_textsw[i]);
629  panel = xv_create(edit_frame[i], PANEL,
630  WIN_ROW_GAP, 1,
631  WIN_COLUMN_GAP, 1,
632  NULL);
633  dont_touch_window[i] = FALSE;
634  check_box[i] = xv_create(panel, PANEL_CHECK_BOX,
635  PANEL_CHOICE_STRINGS, "Retain this window", NULL,
636  PANEL_VALUE, dont_touch_window[i],
637  PANEL_ITEM_X_GAP, 1,
638  PANEL_ITEM_Y_GAP, 1,
639  PANEL_NOTIFY_PROC, dont_touch_window_notify,
641  NULL);
642  window_fit_height(panel);
643  window_fit(edit_frame[i]);
644  }
645 }
#define MAX_NUMBER_OF_WPIPS_WINDOWS
How many display wondows can be opened :
Definition: wpips-local.h:30
Frame edit_frame[MAX_NUMBER_OF_WPIPS_WINDOWS]
Definition: wpips-local.h:41
void dont_touch_window_notify(Panel_item item, int value, Event *event)
Definition: xv_edit2.c:188
static bool dont_touch_window[MAX_NUMBER_OF_WPIPS_WINDOWS]
Definition: xv_edit2.c:76
#define DONT_TOUCH_WINDOW_ADDRESS
Definition: xv_edit2.c:186

References check_box, dont_touch_window, DONT_TOUCH_WINDOW_ADDRESS, dont_touch_window_notify(), edit_frame, edit_textsw, and MAX_NUMBER_OF_WPIPS_WINDOWS.

+ Here is the call graph for this function:

◆ current_selection_notify()

void current_selection_notify ( Menu  menu,
Menu_item  menu_item 
)

Definition at line 175 of file xv_edit2.c.

178 {
179  int i;
180 
181  for(i = 0; i < number_of_wpips_windows; i++)
183 }
void unhide_window(Frame frame)
map a frame on the screen
Definition: xv_utils.c:55

References edit_frame, number_of_wpips_windows, and unhide_window().

Referenced by create_edit_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disable_menu_item()

void disable_menu_item ( Menu_item  item)

Definition at line 558 of file xv_edit2.c.

559 {
560  xv_set(item, MENU_INACTIVE, TRUE, 0);
561 }

Referenced by disable_compile_selection(), disable_option_selection(), disable_transform_selection(), and disable_view_selection().

+ Here is the caller graph for this function:

◆ disable_view_selection()

void disable_view_selection ( )

Definition at line 603 of file xv_edit2.c.

604 {
606 }
void disable_menu_item(Menu_item item)
Definition: xv_edit2.c:558
void apply_on_each_view_item(void(*function_to_apply_on_each_menu_item)(Menu_item), void(*function_to_apply_on_each_panel_item)(Panel_item))
Definition: xv_edit2.c:572
void disable_panel_item(Panel_item item)
Definition: xv_props.c:95

References apply_on_each_view_item(), disable_menu_item(), and disable_panel_item().

+ Here is the call graph for this function:

◆ dont_touch_window_notify()

void dont_touch_window_notify ( Panel_item  item,
int  value,
Event *  event 
)

Definition at line 188 of file xv_edit2.c.

189 {
190  bool *dont_touch_window = (bool *) xv_get(item, XV_KEY_DATA,
192  *dont_touch_window = (bool) xv_get(item, PANEL_VALUE);
193 }
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
Definition: newgen_types.h:78

References dont_touch_window, and DONT_TOUCH_WINDOW_ADDRESS.

Referenced by create_edit_window().

+ Here is the caller graph for this function:

◆ edit_close_notify()

void edit_close_notify ( Menu  menu,
Menu_item  menu_item 
)

Definition at line 527 of file xv_edit2.c.

529 {
530  int i;
531 
532  if (! wpips_emacs_mode) {
533  for(i = 0; i < MAX_NUMBER_OF_WPIPS_WINDOWS; i++)
534  if (! (bool)xv_get(edit_textsw[i], TEXTSW_MODIFIED))
536 
537  for(i = 0; i < MAX_NUMBER_OF_WPIPS_WINDOWS; i++)
538  if ((bool)xv_get(edit_textsw[i], TEXTSW_MODIFIED)) {
540  prompt_user("File not saved in editor");
541  return;
542  }
543 
544  for(i = 0; i < MAX_NUMBER_OF_WPIPS_WINDOWS; i++)
546 
547  xv_set(current_selection_mi,
548  MENU_STRING, "No Selection",
549  MENU_INACTIVE, TRUE, NULL);
550 
551  xv_set(close_menu_item, MENU_INACTIVE, TRUE, NULL);
552  }
554 }
void prompt_user(string a_printf_format,...)
Definition: gtk_log.c:66
void display_memory_usage()
Definition: gtk_status.c:84
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
Definition: gtk_utils.c:89

References close_menu_item, current_selection_mi, display_memory_usage(), edit_frame, edit_textsw, hide_window(), MAX_NUMBER_OF_WPIPS_WINDOWS, prompt_user(), unhide_window(), and wpips_emacs_mode.

Referenced by create_edit_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_notify()

void edit_notify ( Menu  menu,
Menu_item  menu_item 
)

Rely on the standard EPips viewer:

Translate the menu string in a resource name:

Is there an available edit_textsw ?

Display the file name and the module name. RK, 2/06/1993 :

Definition at line 94 of file xv_edit2.c.

96 {
97  char string_filename[SMALL_BUFFER_LENGTH],
98  string_modulename[SMALL_BUFFER_LENGTH];
99  char file_name_in_database[MAXPATHLEN*2];
100  char * modulename = db_get_current_module_name();
101  char * file_name;
102  int win_nb;
103  char * alternate_wpips_editor;
104 
105  if (modulename == NULL) {
106  prompt_user("No module selected");
107  return;
108  }
109 
110  if (wpips_emacs_mode) {
111  /* Rely on the standard EPips viewer: */
112  wpips_view_menu_layout_line * current_view;
113  char * label = (char *) xv_get(menu_item, MENU_STRING);
114  /* Translate the menu string in a resource name: */
115  for (current_view = &wpips_view_menu_layout[0];
116  current_view->menu_entry_string != NULL;
117  current_view++)
118  if (strcmp(label, current_view->menu_entry_string) == 0)
119  break;
120 
121  pips_assert("Resource related to the menu entry not found",
122  current_view->menu_entry_string != NULL);
123 
125  }
126  else {
127  file_name = db_get_file_resource(DBR_SOURCE_FILE, modulename, TRUE);
128  sprintf(file_name_in_database, "%s/%s",
130  file_name);
131 
132  if ((alternate_wpips_editor = getenv("PIPS_WPIPS_EDITOR")) != NULL) {
133  char editor_command[MAXPATHLEN*2];
134  sprintf(editor_command, "%s %s &",
135  alternate_wpips_editor,
136  file_name_in_database);
137  system(editor_command);
138  }
139  else {
140  /* Is there an available edit_textsw ? */
141  if ( (win_nb=alloc_first_initialized_window(FALSE)) == NO_TEXTSW_AVAILABLE ) {
142  prompt_user("None of the text-windows is available");
143  return;
144  }
145 
146  sprintf(string_filename, "File: %s", file_name);
147  sprintf(string_modulename, "Module: %s", modulename);
148 
149  /* Display the file name and the module name. RK, 2/06/1993 : */
150  xv_set(edit_frame[win_nb], FRAME_LABEL, "Pips Edit Facility",
151  FRAME_SHOW_FOOTER, TRUE,
152  FRAME_LEFT_FOOTER, string_filename,
153  FRAME_RIGHT_FOOTER, string_modulename,
154  NULL);
155 
156  xv_set(edit_textsw[win_nb],
157  TEXTSW_FILE, file_name_in_database,
158  TEXTSW_BROWSING, FALSE,
159  TEXTSW_FIRST, 0,
160  NULL);
161 
162  unhide_window(edit_frame[win_nb]);
163 
164  xv_set(current_selection_mi,
165  MENU_STRING, "Lasts",
166  MENU_INACTIVE, FALSE,
167  NULL);
168 
169  xv_set(close_menu_item, MENU_INACTIVE, FALSE, NULL);
170  }
171  }
172 }
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
#define SMALL_BUFFER_LENGTH
Definition: gpips-local.h:24
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define MAXPATHLEN
MAXPATHLEN is defined in <sys/param.h> for SunOS...
Definition: misc-local.h:203
#define db_get_file_resource
#define build_pgmwd
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82
static string file_name
int alloc_first_initialized_window(bool the_same_as_previous)
Find the first free window if any.
Definition: xv_edit2.c:211
void wpips_execute_and_display_something_outside_the_notifyer(wpips_view_menu_layout_line *menu_line)
Definition: xv_edit2.c:453

References alloc_first_initialized_window(), build_pgmwd, close_menu_item, current_selection_mi, db_get_current_module_name(), db_get_current_workspace_name(), db_get_file_resource, edit_frame, edit_textsw, file_name, MAXPATHLEN, wpips_view_menu_layout_line_s::menu_entry_string, NO_TEXTSW_AVAILABLE, pips_assert, prompt_user(), SMALL_BUFFER_LENGTH, unhide_window(), wpips_emacs_mode, wpips_execute_and_display_something_outside_the_notifyer(), and wpips_view_menu_layout.

+ Here is the call graph for this function:

◆ enable_menu_item()

void enable_menu_item ( Menu_item  item)

Definition at line 565 of file xv_edit2.c.

566 {
567  xv_set(item, MENU_INACTIVE, FALSE, 0);
568 }

Referenced by enable_compile_selection(), enable_option_selection(), enable_transform_selection(), and enable_view_selection().

+ Here is the caller graph for this function:

◆ enable_view_selection()

void enable_view_selection ( )

Definition at line 610 of file xv_edit2.c.

611 {
613 }
void enable_menu_item(Menu_item item)
Definition: xv_edit2.c:565
void enable_panel_item(Panel_item item)
Definition: xv_props.c:102

References apply_on_each_view_item(), enable_menu_item(), and enable_panel_item().

+ Here is the call graph for this function:

◆ execute_wpips_execute_and_display_something_outside_the_notifyer()

void execute_wpips_execute_and_display_something_outside_the_notifyer ( )

To execute something and display some Pips output with wpips or epips, called outside the notifyer:

Execute the needed method:

The module list may have changed (well not very likely to happen, but...):

Definition at line 438 of file xv_edit2.c.

439 {
441 
442  /* Execute the needed method: */
443  menu_line->method_function_to_use(menu_line);
444 
445  /* The module list may have changed (well not very likely to
446  happen, but...): */
449 }
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: emacs.c:137
void(* method_function_to_use)(struct wpips_view_menu_layout_line_s *)
Definition: wpips-local.h:87
static wpips_view_menu_layout_line * execute_wpips_execute_and_display_something_outside_the_notifyer_menu_line
To pass the view name to execute_wpips_execute_and_display_something_outside_the_notifyer():
Definition: xv_edit2.c:90

References display_memory_usage(), execute_wpips_execute_and_display_something_outside_the_notifyer_menu_line, wpips_view_menu_layout_line_s::method_function_to_use, and send_the_names_of_the_available_modules_to_emacs().

Referenced by wpips_main_loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ view_notify()

void view_notify ( Menu  menu,
Menu_item  menu_item 
)

Translate the menu string in a resource name:

Definition at line 517 of file xv_edit2.c.

519 {
520  /* Translate the menu string in a resource name: */
521  char * label = (char *) xv_get(menu_item, MENU_STRING);
523 }
void wpips_execute_and_display_something_from_alias(char *alias_name)
To execute something and display some Pips output with wpips or epips by knowing its alias:
Definition: xv_edit2.c:493

References wpips_execute_and_display_something_from_alias().

Referenced by create_edit_menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wpips_display_graph_file_display()

void wpips_display_graph_file_display ( wpips_view_menu_layout_line menu_line)

Use daVinci to display a graph information:

Exploit some parallelism between daVinci/Emacs and PIPS itself:

Preprocess the graph to be understandable by daVinci :

Since Emacs may be with another current directory, use the full path name:

Definition at line 338 of file xv_edit2.c.

339 {
340  char * file_name;
341  char a_buffer[SMALL_BUFFER_LENGTH];
342  /* Exploit some parallelism between daVinci/Emacs and PIPS
343  itself: */
344  if (wpips_emacs_mode)
346 
348 
349  user_log("Displaying in a \"daVinci\" window...\n");
350 
351  /* Preprocess the graph to be understandable by daVinci : */
352  if (wpips_emacs_mode) {
353  sprintf(a_buffer, "pips_graph2daVinci %s", file_name);
354  system(a_buffer);
355  /* Since Emacs may be with another current directory, use the
356  full path name: */
358  "/", file_name, NULL));
359  }
360  else {
361  (void) sprintf(a_buffer, "pips_graph2daVinci -launch_daVinci %s",
362  file_name);
363  system(a_buffer);
364  }
365 
366  free(file_name);
367 }
void user_log(const char *format,...)
Definition: message.c:234
void ask_emacs_to_open_a_new_daVinci_context()
Definition: emacs.c:236
void ask_emacs_to_display_a_graph(string file_name)
Definition: emacs.c:243
char * get_cwd(void)
returns the current working directory name.
Definition: file.c:486
void free(void *)
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
string build_view_file(const char *)
view.c
Definition: view.c:97

References ask_emacs_to_display_a_graph(), ask_emacs_to_open_a_new_daVinci_context(), build_view_file(), concatenate(), file_name, free(), get_cwd(), wpips_view_menu_layout_line_s::resource_name_to_view, SMALL_BUFFER_LENGTH, user_log(), and wpips_emacs_mode.

+ Here is the call graph for this function:

◆ wpips_display_plain_file()

void wpips_display_plain_file ( wpips_view_menu_layout_line menu_line)

Use some text viewer to display the resource:

Definition at line 372 of file xv_edit2.c.

373 {
374  char title_module_name[SMALL_BUFFER_LENGTH];
375 
376  char * print_type = menu_line->resource_name_to_view;
377  char * icon_name = menu_line->icon_name;
378  char * label = menu_line->menu_entry_string;
379 
380  (void) sprintf(title_module_name, "Module: %s",
382  if (wpips_view_marked_busy(title_module_name, label, icon_name,
385 
386  wpips_file_view(file_name, title_module_name, label, icon_name,
388 
389  free(file_name);
390  }
391 }
void print_type(type)
For debugging.
Definition: type.c:111
bool wpips_view_marked_busy(char *title_module_name, char *title_label, char *icon_name, char *icon_title)
Mark a wpips or epips window as busy:
Definition: xv_edit2.c:240
void wpips_file_view(char *file_name, char *title_module_name, char *title_label, char *icon_name, char *icon_title)
Display a file in a wpips or epips window:
Definition: xv_edit2.c:277

References build_view_file(), db_get_current_module_name(), file_name, free(), wpips_view_menu_layout_line_s::icon_name, wpips_view_menu_layout_line_s::menu_entry_string, print_type(), wpips_view_menu_layout_line_s::resource_name_to_view, SMALL_BUFFER_LENGTH, wpips_file_view(), and wpips_view_marked_busy().

+ Here is the call graph for this function:

◆ wpips_display_WP65_file()

void wpips_display_WP65_file ( wpips_view_menu_layout_line menu_line)

Mainly a hack to display 2 files in only one method for WP65...

Now display the other file:

Assume the previous build_view_file built the both resources:

Definition at line 396 of file xv_edit2.c.

397 {
398  char title_module_name[SMALL_BUFFER_LENGTH];
399 
400  char * print_type = menu_line->resource_name_to_view;
401  char * icon_name = menu_line->icon_name;
402  char * label = menu_line->menu_entry_string;
403 
404  (void) sprintf(title_module_name, "Module: %s",
406  if (wpips_view_marked_busy(title_module_name, label, icon_name,
408  {
409  char bank_view_name[SMALL_BUFFER_LENGTH];
410 
412  wpips_file_view(file_name, title_module_name, label, icon_name,
414  free(file_name);
415 
416  /* Now display the other file: */
417  (void) sprintf(bank_view_name, "%s (bank view)", label);
418  if (wpips_view_marked_busy(title_module_name, bank_view_name,
419  "WP65_bank", db_get_current_module_name()))
420  {
421  /* Assume the previous build_view_file built the both
422  resources: */
423  file_name = get_dont_build_view_file(DBR_WP65_BANK_FILE);
424 
425  wpips_file_view(file_name, title_module_name,
426  bank_view_name, "WP65_bank",
428 
429  free(file_name);
430  }
431  }
432 }
string get_dont_build_view_file(const char *)
Definition: view.c:102

References build_view_file(), db_get_current_module_name(), file_name, free(), get_dont_build_view_file(), wpips_view_menu_layout_line_s::icon_name, wpips_view_menu_layout_line_s::menu_entry_string, print_type(), wpips_view_menu_layout_line_s::resource_name_to_view, SMALL_BUFFER_LENGTH, wpips_file_view(), and wpips_view_marked_busy().

+ Here is the call graph for this function:

◆ wpips_execute_and_display_something()

void wpips_execute_and_display_something ( char *  resource_name)

To execute something and display some Pips output with wpips or epips:

Translate the resource name in a menu entry descriptor:

Definition at line 466 of file xv_edit2.c.

467 {
469  wpips_view_menu_layout_line * current_view;
470 
471  if (module_name == NULL) {
472  prompt_user("No module selected");
473  return;
474  }
475 
476  /* Translate the resource name in a menu entry descriptor: */
477  for (current_view = &wpips_view_menu_layout[0];
478  current_view->menu_entry_string != NULL;
479  current_view++)
480  if (strcmp(resource_name, current_view->resource_name_to_view) == 0)
481  break;
482 
483  pips_assert("Resource related to the menu entry not found",
484  current_view->menu_entry_string != NULL);
485 
487 }
#define resource_name(x)
Definition: database.h:108
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296

References db_get_current_module_name(), wpips_view_menu_layout_line_s::menu_entry_string, module_name(), pips_assert, prompt_user(), resource_name, wpips_view_menu_layout_line_s::resource_name_to_view, wpips_execute_and_display_something_outside_the_notifyer(), and wpips_view_menu_layout.

+ Here is the call graph for this function:

◆ wpips_execute_and_display_something_from_alias()

void wpips_execute_and_display_something_from_alias ( char *  alias_name)

To execute something and display some Pips output with wpips or epips by knowing its alias:

Definition at line 493 of file xv_edit2.c.

494 {
496  wpips_view_menu_layout_line * current_view;
497 
498  if (module_name == NULL) {
499  prompt_user("No module selected");
500  return;
501  }
502 
503  for (current_view = &wpips_view_menu_layout[0];
504  current_view->menu_entry_string != NULL;
505  current_view++)
506  if (strcmp(alias_name, current_view->menu_entry_string) == 0)
507  break;
508 
509  pips_assert("Resource related to the menu entry not found",
510  current_view->menu_entry_string != NULL);
511 
513 }

References db_get_current_module_name(), wpips_view_menu_layout_line_s::menu_entry_string, module_name(), pips_assert, prompt_user(), wpips_execute_and_display_something_outside_the_notifyer(), and wpips_view_menu_layout.

Referenced by epips_execute_and_display_something(), options_panel_to_view_menu_gateway(), and view_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wpips_execute_and_display_something_outside_the_notifyer()

void wpips_execute_and_display_something_outside_the_notifyer ( wpips_view_menu_layout_line menu_line)

Ask to execute the execute_wpips_execute_and_display_something_outside_the_notifyer():

I guess the function above does not return...

Definition at line 453 of file xv_edit2.c.

454 {
456  /* Ask to execute the
457  execute_wpips_execute_and_display_something_outside_the_notifyer(): */
459  /* I guess the function above does not return... */
460 }
void execute_main_loop_command(gpips_main_loop_command_type command)
To ask pipsmake to stop as soon as possible:
Definition: gpips.c:267
@ WPIPS_EXECUTE_AND_DISPLAY
Definition: wpips-local.h:69

References execute_main_loop_command(), execute_wpips_execute_and_display_something_outside_the_notifyer_menu_line, and WPIPS_EXECUTE_AND_DISPLAY.

Referenced by edit_notify(), wpips_execute_and_display_something(), and wpips_execute_and_display_something_from_alias().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wpips_file_view()

void wpips_file_view ( char *  file_name,
char *  title_module_name,
char *  title_label,
char *  icon_name,
char *  icon_title 
)

Display a file in a wpips or epips window:

Well, something got wrong...

Is there an available edit_textsw ? Ask for the same one allocated for wpips_view_marked_busy()

Display the file name and the module name. RK, 2/06/1993 :

The Emacs mode equivalent:

send_icon_name_to_emacs(icon_number);

Parameters
title_labelThe module name for example
icon_name"Sequential View" for exemple

Definition at line 277 of file xv_edit2.c.

282 {
283  if (file_name == NULL) {
284  /* Well, something got wrong... */
285  prompt_user("Nothing available to display...");
286  return;
287  }
288 
289  if (! wpips_emacs_mode) {
290  int window_number;
291 
292  /* Is there an available edit_textsw ? Ask for the same one
293  allocated for wpips_view_marked_busy() */
295  == NO_TEXTSW_AVAILABLE) {
296  prompt_user("None of the text-windows is available");
297  return;
298  }
299  /* Display the file name and the module name. RK, 2/06/1993 : */
300  xv_set(edit_frame[window_number],
301  FRAME_LABEL, compute_title_string(window_number),
302  FRAME_SHOW_FOOTER, TRUE,
303  FRAME_RIGHT_FOOTER, title_module_name,
304  NULL);
305 
306  set_pips_icon(edit_frame[window_number], icon_name, icon_title);
307 
308  xv_set(edit_textsw[window_number],
309  TEXTSW_FILE, file_name,
310  TEXTSW_BROWSING, TRUE,
311  TEXTSW_FIRST, 0,
312  NULL);
313 
314  xv_set(edit_frame[window_number],
315  FRAME_LEFT_FOOTER, title_label,
316  FRAME_BUSY, FALSE,
317  NULL);
318 
320 
321  xv_set(current_selection_mi,
322  MENU_STRING, "Lasts",
323  MENU_INACTIVE, FALSE, NULL);
324  xv_set(close_menu_item, MENU_INACTIVE, FALSE, NULL);
325  }
326  else {
327  /* The Emacs mode equivalent: */
329  /* send_icon_name_to_emacs(icon_number); */
330  send_view_to_emacs(title_label, file_name);
331  }
333 }
void send_view_to_emacs(char *view_name, char *the_file_name)
Definition: emacs.c:192
void send_module_name_to_emacs(char *some_text)
Here are all the methods used to send an object to Emacs:
Definition: emacs.c:128
void set_pips_icon(Frame frame, char *icon_name, char *icon_text)
Definition: xv_icons.c:118
char * compute_title_string(int window_number)
Definition: xv_edit2.c:197

References alloc_first_initialized_window(), close_menu_item, compute_title_string(), current_selection_mi, db_get_current_module_name(), display_memory_usage(), edit_frame, edit_textsw, file_name, NO_TEXTSW_AVAILABLE, prompt_user(), send_module_name_to_emacs(), send_view_to_emacs(), set_pips_icon(), unhide_window(), window_number, and wpips_emacs_mode.

Referenced by notify_hpfc_file_view(), wpips_display_plain_file(), and wpips_display_WP65_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wpips_view_marked_busy()

bool wpips_view_marked_busy ( char *  title_module_name,
char *  title_label,
char *  icon_name,
char *  icon_title 
)

Mark a wpips or epips window as busy:

Is there an available edit_textsw ?

Display the file name and the module name. RK, 2/06/1993 :

Parameters
title_labelThe module name for example
icon_name"Sequential View" for exemple

Definition at line 240 of file xv_edit2.c.

244 {
245  char busy_label[SMALL_BUFFER_LENGTH];
246 
247  if (! wpips_emacs_mode) {
248  int window_number;
249  /* Is there an available edit_textsw ? */
251  == NO_TEXTSW_AVAILABLE) {
252  prompt_user("None of the text-windows is available");
253  return FALSE;
254  }
255  (void) sprintf(busy_label, "*Computing %s * ...", title_label);
256  /* Display the file name and the module name. RK, 2/06/1993 : */
257  xv_set(edit_frame[window_number],
258  FRAME_LABEL, compute_title_string(window_number),
259  FRAME_SHOW_FOOTER, TRUE,
260  FRAME_LEFT_FOOTER, busy_label,
261  FRAME_RIGHT_FOOTER, title_module_name,
262  FRAME_BUSY, TRUE,
263  NULL);
264 
265  set_pips_icon(edit_frame[window_number], icon_name, icon_title);
266 
268  }
270 
271  return TRUE;
272 }

References alloc_first_initialized_window(), compute_title_string(), display_memory_usage(), edit_frame, NO_TEXTSW_AVAILABLE, prompt_user(), set_pips_icon(), SMALL_BUFFER_LENGTH, unhide_window(), window_number, and wpips_emacs_mode.

Referenced by wpips_display_plain_file(), and wpips_display_WP65_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ check_box

Panel_item check_box[MAX_NUMBER_OF_WPIPS_WINDOWS]
static

Definition at line 75 of file xv_edit2.c.

Referenced by alloc_first_initialized_window(), and create_edit_window().

◆ close_menu_item

Menu_item close_menu_item
static

◆ current_selection_mi

Menu_item current_selection_mi
static

◆ dont_touch_window

bool dont_touch_window[MAX_NUMBER_OF_WPIPS_WINDOWS]
static

Definition at line 76 of file xv_edit2.c.

Referenced by create_edit_window(), and dont_touch_window_notify().

◆ edit_menu_item

Menu_item edit_menu_item

Definition at line 82 of file xv_edit2.c.

◆ edit_textsw

◆ execute_wpips_execute_and_display_something_outside_the_notifyer_menu_line

wpips_view_menu_layout_line* execute_wpips_execute_and_display_something_outside_the_notifyer_menu_line = NULL
static

◆ number_of_wpips_windows

◆ sequential_view_menu_item

Menu_item sequential_view_menu_item
static

Definition at line 81 of file xv_edit2.c.

Referenced by create_edit_menu().

◆ view_menu

Menu view_menu

The menu "View" on the main panel:

Definition at line 85 of file xv_edit2.c.

Referenced by apply_on_each_view_item(), and create_edit_menu().

◆ wpips_view_menu_layout

wpips_view_menu_layout_line wpips_view_menu_layout[]
static
Initial value:
= {
{
NULL, NULL, NULL
}
}

Include the label names:

Definition at line 64 of file xv_edit2.c.

Referenced by create_edit_menu(), edit_notify(), wpips_execute_and_display_something(), and wpips_execute_and_display_something_from_alias().