home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / call_prefix_not.e < prev    next >
Text File  |  1999-06-05  |  3KB  |  116 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 CALL_PREFIX_NOT
  17.    --
  18.    --   Prefix operator : "not".
  19.    --
  20.  
  21. inherit CALL_PREFIX redefine compile_to_c end;
  22.  
  23. creation make, with
  24.  
  25. feature
  26.  
  27.    precedence: INTEGER is 11;
  28.  
  29. feature {NONE}
  30.  
  31.    make(operator_position: POSITION; rp: like target) is
  32.       require
  33.          operator_position /= Void;
  34.          rp /= Void
  35.       do
  36.          !!feature_name.make(operator,operator_position);
  37.          target := rp;
  38.       ensure
  39.          start_position = operator_position;
  40.          target = rp
  41.       end;
  42.  
  43. feature
  44.  
  45.    operator: STRING is
  46.       do
  47.          Result := as_not;
  48.       end;
  49.  
  50.    isa_dca_inline_argument: INTEGER is
  51.       do
  52.       end;
  53.  
  54.    dca_inline_argument(formal_arg_type: TYPE) is
  55.       do
  56.       end;
  57.  
  58.    is_static: BOOLEAN is
  59.       do
  60.          if target.result_type.is_boolean then
  61.             if target.is_static then
  62.                Result := true;
  63.             end;
  64.          end;
  65.       end;
  66.  
  67.    static_value: INTEGER is
  68.       do
  69.          if target.result_type.is_boolean then
  70.             if target.is_static then
  71.                if target.static_value = 0 then
  72.                   Result := 1;
  73.                end;
  74.             end;
  75.          end;
  76.       end;
  77.  
  78.    compile_to_c is
  79.       do
  80.          if run_control.boost and then
  81.             target.result_type.run_type.is_boolean then
  82.             cpp.put_string("!(");
  83.             target.compile_to_c;
  84.             cpp.put_character(')');
  85.          else
  86.             call_proc_call_c2c;
  87.          end;
  88.       end;
  89.  
  90.    compile_to_jvm is
  91.       do
  92.          call_proc_call_c2jvm;
  93.       end;
  94.  
  95.    jvm_branch_if_false: INTEGER is
  96.       do
  97.          if result_type.is_boolean then
  98.             target.compile_to_jvm;
  99.             Result := code_attribute.opcode_ifne;
  100.          else
  101.             Result := jvm_standard_branch_if_false;
  102.          end;
  103.       end;
  104.  
  105.    jvm_branch_if_true: INTEGER is
  106.       do
  107.          if result_type.is_boolean then
  108.             target.compile_to_jvm;
  109.             Result := code_attribute.opcode_ifeq;
  110.          else
  111.             Result := jvm_standard_branch_if_true;
  112.          end;
  113.       end;
  114.  
  115. end -- CALL_PREFIX_NOT
  116.