PIPS
gtk_transform.c File Reference
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "genC.h"
#include "constants.h"
#include "misc.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "top-level.h"
#include "database.h"
#include "pipsmake.h"
#include "pipsdbm.h"
#include <gtk/gtk.h>
#include "gpips.h"
#include "gpips-labels.h"
#include "resources.h"
#include "phases.h"
#include "wpips_transform_menu_layout.h"
+ Include dependency graph for gtk_transform.c:

Go to the source code of this file.

Functions

static void apply_on_each_transform_menu_item (GtkWidget *widget, gpointer _func)
 
void apply_on_each_transform_item (void(*function_to_apply_on_each_menu_item)(GtkWidget *))
 
void disable_transform_selection ()
 
void enable_transform_selection ()
 
void execute_safe_apply_outside_the_notifier ()
 
void safe_apply_outside_the_notifyer (string transformation_name_to_apply, string module_name)
 
static void transform_notify (GtkWidget *menu_item, gpointer data __attribute__((unused)))
 
void create_transform_menu ()
 

Variables

gpips_transform_menu_layout_line gpips_transform_menu_layout []
 Include the label names: More...
 
static string execute_safe_apply_outside_the_notifyer_transformation_name_to_apply
 To pass arguments to execute_safe_apply_outside_the_notifyer(): More...
 
static string execute_safe_apply_outside_the_notifyer_module_name = NULL
 
GtkWidget * transform_menu
 The transform menu: More...
 
GtkWidget * transform_menu_item
 

Function Documentation

◆ apply_on_each_transform_item()

void apply_on_each_transform_item ( void(*)(GtkWidget *)  function_to_apply_on_each_menu_item)

Definition at line 84 of file gtk_transform.c.

85  {
86  gtk_container_foreach(GTK_CONTAINER(transform_menu), (GtkCallback)
88  function_to_apply_on_each_menu_item);
89 }
GtkWidget * transform_menu
The transform menu:
Definition: gtk_transform.c:75
static void apply_on_each_transform_menu_item(GtkWidget *widget, gpointer _func)
Definition: gtk_transform.c:77

References apply_on_each_transform_menu_item(), and transform_menu.

Referenced by disable_transform_selection(), and enable_transform_selection().

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

◆ apply_on_each_transform_menu_item()

static void apply_on_each_transform_menu_item ( GtkWidget *  widget,
gpointer  _func 
)
static

Definition at line 77 of file gtk_transform.c.

78  {
79  void (*func)(GtkWidget *);
80  func = (void(*)(GtkWidget *)) _func;
81  func(widget);
82 }

Referenced by apply_on_each_transform_item().

+ Here is the caller graph for this function:

◆ create_transform_menu()

void create_transform_menu ( )

Now add all the transformation entries:

Add the Edit entry as the last one:

Definition at line 149 of file gtk_transform.c.

