ifileio.h

Go to the documentation of this file.
00001 /*  X-4
00002 **
00003 **   Copyright © Compaq Computer Corporation 1995.
00004 **
00005 **   Confidential computer software. Valid license from Compaq required for
00006 **   possession, use or copying. Consistent with FAR 12.211 and 12.212, 
00007 **   Commercial Computer Software, Computer Software Documentation, and 
00008 **   Technical Data for Commercial Items are licensed to the U.S. Government 
00009 **   under vendor's standard commercial license.
00010 **
00011 */
00012 
00013 /*
00014 **++
00015 **  FACILITY:  EXEC_INIT
00016 **
00017 **  MODULE DESCRIPTION:
00018 **
00019 **      This header file makes the necessary declarations for the EXEC_INIT file
00020 **      I/O primitives used by 3PB support.
00021 **
00022 **  AUTHOR:
00023 **
00024 **      Richard W. Critz, Jr.
00025 **
00026 **  CREATION DATE:  30-Dec-1993
00027 **
00028 **  MODIFICATION HISTORY:
00029 **
00030 **      X-4     SCS             Sue Sommer                      10-Feb-2000
00031 **              Add prototype for ifsetcase.  Update copyright.
00032 **
00033 **      -- Get version back in sync. --
00034 **
00035 **      X-2     RWC139          Richard W. Critz, Jr.            7-Jan-1994
00036 **              Support multiple concurrently open files.  Work around the ctype
00037 **              table problems in the kernel CRTL.
00038 **              
00039 **      X-1     RWC136          Richard W. Critz, Jr.           30-Dec-1993
00040 **              Initial version.
00041 **              
00042 **--
00043 */
00044 
00045 /*
00046 **
00047 **  INCLUDE FILES
00048 **
00049 */
00050 #include <wcbdef.h>
00051 
00052 #ifndef SS$_CONFIG_SYNTAX
00053 #define SS$_CONFIG_SYNTAX 9564
00054 #endif
00055 
00056 /*
00057 ** An RMS variable length record consists of a 16 bit length field followed by
00058 ** the actual data.
00059 */
00060 #pragma member_alignment __save
00061 #pragma nomember_alignment
00062 typedef struct {
00063     short len;
00064     char data[512];
00065     } RECORD;
00066 #pragma member_alignment __restore
00067 
00068 #define BLKSIZE 512
00069 
00070 typedef struct {
00071     WCB         *wcb;                   /* window control block pointer     */
00072     int         vbn;                    /* current VBN in config file       */
00073     int         size;                   /* actual allocated size            */
00074     RECORD      *current;               /* current (or next) record in file */
00075     RECORD      *last;                  /* pointer to "virtual" record at   */
00076                                         /* end of current block             */
00077     int         efblk;                  /* last VBN in file                 */
00078     int         ffbyte;                 /* first free byte in EFBLK         */
00079     int         as_is;                  /* if non-zero, no upcase in ifgets */
00080     char        buffer[BLKSIZE];        /* buffer for current block         */
00081 } IFILE;
00082 
00083 /*
00084 ** ifopen, ifclose, ifgets and irewind are all declared with the same arguments
00085 ** and returns as their ANSI counterparts.
00086 */
00087 IFILE *ifopen(const char *filename, const char *mode);
00088 
00089 int ifclose(IFILE *stream);
00090 
00091 void irewind(IFILE *stream);
00092 
00093 void ifsetcase (int n, IFILE *stream);
00094 
00095 char *ifgets(char *s, int n, IFILE *stream);
00096 
00097 /*
00098 ** TEMPORARY WORKAROUND:
00099 **
00100 **      isxdigit (and friends) don't work in the kernel CRTL because there are
00101 **      too many levels of indirection introduced by the vector in the base
00102 **      image for DECC$GA___CTYPE.  This works around that by replacing the
00103 **      isxdigit macro with something that will work.  Note that the only places
00104 **      where isxdigit is used in 3PB support know they are working on uppercase
00105 **      strings so there is no need to check for the characters [a-f].  Thus the
00106 **      check is for [0-9A-F].
00107 */
00108 #ifdef isxdigit
00109 #undef isxdigit
00110 #endif
00111 
00112 #define isxdigit(c) (((c) >= '0' && (c) <= '9') || ((c) >= 'A' && (c) <= 'F'))
00113 
00114 /*
00115 **      These are used for error reporting
00116 */
00117 
00118 #define IFILE_OP_OPEN   1
00119 #define IFILE_OP_CLOSE  2
00120 #define IFILE_OP_READ   3
00121 #define IFILE_OP_REWIND 4
00122 
00123 #define IFILE_IR_LDR    1
00124 #define IFILE_IR_MEM    2
00125 #define IFILE_IR_QIO    3
00126 
00127 extern int    ifile_operation;
00128 extern int    ifile_detail;
00129 extern int    ifile_status;
00130 extern short  ifile_iosb[4];

SourceForge.net Logo
Project space on SourceForge.net