home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / compile_to_c.e < prev    next >
Text File  |  1999-06-17  |  5KB  |  127 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  4. --                       http://SmallEiffel.loria.fr
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
  11. -- for  more  details.  You  should  have  received a copy of the GNU General
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class COMPILE_TO_C
  17.    --
  18.    -- The `compile_to_c' command.
  19.    --
  20.  
  21. inherit COMMAND_FLAGS;
  22.  
  23. creation make
  24.  
  25. feature {NONE}
  26.  
  27.    command_name: STRING is
  28.       do
  29.          Result := Command_compile_to_c;
  30.       end;
  31.  
  32.    make is
  33.       local
  34.          argc, argi: INTEGER;
  35.          arg: STRING;
  36.       do
  37.          eiffel_parser.set_drop_comments;
  38.          argc := argument_count;
  39.          if argc < 1 then
  40.             system_tools.bad_use_exit(command_name);
  41.          end;
  42.          search_for_verbose_flag;
  43.          search_for_cc_flag(argc);
  44.          search_for_size_flag(argc);
  45.          from
  46.             argi := 1;
  47.          until
  48.             argi > argc
  49.          loop
  50.             arg := argument(argi);
  51.             if is_flag_case_insensitive(arg) then
  52.                argi := argi + 1;
  53.             elseif is_flag_no_style_warning(arg) then
  54.                argi := argi + 1;
  55.             elseif is_flag_no_warning(arg) then
  56.                argi := argi + 1;
  57.             elseif is_flag_version(arg) then
  58.                argi := argi + 1;
  59.             elseif is_flag_verbose(arg) then
  60.                argi := argi + 1;
  61.             elseif is_flag_boost(arg) then
  62.                argi := argi + 1;
  63.             elseif is_flag_no_check(arg) then
  64.                argi := argi + 1;
  65.             elseif is_flag_require_check(arg) then
  66.                argi := argi + 1;
  67.             elseif is_flag_ensure_check(arg) then
  68.                argi := argi + 1;
  69.             elseif is_flag_invariant_check(arg) then
  70.                argi := argi + 1;
  71.             elseif is_flag_loop_check(arg) then
  72.                argi := argi + 1;
  73.             elseif is_flag_all_check(arg) then
  74.                argi := argi + 1;
  75.             elseif is_flag_debug_check(arg) then
  76.                argi := argi + 1;
  77.             elseif is_flag_trace(arg) then
  78.                argi := argi + 1;
  79.             elseif is_flag_cecil(arg,argi,argc) then
  80.                argi := argi + 2;
  81.             elseif is_flag_o(arg,argi,argc,cpp) then
  82.                argi := argi + 2;
  83.             elseif ("-no_main").is_equal(arg) then
  84.                cpp.set_no_main;
  85.                argi := argi + 1;
  86.             elseif ("-no_gc").is_equal(arg) then
  87.                gc_handler.no_gc;
  88.                argi := argi + 1;
  89.             elseif ("-gc_info").is_equal(arg) then
  90.                gc_handler.set_info_flag;
  91.                argi := argi + 1;
  92.             elseif ("-no_strip").is_equal(arg) then
  93.                system_tools.set_no_strip;
  94.                argi := argi + 1;
  95.             elseif ("-no_split").is_equal(arg) then
  96.                cpp.set_no_split;
  97.                argi := argi + 1;
  98.             elseif Flag_cc.is_equal(arg) then
  99.                if argi < argc then
  100.                   argi := argi + 2;
  101.                else
  102.                   echo.w_put_string(command_name);
  103.                   echo.w_put_string(" : missing compiler name after -cc flag.%N");
  104.                   die_with_code(exit_failure_code);
  105.                end;
  106.             elseif Flag_size.is_equal(arg) then
  107.                if argi < argc then
  108.                   argi := argi + 2;
  109.                else
  110.                   echo.w_put_string(command_name);
  111.                   echo.w_put_string(" : missing value after -size flag.%N");
  112.                   die_with_code(exit_failure_code);
  113.                end;
  114.             elseif argi < argc then
  115.                argi := system_tools.extra_arg(arg,argi,argument(argi + 1));
  116.             else
  117.                argi := system_tools.extra_arg(arg,argi,Void);
  118.             end;
  119.          end;
  120.          check_for_root_class;
  121.          small_eiffel.compile_to_c;
  122.          string_aliaser.echo_information;
  123.       end;
  124.  
  125. end -- COMPILE_TO_C
  126.  
  127.