previous next top complete contents complete index framed top this page unframed
Figure 51–2. write (GENERIC)
| PROCEDURE write (MODIFIES STRING s; REPEATABLE BOOLEAN v); PROCEDURE write (MODIFIES STRING s; POINTER($area) area; REPEATABLE BOOLEAN v); PROCEDURE write (POINTER(textFile) f; REPEATABLE BOOLEAN bo); PROCEDURE write (POINTER(dataFile) f; REPEATABLE BOOLEAN bo); PROCEDURE write (POINTER(dataFile) dst; REPEATABLE BITS v); PROCEDURE write (POINTER(textFile) dst; REPEATABLE BITS v); PROCEDURE write (MODIFIES STRING dst; REPEATABLE BITS v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE BITS v); PROCEDURE write (POINTER(dataFile) dst; REPEATABLE INTEGER v); PROCEDURE write (POINTER(textFile) dst; REPEATABLE INTEGER v); PROCEDURE write (MODIFIES STRING dst; REPEATABLE INTEGER v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE INTEGER v); PROCEDURE write (POINTER(dataFile) dst; REPEATABLE LONG BITS v); PROCEDURE write (POINTER(textFile) dst; REPEATABLE LONG BITS v); PROCEDURE write (MODIFIES STRING dst; REPEATABLE LONG BITS v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE LONG BITS v); PROCEDURE write (POINTER(dataFile) dst; REPEATABLE LONG INTEGER v); PROCEDURE write (POINTER(textFile) dst; REPEATABLE LONG INTEGER v); PROCEDURE write (MODIFIES STRING dst; REPEATABLE LONG INTEGER v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE LONG INTEGER v); PROCEDURE write (POINTER(dataFile) dst; REPEATABLE LONG REAL v); PROCEDURE write (POINTER(textFile) dst; REPEATABLE LONG REAL v); PROCEDURE write (MODIFIES STRING dst; REPEATABLE LONG REAL v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE LONG REAL v); PROCEDURE write (POINTER(dataFile) dst; REPEATABLE REAL v); PROCEDURE write (POINTER(textFile) dst; REPEATABLE REAL v); PROCEDURE write (MODIFIES STRING dst; REPEATABLE REAL v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE REAL v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE STRING v); PROCEDURE write (POINTER(textFile) dst; REPEATABLE STRING v); PROCEDURE write (MODIFIES STRING dst; REPEATABLE STRING v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE POINTER v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE ADDRESS v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE CHARADR v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS dst; REPEATABLE BOOLEAN v); PROCEDURE write (MODIFIES STRING s; POINTER($area) area; REPEATABLE INTEGER v); PROCEDURE write (MODIFIES STRING s; POINTER($area) area; REPEATABLE LONG INTEGER v); PROCEDURE write (MODIFIES STRING s; POINTER($area) area; REPEATABLE REAL v); PROCEDURE write (MODIFIES STRING s; POINTER($area) area; REPEATABLE LONG REAL v); PROCEDURE write (MODIFIES STRING s; POINTER($area) area; REPEATABLE BITS v); PROCEDURE write (MODIFIES STRING s; POINTER($area) area; REPEATABLE LONG BITS v); PROCEDURE write (MODIFIES STRING r; POINTER($area) area; REPEATABLE STRING s); PROCEDURE write (POINTER(dataFile) dst; REPEATABLE STRING v); $BUILTIN PROCEDURE write (MODIFIES ADDRESS a; REPEATABLE $PROCVAR v); |
write writes the value v to dst, which may be an output file, STRING, or memory ADDRESS.
The forms that write a BOOLEAN, (LONG) INTEGER, (LONG) REAL, or (LONG) BITS to a text file or a STRING automatically convert to a STRING representation, which is the same as the default format produced by cvs. When these data types are written to a data file, they are written as they appear in memory, unless the file is open for PDF I/O, in which case they are written in PDF format (see Chapter 26). A STRING is written to a text file, data file, or STRING as the sequence of its characters.
If dst is a STRING, the STRING representation of v is concatenated onto the end of dst.
After writing to an ADDRESS, the ADDRESS is displaced to the location immediately following that to which the value was written. The effect is undefined if the ADDRESS is NULLADDRESS, if the ADDRESS is unaligned (see Section 3.8), or if displace(dst,size(data type of v)) is undefined.
Note that unlike ADDRESSes, there is no alignment restriction on the current file position when writing to a file; any data type may be written to any position in either a text or a data file.
The form that writes a STRING to an ADDRESS writes the machine-dependent STRING descriptor of v to dst, i.e., stores the STRING descriptor at dst and displaces a by the size of a STRING descriptor.
In the forms that write a STRING to a file, if the file is opened for PDF I/O, characters may be translated to the PDF character set. Characters of a STRING written to a data file are stored one per character unit, the same way as in a text file.
In the area forms, area specifies the destination area for the resulting STRING if new STRING text is generated; see Section 29.4.
Example 51–3. Use of write
INTEGER i,j; REAL r; BITS b; writes an INTEGER, REAL, and BITS to outFile. If outFile is a text file, a conversion to a STRING representation takes place.
write(s,i," ",j) has the same effect as:
s := s & cvs(i) & " " & cvs(j) writes an INTEGER, REAL, and BITS to memory locations starting at ADDRESS a. a is updated to have the value given by:
displace(a, |
MAINSAIL Language Manual, Section 51.2