Pristine Ack-5.5
[Ack-5.5.git] / h / ocm_chan.h
1 /* $Id: ocm_chan.h,v 1.4 1994/06/24 10:08:30 ceriel Exp $ */
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
10 typedef union channel {
11         struct {                /* Interprocess channel */
12                 char _type;     /* Channel type, see note */
13                 char synch;     /* State in channel synchronization */
14                 long val;       /* Transmitted value */
15         } c;
16         struct {                /* File channel */
17                 char _type;     /* Dummy field, see note */
18                 char index;     /* Index in the file array */
19                 char flgs;      /* Status flags: in use & readahead */
20                 char preread;   /* Possible preread character */
21         } f;
22 } chan;
23 #define type            c._type /* Channel type */
24 /* Note: The channel type should not be part of each structure in chan. But
25  * the C alignment rules would make chan about 50% bigger if we had done it
26  * the right way. Note that the order of fields in a struct cannot be a problem
27  * as long as struct c is the largest within the union.
28  */
29
30 #define C_T_CHAN        0       /* Type of a interprocess channel */
31 #define C_T_FILE        1       /* Type of a file channel */
32
33 #define C_S_FREE        0       /* IP channel is free */
34 #define C_S_ANY         1       /* IP channel contains data */
35 #define C_S_ACK         2       /* IP channel data is removed */
36
37 #define C_F_EOF         (-1L)   /* File channel returns EOF */
38 #define C_F_TEXT        (-2L)   /* File channel becomes line oriented */
39 #define C_F_RAW         (-3L)   /* File channel becomes character oriented */
40
41 #define C_F_INUSE       0x01    /* File channel is connected to a UNIX file */
42 #define C_F_READAHEAD   0x02    /* File channel has a preread character */
43
44 extern chan file[20];   /* Array of file channels */
45 extern FILE *unix_file[20];     /* Pointers to buffered UNIX files */
46
47 void c_init();
48
49 void chan_in(), cbyte_in(), c_wa_in(), c_ba_in();
50 void chan_out(), c_wa_out(), c_ba_out();
51
52 int chan_any();