The Pitmanual: Old-I/O

The Revised Maclisp Manual The Pitmanual Page A-18


Old-I/O

Old-I/O Control Variables


UREAD Value NIL

The value of UREAD is a file object being used for input initiated by the UREAD function, or NIL if no file is currently being uread.


UWRITE Value NIL

The value of UWRITE is a file object being used for output initiated by the UWRITE function, or NIL if no file is currently being uwritten.

CRUNIT


CRUNIT Special Form (crunit [device] [directory])

If device and/or directory are specified, the respective components or DEFAULTF will be altered. Whether or not any change is made, a list of the form (dev dir) will be returned, indicating the currently active defaults. device and directory are not evaluated. [Note that if DEFAULTF is in a nonstandard form, CRUNIT will have the side-effect of putting it in standard namelist format.]

Examples:

(CRUNIT  TTY  FOO) => (TTY  FOO) ; Setting both
(CRUNIT  DSK) => (DSK FOO) ; Devices are specially known
(CRUNIT  BAR) => (DSK BAR) ; Unknown names are directories
(CRUNIT ) => (DSK BAR) ; Just get current defaults
(crunit) => (dsk >udd> Foo> JDoe) ; Multics example

Opening Files for Output


UAPPEND Special Form (UAPPEND . namelist)

This is the Old-I/O way to open a file in append mode.

Definition:

