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 / os2io.h < prev    next >
C/C++ Source or Header  |  1999-01-02  |  3KB  |  90 lines

  1. /* -*-C-*-
  2.  
  3. $Id: os2io.h,v 1.4 1999/01/02 06:11:34 cph Exp $
  4.  
  5. Copyright (c) 1994-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_OS2IO_H
  23. #define SCM_OS2IO_H
  24.  
  25. #include "osio.h"
  26.  
  27. typedef enum
  28. {
  29.   chop_close,
  30.   chop_read,
  31.   chop_write,
  32.   chop_input_buffered,
  33.   chop_input_flush,
  34.   chop_output_cooked,
  35.   chop_output_flush,
  36.   chop_output_drain
  37. } chop_t;
  38.  
  39. typedef void * choparg_t;
  40. typedef void (* channel_op_t)
  41.      (Tchannel, chop_t, choparg_t, choparg_t, choparg_t);
  42.  
  43. struct channel
  44. {
  45.   LHANDLE handle;
  46.   channel_op_t operator;
  47.   void * operator_context;
  48.   enum channel_type type;
  49.   unsigned int open : 1;
  50.   unsigned int internal : 1;
  51.   unsigned int nonblocking : 1;
  52.   unsigned int inputp : 1;
  53.   unsigned int outputp : 1;
  54. };
  55.  
  56. #define _CHANNEL(c) (OS2_channel_table [(c)])
  57. #define CHANNEL_HANDLE(c) ((_CHANNEL (c)) . handle)
  58. #define CHANNEL_OPERATOR(c) ((_CHANNEL (c)) . operator)
  59. #define CHANNEL_OPERATOR_CONTEXT(c) ((_CHANNEL (c)) . operator_context)
  60. #define CHANNEL_TYPE(c) ((_CHANNEL (c)) . type)
  61. #define CHANNEL_OPEN(c) ((_CHANNEL (c)) . open)
  62. #define CHANNEL_INTERNAL(c) ((_CHANNEL (c)) . internal)
  63. #define CHANNEL_NONBLOCKING(c) ((_CHANNEL (c)) . nonblocking)
  64. #define CHANNEL_INPUTP(c) ((_CHANNEL (c)) . inputp)
  65. #define CHANNEL_OUTPUTP(c) ((_CHANNEL (c)) . outputp)
  66.  
  67. #define CHANNEL_ABSTRACT_P(c) ((CHANNEL_OPERATOR (c)) != 0)
  68.  
  69. #define channel_type_console channel_type_os2_console
  70. #define channel_type_unnamed_pipe channel_type_os2_unnamed_pipe
  71. #define channel_type_named_pipe channel_type_os2_named_pipe
  72.  
  73. /* Channel modes: */
  74. #define CHANNEL_READ    1
  75. #define CHANNEL_WRITE    2
  76.  
  77. extern struct channel * OS2_channel_table;
  78. extern Tchannel * OS2_channel_pointer_table;
  79. extern Tchannel OS2_make_channel (LHANDLE, unsigned int);
  80. extern void OS2_initialize_channel
  81.   (Tchannel, LHANDLE, unsigned int, enum channel_type);
  82. extern Tchannel OS2_allocate_channel (void);
  83. extern void OS2_channel_close_all_noerror (void);
  84. extern void OS_channel_close_on_abort (Tchannel);
  85. extern void OS2_handle_close_on_abort (LHANDLE);
  86. extern void OS2_channel_operation
  87.   (Tchannel, chop_t, choparg_t, choparg_t, choparg_t);
  88.  
  89. #endif /* SCM_OS2IO_H */
  90.