home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-13 | 2.7 KB | 128 lines | [TEXT/ttxt] |
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class PLATFORM
-
- inherit GENERAL;
-
- feature -- Maximum :
-
- Maximum_character_code : INTEGER is
- -- Largest supported code for CHARACTER values.
- once
- c_inline_c("R=CHAR_MAX;");
- ensure
- meaningful: Result >= 127
- end;
-
- Maximum_integer: INTEGER is
- -- Largest supported value of type INTEGER.
- once
- c_inline_c("R=INT_MAX;");
- ensure
- meaningful: Result >= 0
- end;
-
- Maximum_real: REAL is
- -- Largest supported value of type REAL.
- once
- c_inline_c("R=FLT_MAX;");
- ensure
- meaningful: Result >= 0.0
- end;
-
- Maximum_double: DOUBLE is
- -- Largest supported value of type DOUBLE.
- once
- c_inline_c("R=DBL_MAX;");
- ensure
- meaningful: Result >= 0.0
- end;
-
- feature -- Minimum :
-
- Minimum_character_code: INTEGER is
- -- Smallest supported code for CHARACTER values.
- once
- c_inline_c("R=CHAR_MIN;");
- ensure
- meaningful: Result <= 0
- end;
-
- Minimum_integer: INTEGER is
- -- Smallest supported value of type INTEGER.
- once
- c_inline_c("R=INT_MIN;");
- ensure
- meaningful: Result <= 0
- end;
-
- Minimum_double: DOUBLE is
- -- Smallest supported value of type DOUBLE.
- once
- Result := - Maximum_double;
- ensure
- meaningful: Result <= 0
- end;
-
- Minimum_real: REAL is
- -- Smallest supported value of type REAL.
- once
- Result := - Maximum_real;
- ensure
- meaningful: Result <= 0
- end;
-
- feature -- Bits :
-
- Boolean_bits: INTEGER is
- -- Number of bits in a value of type BOOLEAN.
- once
- Result := Character_bits * (true).object_size;
- ensure
- meaningful: Result >= 1
- end;
-
- Character_bits: INTEGER is
- -- Number of bits in a value of type CHARACTER.
- external "CSE"
- ensure
- meaningful: Result >= 1;
- large_enough: (2^Result) >= Maximum_character_code;
- end;
-
- Integer_bits: INTEGER is
- -- Number of bits in a value of type INTEGER.
- external "CSE"
- ensure
- meaningful: Result >= 1;
- end;
-
- Real_bits: INTEGER is
- -- Number of bits in a value of type DOUBLE.
- once
- Result := Character_bits * (1.5).object_size;
- ensure
- meaningful: Result >= 1;
- meaningful: Result >= Real_bits;
- end;
-
- Double_bits: INTEGER is
- -- Number of bits in a value of type DOUBLE.
- once
- Result := Character_bits * (1.5).to_double.object_size;
- ensure
- meaningful: Result >= 1;
- meaningful: Result >= Real_bits;
- end;
-
- Pointer_bits: INTEGER is
- -- Number of bits in a value of type REAL.
- local
- p: POINTER;
- once
- Result := Character_bits * p.object_size;
- end;
-
- end -- PLATFORM
-