;;; Official definition from .INFO.;LISP NEWIO 
(DEFUN  UAPPEND  FEXPR  (FILENAME)
 (SETQ  FILENAME (*UGREAT FILENAME))
 (*UWRITE FILENAME 'APPEND  FILENAME))
;;; *UWRITE is an auxiliary function not available to the user
(DEFUN  *UWRITE (NAME MODE NEWDEFAULT) ;Internal Routine
 (COND  (UWRITE  (SETQ  OUTFILES  (DELQ  UWRITE  OUTFILES ))
 (CLOSE  UWRITE )
 (SETQ  UWRITE  NIL )))
 (PUSH  (SETQ  UWRITE  (OPEN  NAME MODE)) OUTFILES )
 (CAR  (DEFAULTF  NEWDEFAULT)))

UWRITE Special Form (UWRITE [device] [directory])

Opens an output file. When done with this file, UFILE must be used to close it and give it a name. The arguments are the last two elements of a 4-list, specifying the device and directory on which the file is to be written. The first two parts of the 4-list are not specified until the file is UFILE 'd.

Definition:

;;; See UAPPEND  info for description of *UWRITE
(DEFUN  UWRITE  FEXPR  (DEVDIR),
 (IF  (NOT  DEVDIR) (SETQ  DEVDIR (CAR  (DEFAULTF  NIL ))))
 (*UWRITE (CONS  DEVDIR
 (CASEQ  (STATUS  FILESYSTEM-TYPE )
 ((DEC10 ) (CONS  (STATUS  JNAME ) '(OUT )))
 ((DEC20) '(MACLISP OUTPUT))
 ((ITS ) '(/.LISP/. OUTPUT))))
 'OUT 
 (NCONS  DEVDIR)))

Opening Files for Input


UREAD Special Form (UREAD . filename)

This function selects an input file. The argument list is a 4-list as described above. The specified file is made the default input source. Note that the ^Q switch must be turned on before input will be automatically taken from this file.

Definition:

;;; This definition is buggy. Should be (EOFFN  FILE ...)
(DEFUN  UREAD  FEXPR  (FILENAME)
 (UCLOSE )
 (LET  ((FILE (OPEN  (*UGREAT FILENAME) 'IN )))
 (EOFFN  UREAD 
 #'(LAMBDA  (EOFFILE EOFVAL) (UCLOSE ) EOFVAL))
 (INPUSH  (SETQ  UREAD  FILE))
 (DEFAULTF  FILE)))

Closing Files


UCLOSE Special Form (UCLOSE)

Closes file, if any, that has been opened by UREAD .

Definition:

(DEFUN  UCLOSE  FEXPR  (NIL )
 (COND  (UREAD 
 (LET  ((OUREAD UREAD ))
 (IF  (EQ  OUREAD INFILE ) (INPUSH  -1))
 (SETQ  UREAD  NIL )
 (CLOSE  OUREAD)))
 (T  NIL )))

UFILE Special Form (UFILE . shortnamelist)

Closes the UWRITE output file and gives it the name specified by shortnamelist.

Definition:

(DEFUN  UFILE  FEXPR  (SHORTNAME)
 (COND  ((NULL  UWRITE )
 (ERROR  '|NO UWRITE  FILE|
 (CONS  'UFILE  SHORTNAME)
 'IO-LOSSAGE ))
 (T  (PROG1 
 (DEFAULTF  (RENAMEF  UWRITE  (*UGREAT SHORTNAME)))
 (SETQ  OUTFILES  (DELQ  UWRITE  OUTFILES ))
 (SETQ  UWRITE  NIL )
 (OR  OUTFILES  (SETQ  ^R  NIL ))))))
;;; *UGREAT is an auxiliary function not available to the user
(DEFUN  *UGREAT (NAME) ;INTERNAL ROUTINE
 (MERGEF  NAME
 (COND  ((STATUS  FEATURE  DEC10 ) '(*  . LSP))
 ((STATUS  FEATURE  DEC20) '(*  MACLISP * ))
 ((STATUS  FEATURE  ITS ) '(*  . >)))))

External File Manipulation


UKILL Special Form (UKILL . namelist)

Like UREAD , deletes the file specified by namelist.

Definition:

(DEFUN  UKILL  FEXPR  (FILENAME)
 (DEFAULTF  (DELETEF  FILENAME)))

UPROBE Special Form (UPROBE . namelist)

Definition:

;;; See definition of UFILE  for info on  *UGREAT.
(DEFUN  UPROBE  FEXPR  (FILENAME)
 (SETQ  FILENAME (MERGEF  (*UGREAT FILENAME) NIL ))
 (PROBEF  FILENAME))

Old-I/O Status Options



Archaic. Returns a 4-list for the current uread input source, or NIL if UREAD is not being done.

Synonym:

(IF  UREAD  (TRUENAME  UREAD ) NIL )

UREAD SStatus Option (SSTATUS UREAD . namelist)

Archaic. Included for compatibility with Old-I/O syntax. Rewrite your code to call (UREAD . namelist) and see documentation on the UREAD function as a first approximation toward modernization. The better thing to do, however, is to read the section on New-I/O and use the concepts presented there rather than concepts like these. Argument positions are not evaluated.



Archaic. Returns the corresponding list for the current UWRITE output destination.

Synonym:

(IF  UWRITE  (CAR  (TRUENAME  UWRITE )) NIL )

UWRITE SStatus Option (SSTATUS UWRITE . namelist)

Archaic. Included for compatibility with Old-I/O syntax. Rewrite your code to call (UWRITE . namelist) and see documentation on the UWRITE function as a first approximation toward modernization. The better thing to do, however, is to read the section on New-I/O and use the concepts presented there rather than concepts like these. Argument positions are not evaluated.



Archaic. Returns a 2-list giving the file names for the current file in the UREAD I/O system.

Synonym:

(CDR  (DEFAULTF  NIL ))

CRFILE SStatus Option (SSTATUS CRFILE . filespec)

Archaic. Included for compatibility with Old-I/O syntax. Rewrite your code to call (DEFAULTF 'filespec) and see documentation on the DEFAULTF function. Argument positions are not evaluated.



Archaic. Returns a 2-list of the current unit; i.e. device and directory.

Synonym:

(CRUNIT  NIL )

CRUNIT SStatus Option (SSTATUS CRUNIT . crunitspec)

Archaic. Included for compatibility with Old-I/O syntax. Rewrite your code to call (CRUNIT . crunitspec) and see documentation on the CRUNIT function as a first approximation toward modernization. The better thing to do, however, is to read the section on New-I/O and use the concepts presented there rather than concepts like these. Argument positions are not evaluated.

Synonym:

(CRUNIT  . crunitspec)

Obsolete Status Options

We use the term obsolete here to mean that a functionality no longer exists at all. It is distinguished from archaic which is something being phased out. None of the following exist in Maclisp any more:



Obsolete. Their effect can be stimulated with appropriate uses of SETQ or calls to the ERROR or ^G functions.


PAGEPAUSE Status Option (STATUS PAGEPAUSE ...)

Obsolete. Superseded by the ENDPAGEFN facility.


INTERRUPT Status Option (STATUS INTERRUPT)

The INTERRUPT option to STATUS used to control a number of service functions for interesting conditions that might arise. The conditions were known by their number. Names have now been given to each of the functionalities; you'll have to look under the particular documentation for each to see how the syntax/semantics have changed. The places to look are the ENDPAGEFN function, the TTYINT option to STATUS and SSTATUS , and the values of the variables ALARMCLOCK (interrupt 3), ERRSET (4), UNDF-FNCTN (5), UNBND-VRBL (6), WRNG-TYPE-ARG (7), UNSEEN-GO-TAG (8), WRNG-NO-ARGS (9), GC-LOSSAGE (10), FAIL-ACT (11), IO-LOSSAGE (12), *RSET-TRAP (19), and GC-DAEMON (20). The variables AUTOLOAD , CLI-MESSAGE , GC-OVERFLOW , MAR-BREAK and PDL-OVERFLOW also belong in that set; I'm not sure of their numbers.



The Revised Maclisp Manual (Sunday Morning Edition)
Published Sunday, December 16, 2007 06:17am EST, and updated Sunday, July 6, 2008.

AltStyle によって変換されたページ (->オリジナル) /