PIPS
xv_status.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/text.h>
#include <xview/svrimage.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "database.h"
#include "misc.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "wpips.h"
+ Include dependency graph for xv_status.c:

Go to the source code of this file.

Enumerations

enum  { DECALAGE_STATUS = 100 }
 
enum  { CPU_USAGE_LENGTH = 8 }
 Max number of digits displayed in the status panel: More...
 

Functions

void display_memory_usage ()
 
void window_number_notify (Panel_item item, int value, Event *event)
 
void show_directory ()
 
void show_workspace ()
 
void show_module ()
 
void wpips_interrupt_button_blink ()
 
void wpips_interrupt_button_restore ()
 
void show_message (string message_buffer)
 
void create_status_subwindow ()
 

Variables

Panel_item directory_name_panel_item
 
Panel_item workspace_name_panel_item
 
Panel_item memory_name
 
Panel_item message
 
Panel_item window_number
 
Panel_item module_name_panel_item
 
Panel_item cpu_usage_item
 
Server_image status_window_pips_image
 
 etext
 Strange, "man end" says that end is a function! More...
 
 edata
 
 end
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DECALAGE_STATUS 

Definition at line 59 of file xv_status.c.

59  {DECALAGE_STATUS = 100
60 };
@ DECALAGE_STATUS
Definition: xv_status.c:59

◆ anonymous enum

anonymous enum

Max number of digits displayed in the status panel:

Enumerator
CPU_USAGE_LENGTH 

Definition at line 63 of file xv_status.c.

63  {CPU_USAGE_LENGTH = 8
64 };
@ CPU_USAGE_LENGTH
Definition: xv_status.c:63

Function Documentation

◆ create_status_subwindow()

void create_status_subwindow ( )

