25 #include "pips_config.h"
33 #include <sys/resource.h>
34 #include <xview/xview.h>
35 #include <xview/panel.h>
36 #include <xview/notice.h>
37 #include <xview/text.h>
43 #if (defined(TEXT_TYPE))
59 #include "resources.h"
115 user_log(
"Directory \"%s\" does not exist\n", dir);
116 prompt_user(
"Directory \"%s\" does not exist\n", dir);
121 user_log(
"Directory \"%s\" selected\n", dir);
142 char * tmp =
strdup(
"/tmp/wpips.dir.XXXXXX");
161 unlink(tmp);
free(tmp);
179 prompt_user(
"You have to close the current workspace"
180 " before changing directory.");
190 (Panel_item)NULL, (Event*)NULL);
193 "Enter directory path: ",
208 PANEL_NOTIFY_LEVEL, PANEL_SPECIFIED,
210 PANEL_INACTIVE, FALSE,
225 PANEL_NOTIFY_LEVEL, PANEL_ALL,
227 PANEL_INACTIVE, TRUE,
258 PANEL_INACTIVE, TRUE,
267 MENU_INACTIVE, FALSE,
271 MENU_INACTIVE, FALSE,
274 PANEL_INACTIVE, FALSE,
287 PANEL_INACTIVE, TRUE,
298 PANEL_INACTIVE, FALSE,
306 xv_set(
close_pgm, MENU_INACTIVE, TRUE, NULL);
316 xv_set(
close_pgm, MENU_INACTIVE, FALSE, NULL);
371 "is currently opened!",
372 "Do you really want to close and remove it ?",
374 result = notice_prompt(xv_find(
main_frame, WINDOW, 0),
376 NOTICE_MESSAGE_STRINGS,
379 "is currently opened!",
380 "Do you really want to close and remove it ?",
382 NOTICE_BUTTON_YES,
"Yes, remove the database",
383 NOTICE_BUTTON_NO,
"No, cancel",
385 if (result == NOTICE_NO)
386 goto do_not_delete_the_workspace;
392 goto do_not_delete_the_workspace;
397 do_not_delete_the_workspace:
423 int workspace_list_length = 0;
429 if (workspace_list_length == 0) {
430 prompt_user(
"No workspace available in this directory.");
438 schoose(
"Select the Workspace to Delete",
467 "Enter workspace name: ",
493 int fortran_list_length = 0;
505 if (fortran_list_length == 0) {
520 "Do you really want to remove it?",
522 result = notice_prompt(xv_find(
main_frame, WINDOW, 0),
524 NOTICE_MESSAGE_STRINGS,
525 "The database", name,
"already exists!",
526 "Do you really want to remove it?",
529 "Yes, remove the database",
530 NOTICE_BUTTON_NO,
"No, cancel",
532 if (result == NOTICE_NO)
533 goto continue_create_workspace_notify_failed;
541 if (fortran_list_length == 1) {
544 user_log(
"There is only one Fortran program in the current directory.\n"
545 "\tCreating the workspace \"%s\" from the file \"%s\"...\n",
564 continue_create_workspace_notify_failed:
574 prompt_user(
"The name \"%s\" is not a valid workspace name!\n",
669 int workspace_list_length = 0;
675 if (workspace_list_length == 0) {
676 prompt_user(
"No workspace available in this directory.");
678 else if (workspace_list_length == 1) {
681 user_log(
"There is only one workspace in the current directory.\n"
682 "\tOpening the workspace \"%s\"...\n",
708 debug(1,
"close_workspace_notify",
"return_value = %d\n", return_value);
745 int workspace_list_length = 0;
751 (void) strncpy(workspace_name,
752 workspace_name_original,
753 sizeof(workspace_name) - 1);
773 for(i = 0; i < workspace_list_length; i++) {
775 if (strcmp(workspace_name, name) == 0) {
793 Menu_item delete_menu_item;
796 int workspace_list_length = 0;
802 menu = xv_create(XV_NULL, MENU,
803 MENU_TITLE_ITEM,
" Select in the workspace list: ",
808 xv_set(menu, MENU_APPEND_ITEM,
809 xv_create(XV_NULL, MENUITEM,
811 " Create Workspace...",
820 xv_set(menu, MENU_APPEND_ITEM,
821 xv_create(XV_NULL, MENUITEM,
830 delete_menu_item = xv_create(XV_NULL, MENUITEM,
832 " Delete Workspace...",
838 xv_set(menu, MENU_APPEND_ITEM,
843 if (workspace_list_length == 0) {
844 xv_set(menu, MENU_APPEND_ITEM,
845 xv_create(XV_NULL, MENUITEM,
847 "* No workspace available in this directory *",
854 xv_set(delete_menu_item,
859 for(i = 0; i < workspace_list_length; i++)
862 xv_set(menu, MENU_APPEND_ITEM,
863 xv_create(XV_NULL, MENUITEM,
864 MENU_STRING,
strdup(name),
887 if (module_list_length == 0)
889 prompt_user(
"No module available in this workspace.");
893 bool module_found = FALSE;
896 for(i = 0; i < module_list_length; i++) {
898 if (strcmp(name, mn) == 0) {
906 prompt_user(
"The module \"%s\" does not exist in this workspace.",
926 if (module_list_length == 0)
929 prompt_user(
"No module available in this workspace.");
951 menu = xv_create(XV_NULL, MENU,
952 MENU_TITLE_ITEM,
" Select in the module list: ",
956 xv_set(menu, MENU_APPEND_ITEM,
957 xv_create(XV_NULL, MENUITEM,
958 MENU_STRING,
"* No workspace yet! *",
968 if (module_list_length == 0) {
969 xv_set(menu, MENU_APPEND_ITEM,
970 xv_create(XV_NULL, MENUITEM,
972 "* No module available in this workspace *",
981 " Too many modules. Click on the Module Chooser: ",
983 xv_set(menu, MENU_APPEND_ITEM,
984 xv_create(XV_NULL, MENUITEM,
985 MENU_STRING,
"Module Chooser",
991 "Too many modules in this workspace. "
992 "Click on the Module Chooser\n");
995 for(i = 0; i < module_list_length; i++) {
997 xv_set(menu, MENU_APPEND_ITEM,
998 xv_create(XV_NULL, MENUITEM,
1021 MENU_STRING,
"Create",
1026 open_pgm = xv_create(XV_NULL, MENUITEM,
1027 MENU_STRING,
"Open",
1032 close_pgm = xv_create(XV_NULL, MENUITEM,
1033 MENU_STRING,
"Close",
1035 MENU_INACTIVE, TRUE,
1040 MENU_STRING,
"Module",
1042 MENU_INACTIVE, TRUE,
1049 xv_create(XV_NULL, MENU_COMMAND_MENU,
1050 MENU_TITLE_ITEM,
"Deal with workspaces ",
1051 MENU_GEN_PIN_WINDOW,
main_frame,
"Workspace Menu",
1067 xv_create(XV_NULL, MENU_COMMAND_MENU,
1068 MENU_TITLE_ITEM,
"Selecting workspace & Fortran module ",
1069 MENU_GEN_PIN_WINDOW,
main_frame,
"Selection Menu",
1071 MENU_PULLRIGHT_ITEM,
"Workspace", pmenu,
1086 Frame select_button_frame;
1087 Panel select_button_panel;
1089 select_button_frame = xv_create(
main_frame, FRAME,
1092 select_button_panel = xv_create(select_button_frame, PANEL,
1095 (void) xv_create(select_button_panel, PANEL_BUTTON,
1096 PANEL_LABEL_STRING,
"Select",
1097 PANEL_ITEM_MENU, menu,
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)
void send_the_names_of_the_available_modules_to_emacs(void)
Tell Emacs about what are the modules available in the current workspace, if any:
bool wpips_emacs_mode
Here are all the stuff to interface Pips with Emacs.
void send_notice_prompt_to_emacs(char *first_line,...)
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)
#define SMALL_BUFFER_LENGTH
GtkWidget * main_frame
If we are in the Emacs mode, the log_frame is no longer really used:
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 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 display_memory_usage()
gint hide_window(GtkWidget *window, GdkEvent *ev __attribute__((unused)), gpointer data __attribute__((unused)))
#define user_warning(fn,...)
#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.
void initialize_wpips_hpfc_hack_for_fabien_and_from_fabien()
void select_module_notify(Menu menu, Menu_item menu_item)
bool wpips_delete_workspace_menu_inactive
static Menu_item create_pgm
void end_select_module_notify(string name)
void disable_module_selection()
bool wpips_close_workspace_menu_inactive_old
Menu_item directory_menu_item
void enable_module_selection()
void end_delete_workspace_notify(char *name)
void end_directory_text_notify(Panel_item text_item, Event *event)
void prompt_user_not_allowed_to_change_directory(Panel_item text_item, Event *event)
void user_prompt_not_a_valid_workspace_name(char *workspace_name)
Menu generate_directory_menu()
Menu generate_module_menu()
To use with schoose_create_abbrev_menu_with_text:
void enable_workspace_create_or_open()
void start_create_workspace_notify(Menu menu, Menu_item menu_item)
void disable_workspace_delete_or_open()
void cancel_select_module_notify()
static Menu_item module_item
void start_directory_notify(Menu menu, Menu_item menu_item)
void open_workspace_notify(Menu menu, Menu_item menu_item)
bool wpips_change_directory_inactive
void disable_change_directory()
void enable_workspace_close()
void cancel_create_workspace_notify(Panel_item item, Event *event)
static char * workspace_name_to_create
void create_select_menu()
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:
bool wpips_create_workspace_menu_inactive
static Menu_item open_pgm
void start_delete_workspace_notify(Menu menu, Menu_item menu_item)
void disable_workspace_create_or_open()
bool wpips_close_workspace_menu_inactive
To enable or disable the menu items generated by generate_module_menu():
bool wpips_open_workspace_menu_inactive
bool wpips_change_directory_inactive_old
void end_create_workspace_notify(gen_array_t files)
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 end_open_workspace_notify(string name)
success continue_create_workspace_notify(char *name)
success end_directory_notify(char *dir)
void open_or_create_workspace(char *workspace_name_original)
To be used with schoose_create_abbrev_menu_with_text from the main panel:
void cancel_delete_workspace_notify()
success close_workspace_notify(Menu menu, Menu_item menu_item)
void restore_enable_workspace_close_state()
static Menu_item close_pgm
@ WPIPS_MAX_MODULE_MENU_SIZE
void disable_workspace_close()
Menu generate_workspace_menu()
To use with schoose_create_abbrev_menu_with_text:
Panel_item module_name_panel_item
Panel_item workspace_name_panel_item
Panel_item directory_name_panel_item