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

Go to the source code of this file.

Enumerations

enum  { GPIPS_NUMBER_OF_EVENT_TO_DEAL_DURING_PIPSMAKE_INTERPHASE = 10 }
 How much to call the notifyer between each pipsmake phase: More...
 

Functions

static void create_main_window_menu_bar ()
 
static void create_menus ()
 
void create_main_window ()
 
static void gpips_parse_arguments (int argc, char *argv[])
 Try to parse the gpips arguments. More...
 
static void execute_workspace_creation_and_so_on_given_with_options (void)
 Execute some actions asked as option after XView initialization: More...
 
static bool deal_with_gpips_events_during_pipsmake ()
 Since XView is not called while pipsmake is running, explicitly run a hook from pipsmake to run the notifier such as to stop pipsmake: More...
 
void execute_main_loop_command (gpips_main_loop_command_type command)
 To ask pipsmake to stop as soon as possible: More...
 
static void gpips_main_loop ()
 The main loop that deals with command outside the XView notifier: More...
 
int gpips_main (int argc, char *argv[])
 

Variables

GtkWidget * main_window
 
GtkWidget * schoose_window
 
GtkWidget * mchoose_window
 
GtkWidget * log_window
 
GtkWidget * edit_window [MAX_NUMBER_OF_GPIPS_WINDOWS]
 
GtkWidget * help_window
 
GtkWidget * query_dialog
 
GtkWidget * options_window
 
GtkWidget * main_window_vbox
 
GtkWidget * main_frame
 If we are in the Emacs mode, the log_frame is no longer really used: More...
 
GtkWidget * status_frame
 
GtkWidget * mchoose_frame
 
GtkWidget * help_frame
 
GtkWidget * main_window_menu_bar
 
static gpips_main_loop_command_type gpips_main_loop_command = GPIPS_EXIT
 The variables to pass information between inside and outside the XView notifyer: More...
 
static string workspace_name_given_to_gpips = NULL
 To deal with argument parsing: More...
 
static string module_name_given_to_gpips = NULL
 
static gen_array_t files_given_to_gpips = NULL
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

How much to call the notifyer between each pipsmake phase:

Enumerator
GPIPS_NUMBER_OF_EVENT_TO_DEAL_DURING_PIPSMAKE_INTERPHASE 

Definition at line 216 of file gpips.c.

216  {
218 };
@ GPIPS_NUMBER_OF_EVENT_TO_DEAL_DURING_PIPSMAKE_INTERPHASE
Definition: gpips.c:217

Function Documentation

◆ create_main_window()

void create_main_window ( )

Definition at line 118 of file gpips.c.

118  {
119  // main_panel = xv_create(main_frame, PANEL, NULL);
120  main_frame = gtk_frame_new(NULL);
121  main_window_vbox = gtk_vbox_new(FALSE, 0);
122  gtk_container_add(GTK_CONTAINER(main_window), main_window_vbox);
123  gtk_box_pack_start(GTK_BOX(main_window_vbox), main_frame, TRUE, FALSE, 0);
124  gtk_widget_show_all(main_frame);
125 }
GtkWidget * main_window_vbox
Definition: gpips.c:57
GtkWidget * main_window
Definition: gpips.c:54
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
Definition: gpips.c:60

References main_frame, main_window, and main_window_vbox.

Referenced by gpips_main().

+ Here is the caller graph for this function:

◆ create_main_window_menu_bar()

static void create_main_window_menu_bar ( )
static

Definition at line 75 of file gpips.c.

75  {
76  main_window_menu_bar = gtk_menu_bar_new();
77  gtk_box_pack_start(GTK_BOX(main_window_vbox), main_window_menu_bar, FALSE,
78  FALSE, 0);
79  gtk_widget_show_all(main_window_menu_bar);
80 }
GtkWidget * main_window_menu_bar
Definition: gpips.c:62

References main_window_menu_bar, and main_window_vbox.

Referenced by create_menus().

+ Here is the caller graph for this function:

◆ create_menus()

static void create_menus ( )
static

create_analyze_menu();

The option panel use the definition of the edit menu and so needs to be create after it:

Gone in create_menus_end(): ...No !

Definition at line 82 of file gpips.c.