Maintenant on n'utilise plus qu'un seul panel pour la fene^tre principale. En effet, sinon il y a des proble`mes de retrac,age sur e'cran couleur. RK, 15/03/1994.

Ignore the return code of end_directory_notify:

ANEL_ITEM_X_GAP, DECALAGE_STATUS, PANEL_VALUE_Y, xv_rows(main_panel, 4),

Put the Pixmap above the Help button:

Definition at line 203 of file xv_status.c.

204 {
205  /* Maintenant on n'utilise plus qu'un seul panel pour la fene^tre
206  principale. En effet, sinon il y a des proble`mes de retrac,age
207  sur e'cran couleur. RK, 15/03/1994. */
208  Server_image pips_icon_server_image;
209 
210  message =
211  xv_create(main_panel, PANEL_TEXT,
212  PANEL_VALUE_X, DECALAGE_STATUS,
213  PANEL_VALUE_Y, xv_rows(main_panel, 1),
214  PANEL_LABEL_STRING, "Message:",
215  PANEL_READ_ONLY, TRUE,
216  PANEL_VALUE_DISPLAY_LENGTH, 64,
217  PANEL_VALUE_STORED_LENGTH, 1000,
218  NULL);
219 /*
220  directory_name_panel_item =
221  xv_create(main_panel, PANEL_TEXT,
222  PANEL_VALUE_X, DECALAGE_STATUS,
223  PANEL_VALUE_Y, xv_rows(main_panel, 2),
224  PANEL_LABEL_STRING, "Directory:",
225  PANEL_READ_ONLY, FALSE,
226  PANEL_NOTIFY_PROC, end_directory_text_notify,
227  PANEL_VALUE_DISPLAY_LENGTH, 64,
228  PANEL_VALUE_STORED_LENGTH, 256,
229  NULL);
230  */
233  main_panel,
234  "Directory:",
235  61,
237  xv_rows(main_panel, 2),
239  /* Ignore the return code of end_directory_notify: */
240  (void (*)(char *)) end_directory_notify);
241 
243  PANEL_VALUE_STORED_LENGTH, 512,
244  NULL);
245 
248  "Workspace:",
249  20,
251  xv_rows(main_panel, 3),
254 
257  "Module:",
258  20,
260  xv_rows(main_panel, 4),
263 
264  memory_name =
265  xv_create(main_panel, PANEL_TEXT,
266  PANEL_ITEM_X_GAP, DECALAGE_STATUS,
267  PANEL_VALUE_X, xv_col(main_panel, 50),
268  PANEL_VALUE_Y, xv_rows(main_panel, 3),
269  PANEL_LABEL_STRING, "Memory (MB):",
270  PANEL_VALUE_DISPLAY_LENGTH, 9,
271  PANEL_READ_ONLY, TRUE,
272  NULL);
273 
274  cpu_usage_item = xv_create(main_panel, PANEL_TEXT,
275  PANEL_LABEL_STRING, "CPU (s):",
276  PANEL_VALUE_DISPLAY_LENGTH, CPU_USAGE_LENGTH,
277  PANEL_READ_ONLY, TRUE,
278  PANEL_VALUE_X, xv_col(main_panel, 68),
279  PANEL_VALUE_Y, xv_rows(main_panel, 3),
280  NULL);
281 
282  window_number =
283  xv_create(main_panel, PANEL_NUMERIC_TEXT,
284  /*PANEL_ITEM_X_GAP, DECALAGE_STATUS,
285  PANEL_VALUE_Y, xv_rows(main_panel, 4),*/
286  PANEL_VALUE_X, xv_col(main_panel, 50),
287  PANEL_VALUE_Y, xv_rows(main_panel, 4),
288  PANEL_LABEL_STRING, "# windows:",
289  PANEL_MIN_VALUE, 1,
290  PANEL_MAX_VALUE, MAX_NUMBER_OF_WPIPS_WINDOWS,
291  PANEL_VALUE, number_of_wpips_windows,
292  PANEL_VALUE_DISPLAY_LENGTH, 2,
293  PANEL_NOTIFY_PROC, window_number_notify,
294  NULL);
295 
297 
299  xv_create(main_panel, PANEL_BUTTON,
300  PANEL_LABEL_IMAGE,
302  PANEL_NOTIFY_PROC, wpips_interrupt_pipsmake,
303  /* Put the Pixmap above the Help button: */
304  XV_X, xv_get(quit_button, XV_X) + (xv_get(quit_button, XV_WIDTH) - xv_get(pips_icon_server_image, XV_WIDTH))/2,
305  XV_Y, xv_rows(main_panel, 3) + 20,
306  NULL);
307 
308  window_fit(main_panel);
309  window_fit(main_frame);
310 
311  show_directory();
312  show_workspace();
313  show_module();
315 }
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
Definition: gpips.c:60
static Server_image pips_icon_server_image[LAST_ICON]
Definition: xv_icons.c:48
Server_image create_status_window_pips_image()
Definition: xv_icons.c:84
GtkWidget * generate_module_menu()
participe Ã&#160; la génération du menu associés aux modules dans la fenetre principale
Definition: gtk_select.c:749
GtkWidget * generate_workspace_menu()
To use with schoose_create_abbrev_menu_with_text:
Definition: gtk_select.c:625
success end_directory_notify(const char *dir)
Definition: gtk_select.c:103
GtkWidget * generate_directory_menu()
Definition: gtk_select.c:153
void open_or_create_workspace(const char *workspace_name_original)
To be used with schoose_create_abbrev_menu_with_text from the main panel:
Definition: gtk_select.c:570
#define MAX_NUMBER_OF_WPIPS_WINDOWS
How many display wondows can be opened :
Definition: wpips-local.h:30
Panel main_panel
Definition: wpips.c:63
int number_of_wpips_windows
Definition: xv_edit2.c:77
void wpips_interrupt_pipsmake(Panel_item item, Event *event)
To ask pipsmake to stop as soon as possible:
Definition: wpips.c:299
Panel_item quit_button
Definition: xv_quit.c:52
Panel_item schoose_create_abbrev_menu_with_text(Panel main_panel, char *label_string, int value_display_length, int x, int y, Menu(*generate_menu)(void), void(*after_selection)(char *))
Create an abbreviation menu attached with a text item.
Definition: xv_schoose2.c:365
void end_select_module_notify(string name)
Definition: xv_select.c:882
Panel_item window_number
Definition: xv_status.c:69
Panel_item module_name_panel_item
Definition: xv_status.c:70
void show_workspace()
Definition: xv_status.c:135
Panel_item workspace_name_panel_item
Definition: xv_status.c:68
void show_directory()
Definition: xv_status.c:126
void display_memory_usage()
Definition: xv_status.c:79
Panel_item cpu_usage_item
Definition: xv_status.c:71
Panel_item memory_name
Definition: xv_status.c:69
void show_module()
Definition: xv_status.c:149
Server_image status_window_pips_image
Definition: xv_status.c:73
Panel_item directory_name_panel_item
Definition: xv_status.c:67
void window_number_notify(Panel_item item, int value, Event *event)
Definition: xv_status.c:114

