MAINSAIL Language Manual, Section 32.84

previous   next   top   contents   index   framed top   this page unframed


32.84. cvc

Figure 32–85. cvc (GENERIC)
$BUILTIN
CHARADR
PROCEDURE   cvc         (STRING s);

$BUILTIN
CHARADR
PROCEDURE   cvc         (ADDRESS a);

$BUILTIN
CHARADR
PROCEDURE   cvc         (LONG BITS bb);

$BUILTIN
CHARADR
PROCEDURE   cvc         (CHARADR c);

cvc converts to CHARADR.

The STRING form returns the CHARADR that addresses the first character of s. If s is in STRING space and a garbage collection occurs, the CHARADR that addresses the first character of s may change. If s is Zero, NULLCHARADR is returned.

The ADDRESS form returns the CHARADR of the first character in the storage unit addressed by a. If a is NULLADDRESS, NULLCHARADR is returned.

The LONG BITS form returns a CHARADR with the same bit pattern as bb. The effect is undefined if bb is not a valid CHARADR bit pattern. The effect is undefined on machines where the size of a CHARADR and the size of a LONG BITS differ.

The CHARADR form returns its argument.

Example 32–86. Use of cvc
STRING s;
CLASS stringDscr (CHARADR cINTEGER l);
POINTER(stringDscrp;
...
p := new(stringDscr);
p.c := cvc(s);
p.l := length(s);

In Example 32–86, the STRING variable s contains the same information as the record pointed to by p, though s's representation is machine-dependent and may be more compact than stringDscr records. s may also be subject to garbage collection if its characters are located in STRING space; the fields of the record are not updated if s is moved.


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 32.84