MAINSAIL Language Manual, Section 46.6

previous   next   top   contents   index   framed top   this page unframed


46.6. rcWrite

Figure 46–7. rcWrite
 (GENERIC)
PROCEDURE   rcWrite     (MODIFIES STRING s;
                         
REPEATABLE INTEGER char);

PROCEDURE   rcWrite     (MODIFIES STRING s;
                         
POINTER($areaarea;
                         
REPEATABLE INTEGER char);

rcWrite (“reverse cWrite”) concatenates the character char onto the front of the STRING s. In the area form, area specifies the destination area for the resulting STRING if new STRING text is generated; see Section 29.4.

Example 46–8. Use of rcWrite
s := "bc"; rcWrite(s,'a');   # s = "abc"

The “reverse” PROCEDURE of Example 46–6 could also be written with rcWrite replacing cWrite and cRead replacing rcRead:

STRING PROCEDURE reverse (STRING s);
BEGIN # reverse characters of s
STRING r;
r := "";
WHILE s DO rcWrite(r,cRead(s));
RETURN(rEND

(although the rcRead/cWrite form would use STRING space more efficiently than the cRead/rcWrite form).


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 46.6