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

  1. /* -*-C-*-
  2.  
  3. $Id: os2cthrd.h,v 1.7 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_OS2CTHRD_H
  23. #define SCM_OS2CTHRD_H
  24.  
  25. #ifndef SM_READAHEAD_MAX
  26. #define SM_READAHEAD_MAX 4096
  27. #endif
  28.  
  29. typedef struct
  30. {
  31.   TID tid;
  32.   qid_t reader_qid;
  33.   qid_t writer_qid;
  34.   unsigned int eofp : 1;
  35.   unsigned int first_read_p : 1;
  36. } channel_context_t;
  37. #define CHANNEL_CONTEXT_TID(c) ((c) -> tid)
  38. #define CHANNEL_CONTEXT_READER_QID(c) ((c) -> reader_qid)
  39. #define CHANNEL_CONTEXT_WRITER_QID(c) ((c) -> writer_qid)
  40. #define CHANNEL_CONTEXT_EOFP(c) ((c) -> eofp)
  41. #define CHANNEL_CONTEXT_FIRST_READ_P(c) ((c) -> first_read_p)
  42.  
  43. typedef struct
  44. {
  45.   DECLARE_MSG_HEADER_FIELDS;
  46.   unsigned short size;
  47.   unsigned short index;
  48.   char data [SM_READAHEAD_MAX];
  49. } sm_readahead_t;
  50. #define SM_READAHEAD_SIZE(m) (((sm_readahead_t *) (m)) -> size)
  51. #define SM_READAHEAD_INDEX(m) (((sm_readahead_t *) (m)) -> index)
  52. #define SM_READAHEAD_DATA(m) (((sm_readahead_t *) (m)) -> data)
  53.  
  54. enum readahead_ack_action { raa_read, raa_close };
  55.  
  56. typedef struct
  57. {
  58.   DECLARE_MSG_HEADER_FIELDS;
  59.   enum readahead_ack_action action;
  60. } sm_readahead_ack_t;
  61. #define SM_READAHEAD_ACK_ACTION(m) (((sm_readahead_ack_t *) (m)) -> action)
  62.  
  63. typedef msg_t * (* channel_reader_t) (LHANDLE, qid_t, msg_t *, int *);
  64.  
  65. extern void OS2_start_channel_thread
  66.   (Tchannel, channel_reader_t, channel_op_t);
  67. extern void OS2_channel_thread_read_op
  68.   (Tchannel, choparg_t, choparg_t, choparg_t);
  69.  
  70. extern channel_context_t * OS2_make_channel_context (void);
  71. extern long OS2_channel_thread_read (Tchannel, char *, size_t);
  72. extern enum readahead_ack_action OS2_wait_for_readahead_ack (qid_t);
  73. extern void OS2_channel_thread_close (Tchannel);
  74.  
  75. #define OS2_make_readahead_buffer OS2_create_msg_fifo
  76. #define OS2_readahead_buffer_emptyp OS2_msg_fifo_emptyp
  77.  
  78. extern void OS2_readahead_buffer_insert (void *, char);
  79. extern char OS2_readahead_buffer_rubout (void *);
  80. extern msg_t * OS2_make_readahead (void);
  81. extern msg_t * OS2_readahead_buffer_read (void *);
  82.  
  83. #define OS2_readahead_buffer_read_all(b)                \
  84.   ((msg_t **) (OS2_msg_fifo_remove_all (b)))
  85.  
  86. #endif /* SCM_OS2CTHRD_H */
  87.