References cpu_usage_item, CPU_USAGE_LENGTH, create_status_window_pips_image(), DECALAGE_STATUS, directory_name_panel_item, display_memory_usage(), end_directory_notify(), end_select_module_notify(), generate_directory_menu(), generate_module_menu(), generate_workspace_menu(), main_frame, main_panel, MAX_NUMBER_OF_WPIPS_WINDOWS, memory_name, module_name_panel_item, number_of_wpips_windows, open_or_create_workspace(), pips_icon_server_image, quit_button, schoose_create_abbrev_menu_with_text(), show_directory(), show_module(), show_workspace(), status_window_pips_image, window_number, window_number_notify(), workspace_name_panel_item, and wpips_interrupt_pipsmake().

+ Here is the call graph for this function:

◆ display_memory_usage()

void display_memory_usage ( )

etext, edata and end are only address symbols...

getrusage() failed:

Definition at line 79 of file xv_status.c.

80 {
81  char memory_string[17];
82  char cpu_string[CPU_USAGE_LENGTH + 1];
83  struct rusage an_rusage;
84 
85  /* etext, edata and end are only address symbols... */
86  debug(6, "display_memory_usage",
87  "_text %#x, _data %#x, _end %#x, _brk %#x\n",
88  &etext, &edata, &end, sbrk(0));
89 
90  sprintf(memory_string, "%10.3f", (sbrk(0) - (int) &etext)/(double)(1 << 20));
91 
92  xv_set(memory_name,
93  PANEL_VALUE, memory_string,
94  NULL);
95 
96  if (getrusage(RUSAGE_SELF, &an_rusage) == 0) {
97  double the_cpu_time =
98  an_rusage.ru_utime.tv_sec + an_rusage.ru_stime.tv_sec
99  + (an_rusage.ru_utime.tv_usec + an_rusage.ru_stime.tv_usec)*1e-6;
100  sprintf(cpu_string, "%*.*g",
101  CPU_USAGE_LENGTH, CPU_USAGE_LENGTH - 2, the_cpu_time);
102  }
103  else
104  /* getrusage() failed: */
105  sprintf(cpu_string, "%*s", CPU_USAGE_LENGTH, "?");
106 
107  xv_set(cpu_usage_item,
108  PANEL_VALUE, cpu_string,
109  NULL);
110 }
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
edata
Definition: xv_status.c:76
etext
Strange, "man end" says that end is a function!
end
Definition: xv_status.c:76

References cpu_usage_item, CPU_USAGE_LENGTH, debug(), edata, end, etext, and memory_name.

Referenced by create_status_subwindow(), show_directory(), show_message(), show_module(), show_workspace(), and window_number_notify().

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

◆ show_directory()

void show_directory ( )

Definition at line 126 of file xv_status.c.

127 {
128  xv_set(directory_name_panel_item, PANEL_VALUE, get_cwd(), NULL);
130 }
char * get_cwd(void)
returns the current working directory name.
Definition: file.c:486

References directory_name_panel_item, display_memory_usage(), and get_cwd().

Referenced by create_status_subwindow().

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

◆ show_message()

void show_message ( string  message_buffer)

va_list some_arguments; static char message_buffer[SMALL_BUFFER_LENGTH];

va_start(some_arguments, a_printf_format);

(void) vsprintf(message_buffer, a_printf_format, some_arguments);

Parameters
message_buffer...

Definition at line 188 of file xv_status.c.

189 {
190  /* va_list some_arguments;
191  static char message_buffer[SMALL_BUFFER_LENGTH]; */
192 
193  /* va_start(some_arguments, a_printf_format); */
194 
195  /* (void) vsprintf(message_buffer, a_printf_format, some_arguments);*/
196 
197  xv_set(message, PANEL_VALUE, message_buffer, 0);
199 }