82  {
84  // create_select_menu();
86  /* create_analyze_menu();*/
89  /* The option panel use the definition of the edit menu and so
90  needs to be create after it: */
92  /* Gone in create_menus_end(): ...No ! */
96 }
static void create_main_window_menu_bar()
Definition: gpips.c:75
void create_compile_menu()
Definition: gtk_compile.c:190
void create_edit_menu()
Definition: gtk_edit2.c:563
void create_help_menu()
Definition: gtk_help.c:132
void create_log_menu()
Definition: gtk_log.c:178
void create_options_menu_and_window()
Definition: gtk_props.c:516
void create_quit_button()
Definition: gtk_quit.c:108
void create_transform_menu()

References create_compile_menu(), create_edit_menu(), create_help_menu(), create_log_menu(), create_main_window_menu_bar(), create_options_menu_and_window(), create_quit_button(), and create_transform_menu().

Referenced by gpips_main().

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

◆ deal_with_gpips_events_during_pipsmake()

static bool deal_with_gpips_events_during_pipsmake ( )
static

Since XView is not called while pipsmake is running, explicitly run a hook from pipsmake to run the notifier such as to stop pipsmake:

First, try to show we are working :-)

Ask the XView notifier to deal with one event.

Refresh the main frame:

pipsmake not interrupted by default:

Definition at line 222 of file gpips.c.

222  {
223  int i;
224 
225  /* First, try to show we are working :-) */
227 
229  /* Ask the XView notifier to deal with one event. */
230  // notify_dispatch();
231  gtk_main_iteration_do(FALSE);
232 
233  /* Refresh the main frame: */
234  // XFlush((Display *) xv_get(main_frame, XV_DISPLAY));
235  /* pipsmake not interrupted by default: */
236  return TRUE;
237 }
void gpips_interrupt_button_blink()
Definition: gtk_status.c:145

References gpips_interrupt_button_blink(), and GPIPS_NUMBER_OF_EVENT_TO_DEAL_DURING_PIPSMAKE_INTERPHASE.

Referenced by gpips_main().

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

◆ execute_main_loop_command()

void execute_main_loop_command ( gpips_main_loop_command_type  command)

To ask pipsmake to stop as soon as possible:

Try to inform the user about an XView error. For debug, use the GPIPS_DEBUG_LEVEL to have an abort on this kind of error. Exit the notify loop to execute a gpips command:

I guess the function above does not return...

Definition at line 267 of file gpips.c.

267  {
268  gpips_main_loop_command = command;
269  // notify_stop();
270  gtk_main_quit();
271  /* I guess the function above does not return... */
272 }
static gpips_main_loop_command_type gpips_main_loop_command
The variables to pass information between inside and outside the XView notifyer:
Definition: gpips.c:68

References gpips_main_loop_command.

Referenced by gpips_execute_and_display_something_outside_the_notifyer(), safe_apply_outside_the_notifyer(), and wpips_execute_and_display_something_outside_the_notifyer().

+ Here is the caller graph for this function:

◆ execute_workspace_creation_and_so_on_given_with_options()

static void execute_workspace_creation_and_so_on_given_with_options ( void  )
static

Execute some actions asked as option after XView initialization:

It fails, Go on with the normal gpips behaviour...

It fails, Go on with the normal gpips behaviour...

It fails, Go on with the normal gpips behaviour...

Definition at line 184 of file gpips.c.

184  {
185  if (workspace_name_given_to_gpips != NULL) {
186  if (files_given_to_gpips != NULL) {
188  /* It fails, Go on with the normal gpips behaviour... */
189  return;
190 
192  /* It fails, Go on with the normal gpips behaviour... */
193  return;
194 
196  } else {
198  /* It fails, Go on with the normal gpips behaviour... */
199  return;
200  }
201 
202  if (module_name_given_to_gpips != NULL) {
204  }
206  show_workspace();
211  show_module();
212  }
213 }
void gen_array_free(gen_array_t a)
Definition: array.c:70
bool create_workspace(gen_array_t files)
FI: should be called "initialize_workspace()"; a previous call to db_create_workspace() is useful to ...
Definition: dbm.c:180
bool open_workspace(const char *name)
should be: success (cf wpips.h)
Definition: dbm.c:309
static gen_array_t files_given_to_gpips
Definition: gpips.c:73
static string module_name_given_to_gpips
Definition: gpips.c:72
static string workspace_name_given_to_gpips
To deal with argument parsing:
Definition: gpips.c:71
void enable_module_selection()
Definition: gtk_select.c:262
void enable_workspace_create_or_open()
Definition: gtk_select.c:213
void disable_change_directory()
Definition: gtk_select.c:186
void enable_workspace_close()
Definition: gtk_select.c:242
void end_select_module_callback(const char *name)
Definition: gtk_select.c:691
void show_workspace()
Definition: gtk_status.c:123
void display_memory_usage()
Definition: gtk_status.c:84
void show_module()
Definition: gtk_status.c:134
bool db_create_workspace(const char *)
Definition: workspace.c:282

