indexing description: "Wizard action that preforms the creation of an Ace file" legal: "See notice at end of class." status: "See notice at end of class."; date: "$Date$"; revision: "$Revision$" class ACE_BUILDER inherit WIZARD_ACTION; EIFFEL_ENV; PROJECT_CONTEXT; WINDOWS; WINDOW_ATTRIBUTES; EB_CONSTANTS create make feature -- Initialization make (a_caller: CREATE_ACE_CALLER) is require non_void_caller: a_caller /= Void do caller := a_caller ensure caller_set: equal (caller, a_caller); end; feature -- Graphical User Interface build_interface is local twl: TWO_WAY_LIST [STRING] toggle: TOGGLE_B first: BOOLEAN subdir: DIRECTORY_NAME l_s_d, l_s_d_lower, std_precomp_name, project_name: STRING sep1, sep2, sep3: THREE_D_SEPARATOR inlining_cmd: INLINING_ACE_COMMAND option_form, check_form, radio_form: FORM default_option_box: CHECK_BOX; assertion_radio: RADIO_BOX; do create system_edit.make ("system_edit", dialog.action_form); create root_class_edit.make ("root_class_edit", dialog.action_form); create creation_procedure_edit.make ("creation_procedure_edit", dialog.action_form); create dir_label.make ("project_directory", dialog.action_form); create system_label.make ("system_label", dialog.action_form); create root_class_label.make ("root_class_label", dialog.action_form); create creation_procedure_label.make ("creation_procedure_label", dialog.action_form); twl := precompiles; if twl.count > 0 then create sep1.make (Interface_names.t_Empty, dialog.action_form) create precomp_label.make ("precomp_label", dialog.action_form); end if twl.count > 0 then from twl.start; create precomp_box.make ("precomp_box", dialog.action_form); first := True; create standard_precompiles_reverse.make (3) until twl.after loop create toggle.make ("toggle", precomp_box); create subdir.make_from_string (twl.item); l_s_d := last_sub_dir (subdir); l_s_d_lower := clone (l_s_d); l_s_d_lower.to_lower; std_precomp_name := standard_precompiles.item (l_s_d_lower); if std_precomp_name /= Void then standard_precompiles_reverse.put (l_s_d, std_precomp_name); toggle.set_text (std_precomp_name) else standard_precompiles_reverse.put (l_s_d, l_s_d); toggle.set_text (l_s_d); end; if first then toggle.set_toggle_on else toggle.set_toggle_off end; first := False; twl.forth end; standard_precompiles_reverse.compare_objects; end create sep2.make (Interface_names.t_Empty, dialog.action_form) create option_form.make ("Enclosing default option form", dialog.action_form) create check_form.make ("Check form", option_form) create default_option_label.make ("default_option_label", check_form); create default_option_box.make ("default_option_box", check_form) create multithreaded_toggle.make ("multithreaded", default_option_box) create console_application_toggle.make ("console application", default_option_box) create array_optimization_toggle.make ("array optimization", default_option_box) create dynamic_runtime_toggle.make ("dynamic runtime", default_option_box) create dead_code_removal_toggle.make ("dead_code_removal", default_option_box) create profiler_toggle.make ("profiler", default_option_box) create debug_toggle.make ("debug", default_option_box) create line_generation_toggle.make ("line generation", default_option_box) create inlining_toggle.make ("inlining", default_option_box) create inlining_size_edit.make ("inlining_size_edit", check_form) inlining_toggle.set_toggle_off inlining_size_edit.set_text ("4") inlining_size_edit.set_insensitive -- Command associates to `inlining_toggle': when we are selecting the -- check box, inlining_size will be enabled, otherwise it will be -- disabled. create inlining_cmd.make (inlining_toggle, inlining_size_edit) inlining_toggle.add_value_changed_action (inlining_cmd, Void) -- We put "4" by default, since it is the standard inlining default value. create sep3.make (Interface_names.t_Empty, option_form) sep3.set_horizontal (False) create radio_form.make ("Radio form", option_form) create assertion_label.make ("assertion_label", radio_form); create assertion_radio.make ("assertion_radio", radio_form); create no_ass.make ("ass_no", assertion_radio); create require_ass.make ("ass_require", assertion_radio); create ensure_ass.make ("ass_ensure", assertion_radio); create invariant_ass.make ("ass_invariant", assertion_radio); create loop_ass.make ("ass_loop", assertion_radio); create check_ass.make ("ass_check", assertion_radio); create all_ass.make ("all_ass", assertion_radio); project_name := "Project_directory: " project_name.append (Project_directory_name) dir_label.set_text (project_name); system_label.set_text ("System name:"); root_class_label.set_text ("Root class name:"); creation_procedure_label.set_text ("Creation procedure name:"); if twl.count > 0 then precomp_label.set_text ("Precompiled libraries:"); end default_option_label.set_text ("Default options:"); assertion_label.set_text ("Default assertion checking:"); system_edit.set_text ("sample"); root_class_edit.set_text ("ROOT_CLASS"); creation_procedure_edit.set_text ("make"); console_application_toggle.set_text ("Console application") array_optimization_toggle.set_text ("Array optimization") dynamic_runtime_toggle.set_text ("Dynamic runtime") multithreaded_toggle.set_text ("Multithreaded") inlining_toggle.set_text ("Inlining - Threshold:") profiler_toggle.set_text ("Profiler") dead_code_removal_toggle.set_text ("Dead code removal") line_generation_toggle.set_text ("Line generation") debug_toggle.set_text ("Debug") dead_code_removal_toggle.set_toggle_on require_ass.set_toggle_on; assertion_radio.set_always_one (True); no_ass.set_text ("No assertions"); require_ass.set_text ("Require"); ensure_ass.set_text ("Ensure"); invariant_ass.set_text ("Invariant"); loop_ass.set_text ("Loop"); check_ass.set_text ("Check"); all_ass.set_text ("All"); dialog.action_form.attach_top (dir_label, 15); dialog.action_form.attach_left (dir_label, 10); dialog.action_form.attach_top_widget (dir_label, system_label, 15); dialog.action_form.attach_left (system_label, 10); dialog.action_form.attach_top_widget (dir_label, system_edit, 10); dialog.action_form.attach_right (system_edit, 10); dialog.action_form.attach_left_widget (system_label, system_edit, 20); dialog.action_form.attach_left (root_class_label, 10); dialog.action_form.attach_top_widget (system_edit, root_class_label, 15); dialog.action_form.attach_left_widget (root_class_label, root_class_edit, 20); dialog.action_form.attach_right (root_class_edit, 10); dialog.action_form.attach_top_widget (system_edit, root_class_edit, 10); dialog.action_form.attach_left (creation_procedure_label, 10); dialog.action_form.attach_top_widget (root_class_edit, creation_procedure_label, 15); dialog.action_form.attach_left_widget (creation_procedure_label, creation_procedure_edit, 20); dialog.action_form.attach_right (creation_procedure_edit, 10); dialog.action_form.attach_top_widget (root_class_edit, creation_procedure_edit, 10); if precomp_box /= Void then dialog.action_form.attach_left (sep1, 2); dialog.action_form.attach_right (sep1, 2); dialog.action_form.attach_top_widget (creation_procedure_edit, sep1, 10); dialog.action_form.attach_left (precomp_label, 10); dialog.action_form.attach_top_widget (sep1, precomp_label, 5); dialog.action_form.attach_left (precomp_box, 10); dialog.action_form.attach_top_widget (precomp_label, precomp_box, 10); dialog.action_form.attach_left (sep2, 2); dialog.action_form.attach_right (sep2, 2); dialog.action_form.attach_top_widget (precomp_box, sep2, 5); else dialog.action_form.attach_left (sep2, 2); dialog.action_form.attach_right (sep2, 2); dialog.action_form.attach_top_widget (creation_procedure_edit, sep2, 10); end dialog.action_form.attach_left (option_form, 0) dialog.action_form.attach_right (option_form, 0) dialog.action_form.attach_bottom (option_form, 0) dialog.action_form.attach_top_widget (sep2, option_form, 5) option_form.attach_left (check_form, 0) option_form.attach_bottom (check_form, 0) option_form.attach_top (check_form, 0) option_form.attach_top (sep3, 0) option_form.attach_bottom (sep3, 0) option_form.attach_left_widget (check_form, sep3, 5) option_form.attach_top (radio_form, 0) option_form.attach_bottom (radio_form, 0) option_form.attach_left_widget (sep3, radio_form, 5) option_form.attach_right (radio_form, 0) check_form.attach_top (default_option_label, 5) check_form.attach_left (default_option_label, 10) check_form.attach_left (default_option_box, 10) check_form.attach_top_widget (default_option_label, default_option_box, 10) check_form.attach_left (inlining_size_edit, 10) check_form.attach_bottom (inlining_size_edit, 10) check_form.attach_top_widget (default_option_box, inlining_size_edit, 10) radio_form.attach_top (assertion_label, 5) radio_form.attach_left (assertion_label, 10) radio_form.attach_left (assertion_radio, 10) radio_form.attach_top_widget (assertion_label, assertion_radio, 10) dialog.set_next_label ("Create project"); dialog.set_next_sensitive; set_composite_attributes (dialog) end; feature -- Useless stuff set_previous_action is --- Useless here. do -- Do Nothing end; work (argument: ANY) is --- Useless here. do -- Do Nothing end; feature -- Information Handling process_information is local id: IDENTIFIER; contents, c_name: STRING; new_ace: PLAIN_TEXT_FILE do create new_ace.make ("Ace.ace"); create id.make (0); id.append (system_edit.text); if (new_ace.exists and then not new_ace.is_writable) or else not new_ace.is_creatable then warner (dialog).gotcha_call (Warning_messages.w_Not_writable (new_ace.name)) processed := False; elseif not id.is_valid then warner (dialog).gotcha_call (Warning_messages.w_Invalid_system_name (id)) processed := False; else create id.make (0); id.append (root_class_edit.text); id.to_upper; create c_name.make (0); c_name.append (id); if not id.is_valid then warner (dialog).gotcha_call (Warning_messages.w_Invalid_root_class_name (id)) processed := False; else create id.make (0); id.append (creation_procedure_edit.text); id.to_lower; if not (( id.is_empty and then (c_name.is_equal ("ANY") or else c_name.is_equal ("NONE"))) or else id.is_valid) then warner (dialog).gotcha_call (Warning_messages.w_Invalid_creation_name (id)) processed := False; else contents := default_ace_file_contents; if contents = Void then warner (dialog).gotcha_call (Warning_messages.w_Default_ace_file_not_exist (default_ace_name)) processed := False; else processed := True; generate_ace_file (contents); save_ace_file (contents); if not c_name.is_equal ("ANY") or else c_name.is_equal ("NONE") then create_root_class; end caller.perform_post_creation end end end end end; feature -- Execution set_next_action is do has_next := False; finished := True; wizard.next_action end; feature -- Toggles for the default option array_optimization_toggle: TOGGLE_B -- Toggle for enabling/disabling array optimizations console_application_toggle: TOGGLE_B -- Toggle for having a console application (only on Windows) dynamic_runtime_toggle: TOGGLE_B -- Toggle for using a shared version of the runtime. line_generation_toggle: TOGGLE_B -- Toggle for generating the line number in the C generated code. multithreaded_toggle: TOGGLE_B -- Toggle for the multithreaded mode. inlining_toggle: TOGGLE_B -- Toggle for the inlining option. profiler_toggle: TOGGLE_B -- Toggle for the profiler option. dead_code_removal_toggle: TOGGLE_B -- Toggle for the dead code removal option. debug_toggle: TOGGLE_B -- Toggle for the debug option. feature -- Toggles for the assertions no_ass: TOGGLE_B; -- Toggle for no assertion checking. require_ass: TOGGLE_B; -- Toggle for check require clauses. ensure_ass: TOGGLE_B; -- Toggle for check enusre clauses. invariant_ass: TOGGLE_B; -- Toggle for check invariant clauses. loop_ass: TOGGLE_B; -- Toggle for check loop clauses. check_ass: TOGGLE_B; -- Toggle for check `check' statements. all_ass: TOGGLE_B; -- Toggle for check all assertions. feature -- Edit control system_edit: TEXT_FIELD; -- Text field to type in the name of the system. root_class_edit: TEXT_FIELD; -- Text field to type in the name of the root class. creation_procedure_edit: TEXT_FIELD; -- Text field to type in the name of the creation procedure. inlining_size_edit: TEXT_FIELD -- Text field to type the size of the inlining (default value is 4). feature -- Text labels dir_label: LABEL; -- Label to display the project directory. system_label: LABEL; -- Label to indicate what to type in. root_class_label: LABEL; -- Label to indicate what to type in. creation_procedure_label: LABEL; -- Label to indicate what to type in. precomp_label: LABEL; -- Label to display the precompiled libraries text. default_option_label: LABEL -- Label to display the default option list. assertion_label: LABEL; -- Label to display the assertion checking text. feature -- Radio Boxes precomp_box: CHECK_BOX; -- Check box to display all precompiles feature {NONE} -- Properties precompiles: TWO_WAY_LIST [STRING] is -- Looks up the disk to find the precompiled libraries in -- $ISE_EIFFEL/precomp/spec/$ISE_PLATFORM/*. -- The list will only contain those precompiles that are actually -- precompiled (by the means the file ./EIFGEN/project.eif exists). local dir: DIRECTORY; file_name: FILE_NAME; file: RAW_FILE once create Result.make; create dir.make (Default_precompiled_location); if dir.exists and then dir.is_readable then from dir.open_read; dir.start; dir.readentry until dir.lastentry = Void loop create file_name.make_from_string (dir.name); file_name.extend_from_array (<