home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ppcsmalleiffel / lib_se / integer_constant.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.6 KB  |  117 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://www.loria.fr/SmallEiffel
  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 
  22.    BASE_TYPE_CONSTANT 
  23.       redefine to_integer
  24.       end;
  25.    
  26. creation make
  27.    
  28. feature 
  29.    
  30.    value: INTEGER;
  31.    
  32.    is_static: BOOLEAN is 
  33.       do 
  34.      static_value_mem := value;
  35.      -- ********************** FACTORISER ???
  36.      Result := true;
  37.       end;
  38.       
  39.    compile_to_c is
  40.       do
  41.      cpp.put_integer(value);
  42.       end;
  43.    
  44.    compile_target_to_jvm, compile_to_jvm is
  45.       do
  46.      code_attribute.opcode_push_integer(value);
  47.       end;
  48.    
  49.    jvm_branch_if_false: INTEGER is
  50.       do
  51.       end;
  52.  
  53.    jvm_branch_if_true: INTEGER is
  54.       do
  55.       end;
  56.    
  57.    compile_to_jvm_into(dest: TYPE): INTEGER is
  58.       do
  59.      Result := standard_compile_to_jvm_into(dest);
  60.       end;
  61.  
  62.    to_integer: INTEGER is
  63.       do
  64.      Result := value;
  65.       end;
  66.    
  67.    c_simple: BOOLEAN is
  68.       do
  69.      Result := true;
  70.       end;
  71.    
  72.    to_string: STRING is
  73.      -- *** SHOULD ADD PRINTING MODE WITH/WITHOUT UNDESCORE.
  74.       do
  75.      Result := value.to_string;
  76.       end;
  77.       
  78.    make(a_value: INTEGER; sp: like start_position) is
  79.       do
  80.      value := a_value;
  81.      start_position := sp;
  82.       ensure
  83.      value = a_value;
  84.       end;
  85.    
  86.    result_type: TYPE_INTEGER is 
  87.       once
  88.      !!Result.make(Void);
  89.       end;
  90.  
  91. feature {TMP_FEATURE}
  92.    
  93.    to_real_constant: REAL_CONSTANT is
  94.       do
  95.      !!Result.make(start_position,value.to_string);
  96.       end;
  97.    
  98. feature {EIFFEL_PARSER}
  99.    
  100.    unary_minus is
  101.       do
  102.      value := - value;
  103.       end;
  104.    
  105. feature {CST_ATT_UNIQUE}
  106.    
  107.    set_value(v: INTEGER) is
  108.       do
  109.      value := v;
  110.       ensure 
  111.      value = v;
  112.       end;
  113.    
  114. end -- INTEGER_CONSTANT
  115.  
  116.  
  117.