home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / xjig / vms_unix_types.h < prev    next >
C/C++ Source or Header  |  1997-12-31  |  3KB  |  136 lines

  1. /*    @(#)types.h 2.22 88/01/13 SMI; from UCB 7.1 6/4/86    */
  2.  
  3. /*
  4.  * Copyright (c) 1982, 1986 Regents of the University of California.
  5.  * All rights reserved.  The Berkeley software License Agreement
  6.  * specifies the terms and conditions for redistribution.
  7.  */
  8.  
  9. #ifndef    _UNIX_TYPES_
  10. #define    _UNIX_TYPES_
  11.  
  12. /*
  13.  * Basic system types.
  14.  */
  15.  
  16. /*
  17. This is not relevant on VMS:
  18. #include <sys/sysmacros.h>
  19. */
  20. #ifndef  __SOCKET_TYPEDEFS
  21. typedef    unsigned char    u_char;
  22. typedef    unsigned short    u_short;
  23. typedef    unsigned long    u_long;
  24. #define __SOCKET_TYPEDEFS 1
  25. #endif
  26.  
  27. #ifndef __DECCXX
  28. typedef    unsigned int    u_int;
  29. typedef    unsigned short    ushort;        /* System V compatibility */
  30. typedef    unsigned int    uint;        /* System V compatibility */
  31. #else
  32. #if __DECCXX_VER < 50200000
  33. typedef    unsigned int    u_int;
  34. typedef    unsigned short    ushort;        /* System V compatibility */
  35. typedef    unsigned int    uint;        /* System V compatibility */
  36. #else
  37. #define _FD_MASK_
  38. #endif /* __DECCXX_VER */
  39. #endif /* __DECCXX */
  40.  
  41. typedef    struct    _physadr { int r[1]; } *physadr;
  42. typedef    struct    label_t    {
  43.     int    val[14];
  44. } label_t;
  45.  
  46. typedef    struct    _quad { long val[2]; } quad;
  47. typedef    long    daddr_t;
  48.  
  49. /* This appears elsewhere, e.g., in X Windows include files */
  50. #if !defined(CADDR_T) && !defined(__CADDR_T)
  51. typedef    char    *caddr_t;
  52. #define CADDR_T
  53. #define __CADDR_T
  54. #endif
  55.  
  56. #ifndef __STAT
  57. #include <stat.h>
  58. #endif /* __STAT */
  59. typedef    long    swblk_t;
  60.  
  61.  
  62. /* For VMS we need to avoid a couple of multiple definitions */
  63.  
  64. #if !defined (__TYPES) && !defined (__TIME_T) && !defined (__TYPES_LOADED)
  65. /* TYPES.H    */
  66. /*    TYPES - RTL Typedef Definitions     */
  67. typedef long int time_t;
  68. #define __TIME_T
  69. #endif
  70.  
  71. #ifndef __STDDEF
  72. /* STDDEF.H    */
  73. #if defined(vax11c) || defined(__DECCXX)
  74. #include <stddef.h>
  75. #else
  76. #define __STDDEF
  77. typedef int ptrdiff_t;
  78. typedef int size_t;
  79. #define NULL        (void *) 0
  80. #define offsetof( type, identifier)            \
  81.          ((size_t)(&((type*) NULL)->identifier))
  82. extern volatile int noshare errno;    /* UNIX style error code */
  83. #endif /* vax11c */
  84. #endif
  85.  
  86.  
  87. #ifndef __DEV_T                   /* This started to appear with DECC 5.0 */
  88. typedef    u_short    uid_t;
  89. typedef    u_short    gid_t;
  90. typedef    long    key_t;
  91. #endif
  92.  
  93. #define    NBBY    8        /* number of bits in a byte */
  94. /*
  95.  * Select uses bit masks of file descriptors in longs.
  96.  * These macros manipulate such bit fields (the filesystem macros use chars).
  97.  * FD_SETSIZE may be defined by the user, but the default here
  98.  * should be >= NOFILE (param.h).
  99.  */
  100. #ifndef    FD_SETSIZE
  101. #define    FD_SETSIZE    256
  102. #endif
  103.  
  104. #ifndef _FD_MASK_
  105. #define _FD_MASK_
  106. typedef    long    fd_mask;
  107. #endif /*_FD_MASK_*/
  108.  
  109. #define    NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  110. #ifndef    howmany
  111. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  112. #endif
  113.  
  114. #ifndef __FD_SET
  115. typedef    struct fd_set {
  116.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  117. } fd_set;
  118. #endif 
  119.  
  120. typedef    char *    addr_t;
  121.  
  122. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  123. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  124. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  125. #define    FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  126.  
  127. #if !defined(F_OK) || !defined(X_OK) || !defined(W_OK) || !defined(R_OK)
  128. #define    F_OK    0
  129. #define    X_OK    1
  130. #define    W_OK    2
  131. #define R_OK    4
  132. #endif 
  133.  
  134. #define MAXPATHLEN    256
  135. #endif    /*_UNIX_TYPES_*/
  136.