home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK7 / SOURCE / STARTUP / FILE2.H$ / FILE2
Encoding:
Text File  |  1991-11-06  |  1.8 KB  |  64 lines

  1. /***
  2. *file2.h - auxiliary file structure used internally by file run-time routines
  3. *
  4. *    Copyright (c) 1985-1992, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    This file defines the auxiliary file structure used internally by
  8. *    the file run time routines.
  9. *    [Internal]
  10. *
  11. ****/
  12.  
  13. #if (_MSC_VER <= 600)
  14. #define __near      _near
  15. #endif
  16.  
  17. /*
  18.    Define the FILE2 structure.
  19.  
  20.    [Note that we depend on the FILE2 structure being the same size as a
  21.    FILE structure (see macro definitions).]
  22. */
  23.  
  24. #define FILE2  struct _iobuf2
  25.  
  26. extern FILE2 {
  27.     char  _flag2;
  28.     char  _charbuf;
  29.     int   _bufsiz;
  30.     int   __tmpnum;
  31. #if (defined(M_I86SM) || defined(M_I86MM))
  32.     char  _padding[2];        /* pad out to size of FILE structure */
  33. #else
  34.     char  _padding[6];        /* pad out to size of FILE structure */
  35. #endif
  36.     } __near _iob2[];
  37.  
  38. #define _IOYOURBUF    0x01
  39. #define _IOFEOF     0x08
  40. #define _IOFLRTN    0x10
  41. #define _IOCTRLZ    0x20
  42. #define _IOCOMMIT    0x40
  43.  
  44. /* Macros for getting _iob[] index and translating (FILE *) to (FILE2 *) */
  45.  
  46. #define _iob2_(s)  (*((FILE2 near *) ((char near *)_iob2 + ((char *)s - (char *)_iob))))
  47. #define _iob_index(s)    ( (FILE *) s - (FILE *)_iob)
  48.  
  49. /* General use macros */
  50.  
  51. #define inuse(s)    ((s)->_flag & (_IOREAD|_IOWRT|_IORW))
  52. #define mbuf(s)     ((s)->_flag & _IOMYBUF)
  53. #define nbuf(s)     ((s)->_flag & _IONBF)
  54. #define ybuf(s)     (_iob2_(s)._flag2 & _IOYOURBUF)
  55. #define bigbuf(s)    (mbuf(s) || ybuf(s))
  56. #define anybuf(s)    ((s)->_flag & (_IOMYBUF|_IONBF) || ybuf(s))
  57. #define _tmpnum(s)    _iob2_(s).__tmpnum
  58.  
  59. /* Optimized macros for use when the (FILE2 *) pointer is already known */
  60.  
  61. #define ybuf2(s2)    ((s2)->_flag2 & _IOYOURBUF)
  62. #define bigbuf2(s,s2)    (mbuf(s) || ybuf2(s2))
  63. #define anybuf2(s,s2)    ((s)->_flag & (_IOMYBUF|_IONBF) || ybuf2(s2))
  64.