References create_workspace(), db_create_workspace(), disable_change_directory(), display_memory_usage(), enable_module_selection(), enable_workspace_close(), enable_workspace_create_or_open(), end_select_module_callback(), files_given_to_gpips, gen_array_free(), module_name_given_to_gpips, open_workspace(), show_module(), show_workspace(), and workspace_name_given_to_gpips.

Referenced by gpips_main().

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

◆ gpips_main()

int gpips_main ( int  argc,
char *  argv[] 
)

we parse command line arguments

XV_ERROR_PROC unset as we shifted to xview.3, Apr. 92

we parse remaining command line arguments

we create all windows

Definition at line 312 of file gpips.c.

312  {
313  pips_checks();
314  //FIXME: set_pips_meta_informations(soft_revisions, soft_date, cc_version);
315  set_pips_meta_informations("<unknown>", "<unknown>", "<unknown>");
316 
322 
326 
327  debug_on("GPIPS_DEBUG_LEVEL");
328 
329  /* we parse command line arguments */
330  /* XV_ERROR_PROC unset as we shifted to xview.3, Apr. 92 */
331  // xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, XV_ERROR_PROC,
332  // gpips_xview_error, 0);
333  gtk_init(&argc, &argv);
334 
335  /* we parse remaining command line arguments */
336  gpips_parse_arguments(argc, argv);
337 
338  /* we create all windows */
339  create_windows();
347  create_menus();
349  //create_icons(); TODO: icon mangement
350  // place_frames();
351  gtk_widget_show_all(main_window);
352 
354 
363 
365 
367 
368  gpips_main_loop();
369 
371 
372  close_log_file();
373 
374  debug_off();
375 
376  exit(0);
377 }
void close_log_file(void)
Definition: message.c:162
void(* pips_log_handler)(const char *fmt, va_list *args)
USER_LOG is a function that should be called to log the current PIPS request, as soon as it is releva...
Definition: message.c:216
string(* pips_request_handler)(const char *, va_list *)
default assignment of pips_request_handler is default_user_request.
Definition: message.c:139
void(* pips_error_handler)(const char *, const char *, va_list *)
PROMPT_USER schould be implemented.
Definition: message.c:455
void set_pips_meta_informations(const char *revs, const char *date, const char *comp)
Definition: message.c:102
void(* pips_warning_handler)(const char *, const char *, va_list *)
default assignment of pips_warning_handler is default_user_warning.
Definition: message.c:325
void set_exception_callbacks(exception_callback_t, exception_callback_t)
void set_pipsmake_callback(pipsmake_callback_handler_type p)
callback.c
Definition: callback.c:43
void reset_pipsmake_callback()
Definition: callback.c:51
void(* pips_update_props_handler)()=default_update_props
default assignment of pips_update_props_handler is default_update_props.
Definition: dbm.c:53
void push_pips_context(char const *file, char const *function, int line)
exception.c
Definition: exception.c:43
void pop_pips_context(char const *file, char const *function, int line)
Definition: exception.c:50
void gpips_user_warning(const char *calling_function_name, const char *format, va_list *args)
Definition: vararg.c:56
void gpips_user_error(const char *calling_function_name, const char *format, va_list *args)
Definition: vararg.c:37
static void gpips_parse_arguments(int argc, char *argv[])
Try to parse the gpips arguments.
Definition: gpips.c:153
static bool deal_with_gpips_events_during_pipsmake()
Since XView is not called while pipsmake is running, explicitly run a hook from pipsmake to run the n...
Definition: gpips.c:222
void create_main_window()
Definition: gpips.c:118
static void execute_workspace_creation_and_so_on_given_with_options(void)
Execute some actions asked as option after XView initialization:
Definition: gpips.c:184
static void create_menus()
Definition: gpips.c:82
static void gpips_main_loop()
The main loop that deals with command outside the XView notifier:
Definition: gpips.c:275
void disable_compile_selection()
Definition: gtk_compile.c:74
void create_edit_window()
Definition: gtk_edit2.c:513
void disable_view_selection()
Definition: gtk_edit2.c:505
void create_help_window()
Definition: gtk_help.c:78
void gpips_user_log(const char *fmt, va_list *args)
Definition: gtk_log.c:136
void create_log_window()
This works but it is cleaner to use textsw_reset() instead...
Definition: gtk_log.c:215
void create_mchoose_window()
Definition: gtk_mchoose.c:242
void update_options()
Definition: gtk_props.c:138
void disable_option_selection()
Definition: gtk_props.c:130
void create_query_window()
Definition: gtk_query.c:163
string gpips_user_request(const char *a_printf_format, va_list *args)
Definition: gtk_query.c:136
void create_schoose_window()
Definition: gtk_schoose2.c:189
void disable_module_selection()
Definition: gtk_select.c:253
void enable_change_directory()
Definition: gtk_select.c:173
void disable_workspace_close()
Definition: gtk_select.c:234
void create_status_subwindow()
Definition: gtk_status.c:331
void disable_transform_selection()
Definition: gtk_transform.c:91
void create_windows()
Definition: gtk_windows.c:86
void pips_checks(void)
add checkings here (FI: why in help.c?) SG : PIPS_ROOT should not be required :)
Definition: help.c:100
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
#define exit(code)
Definition: misc-local.h:54
void initialize_newgen()
cproto-generated files
Definition: newgen.c:48
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
void initialize_sc(char *(*var_to_string)(Variable))
Definition: sc_debug.c:253
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60

