25 #include "pips_config.h"
33 #include <sys/resource.h>
39 #if (defined(TEXT_TYPE))
54 #include "resources.h"
108 user_log(
"Directory \"%s\" does not exist\n", dir);
109 prompt_user(
"Directory \"%s\" does not exist\n", dir);
113 user_log(
"Directory \"%s\" selected\n", dir);
128 char * tmp =
strdup(
"/tmp/gpips.dir.XXXXXX");
140 while ((c = getc(tmph)) != EOF && i <
MAXPATHLEN)
142 newdir[i - 1] =
'\0';
161 prompt_user(
"You have to close the current workspace"
162 " before changing directory.");
169 start_query(
"Change Directory",
"Enter directory path: ",
283 GtkWidget * dialog = gtk_message_dialog_new(GTK_WINDOW(
log_window),
284 GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO,
285 GTK_BUTTONS_YES_NO,
"%s",
concatenate(
"The workspace ", name,
286 " is currently opened!\n",
287 "Do you really want to close and remove it ?", NULL));
288 result = gtk_dialog_run(GTK_DIALOG(dialog));
289 gtk_widget_destroy(dialog);
292 goto do_not_delete_the_workspace;
315 int workspace_list_length = 0;
321 if (workspace_list_length == 0) {
322 prompt_user(
"No workspace available in this directory.");
329 schoose(
"Select the Workspace to Delete", workspace_list,
350 start_query(
"Create Workspace",
"Enter workspace name: ",
368 int fortran_list_length = 0;
378 if (fortran_list_length == 0) {
387 GtkWidget * dialog = gtk_message_dialog_new(GTK_WINDOW(
389 GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO,
"%s",
concatenate(
390 "The database ", name,
" already exists!\n",
391 "Do you really want to remove it ?", NULL));
392 result = gtk_dialog_run(GTK_DIALOG(dialog));
393 gtk_widget_destroy(dialog);
395 if (result == GTK_RESPONSE_NO) {
396 goto continue_create_workspace_notify_failed;
405 if (fortran_list_length == 1) {
409 "There is only one Fortran program in the current directory.\n"
410 "\tCreating the workspace \"%s\" from the file \"%s\"...\n",
414 mchoose(
"Create Workspace", fortran_list,
433 prompt_user(
"The name \"%s\" is not a valid workspace name!\n",
510 int workspace_list_length = 0;
516 if (workspace_list_length == 0) {
517 prompt_user(
"No workspace available in this directory.");
518 }
else if (workspace_list_length == 1) {
521 user_log(
"There is only one workspace in the current directory.\n"
528 schoose(
"Select Workspace", workspace_list,
541 debug(1,
"close_workspace_notify",
"return_value = %d\n", return_value);
573 int workspace_list_length = 0;
579 (void) strncpy(workspace_name, workspace_name_original,
580 sizeof(workspace_name) - 1);
600 for (i = 0; i < workspace_list_length; i++) {
602 if (strcmp(workspace_name, name) == 0) {
628 GtkWidget * delete_menu_item;
631 int workspace_list_length = 0;
637 menu = gtk_menu_new();
641 GtkWidget * temp_item;
643 temp_item = gtk_menu_item_new_with_label(
"Create Workspace");
644 g_signal_connect(G_OBJECT(temp_item),
"activate",
646 gtk_menu_append(GTK_MENU(menu), temp_item);
649 temp_item = gtk_menu_item_new_with_label(
"Close Workspace");
652 gtk_menu_append(GTK_MENU(menu), temp_item);
655 delete_menu_item = gtk_menu_item_new_with_label(
"Delete Workspace");
656 g_signal_connect(G_OBJECT(delete_menu_item),
"activate",
658 gtk_menu_append(GTK_MENU(menu), delete_menu_item);
659 gtk_widget_set_sensitive(delete_menu_item,
663 if (workspace_list_length == 0) {
664 temp_item = gtk_menu_item_new_with_label(
665 "* No workspace available in this directory *");
666 gtk_menu_append(GTK_MENU(menu), temp_item);
667 gtk_widget_set_sensitive(temp_item, FALSE);
670 gtk_widget_set_sensitive(delete_menu_item, FALSE);
672 gtk_menu_append(GTK_MENU(menu), gtk_separator_menu_item_new());
673 for (i = 0; i < workspace_list_length; i++) {
675 temp_item = gtk_menu_item_new_with_label(name);
676 gtk_menu_append(GTK_MENU(menu), temp_item);
677 g_signal_connect(G_OBJECT(temp_item),
"activate",
679 gtk_widget_set_sensitive(temp_item,
686 gtk_widget_show_all(menu);
695 if (module_list_length == 0) {
696 prompt_user(
"No module available in this workspace.");
698 bool module_found = FALSE;
701 for (i = 0; i < module_list_length; i++) {
703 if (strcmp(name, mn) == 0) {
711 prompt_user(
"The module \"%s\" does not exist in this workspace.",
727 if (module_list_length == 0) {
729 prompt_user(
"No module available in this workspace.");
731 schoose(
"Select Module", module_list,
753 menu = gtk_menu_new();
756 GtkWidget * no_workspace_menu_item;
757 no_workspace_menu_item = gtk_menu_item_new_with_label(
758 "* No workspace yet! *");
759 gtk_widget_set_sensitive(no_workspace_menu_item, FALSE);
760 gtk_menu_append(GTK_MENU(menu), no_workspace_menu_item);
765 if (module_list_length == 0) {
766 GtkWidget * no_workspace_menu_item;
767 no_workspace_menu_item = gtk_menu_item_new_with_label(
768 "* No module available in this workspace *");
769 gtk_widget_set_sensitive(no_workspace_menu_item, FALSE);
770 gtk_menu_append(GTK_MENU(menu), no_workspace_menu_item);
773 for (i = 0; i < module_list_length; i++) {
784 gtk_widget_show_all(menu);
789 GtkWidget *menu, *menu_item, *pmenu, *pmenu_item;
796 g_signal_connect(G_OBJECT(
open_menu_item),
"activate", G_CALLBACK(
804 pmenu = gtk_menu_new();
809 pmenu_item = gtk_menu_item_new_with_label(
"Deal with workspaces");
810 gtk_menu_item_set_submenu(GTK_MENU_ITEM(pmenu_item), pmenu);
821 menu = gtk_menu_new();
823 gtk_menu_append(GTK_MENU(menu), pmenu_item);
826 menu_item = gtk_menu_item_new_with_label(
"Selection Menu");
827 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu);
829 gtk_widget_show(menu_item);
830 gtk_widget_show_all(menu);
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
void user_log(const char *format,...)
string db_get_current_module_name(void)
Also used to check whether set...
size_t gen_array_nitems(const gen_array_t a)
void gen_array_full_free(gen_array_t a)
gen_array_t gen_array_make(size_t size)
declarations...
void * gen_array_item(const gen_array_t a, size_t i)
bool delete_workspace(const char *wname)
bool create_workspace(gen_array_t files)
FI: should be called "initialize_workspace()"; a previous call to db_create_workspace() is useful to ...
bool close_workspace(bool is_quit)
bool lazy_open_module(const char *name)
Do not open a module already opened :
bool open_workspace(const char *name)
should be: success (cf wpips.h)
const char * module_name(const char *s)
Return the module part of an entity name.
FILE * safe_fopen(const char *filename, const char *what)
char * get_cwd(void)
returns the current working directory name.
int safe_fclose(FILE *stream, const char *filename)
GtkWidget * schoose_window
#define SMALL_BUFFER_LENGTH
GtkWidget * main_window_menu_bar
gen_array_t db_get_module_list(void)
Get an array of all the modules (functions, procedures and compilation units) of a workspace.
void disable_compile_selection()
void initialize_gpips_hpfc_hack_for_fabien_and_from_fabien()
void enable_compile_selection()
void disable_view_selection()
void enable_view_selection()
void edit_close_notify(GtkWidget *widget, gpointer data)
void prompt_user(string a_printf_format,...)
void mchoose(char *title, gen_array_t array, void(*function_ok)(gen_array_t), void(*function_cancel)(void))
void enable_option_selection()
void disable_option_selection()
void start_query(char *window_title, char *query_title, char *help_topic, success(*ok_func)(const char *), void(*cancel_func)(GtkWidget *, gpointer))
void cancel_query_notify(GtkWidget *widget, gpointer data)
hides a window...
void schoose(char *title, gen_array_t array, char *initial_choice, void(*function_for_ok)(const char *), void(*function_for_cancel)(void))
void schoose_close()
schoose_close() can be called even when schoose window is already closed.
void end_directory_text_notify(GtkWidget *text_item, gpointer data)
@ GPIPS_MAX_MODULE_MENU_SIZE
void prompt_user_not_allowed_to_change_directory(GtkWidget *widget, gpointer data)
bool gpips_close_workspace_menu_inactive_old
void disable_module_selection()
static GtkWidget * close_menu_item
void enable_module_selection()
bool gpips_change_directory_inactive
static GtkWidget * create_menu_item
static GtkWidget * open_menu_item
void enable_workspace_create_or_open()
void disable_workspace_delete_or_open()
void start_directory_notify(GtkWidget *widget, gpointer data)
GtkWidget * generate_module_menu()
participe à la génération du menu associés aux modules dans la fenetre principale
bool gpips_create_workspace_menu_inactive
bool gpips_change_directory_inactive_old
void disable_change_directory()
GtkWidget * directory_menu_item
bool gpips_open_workspace_menu_inactive
void enable_workspace_close()
void start_delete_workspace_notify(GtkWidget *widget, gpointer data)
void create_select_menu()
GtkWidget * generate_workspace_menu()
To use with schoose_create_abbrev_menu_with_text:
void end_delete_workspace_notify(const char *name)
void select_a_module_by_default()
Try to select a main module (that is the PROGRAM in the Fortran stuff) if no one is selected:
static GtkWidget * module_menu_item
void cancel_select_module_notify(void)
void end_open_workspace_notify(const char *name)
void disable_workspace_create_or_open()
success end_directory_notify(const char *dir)
void end_select_module_callback(const char *name)
static void select_module_from_status_menu_callback(GtkWidget *widget, gpointer data __attribute__((unused)))
void end_create_workspace_notify(gen_array_t files)
bool gpips_close_workspace_menu_inactive
To enable or disable the menu items generated by generate_module_menu():
void user_prompt_not_a_valid_workspace_name(const char *workspace_name)
success close_workspace_notify(GtkWidget *widget, gpointer data)
void start_create_workspace_notify(GtkWidget *widget, gpointer data)
static void restore_enable_change_directory_state()
void enable_change_directory()
void cancel_open_workspace_notify()
void enable_workspace_delete_or_open()
void direct_change_directory()
FC: uses an external wish script I do not know how to activate this function safely....
void select_module_from_menubar_callback(GtkWidget *widget, gpointer data)
void cancel_delete_workspace_notify()
success continue_create_workspace_notify(const char *name)
GtkWidget * generate_directory_menu()
void restore_enable_workspace_close_state()
void cancel_create_workspace_notify(GtkWidget *widget, gpointer data)
void open_or_create_workspace(const char *workspace_name_original)
To be used with schoose_create_abbrev_menu_with_text from the main panel:
bool gpips_delete_workspace_menu_inactive
void open_workspace_notify(GtkWidget *widget, gpointer data)
void select_workspace_notify(GtkWidget *w, gpointer data __attribute__((unused)))
void disable_workspace_close()
GtkWidget * module_name_entry
GtkWidget * workspace_name_entry
void display_memory_usage()
GtkWidget * directory_name_entry
const char * gpips_gtk_menu_item_get_label(GtkWidget *w)
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
#define MAXPATHLEN
MAXPATHLEN is defined in <sys/param.h> for SunOS...
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
void safe_system(string)
system.c
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define string_undefined_p(s)
bool workspace_exists_p(const char *)
bool db_create_workspace(const char *)
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
bool workspace_name_p(const char *)
workspace.c
string get_first_main_module(void)
Should be able to handle Fortran applications, C applications and mixed Fortran/C applications.
void pips_get_fortran_list(gen_array_t)
Select the true file with names ending in ".[fF]" and return a sorted arg list:
void pips_get_workspace_list(gen_array_t)
cproto-generated files
string pips_change_directory(const char *)
Change to the given directory if it exists and return a canonical name.
static char * workspace_name_to_create