User guide
82 CHAPTER 3. THE LIBRARY
AND wrch(ch) = VALOF
{ LET pos = cos!scb_pos
IF pos >= cos!scb_bufend DO
{ // The buffer is full
UNLESS deplete(cos) RESULTIS FALSE
UNLESS cos!scb_buf RESULTIS TRUE // Must be writing to NIL:
pos := cos!scb_pos
}
// Pack the character and advance pos.
cos!scb_buf%pos := ch
pos := pos+1
cos!scb_pos := pos
// Advance end of valid data pointer, if necessary
IF cos!scb_end < pos DO cos!scb_end := pos
cos!scb_write := TRUE // Set flag to indicate the buffer has changed.
UNLESS ch<’*s’ & cos!scb_type<0 RESULTIS TRUE // Normal return
// The stream is interactive and ch is a control character.
IF ch=’*n’ DO wrch(’*c’) // Fiddle for Cygwin
// Call deplete at the end of each interactive line.
IF ch=’*n’ | ch=’*p’ RESULTIS deplete(cos)
RESULTIS TRUE
}
Figure 3.9: The definition of wrch
TCP/IP communication or to other filing systems. These are often dependent on the
host operating system.
A file name starting ’/’ or ’\’ or containing a c ol on is treated as an abso-
lute name; all othe r s are rel at i ve names and are i nterpreted relative to the cur-
rent director y. A file name consisting of a single aste ri s k (*) is special and rep-
resents standard input (normally the keyboard) or standard output (n or mal l y the
screen) depending on context. Within a file name, the components dot (.) and
double dot (..) represent the current and parent directories, respectively. As
an e x ampl e , the file name ../bcplprogs/demos/queens.b is valid and automati-
cally converted when use d to ..\bcplprogs\demos\queens.b under Windows or to
[-.bcplprogs.demos]queens.b under VMS.
Some operating systems such as Windows CE2.0 have no concept of a current
working directory. For such systems there is a feature that allows users to spec-
ify a character string to be automatically prepended to any relative (non absolute)
file name before it is used. The prefix stri ng is stored in static Cintcode space allo-
cated when Cintsys or Cintpos starts up. It can be inspected and changed using the
calls: sys(Sys
getprefix) and sys(Sys setprefix, prefix), or the CLI command
prefix described on page 119. The prefix string is only used wi th relative file names not
already prefixed with directories given by path variables such as BCPLPATH or POSPATH.