References close_log_file(), create_edit_window(), create_help_window(), create_log_window(), create_main_window(), create_mchoose_window(), create_menus(), create_query_window(), create_schoose_window(), create_status_subwindow(), create_windows(), deal_with_gpips_events_during_pipsmake(), debug_off, debug_on, disable_compile_selection(), disable_module_selection(), disable_option_selection(), disable_transform_selection(), disable_view_selection(), disable_workspace_close(), display_memory_usage(), enable_change_directory(), enable_workspace_create_or_open(), entity_local_name(), execute_workspace_creation_and_so_on_given_with_options(), exit, gpips_main_loop(), gpips_parse_arguments(), gpips_user_error(), gpips_user_log(), gpips_user_request(), gpips_user_warning(), initialize_newgen(), initialize_sc(), main_window, pips_checks(), pips_error_handler, pips_log_handler, pips_request_handler, pips_update_props_handler, pips_warning_handler, pop_pips_context(), push_pips_context(), reset_pipsmake_callback(), set_exception_callbacks(), set_pips_meta_informations(), set_pipsmake_callback(), and update_options().

+ Here is the call graph for this function:

◆ gpips_main_loop()

static void gpips_main_loop ( )
static

The main loop that deals with command outside the XView notifier:

The loop to execute commands:

If the notifier happen to exit without a specified command, just exit:

Restore the initial state of the blinking pips icon:

Wait again for something from X11

Definition at line 275 of file gpips.c.

275  {
276  // xv_main_loop(frame_to_map_first);
277  gtk_main();
278 
279  /* The loop to execute commands: */
281  debug(1, "gpips_main_loop", "gpips_main_loop_command = %d\n",
283 
284  switch ((int) gpips_main_loop_command) {
285  case GPIPS_SAFE_APPLY:
287  break;
288 
291  break;
292 
293  default:
294  pips_assert(
295  "gpips_main_loop does not understand the gpips_main_loop_command",
296  0);
297  }
298 
299  /* If the notifier happen to exit without a specified command,
300  just exit: */
302 
303  /* Restore the initial state of the blinking pips icon: */
305 
306  /* Wait again for something from X11 */
307  // notify_start();
308  gtk_main();
309  }
310 }
@ GPIPS_SAFE_APPLY
Definition: gpips-local.h:63
@ GPIPS_EXECUTE_AND_DISPLAY
Definition: gpips-local.h:63
@ GPIPS_EXIT
Definition: gpips-local.h:63
void execute_gpips_execute_and_display_something_outside_the_notifier()
To execute something and display some Pips output with gpips, called outside the notifyer:
Definition: gtk_edit2.c:367
void gpips_interrupt_button_restore()
Definition: gtk_status.c:156
void execute_safe_apply_outside_the_notifier()
Definition: gtk_transform.c:99
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189

