Binary input and output are necessary to provide an efficient access to large files e.g. for loading
or generating binary files (e.g. faslin or faslout) or for communication with other processors e.g.
graphics or database processors. Another important application is the connection between two or
more PSL processors on incompatible platforms. In the following descriptions HANDLE means
something system specific which in many cases should better not be interpreted by the LISP
evaluator. One can very well think of HANDLE as a FILE* object belonging to the world of C’s
I/O library. The results of a binary read function is usually not meant for LISP evaluation,
either.
(binaryopenread FILENAME:string): HANDLE                                                    expr
opens  the  file  FILENAME  for  reading.  If  the  file  cannot  be  opened,  an
error message Couldn't open binary file for input will be
shown, an error condition is raised.
 
(binaryopenwrite FILENAME:string): HANDLE                                                   expr
opens  the  file  FILENAME  for  writing.  If  the  file  cannot  be  opened,  an
error  message  Couldn't open binary file for output will
be shown, an error condition is raised.
 
(binaryopenappend FILENAME:string): HANDLE                                               expr
opens the file FILENAME in append mode. If the file cannot be opened, an
error  message  Couldn't open binary file for append will
be shown, an error condition is raised.
 
(binaryopenupdate FILENAME:string): HANDLE                                                expr
opens  the  file  FILENAME  for  update.  If  the  file  cannot  be  opened,  an
error  message  Couldn't open binary file for update will
be shown, an error condition is raised.
 
(binaryclose Filepointer:handle):NIL                                                                        expr
Closes the file referenced by filepointer
 
(binaryread CHANNEL:handle): any                                                                       expr
reads one LISP item from file channel and returns it as value. There is no
way to distinguish error conditions from normal return values.
 
(binaryreadblock CHANNEL:handle ADDR:int SIZE:int): int                             expr
reads SIZE LISP items from the file into an array pointed to by ADDR. The
number of actually read items is returned, indicating error or end-of-file if
the returned value is less than the number of items requested.
 
(binarywrite CHANNEL:handle WORD:any): NIL                                                expr
writes one LISP item in WORD to file channel.
 
(binarywriteblock Filepointer:handle ADDR:int SIZE:int): NIL                          expr
writes SIZE LISP items from the an array pointed to by ADDR to the file
referenced by Filepointer. The number of actually written items is returned,
indicating  error  if  the  returned  value  is  less  than  the  number  of  items
requested.
 
(binarypositionfile CHANNEL:handle, SPECIAL:int): any                                   expr
this corresponds to C’s fseek operation. The special value (the address) as
well as the return value is system dependent, please investigate.