previous next top contents index framed top this page unframed
Figure 32–95. cvlb (GENERIC)
| $BUILTIN COMPILETIME LONG BITS PROCEDURE cvlb (BITS b); $BUILTIN COMPILETIME LONG BITS PROCEDURE cvlb (INTEGER i); $BUILTIN COMPILETIME LONG BITS PROCEDURE cvlb (LONG INTEGER i); LONG BITS PROCEDURE cvlb (STRING s; OPTIONAL BITS radix); $BUILTIN LONG BITS PROCEDURE cvlb (ADDRESS a); $BUILTIN LONG BITS PROCEDURE cvlb (CHARADR c); $BUILTIN COMPILETIME LONG BITS PROCEDURE cvlb (LONG BITS bb); |
cvlb converts to LONG BITS.
The (LONG) INTEGER forms convert i to the bit pattern for its binary representation, sign-extending on the left if necessary.
The BITS form converts to a different format, if necessary. If there are more bits in the LONG BITS data type than in the BITS data type, the extra leftmost bits are cleared.
The CHARADR form returns a LONG BITS with the same bit pattern as c. The effect is undefined on machines where the size of a CHARADR and the size of a LONG BITS differ (at present, the sizes of CHARADR and LONG BITS are the same on all MAINSAIL implementations).
The LONG BITS form returns its argument.
If s is a STRING, b := cvlb(s) has the same result as r := s; read(r,b), where r is a STRING temporary variable. The valid bits for radix are binary, hex, and octal (octal is assumed if radix is not specified); s is assumed to contain a value in the specified radix unless s contains an explicit radix specifier ('B, 'H, 'O, or ' (the latter is equivalent to 'O)), in which case the explicit radix specifier overrides the radix bit.
The ADDRESS form returns the bit pattern of a.
Example 32–96. Use of cvb
| cvb(97) = '141 cvb('723L) = '723 cvb("Location '134 in error.") = '134 cvb("Location 134 in error.") = '134 cvb("134",hex) = '464 = 'H134 cvb("Location 134 in error.",hex) = '312 = 'HCA (because the ca in Location is interpreted as a hexadecimal number) |
Example 32–97. Use of cvlb
| cvlb(123) = '173L cvlb('123) = '123L cvlb("The bits are '456") = '456L cvlb("The bits are 456") = '456L cvlb("456",hex) = '2126L = 'H456L cvlb("The bits are 456",hex) = '16L = 'HEL (because the e in The is interpreted as a hexadecimal number) |
MAINSAIL Language Manual, Section 32.90