References display_memory_usage().

+ Here is the call graph for this function:

◆ show_module()

void show_module ( )

Definition at line 149 of file xv_status.c.

150 {
151  static char *none = "(* none *)";
152  char *module_name_content = db_get_current_module_name();
153 
154  if (module_name_content == NULL)
155  module_name_content = none;
156 
157  xv_set(module_name_panel_item, PANEL_VALUE, module_name_content, 0);
159 }
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059

References db_get_current_module_name(), display_memory_usage(), and module_name_panel_item.

Referenced by create_status_subwindow().

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

◆ show_workspace()

void show_workspace ( )

Definition at line 135 of file xv_status.c.

136 {
137  static char *none = "(* none *)";
138  char *name = db_get_current_workspace_name();
139 
140  if (name == NULL)
141  name = none;
142 
143  xv_set(workspace_name_panel_item, PANEL_VALUE, name, 0);
145 }
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82

References db_get_current_workspace_name(), display_memory_usage(), and workspace_name_panel_item.

Referenced by create_status_subwindow().

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

◆ window_number_notify()

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

Definition at line 114 of file xv_status.c.

115 {
116  number_of_wpips_windows = (int) xv_get(item, PANEL_VALUE);
117 
118  if (wpips_emacs_mode)
120 
122 }
void const char const char const int
bool wpips_emacs_mode
Here are all the stuff to interface Pips with Emacs.
Definition: emacs.c:65
void send_window_number_to_emacs(int number)
Definition: emacs.c:209

References display_memory_usage(), int, number_of_wpips_windows, send_window_number_to_emacs(), and wpips_emacs_mode.

Referenced by create_status_subwindow().

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

◆ wpips_interrupt_button_blink()

void wpips_interrupt_button_blink ( )

Definition at line 163 of file xv_status.c.

164 {
165  if ((Server_image) xv_get(status_window_pips_image, PANEL_LABEL_IMAGE) ==
168  PANEL_LABEL_IMAGE, wpips_positive_server_image,
169  NULL);
170  else
172  PANEL_LABEL_IMAGE, wpips_negative_server_image,
173  NULL);
174 
175 }
Server_image wpips_positive_server_image
To store the negative image for a blinking icon in the interrupt button:
Definition: xv_icons.c:46
Server_image wpips_negative_server_image
Definition: xv_icons.c:46

References status_window_pips_image, wpips_negative_server_image, and wpips_positive_server_image.

Referenced by deal_with_wpips_events_during_pipsmake().

+ Here is the caller graph for this function:

◆ wpips_interrupt_button_restore()

void wpips_interrupt_button_restore ( )

Definition at line 179 of file xv_status.c.

180 {
182  PANEL_LABEL_IMAGE, wpips_positive_server_image,
183  NULL);
184 }

References status_window_pips_image, and wpips_positive_server_image.

Referenced by wpips_main_loop().

+ Here is the caller graph for this function:

Variable Documentation

◆ cpu_usage_item

Panel_item cpu_usage_item

Definition at line 71 of file xv_status.c.

Referenced by create_status_subwindow(), and display_memory_usage().

◆ directory_name_panel_item

Panel_item directory_name_panel_item

◆ edata

edata

Definition at line 76 of file xv_status.c.

Referenced by display_memory_usage().

◆ end

end

Definition at line 76 of file xv_status.c.

Referenced by display_memory_usage().

◆ etext

etext
extern

Strange, "man end" says that end is a function!

Referenced by display_memory_usage().

◆ memory_name

Panel_item memory_name

Definition at line 69 of file xv_status.c.

Referenced by create_status_subwindow(), and display_memory_usage().

◆ message

Panel_item message

Definition at line 69 of file xv_status.c.

◆ module_name_panel_item

Panel_item module_name_panel_item

◆ status_window_pips_image

Server_image status_window_pips_image

◆ window_number

Panel_item window_number

Definition at line 69 of file xv_status.c.

Referenced by create_status_subwindow().

◆ workspace_name_panel_item