PIPS
xv_props.c
Go to the documentation of this file.
1 /*
2 
3  $Id: xv_props.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <string.h>
31 
32 #include <sys/time.h>
33 #include <sys/resource.h>
34 #include <xview/xview.h>
35 #include <xview/frame.h>
36 #include <xview/panel.h>
37 
38 #include "genC.h"
39 #include "linear.h"
40 #include "ri.h"
41 #include "top-level.h"
42 #include "database.h"
43 
44 #include "misc.h"
45 #include "ri-util.h"
46 #include "pipsdbm.h"
47 #include "pipsmake.h"
48 #include "complexity_ri.h"
49 
50 #include "constants.h"
51 #include "resources.h"
52 #include "properties.h"
53 
54 #include "wpips.h"
55 
56 #define OPTION_PANEL_BUTTONS_ALIGNED
57 
58 typedef struct
59 {
60  char *name;
61  list choices;
62 }
64 
65 
66 static Menu smenu_options;
67 static Menu options_menu;
68 Menu_item static options_panel_menu_item;
70 
72 
73 static char display_options_panel[] = "Options panel...";
74 static char hide_options_panel[] = "Hide options panel";
75 
76  /* Flag allowing update_options also to select a option : */
78 
79 
80 /* returns the first key which value is svp. when not found, returns NULL */
81 string hash_get_key_by_value(htp, svp)
82 hash_table htp;
83 string svp;
84 {
85  HASH_MAP(kp, vp, {
86  if (strcmp(vp, svp) == 0)
87  return kp;
88  }, htp);
89 
90  return HASH_UNDEFINED_VALUE;
91 }
92 
93 
94 void
95 disable_panel_item(Panel_item item)
96 {
97  xv_set(item, PANEL_INACTIVE, TRUE, 0);
98 }
99 
100 
101 void
102 enable_panel_item(Panel_item item)
103 {
104  xv_set(item, PANEL_INACTIVE, FALSE, 0);
105 }
106 
107 
108 void
109 apply_on_each_option_item(void (* function_to_apply_on_each_menu_item)(Menu_item),
110  void (* function_to_apply_on_each_panel_item)(Panel_item))
111 {
112  int i;
113 
114  /* Walk through items of menu_options */
115  for (i = (int) xv_get(options_menu, MENU_NITEMS); i > 0; i--) {
116  char * res_alias_n;
117 
118  /* find resource corresponding to the item */
119  Menu_item menu_item = (Menu_item) xv_get(options_menu, MENU_NTH_ITEM, i);
120 
121  if ((bool) xv_get(menu_item, MENU_TITLE))
122  /* Skip the title item: */
123  break;
124 
125  res_alias_n = (string) xv_get(menu_item, MENU_STRING);
126  if (res_alias_n == NULL
127  || strcmp(res_alias_n, display_options_panel) == 0
128  || strcmp(res_alias_n, hide_options_panel) == 0)
129  /* It must be the pin item, or the item controlling the
130  options panel. */
131  continue;
132 
133  function_to_apply_on_each_menu_item(menu_item);
134  }
135 
136  /* Now walk through the options panel: */
137  {
138  Panel_item panel_item;
139 
140  PANEL_EACH_ITEM(options_panel, panel_item)
141  /* Only on the PANEL_CHOICE_STACK: */
142  if ((Panel_item_type) xv_get(panel_item, PANEL_ITEM_CLASS) ==
143  PANEL_CHOICE_ITEM)
144  function_to_apply_on_each_panel_item(panel_item);
145  PANEL_END_EACH
146  }
147 }
148 
149 
150 void
152 {
154 }
155 
156 
157 void
159 {
161 }
162 
163 
164 void
166 {
167  string res_alias_n, res_true_n ,phase_alias_n ,phase_true_n;
168  Menu menu_options, special_prop_m;
169  Menu_item options_mi, special_prop_mi;
170  int i, j;
171 
172  debug_on("WPIPS_DEBUG_LEVEL");
173 
174  menu_options = smenu_options;
175 
176  /* walk through items of menu_options */
177  for (i = (int) xv_get(menu_options, MENU_NITEMS); i > 0; i--) {
178 
179  /* find resource corresponding to the item */
180  options_mi = (Menu_item) xv_get(menu_options, MENU_NTH_ITEM, i);
181 
182  if ((bool) xv_get(options_mi, MENU_TITLE))
183  /* Skip the title item: */
184  break;
185 
186  res_alias_n = (string) xv_get(options_mi, MENU_STRING);
187  if (res_alias_n == NULL
188  || strcmp(res_alias_n, display_options_panel) == 0
189  || strcmp(res_alias_n, hide_options_panel) == 0)
190  /* It must be the pin item, or the item controlling the
191  options panel. RK, 4/06/1993. */
192  continue;
193  if ((res_true_n = (string) hash_get(aliases, res_alias_n))
195  pips_internal_error("Hash table aliases no more consistent\n");
196 
197  /* find special prop menu containing item corresponding to active
198  phase*/
199  special_prop_m = (Menu) xv_get (options_mi, MENU_PULLRIGHT);
200 
201  /* find active phase which produces resource res_true_n */
202  phase_true_n = rule_phase(find_rule_by_resource(res_true_n));
203  if ( (phase_alias_n=hash_get_key_by_value(aliases, phase_true_n))
204  == HASH_UNDEFINED_VALUE ) {
205  /* There is no alias for currently selected phase: phase_true_n
206  We have to activate another phase
207  */
208  special_prop_mi = xv_get(special_prop_m, MENU_NTH_ITEM, 1);
209  phase_alias_n = (string) xv_get(special_prop_mi, MENU_STRING);
210  user_warning("update_options",
211  "No alias available for selected phase `%s'; selecting `%s'\n",
212  phase_true_n, phase_alias_n);
213  phase_true_n = hash_get(aliases, phase_alias_n);
214  activate(phase_true_n);
215  /* It does not seem to work (the doc does not talk about
216  xv_set for MENU_SELECTED by the way...): */
217  xv_set(special_prop_mi, MENU_SELECTED, TRUE, NULL);
218  /* Then, try harder : */
219  xv_set(special_prop_m,
220  MENU_DEFAULT_ITEM, special_prop_mi,
221  NULL);
222  debug(2, "update_options",
223  "Rule `%s' selected to produce resource `%s'\n",
224  phase_alias_n, res_alias_n);
225  }
226  else {
227  /* walk through items of special_prop_m to select the activated
228  one */
229  for (j = (int) xv_get(special_prop_m, MENU_NITEMS); j > 0; j--) {
230  Panel_item panel_choice_item;
231 
232  special_prop_mi = xv_get(special_prop_m, MENU_NTH_ITEM, j);
233  debug(9, "update_options", "Menu item tested:\"%s\"\n",
234  (string) xv_get(special_prop_mi, MENU_STRING));
235  if (strcmp((string)xv_get(special_prop_mi, MENU_STRING),
236  phase_alias_n ) ==0 ) {
237  xv_set(special_prop_mi, MENU_SELECTED, TRUE, NULL);
238  /* Update the dual options panel entry : */
239  panel_choice_item = (Panel_item) xv_get(special_prop_m,
240  MENU_CLIENT_DATA);
241  xv_set(panel_choice_item, PANEL_VALUE, j - 1, NULL);
242 
244  user_log("Options: phase %s set on.\n", phase_alias_n);
245  debug(2, "update_options",
246  "Rule `%s' selected to produce resource `%s'\n",
247  phase_alias_n, res_alias_n);
248  }
249  }
250  }
251  }
252 
254 
255  debug_off();
256 }
257 
258 /* The following procedure is never used !
259  I have removed it. RK, 11/06/1993. */
260 #if 0
261 void clear_options()
262 {
263  /* string res_alias_n, res_true_n ,phase_alias_n ,phase_true_n; */
264  Menu menu_options, special_prop_m;
265  Menu_item options_mi, special_prop_mi;
266  int i, j;
267 
268  menu_options = smenu_options;
269 
270  /* walk through items of menu_options */
271  for (i=(int)xv_get(menu_options, MENU_NITEMS); i>0; i--) {
272 
273  options_mi = (Menu_item) xv_get(menu_options, MENU_NTH_ITEM, i);
274  special_prop_m = (Menu) xv_get (options_mi, MENU_PULLRIGHT);
275 
276  /* walk through items of special_prop_m */
277  for (j=(int)xv_get(special_prop_m, MENU_NITEMS); j>0; j--) {
278  special_prop_mi = xv_get(special_prop_m, MENU_NTH_ITEM, j);
279  xv_set(special_prop_mi, MENU_SELECTED, FALSE);
280  }
281  }
282 }
283 #endif
284 
285 void options_select(aliased_phase)
286 char *aliased_phase;
287 {
288  string phase = hash_get(aliases, aliased_phase);
289 
290  if (phase == (string) HASH_UNDEFINED_VALUE)
291  {
292  pips_internal_error("aliases badly managed !!!\n");
293  }
294  else {
296  prompt_user("No workspace opened. Options not accounted.\n");
297  }
298  else {
299  debug_on("WPIPS_DEBUG_LEVEL");
300  activate(phase);
301  debug_off();
302  user_log("Options: phase %s (%s) set on.\n",
303  aliased_phase,
304  phase);
305  }
306  }
307  /* To have the options panel consistent with the real phase set :
308  RK, 05/07/1993. */
310  update_options();
312 }
313 
314 
315 void
316 options_panel_notify(Panel_item item,
317  int valeur,
318  Event *event)
319 /* "value" is already used for a typedef... :-) RK, 11/06/1993. */
320 {
321 
322  Menu menu_special_prop;
323  Menu_item menu_item;
324  string aliased_phase;
325 
326  menu_special_prop = (Menu) xv_get(item, PANEL_CLIENT_DATA);
327  /* Look at the corresponding (dual) item in the options menu to
328  get the value. RK, 11/06/1993. */
329  /* Argh ! MENU_NTH_ITEM begins from 1 but
330  PANEL_VALUE begins from 0... RK, 02/07/1993. */
331  menu_item = (Menu_item) xv_get(menu_special_prop,
332  MENU_NTH_ITEM, valeur + 1);
333  aliased_phase = (string) xv_get(menu_item, MENU_STRING);
334  options_select(aliased_phase);
335 }
336 
337 
338 void
340  Event * event)
341 {
342  char * label = (char *) xv_get(item, PANEL_LABEL_STRING);
343 
345 }
346 
347 
348 void
350  Menu_item menu_item)
351 {
352  string aliased_phase = (char *) xv_get(menu_item, MENU_STRING);
353  options_select(aliased_phase);
354 }
355 
356 
357 /* The function used by qsort to compare 2 option_type structures
358  according to their name string: */
359 static int
361  const void *y)
362 {
363  return strcmp(((option_type *) x)->name, ((option_type *) y)->name);
364 }
365 
366 
367 
368 /* Build the option menu by looking at the pipsmake.rc file and
369  searching if there are several way to build a ressource: */
370 /* The option panel use the definition of the edit menu and so needs
371  to be create after it: */
372 void
374  Panel options_panel)
375 {
376  int i, j;
377  option_type *all_the_options;
378  makefile m = parse_makefile();
379  int max_item_width = 0;
380 
381  int number_of_options = 0;
382  hash_table phase_by_made_htp = hash_table_make(hash_string, 0);
383 
384  smenu_options = menu_options;
385 
386  /* walking thru rules */
387  MAPL(pr, {
388  rule r = RULE(CAR(pr));
389 
390  /* walking thru resources made by this particular rule */
391  MAPL(pvr, {
393  string vrn = virtual_resource_name(vr);
394  list p = CONS(STRING, rule_phase(r), NIL);
395  list l = (list) hash_get(phase_by_made_htp, vrn);
396 
397  if ( l == (list) HASH_UNDEFINED_VALUE ) {
398  hash_put(phase_by_made_htp, vrn, (char *)p);
399  }
400  else {
401  (void) gen_nconc(l, p);
402  }
403  }, rule_produced(r));
404 
405  }, makefile_rules(m));
406 
407  /* walking thru phase_by_made_htp */
408 
409  /* First, try to do some measurements on the options item to be
410  able to sort and align menu items later: */
411  HASH_MAP(k, v, {
412  string alias1 = hash_get_key_by_value(aliases, k);
413  list l = (list) v;
414 
415  if ((alias1 != HASH_UNDEFINED_VALUE) && (gen_length(l) >= 2))
416  number_of_options++;
417  }, phase_by_made_htp);
418 
419  all_the_options = (option_type *)
420  malloc(number_of_options*sizeof(option_type));
421 
422  /* Now generate an array of the Options: */
423  i = 0;
424  HASH_MAP(k, v, {
425  string alias1 = hash_get_key_by_value(aliases, k);
426  list l = (list) v;
427 
428  if ((alias1 != HASH_UNDEFINED_VALUE) && (gen_length(l) >= 2)) {
429  all_the_options[i].name = alias1;
430  all_the_options[i].choices = l;
431  i++;
432  }
433  }, phase_by_made_htp);
434 
435  /* Sort the Options: */
436  qsort((char *)all_the_options,
437  number_of_options,
438  sizeof(option_type),
440 
441  /* Create the Options in the Option menu and option panel: */
442  for(i = 0; i < number_of_options; i++) {
443  Menu sub_menu_option;
444  Menu_item menu_options_item;
445  Panel_item panel_choice_item;
446 
447  /* Create the sub-menu entry of an option: */
448  sub_menu_option =
449  (Menu) xv_create(NULL, MENU_CHOICE_MENU,
450  MENU_NOTIFY_PROC, options_menu_notify,
451  NULL);
452 
453  /* PANEL_CLIENT_DATA is used to link the PANEL_CHOICE_STACK
454  to its dual MENU_PULLRIGHT. RK, 11/06/1993. */
455  panel_choice_item = xv_create(options_panel, PANEL_CHOICE_STACK,
456  PANEL_LAYOUT, PANEL_HORIZONTAL,
457  PANEL_LABEL_STRING,
458  all_the_options[i].name,
459  PANEL_CLIENT_DATA, sub_menu_option,
460  /* Nothing selected yet: */
461  PANEL_VALUE, 0,
462  PANEL_NOTIFY_PROC, options_panel_notify,
463  NULL);
464  j = 0;
465  MAPL(vrn, {
466  string alias2 = hash_get_key_by_value(aliases,
467  STRING(CAR(vrn)));
468  Menu_item sub_menu_option_item;
469 
470  if (alias2 != HASH_UNDEFINED_VALUE) {
471  /* Add a sub-option entry in the menu: */
472  sub_menu_option_item = (Menu_item) xv_create(NULL, MENUITEM,
473  MENU_STRING,
474  alias2,
475  MENU_RELEASE,
476  NULL);
477  /* Attach the sub-menu to an Option menu: */
478  xv_set(sub_menu_option,
479  MENU_APPEND_ITEM, sub_menu_option_item,
480  NULL);
481  /* ... And in the Option panel: */
482  xv_set(panel_choice_item,
483  PANEL_CHOICE_STRING,
484  j++,
485  alias2,
486  NULL);
487  }
488  }, all_the_options[i].choices);
489  /* Create the Option Item for this alias: */
490  menu_options_item = (Menu_item) xv_create(NULL, MENUITEM,
491  MENU_STRING,
492  all_the_options[i].name,
493  MENU_PULLRIGHT,
494  sub_menu_option,
495  MENU_RELEASE,
496  NULL);
497  /* Attach the Option Item to the Option menu: */
498  xv_set(menu_options, MENU_APPEND_ITEM, menu_options_item, NULL);
499  /* Add a link information from the sub_menu_option to the
500  equivalent panel_choice_item for update_props(): */
501  xv_set(sub_menu_option,
502  MENU_CLIENT_DATA, panel_choice_item,
503  NULL);
504  }
505 
506  /* Now we set the width of the PANEL_CHOICE_STACK items the same to
507  have a nicer vertical alignment: */
508  {
509  Panel_item item;
510 
511 #ifdef OPTION_PANEL_BUTTONS_ALIGNED
512  /* If I want something with the buttons vertically aligned: */
513  PANEL_EACH_ITEM(options_panel, item)
514  max_item_width = MAX(max_item_width,
515  (int) xv_get(item, PANEL_LABEL_WIDTH));
516  PANEL_END_EACH
517 
518  /* It looks on my screen that this width is 8:7 larger. Apply
519  a pifometric scaling factor... :-) */
520  max_item_width = (max_item_width*7)/8;
521 
522  PANEL_EACH_ITEM(options_panel, item)
523  xv_set(item, PANEL_LABEL_WIDTH,
524  max_item_width,
525  NULL);
526  PANEL_END_EACH
527 #else
528  /* If I want something a` la TeX, justified on the left and
529  on the right: */
530  PANEL_EACH_ITEM(options_panel, item)
531  max_item_width = MAX(max_item_width,
532  (int) xv_get(item, XV_WIDTH));
533  PANEL_END_EACH
534 
535  PANEL_EACH_ITEM(options_panel, item)
536  xv_set(item, PANEL_LABEL_WIDTH,
537  (int) xv_get(item, PANEL_LABEL_WIDTH)
538  + max_item_width
539  - (int) xv_get(item, XV_WIDTH),
540  NULL);
541  PANEL_END_EACH
542 #endif
543  }
544 
545  /* According to a suggestion from Guillaume Oget, it should be nice
546  to be able to select a view also from the Option panel: */
547  {
548  Panel_item option_item;
549  char * option_item_label;
550 
551  PANEL_EACH_ITEM(options_panel, option_item)
552  if ((Panel_item_type) xv_get(option_item, PANEL_ITEM_CLASS) ==
553  PANEL_CHOICE_ITEM) {
554  Menu_item view_menu_item;
555 
556  option_item_label = (char *) xv_get(option_item,
557  PANEL_LABEL_STRING);
558 
559  /* Find if the View menu has an item with the same value: */
561  (Menu_item) xv_find(view_menu, MENUITEM,
562  MENU_STRING, option_item_label,
563  /* Do not create the menu item if it
564  does not exist: */
565  XV_AUTO_CREATE, FALSE,
566  NULL);
567  if (view_menu_item != XV_NULL) {
568  /* OK, there is also a View menu with the same name. */
569  xv_create(options_panel, PANEL_BUTTON,
570  PANEL_NOTIFY_PROC, options_panel_to_view_menu_gateway,
571  PANEL_LABEL_STRING, option_item_label,
572  XV_X, xv_get(option_item, XV_X),
573  XV_Y, xv_get(option_item, XV_Y),
574  NULL);
575 
576  xv_set(option_item,
577  PANEL_LABEL_STRING, NULL,
578  PANEL_LABEL_WIDTH, 0,
579  PANEL_VALUE_X, xv_get(option_item, PANEL_VALUE_X),
580  NULL);
581  }
582  else {
583  /* Shift a little bit the PANEL_LABEL to align with
584  other text of the menu buttons: */
585  xv_set(option_item,
586  PANEL_VALUE_X, xv_get(option_item, PANEL_VALUE_X),
587  PANEL_LABEL_X, xv_get(option_item, PANEL_LABEL_X) + 8,
588  NULL);
589 
590  }
591  }
592  PANEL_END_EACH
593  }
594 
595 #if 0
596  {
597  Panel_item option_item;
598  char * option_item_label;
599  Panel_item * the_option_panel_items;
600  int number_of_options_to_link_with_the_view_menu;
601  int i = 0;
602 
603  /* A conservative allocation... */
604  the_option_panel_items = (Panel_item *) calloc(number_of_options,
605  sizeof(Panel_item *));
606 
607  PANEL_EACH_ITEM(options_panel, option_item)
608  {
609  Menu_item view_menu_item;
610 
611  option_item_label = (char *) xv_get(option_item,
612  PANEL_LABEL_STRING);
613 
614  /* Find if the View menu has an item with the same value: */
616  (Menu_item) xv_find(view_menu, MENUITEM,
617  MENU_STRING, option_item_label,
618  /* Do not create the menu item if it
619  does not exist: */
620  XV_AUTO_CREATE, FALSE,
621  NULL);
622  if (view_menu_item != XV_NULL) {
623  /* OK, there is also a View menu with the same name. */
624  /* Put it in the array of panel items to create. We
625  cannot create it directly since it would confuse
626  PANEL_EACH_ITEM: */
627  the_option_panel_items[i++] = option_item;
628  }
629  }
630  PANEL_END_EACH
631  number_of_options_to_link_with_the_view_menu = i;
632 
633  window_fit(options_panel);
634  window_fit(options_frame);
635 
636  for(i = 0; i < number_of_options_to_link_with_the_view_menu; i++) {
637  /* Overlay the label of an option item with a button
638  with the same name to select the View item: */
639  xv_create(options_panel, PANEL_BUTTON,
640  PANEL_NOTIFY_PROC, options_panel_to_view_menu_gateway,
641  PANEL_LABEL_STRING, xv_get(the_option_panel_items[i],
642  PANEL_LABEL_STRING),
643  XV_X, xv_get(the_option_panel_items[i],
644  XV_X),
645  XV_Y, xv_get(the_option_panel_items[i],
646  XV_Y),
647  NULL);
648 
649  xv_set(the_option_panel_items[i],
650  PANEL_LABEL_STRING, NULL,
651  PANEL_LABEL_WIDTH, 0,
652  PANEL_VALUE_X, xv_get(the_option_panel_items[i],
653  PANEL_VALUE_X),
654  NULL);
655  }
656  }
657 #endif
658 }
659 
660 #define BSIZE_HERE (256)
661 
662 void
664 {
665  char buffer[BSIZE_HERE];
666  char true_name[BSIZE_HERE], alias_name[BSIZE_HERE];
667  FILE *fd;
668 
670 
671  fd = fopen_config(WPIPS_RC, NULL,NULL);
672 
673  while (fgets(buffer, BSIZE_HERE, fd) != NULL) {
674  if (buffer[0] == '-')
675  continue;
676 
677  sscanf(buffer, "alias%s '%[^']", true_name, alias_name);
678 
679  if (hash_get(aliases, alias_name) != HASH_UNDEFINED_VALUE) {
680  pips_internal_error("Aliases must not be ambiguous\n"
681  "\talias '%s' seems ambiguous!\n", true_name);
682  }
683  else {
684  char upper[128];
685 
686  hash_put(aliases,
687  strdup(alias_name),
688  strdup(strupper(upper, true_name)));
689  }
690  }
691  safe_fclose(fd, WPIPS_RC);
692 }
693 
694 void
696  Menu_item menu_item)
697 {
698  char *message_string;
699 
700 
701  /* Should be added : when the options panel is destroyed by the
702  window manager, toggle the menu. RK, 7/6/93. */
703 
704  message_string = (char *) xv_get(menu_item, MENU_STRING);
705  if (strcmp(message_string, display_options_panel) == 0)
706  {
708  xv_set(menu_item, MENU_STRING, hide_options_panel, NULL);
709  }
710  else
711  {
713  xv_set(menu_item, MENU_STRING, display_options_panel, NULL);
714  }
715 }
716 
717 
718 /* Hide and restore the menu item to reopen the option panel: */
719 void static
721 {
723  xv_set(options_panel_menu_item, MENU_STRING, display_options_panel, NULL);
724 }
725 
726 
727 void
729 {
730  options_panel = (Panel) xv_create(options_frame, PANEL,
731  PANEL_LAYOUT, PANEL_VERTICAL,
732  /* RK, 11/06/1993. There is no room : */
733  PANEL_ITEM_Y_GAP, 0,
734  PANEL_ITEM_X_GAP, 0,
735  NULL);
736 
737  /* Trap the FRAME_DONE event: */
738  xv_set(options_frame, FRAME_DONE_PROC, options_frame_done_procedure, NULL);
739 
741  (Menu_item) xv_create(NULL, MENUITEM,
742  MENU_STRING, display_options_panel,
743  MENU_NOTIFY_PROC, display_or_hide_options_panel,
744  NULL);
745  options_menu = (Menu) xv_create(XV_NULL, MENU_COMMAND_MENU,
746  MENU_TITLE_ITEM, "Selecting PIPS Options ",
747  MENU_GEN_PIN_WINDOW, main_frame, "Options Menu",
748  MENU_APPEND_ITEM, options_panel_menu_item,
749  NULL);
750 
751  build_aliases();
753 
754  (void) xv_create(main_panel, PANEL_BUTTON,
755  PANEL_LABEL_STRING, "Options",
756  PANEL_ITEM_MENU, options_menu,
757  NULL);
758 
759  window_fit(options_panel);
760  window_fit(options_frame);
761 }
void user_log(const char *format,...)
Definition: message.c:234
const char * activate(const char *phase)
Definition: activate.c:214
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
FILE * fopen_config(const char *canonical_name, const char *cproperty, const char *cenv)
Definition: file.c:952
#define STRING(x)
Definition: genC.h:87
void * malloc(YYSIZE_T)
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
Definition: gpips.c:60
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
GtkWidget * view_menu
The menu "View" on the main panel:
Definition: gtk_edit2.c:93
GtkWidget * view_menu_item
Definition: gtk_edit2.c:93
void prompt_user(string a_printf_format,...)
Definition: gtk_log.c:66
static GtkListStore * choices
Definition: gtk_mchoose.c:45
GtkWidget * options_frame
Definition: gtk_props.c:67
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
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define rule_phase(x)
Definition: makefile.h:244
#define RULE(x)
RULE.
Definition: makefile.h:209
#define virtual_resource_name(x)
Definition: makefile.h:290
#define rule_produced(x)
Definition: makefile.h:248
#define VIRTUAL_RESOURCE(x)
VIRTUAL_RESOURCE.
Definition: makefile.h:260
#define makefile_rules(x)
Definition: makefile.h:82
#define debug_on(env)
Definition: misc-local.h:157
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
#define user_warning(fn,...)
Definition: misc-local.h:262
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
string strupper(string, const char *)
Definition: string.c:213
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
@ hash_string
Definition: newgen_hash.h:32
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
char * string
STRING.
Definition: newgen_types.h:39
struct cons * list
Definition: newgen_types.h:106
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82
makefile parse_makefile(void)
rule find_rule_by_resource(const char *rname)
This function returns the active rule to produce resource rname.
Definition: pipsmake.c:694
char * strdup()
static char * x
Definition: split_file.c:159
#define MAX(x, y)
Definition: string.c:110
static string buffer
Definition: string.c:113
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
list choices
Definition: gtk_props.c:61
char * name
Definition: gtk_props.c:60
Entier valeur(Tableau *tp, int i, int j, Entier D)
Definition: traiter.c:178
Panel main_panel
Definition: wpips.c:63
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
void enable_menu_item(Menu_item item)
Definition: xv_edit2.c:565
void disable_menu_item(Menu_item item)
Definition: xv_edit2.c:558
void enable_option_selection()
Definition: xv_props.c:158
static Menu smenu_options
Definition: xv_props.c:66
static int compare_option_type_for_qsort(const void *x, const void *y)
The function used by qsort to compare 2 option_type structures according to their name string:
Definition: xv_props.c:360
void enable_panel_item(Panel_item item)
Definition: xv_props.c:102
void build_options_menu_and_panel(Menu menu_options, Panel options_panel)
Build the option menu by looking at the pipsmake.rc file and searching if there are several way to bu...
Definition: xv_props.c:373
static Menu options_menu
Definition: xv_props.c:67
#define BSIZE_HERE
Definition: xv_props.c:660
int verbose_update_options
Flag allowing update_options also to select a option :
Definition: xv_props.c:77
void options_panel_to_view_menu_gateway(Panel_item item, Event *event)
Definition: xv_props.c:339
void apply_on_each_option_item(void(*function_to_apply_on_each_menu_item)(Menu_item), void(*function_to_apply_on_each_panel_item)(Panel_item))
Definition: xv_props.c:109
void create_options_menu_and_window()
Definition: xv_props.c:728
void update_options()
Definition: xv_props.c:165
static char hide_options_panel[]
Definition: xv_props.c:74
static void options_frame_done_procedure(Frame frame)
Hide and restore the menu item to reopen the option panel:
Definition: xv_props.c:720
static char display_options_panel[]
Definition: xv_props.c:73
static Menu_item options_panel_menu_item
Definition: xv_props.c:68
void disable_option_selection()
Definition: xv_props.c:151
Panel options_panel
Definition: xv_props.c:69
void disable_panel_item(Panel_item item)
Definition: xv_props.c:95
void display_or_hide_options_panel(Menu menu, Menu_item menu_item)
Definition: xv_props.c:695
void options_menu_notify(Menu menu, Menu_item menu_item)
Definition: xv_props.c:349
static hash_table aliases
Definition: xv_props.c:71
void options_select(char *aliased_phase)
The following procedure is never used ! I have removed it.
Definition: xv_props.c:285
string hash_get_key_by_value(hash_table htp, string svp)
returns the first key which value is svp.
Definition: xv_props.c:81
void options_panel_notify(Panel_item item, int valeur, Event *event)
"value" is already used for a typedef...
Definition: xv_props.c:316
void build_aliases()
Definition: xv_props.c:663
void unhide_window(Frame frame)
map a frame on the screen
Definition: xv_utils.c:55