/* * Stdio header file. Version of 01-Jul-82 * * Edit history * 01 13-Aug-79 MM Defined IOV to match the RSX package * 02 18-Mar-80 MM Redefined everything for the new library * 03 14-May-80 MM Do not define things twice * 04 13-Jun-80 MM Define fwild stuff * 05 01-Aug-80 MM Flag changes (IOV Version 08) * 06 15-Sep-80 RBD Add cell for UIC under RSX. * 07 22-Sep-80 MM Added VF$WLD * 08 25-Sep-80 MM Removed VF$BAD * 09 17-Feb-81 MM Added VMS runoff hack flag * 10 08-Oct-81 MM Nothing special * 11 10-Mar-82 MM Added documentation header * 12 14-Apr-82 JLB Add RSTS stuff * 13 13-May-82 MM Moved $$luns[] definition * 14 24-Jul-82 MM Really redone */ #ifdef DOCUMENTATION title stdio Definitions for standard i/o library index Definitions for standard i/o library Synopsis #include Description should be included in the assembly of all C programs that use the standard i/o library (fopen(), getc(), printf(), etc.) .s It defines the following: .s FILE The i/o routines use and return pointers to objects of this type. .s NULL I/O routines signal "rejection" by returning a null pointer. .s EOF The get character routine returns this value to signal end of file. .s TRUE The value 1. .s FALSE The value 0. .s EOS The "end of string" marker: '\0'. .s .br;##IO__SUCCESS#Normal exit to operating system. .s .br;##IO__WARNING#"Warning error" exit to operating system. .s .br;##IO__ERROR###"Error" exit to operating system. .s .br;##IO__FATAL###"Severe error" exit to operating system. .s stdin The "standard" input file. Normally the user's terminal; it may be redirected. .s stdout The "standard" output file. Normally the user's terminal; it may be redirected. .s stderr The "error" output file. It will always write to the user's terminal. Differences from Unix FILE is defined as a "typedef struc", rather than a #define. The i/o structure is considerably different from Unix. It is, however, arranged so that reasonable compatibility may be attained. Specifically, things which have the same name are used for the same purpose, and located in the same place within the I/O structure. Bugs TRUE, FALSE, and EOS are not transportable to other C systems. .s If you compile with -r or #define rsts, you will get a native rsts standard i/o header which is not yet fully supported. If you compile under rt11 and invoke CC with the /r switch or #define rsts before #include , a native RSTS/E I/O vector will be defined which is neither fully supported nor fully implemented. #endif #ifndef IO_OPN /* * Note: _... is identical to Unix usage, while io_... is for Decus C */ typedef struct IOV { int _cnt; /* Bytes left in buffer */ char *_ptr; /* Free spot in buffer */ char *_base; /* Base of buffer */ int _flag; /* Flag word */ int _wflag; /* Wild card flags */ char *io_wild; /* Wild card buffer */ int io_rbsz; /* Record buffer size */ #ifdef rt11 /* * RT11 or RSTS native */ int io_lun; /* RT11 unit number */ int io_bnbr; /* Disk block number */ int io_size; /* File size in blocks */ char *io_name; /* File name pointer */ char io_dbuf[2]; /* Dummy record buffer */ #ifdef rsts /* Rsts native */ /* * RSTS specific */ int io_rsflag; /* RSTS specific flags */ int io_recm; /* Record Modifier */ int io_wait; /* Wait time */ int io_rsbnbr; /* Disk block number */ #endif #endif #ifdef rsx /* * RSX specific */ char *io_bbuf; /* Block buffer start */ int io_uic; /* File's UIC in binary */ char *io_dnam; /* Directory name ptr. */ int io_fdb[0]; /* File data block */ #endif } FILE; #define MAXLUN 15 extern FILE *$$luns[]; /* Lun table */ /* * Bits in ((FILE *)fd)->_flag: * _NAME Compatible with Unix usage * IO_NAME Decus C specific. */ #define _IOREAD 0000001 /* Open for reading */ #define _IOWRT 0000002 /* Open for writing */ #define _IONBF 0000004 /* Unbuffered "u" mode */ #define _IOMYBUF 0000010 /* io stuff got buffer */ #define _IOEOF 0000020 /* Eof seen if set */ #define _IOERR 0000040 /* Error seen if set */ #define _IOSTRG 0000100 /* for sprintf, sscanf */ #define _IORW 0000200 /* Open for read/write */ /* * Bits in fd->_flag (all in high byte of that word) * These are needed for Dec-style i/o. */ #define IO_BZY 0000400 /* Buffer busy (RT11) */ #define IO_APN 0001000 /* Append mode open */ #define IO_NOS 0002000 /* No newlines needed */ #define IO_NEWL 0004000 /* RSX TTY newline hack */ #define IO_FIL 0010000 /* Disk file */ #define IO_TTY 0020000 /* Console terminal */ #define IO_REC 0040000 /* Record device */ #define IO_OPN 0100000 /* Open file */ /* * The following bits are set in fd->io_wflag. They are needed for wild-card * processing. Note: IO_WLD must be in the low byte. */ #define IO_WLD 0000001 /* fwild: wildcard file */ #define IO_VM1 0000002 /* fwild: version ;-1 */ #define IO_VER 0000004 /* fwild: ;0 or ;-1 */ #define IO_WF1 0000010 /* fwild first flag */ #define IO_NLH 0000020 /* fopen 'n' hack bit */ /* * Bits in fd->io_rsflag (RSTS native) */ #define IO_ODT2 0100000 /* ODT mode (RSTS only) */ /* * Common definitions */ #define EOF (-1) /* End of file by getc */ #define NULL (0) /* Impossible pointer */ /* * Warning -- the following definitions are not transportable */ #define TRUE 1 /* if (TRUE) */ #define FALSE 0 /* if (!TRUE) */ #define EOS 0 /* End of string */ #ifdef rsx #define IO_SUCCESS 1 /* Normal exit */ #define IO_WARNING 0 /* Warning error */ #define IO_ERROR 2 /* Error */ #define IO_FATAL 4 /* Severe error */ #endif #ifdef rt11 #define IO_SUCCESS 1 /* Normal exit */ #define IO_WARNING 2 /* Warning error */ #define IO_ERROR 4 /* Error */ #define IO_FATAL 8 /* Severe error */ #endif extern FILE *stdin; /* Standard input file */ extern FILE *stdout; /* Standard output file */ extern FILE *stderr; /* Standard error file */ extern char *fgets(); /* Defined by unix */ extern int $$ferr; /* Error codes set here */ extern int $$exst; /* Exit status set here */ #endif