149  {
150  GtkWidget * menu_item;
151 
152  gpips_transform_menu_layout_line * current_transformation;
153 
154  edit_menu_item = gtk_menu_item_new_with_label(EDIT_VIEW);
155  g_signal_connect(G_OBJECT(edit_menu_item), "activate", G_CALLBACK(
156  edit_notify), NULL);
157 
158  transform_menu = gtk_menu_new();
159  transform_menu_item = gtk_menu_item_new_with_label("Transform/Edit");
160  gtk_menu_item_set_submenu(GTK_MENU_ITEM(transform_menu_item), transform_menu);
161  gtk_menu_bar_append(GTK_MENU_BAR(main_window_menu_bar), transform_menu_item);
162 
163  /* Now add all the transformation entries: */
164  for (current_transformation = &gpips_transform_menu_layout[0]; current_transformation->menu_entry_string
165  != NULL; current_transformation++) {
166  if (strcmp(current_transformation->menu_entry_string,
167  GPIPS_MENU_SEPARATOR_ID) == 0) {
168  gtk_menu_append(GTK_MENU(transform_menu),
169  gtk_separator_menu_item_new());
170  } else {
171  menu_item = gtk_menu_item_new_with_label(
172  current_transformation->menu_entry_string);
173  g_signal_connect(G_OBJECT(menu_item), "activate",
174  G_CALLBACK(transform_notify), NULL);
175  gtk_menu_append(GTK_MENU(transform_menu), menu_item);
176  }
177  }
178 
179  /* Add the Edit entry as the last one: */
180  gtk_menu_append(GTK_MENU(transform_menu), gtk_separator_menu_item_new());
181 
182  gtk_menu_append(GTK_MENU(transform_menu), edit_menu_item);
183 
184  gtk_widget_show_all(transform_menu);
185  gtk_widget_show(transform_menu_item);
186 }
#define EDIT_VIEW
A special view that gives the .f source mainly for edition:
Definition: gpips-labels.h:46
#define GPIPS_MENU_SEPARATOR_ID
How it is specified in the layout .h:
Definition: gpips-local.h:84
GtkWidget * main_window_menu_bar
Definition: gpips.c:62
void edit_notify(GtkWidget *widget, gpointer data)
Definition: gtk_edit2.c:101
GtkWidget * edit_menu_item
Definition: gtk_edit2.c:90
gpips_transform_menu_layout_line gpips_transform_menu_layout[]
Include the label names:
Definition: gtk_transform.c:63
static void transform_notify(GtkWidget *menu_item, gpointer data __attribute__((unused)))
GtkWidget * transform_menu_item
Definition: gtk_transform.c:75
The type describing a Transform menu entry:
Definition: gpips-local.h:67

References edit_menu_item, edit_notify(), EDIT_VIEW, GPIPS_MENU_SEPARATOR_ID, gpips_transform_menu_layout, main_window_menu_bar, gpips_transform_menu_layout_line::menu_entry_string, transform_menu, transform_menu_item, and transform_notify().

Referenced by create_menus().

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

◆ disable_transform_selection()

void disable_transform_selection ( )

Definition at line 91 of file gtk_transform.c.

91  {
93 }
void disable_item(GtkWidget *item)
Definition: gtk_edit2.c:461
void apply_on_each_transform_item(void(*function_to_apply_on_each_menu_item)(GtkWidget *))
Definition: gtk_transform.c:84

References apply_on_each_transform_item(), and disable_item().

Referenced by disable_module_selection(), gpips_main(), and wpips_main().

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

◆ enable_transform_selection()

void enable_transform_selection ( )

Definition at line 95 of file gtk_transform.c.

95  {
97 }
void enable_item(GtkWidget *item)
Definition: gtk_edit2.c:465

References apply_on_each_transform_item(), and enable_item().

Referenced by enable_module_selection().

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

◆ execute_safe_apply_outside_the_notifier()

void execute_safe_apply_outside_the_notifier ( )

Definition at line 99 of file gtk_transform.c.

