From: ceriel Date: Thu, 26 Feb 1987 09:55:46 +0000 (+0000) Subject: Initial revision X-Git-Tag: release-5-5~4584 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=51eff1445658e871c1a33a75d82b74011ea9fc0c;p=ack.git Initial revision --- diff --git a/h/ocm_chan.h b/h/ocm_chan.h new file mode 100644 index 000000000..ff66f8594 --- /dev/null +++ b/h/ocm_chan.h @@ -0,0 +1,47 @@ +/* ocm_chan.h - channel definitions */ +#include +#include "ocm_parco.h" + +typedef union channel { + struct { /* Interprocess channel */ + char _type; /* Channel type, see note */ + char synch; /* State in channel synchronization */ + long val; /* Transmitted value */ + } c; + struct { /* File channel */ + char _type; /* Dummy field, see note */ + char index; /* Index in the file array */ + char flgs; /* Status flags: in use & readahead */ + char preread; /* Possible preread character */ + } f; +} chan; +#define type c._type /* Channel type */ +/* Note: The channel type should not be part of each structure in chan. But + * the C alignment rules would make chan about 50% bigger if we had done it + * the right way. Note that the order of fields in a struct cannot be a problem + * as long as struct c is the largest within the union. + */ + +#define C_T_CHAN 0 /* Type of a interprocess channel */ +#define C_T_FILE 1 /* Type of a file channel */ + +#define C_S_FREE 0 /* IP channel is free */ +#define C_S_ANY 1 /* IP channel contains data */ +#define C_S_ACK 2 /* IP channel data is removed */ + +#define C_F_EOF (-1L) /* File channel returns EOF */ +#define C_F_TEXT (-2L) /* File channel becomes line oriented */ +#define C_F_RAW (-3L) /* File channel becomes character oriented */ + +#define C_F_INUSE 0x01 /* File channel is connected to a UNIX file */ +#define C_F_READAHEAD 0x02 /* File channel has a preread character */ + +extern chan file[20]; /* Array of file channels */ +extern FILE *unix_file[20]; /* Pointers to buffered UNIX files */ + +void c_init(); + +void chan_in(), cbyte_in(), c_wa_in(), c_ba_in(); +void chan_out(), c_wa_out(), c_ba_out(); + +int chan_any(); diff --git a/h/ocm_parco.h b/h/ocm_parco.h new file mode 100644 index 000000000..1588d43c3 --- /dev/null +++ b/h/ocm_parco.h @@ -0,0 +1,18 @@ +/* parco.h - Define names for simulation routines + * + * This file is to be included by users of the higher-level routines + * + */ + +void pc_begin(), resumenext(), parend(), resume(), coend(); +int pc_fork(); + +#define nullid ((int *) 0 - (int *) 0) + /* I.e. a 0 of type "pointer difference" */ + +#define parbegin(sbrk) pc_begin(sbrk, nullid) +#define parfork() pc_fork(nullid) +#define cobegin(sbrk, id) pc_begin(sbrk, id) +#define cofork(id) pc_fork(id) + +extern int deadlock; diff --git a/h/ocm_proc.h b/h/ocm_proc.h new file mode 100644 index 000000000..3f716e812 --- /dev/null +++ b/h/ocm_proc.h @@ -0,0 +1,56 @@ +/* process.h - Define administration types and functions + * + * This file is to be included by implementors of the higher + * level routines + * + */ +#include "ocm_parco.h" + +#ifndef ptrdiff /* This type must be able to hold a pointer difference */ +#if EM_WSIZE