References debug(), execute_gpips_execute_and_display_something_outside_the_notifier(), execute_safe_apply_outside_the_notifier(), GPIPS_EXECUTE_AND_DISPLAY, GPIPS_EXIT, gpips_interrupt_button_restore(), gpips_main_loop_command, GPIPS_SAFE_APPLY, and pips_assert.

Referenced by gpips_main().

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

◆ gpips_parse_arguments()

static void gpips_parse_arguments ( int  argc,
char *  argv[] 
)
static

Try to parse the gpips arguments.

Should add a help and version option.

the one of getopt (3)

lazy init

Definition at line 153 of file gpips.c.

153  {
154  extern int optind; /* the one of getopt (3) */
155  int iarg = optind;
156 
157  while (iarg < argc) {
158  if (same_string_p(argv[iarg], "-workspace")) {
159  argv[iarg] = NULL;
160  workspace_name_given_to_gpips = argv[++iarg];
161  } else if (same_string_p(argv[iarg], "-module")) {
162  argv[iarg] = NULL;
163  module_name_given_to_gpips = argv[++iarg];
164  } else if (same_string_p(argv[iarg], "-files")) {
165  argv[iarg] = NULL;
166 
167  if (!files_given_to_gpips) /* lazy init */
169  gen_array_append(files_given_to_gpips, argv[++iarg]);
170  } else {
171  if (argv[iarg][0] == '-') {
172  fprintf(stderr, "Usage: %s ", argv[0]);
173  fprintf(stderr, "[ X-Window options ]");
174  fprintf(stderr, "[ -workspace name [ -module name ] ");
175  fprintf(stderr, "[ -files file1.f file2.f ... ] ]\n");
176  exit(1);
177  }
178  }
179  iarg += 1;
180  }
181 }
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
void gen_array_append(gen_array_t a, void *what)
Definition: array.c:105
#define same_string_p(s1, s2)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
int optind

References exit, files_given_to_gpips, fprintf(), gen_array_append(), gen_array_make(), module_name_given_to_gpips, optind, same_string_p, and workspace_name_given_to_gpips.

Referenced by gpips_main().

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

Variable Documentation

◆ edit_window

GtkWidget * edit_window[MAX_NUMBER_OF_GPIPS_WINDOWS]

Definition at line 55 of file gpips.c.

◆ files_given_to_gpips

gen_array_t files_given_to_gpips = NULL
static

◆ gpips_main_loop_command

gpips_main_loop_command_type gpips_main_loop_command = GPIPS_EXIT
static

The variables to pass information between inside and outside the XView notifyer:

By default, exiting the notifyer is to exit gpips:

Definition at line 68 of file gpips.c.

Referenced by execute_main_loop_command(), and gpips_main_loop().

◆ help_frame

GtkWidget * help_frame

Definition at line 60 of file gpips.c.

◆ help_window

GtkWidget * help_window

Definition at line 55 of file gpips.c.

◆ log_window

GtkWidget * log_window

Definition at line 54 of file gpips.c.

◆ main_frame

GtkWidget* main_frame

If we are in the Emacs mode, the log_frame is no longer really used:

Definition at line 60 of file gpips.c.

Referenced by create_main_window().

◆ main_window

GtkWidget* main_window

◆ main_window_menu_bar

◆ main_window_vbox

GtkWidget* main_window_vbox

◆ mchoose_frame

GtkWidget * mchoose_frame

Definition at line 60 of file gpips.c.

◆ mchoose_window

GtkWidget * mchoose_window

Definition at line 54 of file gpips.c.

◆ module_name_given_to_gpips

string module_name_given_to_gpips = NULL
static

◆ options_window

GtkWidget * options_window

Definition at line 56 of file gpips.c.

◆ query_dialog

GtkWidget * query_dialog

Definition at line 55 of file gpips.c.

◆ schoose_window

GtkWidget * schoose_window

Definition at line 54 of file gpips.c.

◆ status_frame

GtkWidget * status_frame

Definition at line 60 of file gpips.c.

◆ workspace_name_given_to_gpips

string workspace_name_given_to_gpips = NULL
static

To deal with argument parsing:

Definition at line 71 of file gpips.c.

Referenced by execute_workspace_creation_and_so_on_given_with_options(), and gpips_parse_arguments().