home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / microcode / uxio.h < prev    next >
C/C++ Source or Header  |  1999-01-02  |  2KB  |  58 lines

  1. /* -*-C-*-
  2.  
  3. $Id: uxio.h,v 1.5 1999/01/02 06:11:34 cph Exp $
  4.  
  5. Copyright (c) 1990-1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. #ifndef SCM_UXIO_H
  23. #define SCM_UXIO_H
  24.  
  25. #include "osio.h"
  26.  
  27. struct channel
  28. {
  29.   int descriptor;
  30.   enum channel_type type;
  31.   unsigned int internal : 1;
  32.   unsigned int nonblocking : 1;
  33. };
  34.  
  35. #define MARK_CHANNEL_CLOSED(channel) ((CHANNEL_DESCRIPTOR (channel)) = (-1))
  36. #define CHANNEL_CLOSED_P(channel) ((CHANNEL_DESCRIPTOR (channel)) < 0)
  37. #define CHANNEL_OPEN_P(channel) ((CHANNEL_DESCRIPTOR (channel)) >= 0)
  38. #define CHANNEL_DESCRIPTOR(channel) ((channel_table [(channel)]) . descriptor)
  39. #define CHANNEL_TYPE(channel) ((channel_table [(channel)]) . type)
  40. #define CHANNEL_INTERNAL(channel) ((channel_table [(channel)]) . internal)
  41. #define CHANNEL_NONBLOCKING(channel)                    \
  42.   ((channel_table [(channel)]) . nonblocking)
  43.  
  44. #define MAKE_CHANNEL(descriptor, type, receiver)            \
  45. {                                    \
  46.   Tchannel MAKE_CHANNEL_temp = (channel_allocate ());            \
  47.   (CHANNEL_DESCRIPTOR (MAKE_CHANNEL_temp)) = (descriptor);        \
  48.   (CHANNEL_TYPE (MAKE_CHANNEL_temp)) = (type);                \
  49.   (CHANNEL_INTERNAL (MAKE_CHANNEL_temp)) = 0;                \
  50.   (CHANNEL_NONBLOCKING (MAKE_CHANNEL_temp)) = 0;            \
  51.   receiver (MAKE_CHANNEL_temp);                        \
  52. }
  53.  
  54. extern struct channel * channel_table;
  55. extern Tchannel EXFUN (channel_allocate, (void));
  56.  
  57. #endif /* SCM_UXIO_H */
  58.