99  {
100  (void) safe_apply(
105 
107 }
void free(void *)
void display_memory_usage()
Definition: gtk_status.c:84
static string execute_safe_apply_outside_the_notifyer_module_name
Definition: gtk_transform.c:72
static string execute_safe_apply_outside_the_notifyer_transformation_name_to_apply
To pass arguments to execute_safe_apply_outside_the_notifyer():
Definition: gtk_transform.c:70
bool safe_apply(const char *phase_n, const char *module_n)
Definition: pipsmake.c:1723

References display_memory_usage(), execute_safe_apply_outside_the_notifyer_module_name, execute_safe_apply_outside_the_notifyer_transformation_name_to_apply, free(), and safe_apply().

Referenced by gpips_main_loop().

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

◆ safe_apply_outside_the_notifyer()

void safe_apply_outside_the_notifyer ( string  transformation_name_to_apply,
string  module_name 
)

Ask to execute the execute_safe_apply_outside_the_notifyer():

I guess the function above does not return...

Definition at line 109 of file gtk_transform.c.

110  {
112  = strdup(transformation_name_to_apply);
114  /* Ask to execute the execute_safe_apply_outside_the_notifyer(): */
116  /* I guess the function above does not return... */
117 }
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
@ GPIPS_SAFE_APPLY
Definition: gpips-local.h:63
void execute_main_loop_command(gpips_main_loop_command_type command)
To ask pipsmake to stop as soon as possible:
Definition: gpips.c:267
char * strdup()

References execute_main_loop_command(), execute_safe_apply_outside_the_notifyer_module_name, execute_safe_apply_outside_the_notifyer_transformation_name_to_apply, GPIPS_SAFE_APPLY, module_name(), and strdup().

Referenced by hpfc_notify(), and transform_notify().

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

◆ transform_notify()

static void transform_notify ( GtkWidget *  menu_item,
gpointer data   __attribute__(unused) 
)
static

FI: borrowed from edit_notify()

Find the transformation to apply:

Apply the transformation:

I guess the function above does not return...

Definition at line 119 of file gtk_transform.c.

119  {
120  const char * label = gpips_gtk_menu_item_get_label(menu_item);
121 
122  char * modulename = db_get_current_module_name();
123 
124  /* FI: borrowed from edit_notify() */
125  if (modulename == NULL) {
126  prompt_user("No module selected");
127  } else {
128  gpips_transform_menu_layout_line * current_transformation;
129 
130  /* Find the transformation to apply: */
131  for (current_transformation = &gpips_transform_menu_layout[0]; current_transformation->menu_entry_string
132  != NULL; current_transformation++)
133  if (strcmp(label, current_transformation->menu_entry_string) == 0)
134  break;
135 
136  if (current_transformation->menu_entry_string != NULL)
137  /* Apply the transformation: */
139  current_transformation->transformation_name_to_apply,
140  modulename);
141  /* I guess the function above does not return... */
142  else
143  pips_user_error("What is this \"%s\" entry you ask for?", label);
144  }
145 
147 }
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
void prompt_user(string a_printf_format,...)
Definition: gtk_log.c:66
void safe_apply_outside_the_notifyer(string transformation_name_to_apply, string module_name)
const char * gpips_gtk_menu_item_get_label(GtkWidget *w)
Definition: gtk_utils.c:43
#define pips_user_error
Definition: misc-local.h:147

References db_get_current_module_name(), display_memory_usage(), gpips_gtk_menu_item_get_label(), gpips_transform_menu_layout, gpips_transform_menu_layout_line::menu_entry_string, pips_user_error, prompt_user(), safe_apply_outside_the_notifyer(), and gpips_transform_menu_layout_line::transformation_name_to_apply.

Referenced by create_transform_menu().

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

Variable Documentation

◆ execute_safe_apply_outside_the_notifyer_module_name

string execute_safe_apply_outside_the_notifyer_module_name = NULL
static

◆ execute_safe_apply_outside_the_notifyer_transformation_name_to_apply

string execute_safe_apply_outside_the_notifyer_transformation_name_to_apply
static
Initial value:
=
NULL

To pass arguments to execute_safe_apply_outside_the_notifyer():

Definition at line 70 of file gtk_transform.c.

Referenced by execute_safe_apply_outside_the_notifier(), and safe_apply_outside_the_notifyer().

◆ gpips_transform_menu_layout

gpips_transform_menu_layout_line gpips_transform_menu_layout[]
Initial value:
= {
{ NULL, NULL } }

Include the label names:

Definition at line 63 of file gtk_transform.c.

Referenced by create_transform_menu(), and transform_notify().

◆ transform_menu

GtkWidget* transform_menu

The transform menu:

Definition at line 75 of file gtk_transform.c.

Referenced by apply_on_each_transform_item(), and create_transform_menu().

◆ transform_menu_item

GtkWidget * transform_menu_item

Definition at line 75 of file gtk_transform.c.

Referenced by create_transform_menu().