class WIZARD_C_COMPILER inherit WIZARD_SHARED_GENERATION_ENVIRONMENT export {NONE} all end WIZARD_SHARED_DATA export {NONE} all end WIZARD_ROUTINES WIZARD_COMPILER_ENVIRONMENT export {NONE} all end WIZARD_WRITER_DICTIONARY export {NONE} all end OPERATING_ENVIRONMENT export {NONE} all end WIZARD_RESCUABLE export {NONE} all end WIZARD_ERRORS export {NONE} all end feature -- Basic Operations compile_folder (a_folder_name: STRING) is -- Compiler C files in folder `a_folder_name'. -- Report progress with `a_progress_report' if not void. require non_void_folder_name: a_folder_name /= Void valid_folder_name: is_valid_folder_name (a_folder_name) local l_directory: DIRECTORY l_string: STRING l_process_launcher: WEL_PROCESS_LAUNCHER do Env.put (Eiffel_installation_dir_name, "ISE_EIFFEL") create l_directory.make_open_read (a_folder_name) if use_bcb then if l_directory.has_entry ("makefile.bcb") then l_string := "make /f makefile.bcb" end else if l_directory.has_entry ("makefile.msc") then l_string := "nmake /f makefile.msc" end end if l_string /= Void then create l_process_launcher l_process_launcher.run_hidden environment.add_abort_request_action (agent l_process_launcher.terminate_process) l_process_launcher.launch (l_string, a_folder_name, agent message_output.add_text) if not l_process_launcher.last_launch_successful or not l_directory.has_entry ("msc") then environment.set_abort (C_compilation_failed) environment.set_error_data ("in folder " + Env.current_working_directory + "\" + a_folder_name) end environment.remove_abort_request_action end l_directory.close end compile_file (a_file_name: STRING) is -- Compile C file `a_file_name'. require non_void_file_name: a_file_name /= Void valid_file_name: is_c_file (a_file_name) local l_string: STRING l_process_launcher: WEL_PROCESS_LAUNCHER do generate_command_line_file (C_compiler_command_line (a_file_name), Temporary_input_file_name) if not environment.abort then l_string := C_compiler.twin l_string.append (Space) l_string.append (last_make_command) create l_process_launcher l_process_launcher.run_hidden l_process_launcher.launch (l_string, Env.current_working_directory, agent message_output.add_text) if not l_process_launcher.last_launch_successful then environment.set_abort (C_compilation_failed) environment.set_error_data ("file " + a_file_name) end end end feature {NONE} -- Implementation Lib_command: STRING is "Lib" -- Link command Lib_out_option: STRING is "/OUT:" -- Lib out option last_make_command: STRING -- Input to compiler -- Set by `generate_make_file'. generate_command_line_file (content, a_file_name: STRING) is -- Generate command line with content `content' and file name `a_file_name'. -- Set `last_make_command' with argument to pass to compiler. local retried: BOOLEAN a_file: PLAIN_TEXT_FILE a_string: STRING do if not retried then a_string := Env.current_working_directory.twin a_string.append_character (Directory_separator) a_string.append (a_file_name) create a_file.make_open_write (a_string) a_file.put_string (content) last_make_command := At_sign.twin last_make_command.append (a_file_name) a_file.close else environment.set_abort (Makefile_write_error) end rescue if not failed_on_rescue then retried := True retry end end C_compiler_command_line (a_file_name: STRING): STRING is -- Cl command line used to compile Proxy Stub do Result := Common_c_compiler_options.twin Result.append (" /nologo ") Result.append (Env.current_working_directory.twin) Result.append_character (Directory_separator) Result.append (a_file_name) end end -- class WIZARD_C_COMPILER --+---------------------------------------------------------------- --| EiffelCOM Wizard --| Copyright (C) 1999-2005 Eiffel Software. All rights reserved. --| Eiffel Software Confidential --| Duplication and distribution prohibited. --| --| Eiffel Software --| 356 Storke Road, Goleta, CA 93117 USA --| http://www.eiffel.com --+----------------------------------------------------------------