25 #include "pips_config.h"
33 #include <sys/resource.h>
34 #include <xview/xview.h>
35 #include <xview/frame.h>
36 #include <xview/panel.h>
50 #include "constants.h"
51 #include "resources.h"
56 #define OPTION_PANEL_BUTTONS_ALIGNED
86 if (strcmp(vp, svp) == 0)
97 xv_set(item, PANEL_INACTIVE, TRUE, 0);
104 xv_set(item, PANEL_INACTIVE, FALSE, 0);
110 void (* function_to_apply_on_each_panel_item)(Panel_item))
115 for (i = (
int) xv_get(
options_menu, MENU_NITEMS); i > 0; i--) {
119 Menu_item menu_item = (Menu_item) xv_get(
options_menu, MENU_NTH_ITEM, i);
121 if ((
bool) xv_get(menu_item, MENU_TITLE))
125 res_alias_n = (
string) xv_get(menu_item, MENU_STRING);
126 if (res_alias_n == NULL
133 function_to_apply_on_each_menu_item(menu_item);
138 Panel_item panel_item;
142 if ((Panel_item_type) xv_get(panel_item, PANEL_ITEM_CLASS) ==
144 function_to_apply_on_each_panel_item(panel_item);
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;
177 for (i = (
int) xv_get(menu_options, MENU_NITEMS); i > 0; i--) {
180 options_mi = (Menu_item) xv_get(menu_options, MENU_NTH_ITEM, i);
182 if ((
bool) xv_get(options_mi, MENU_TITLE))
186 res_alias_n = (
string) xv_get(options_mi, MENU_STRING);
187 if (res_alias_n == NULL
199 special_prop_m = (Menu) xv_get (options_mi, MENU_PULLRIGHT);
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);
211 "No alias available for selected phase `%s'; selecting `%s'\n",
212 phase_true_n, phase_alias_n);
217 xv_set(special_prop_mi, MENU_SELECTED, TRUE, NULL);
219 xv_set(special_prop_m,
220 MENU_DEFAULT_ITEM, special_prop_mi,
222 debug(2,
"update_options",
223 "Rule `%s' selected to produce resource `%s'\n",
224 phase_alias_n, res_alias_n);
229 for (j = (
int) xv_get(special_prop_m, MENU_NITEMS); j > 0; j--) {
230 Panel_item panel_choice_item;
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);
239 panel_choice_item = (Panel_item) xv_get(special_prop_m,
241 xv_set(panel_choice_item, PANEL_VALUE, j - 1, NULL);
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);
264 Menu menu_options, special_prop_m;
265 Menu_item options_mi, special_prop_mi;
271 for (i=(
int)xv_get(menu_options, MENU_NITEMS); i>0; i--) {
273 options_mi = (Menu_item) xv_get(menu_options, MENU_NTH_ITEM, i);
274 special_prop_m = (Menu) xv_get (options_mi, MENU_PULLRIGHT);
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);
296 prompt_user(
"No workspace opened. Options not accounted.\n");
302 user_log(
"Options: phase %s (%s) set on.\n",
322 Menu menu_special_prop;
324 string aliased_phase;
326 menu_special_prop = (Menu) xv_get(item, PANEL_CLIENT_DATA);
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);
342 char * label = (
char *) xv_get(item, PANEL_LABEL_STRING);
352 string aliased_phase = (
char *) xv_get(menu_item, MENU_STRING);
379 int max_item_width = 0;
381 int number_of_options = 0;
398 hash_put(phase_by_made_htp, vrn, (
char *)p);
417 }, phase_by_made_htp);
429 all_the_options[i].
name = alias1;
430 all_the_options[i].
choices = l;
433 }, phase_by_made_htp);
436 qsort((
char *)all_the_options,
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;
449 (Menu) xv_create(NULL, MENU_CHOICE_MENU,
455 panel_choice_item = xv_create(
options_panel, PANEL_CHOICE_STACK,
456 PANEL_LAYOUT, PANEL_HORIZONTAL,
458 all_the_options[i].name,
459 PANEL_CLIENT_DATA, sub_menu_option,
468 Menu_item sub_menu_option_item;
472 sub_menu_option_item = (Menu_item) xv_create(NULL, MENUITEM,
478 xv_set(sub_menu_option,
479 MENU_APPEND_ITEM, sub_menu_option_item,
482 xv_set(panel_choice_item,
488 }, all_the_options[i].
choices);
490 menu_options_item = (Menu_item) xv_create(NULL, MENUITEM,
492 all_the_options[i].name,
498 xv_set(menu_options, MENU_APPEND_ITEM, menu_options_item, NULL);
501 xv_set(sub_menu_option,
502 MENU_CLIENT_DATA, panel_choice_item,
511 #ifdef OPTION_PANEL_BUTTONS_ALIGNED
514 max_item_width =
MAX(max_item_width,
515 (
int) xv_get(item, PANEL_LABEL_WIDTH));
520 max_item_width = (max_item_width*7)/8;
523 xv_set(item, PANEL_LABEL_WIDTH,
531 max_item_width =
MAX(max_item_width,
532 (
int) xv_get(item, XV_WIDTH));
536 xv_set(item, PANEL_LABEL_WIDTH,
537 (
int) xv_get(item, PANEL_LABEL_WIDTH)
539 - (
int) xv_get(item, XV_WIDTH),
548 Panel_item option_item;
549 char * option_item_label;
552 if ((Panel_item_type) xv_get(option_item, PANEL_ITEM_CLASS) ==
556 option_item_label = (
char *) xv_get(option_item,
562 MENU_STRING, option_item_label,
565 XV_AUTO_CREATE, FALSE,
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),
577 PANEL_LABEL_STRING, NULL,
578 PANEL_LABEL_WIDTH, 0,
579 PANEL_VALUE_X, xv_get(option_item, PANEL_VALUE_X),
586 PANEL_VALUE_X, xv_get(option_item, PANEL_VALUE_X),
587 PANEL_LABEL_X, xv_get(option_item, PANEL_LABEL_X) + 8,
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;
604 the_option_panel_items = (Panel_item *) calloc(number_of_options,
605 sizeof(Panel_item *));
611 option_item_label = (
char *) xv_get(option_item,
617 MENU_STRING, option_item_label,
620 XV_AUTO_CREATE, FALSE,
627 the_option_panel_items[i++] = option_item;
631 number_of_options_to_link_with_the_view_menu = i;
636 for(i = 0; i < number_of_options_to_link_with_the_view_menu; i++) {
641 PANEL_LABEL_STRING, xv_get(the_option_panel_items[i],
643 XV_X, xv_get(the_option_panel_items[i],
645 XV_Y, xv_get(the_option_panel_items[i],
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],
660 #define BSIZE_HERE (256)
677 sscanf(
buffer,
"alias%s '%[^']", true_name, alias_name);
681 "\talias '%s' seems ambiguous!\n", true_name);
698 char *message_string;
704 message_string = (
char *) xv_get(menu_item, MENU_STRING);
731 PANEL_LAYOUT, PANEL_VERTICAL,
741 (Menu_item) xv_create(NULL, MENUITEM,
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",
755 PANEL_LABEL_STRING,
"Options",
void user_log(const char *format,...)
const char * activate(const char *phase)
int safe_fclose(FILE *stream, const char *filename)
FILE * fopen_config(const char *canonical_name, const char *cproperty, const char *cenv)
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define CAR(pcons)
Get the value of the first element of a list.
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
GtkWidget * view_menu
The menu "View" on the main panel:
GtkWidget * view_menu_item
void prompt_user(string a_printf_format,...)
static GtkListStore * choices
GtkWidget * options_frame
void display_memory_usage()
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
hash_table hash_table_make(hash_key_type key_type, size_t size)
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.
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.
#define virtual_resource_name(x)
#define VIRTUAL_RESOURCE(x)
VIRTUAL_RESOURCE.
#define makefile_rules(x)
#define pips_internal_error
#define user_warning(fn,...)
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
string strupper(string, const char *)
#define HASH_MAP(k, v, code, ht)
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
makefile parse_makefile(void)
rule find_rule_by_resource(const char *rname)
This function returns the active rule to produce resource rname.
The structure used to build lists in NewGen.
Entier valeur(Tableau *tp, int i, int j, Entier D)
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:
void enable_menu_item(Menu_item item)
void disable_menu_item(Menu_item item)
void enable_option_selection()
static Menu smenu_options
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:
void enable_panel_item(Panel_item item)
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...
int verbose_update_options
Flag allowing update_options also to select a option :
void options_panel_to_view_menu_gateway(Panel_item item, Event *event)
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))
void create_options_menu_and_window()
static char hide_options_panel[]
static void options_frame_done_procedure(Frame frame)
Hide and restore the menu item to reopen the option panel:
static char display_options_panel[]
static Menu_item options_panel_menu_item
void disable_option_selection()
void disable_panel_item(Panel_item item)
void display_or_hide_options_panel(Menu menu, Menu_item menu_item)
void options_menu_notify(Menu menu, Menu_item menu_item)
static hash_table aliases
void options_select(char *aliased_phase)
The following procedure is never used ! I have removed it.
string hash_get_key_by_value(hash_table htp, string svp)
returns the first key which value is svp.
void options_panel_notify(Panel_item item, int valeur, Event *event)
"value" is already used for a typedef...
void unhide_window(Frame frame)
map a frame on the screen