ocm_chan.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* $Id$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. /* ocm_chan.h - channel definitions */
  7. #include <stdio.h>
  8. #include "ocm_parco.h"
  9. typedef union channel {
  10. struct { /* Interprocess channel */
  11. char _type; /* Channel type, see note */
  12. char synch; /* State in channel synchronization */
  13. long val; /* Transmitted value */
  14. } c;
  15. struct { /* File channel */
  16. char _type; /* Dummy field, see note */
  17. char index; /* Index in the file array */
  18. char flgs; /* Status flags: in use & readahead */
  19. char preread; /* Possible preread character */
  20. } f;
  21. } chan;
  22. #define type c._type /* Channel type */
  23. /* Note: The channel type should not be part of each structure in chan. But
  24. * the C alignment rules would make chan about 50% bigger if we had done it
  25. * the right way. Note that the order of fields in a struct cannot be a problem
  26. * as long as struct c is the largest within the union.
  27. */
  28. #define C_T_CHAN 0 /* Type of a interprocess channel */
  29. #define C_T_FILE 1 /* Type of a file channel */
  30. #define C_S_FREE 0 /* IP channel is free */
  31. #define C_S_ANY 1 /* IP channel contains data */
  32. #define C_S_ACK 2 /* IP channel data is removed */
  33. #define C_F_EOF (-1L) /* File channel returns EOF */
  34. #define C_F_TEXT (-2L) /* File channel becomes line oriented */
  35. #define C_F_RAW (-3L) /* File channel becomes character oriented */
  36. #define C_F_INUSE 0x01 /* File channel is connected to a UNIX file */
  37. #define C_F_READAHEAD 0x02 /* File channel has a preread character */
  38. extern chan file[20]; /* Array of file channels */
  39. extern FILE *unix_file[20]; /* Pointers to buffered UNIX files */
  40. void c_init();
  41. void chan_in(), cbyte_in(), c_wa_in(), c_ba_in();
  42. void chan_out(), c_wa_out(), c_ba_out();
  43. int chan_any();