home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / integer_constant.e < prev    next >
Text File  |  1999-06-05  |  3KB  |  119 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 INTEGER_CONSTANT
  17.    --
  18.    -- For Manifest Constant of class INTEGER.
  19.    --
  20.  
  21. inherit BASE_TYPE_CONSTANT redefine to_integer end;
  22.  
  23. creation make
  24.  
  25. feature
  26.  
  27.    value: INTEGER;
  28.  
  29.    is_static: BOOLEAN is true;
  30.  
  31.    static_result_base_class: BASE_CLASS is
  32.       do
  33.          Result := small_eiffel.get_class(as_integer);
  34.       end;
  35.  
  36.    static_value: INTEGER is
  37.       do
  38.          Result := value;
  39.       end;
  40.  
  41.    compile_to_c is
  42.       do
  43.          cpp.put_integer(value);
  44.       end;
  45.  
  46.    compile_target_to_jvm, compile_to_jvm is
  47.       do
  48.          code_attribute.opcode_push_integer(value);
  49.       end;
  50.  
  51.    jvm_branch_if_false: INTEGER is
  52.       do
  53.       end;
  54.  
  55.    jvm_branch_if_true: INTEGER is
  56.       do
  57.       end;
  58.  
  59.    compile_to_jvm_into(dest: TYPE): INTEGER is
  60.       do
  61.          Result := standard_compile_to_jvm_into(dest);
  62.       end;
  63.  
  64.    to_integer: INTEGER is
  65.       do
  66.          Result := value;
  67.       end;
  68.  
  69.    c_simple: BOOLEAN is
  70.       do
  71.          Result := true;
  72.       end;
  73.  
  74.    to_string: STRING is
  75.          -- *** SHOULD ADD PRINTING MODE WITH/WITHOUT UNDESCORE.
  76.       do
  77.          Result := value.to_string;
  78.       end;
  79.  
  80.    make(a_value: INTEGER; sp: like start_position) is
  81.       do
  82.          value := a_value;
  83.          start_position := sp;
  84.       ensure
  85.          value = a_value;
  86.       end;
  87.  
  88.    result_type: TYPE_INTEGER is
  89.       once
  90.          !!Result.make(Void);
  91.       end;
  92.  
  93. feature {TMP_FEATURE}
  94.  
  95.    to_real_constant: REAL_CONSTANT is
  96.       do
  97.          !!Result.make(start_position,value.to_string);
  98.       end;
  99.  
  100. feature {EIFFEL_PARSER}
  101.  
  102.    unary_minus is
  103.       do
  104.          value := - value;
  105.       end;
  106.  
  107. feature {CST_ATT_UNIQUE}
  108.  
  109.    set_value(v: INTEGER) is
  110.       do
  111.          value := v;
  112.       ensure
  113.          value = v;
  114.       end;
  115.  
  116. end -- INTEGER_CONSTANT
  117.  
  118.  
  119.