home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / xpaint-247 / unix_types.h < prev    next >
C/C++ Source or Header  |  1995-09-15  |  3KB  |  124 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. typedef    unsigned int    u_int;
  28. typedef    unsigned short    ushort;        /* System V compatibility */
  29. typedef    unsigned int    uint;        /* System V compatibility */
  30.  
  31. typedef    struct    _physadr { int r[1]; } *physadr;
  32. typedef    struct    label_t    {
  33.     int    val[14];
  34. } label_t;
  35.  
  36. typedef    struct    _quad { long val[2]; } quad;
  37. typedef    long    daddr_t;
  38.  
  39. /* This appears elsewhere, e.g., in X Windows include files */
  40. #if !defined(CADDR_T) && !defined(__CADDR_T)
  41. typedef    char    *caddr_t;
  42. #define CADDR_T
  43. #define __CADDR_T
  44. #endif
  45.  
  46. #ifndef __STAT
  47. #include <stat.h>
  48. #endif /* __STAT */
  49. typedef    long    swblk_t;
  50.  
  51.  
  52. /* For VMS we need to avoid a couple of multiple definitions */
  53.  
  54. #if !defined (__TYPES) && !defined (__TIME_T) && !defined (__TYPES_LOADED)
  55. /* TYPES.H    */
  56. /*    TYPES - RTL Typedef Definitions     */
  57. typedef long int time_t;
  58. #define __TIME_T
  59. #endif
  60.  
  61. #ifndef __STDDEF
  62. /* STDDEF.H    */
  63. #if defined(vax11c) || defined(__DECC)
  64. #include <stddef.h>
  65. #else
  66. #define __STDDEF
  67. typedef int ptrdiff_t;
  68. typedef int size_t;
  69. #define NULL        (void *) 0
  70. #define offsetof( type, identifier)            \
  71.          ((size_t)(&((type*) NULL)->identifier))
  72. extern volatile int noshare errno;    /* UNIX style error code */
  73. #endif /* vax11c */
  74. #endif
  75.  
  76.  
  77. #ifndef __DEV_T                   /* This started to appear with DECC 5.0 */
  78. typedef    u_short    uid_t;
  79. typedef    u_short    gid_t;
  80. typedef    long    key_t;
  81. #endif
  82.  
  83. #define    NBBY    8        /* number of bits in a byte */
  84. /*
  85.  * Select uses bit masks of file descriptors in longs.
  86.  * These macros manipulate such bit fields (the filesystem macros use chars).
  87.  * FD_SETSIZE may be defined by the user, but the default here
  88.  * should be >= NOFILE (param.h).
  89.  */
  90. #ifndef    FD_SETSIZE
  91. #define    FD_SETSIZE    256
  92. #endif
  93.  
  94. #ifndef _FD_MASK_
  95. #define _FD_MASK_
  96. typedef    long    fd_mask;
  97. #endif /*_FD_MASK_*/
  98.  
  99. #define    NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  100. #ifndef    howmany
  101. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  102. #endif
  103.  
  104. typedef    struct fd_set {
  105.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  106. } fd_set;
  107.  
  108. typedef    char *    addr_t;
  109.  
  110. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  111. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  112. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  113. #define    FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  114.  
  115. #if !defined(F_OK) || !defined(X_OK) || !defined(W_OK) || !defined(R_OK)
  116. #define    F_OK    0
  117. #define    X_OK    1
  118. #define    W_OK    2
  119. #define R_OK    4
  120. #endif 
  121.  
  122. #define MAXPATHLEN    256
  123. #endif    /*_UNIX_TYPES_*/
  124.