# ifndef NO_WHAT
/*
 *      SCCS file type - Emulator Include File
 *
 *      What identification string:
 */
static char *_S_hESY = "@(#)ESY.h	3.1";
# endif

/*
 *      CONSTANTS
 */


/*
 *      TYPES
 */

/*
 *      ProcDescriptor = 0 .. NcoopProc-1
 */
#define ProcDescriptor char

/*
 *      SyncMapIndex = 0 .. NsharedSegs
 */
#define SyncMapIndex char

typedef struct {
		int            S_free;
		Boolean    S_choosing;
		int             S_num;
		SEID          S_pSEID;
		ProcDescriptor S_next;
	} SyncEntry;

typedef struct {
		Boolean          S_initialized;
		int                 S_locklock;
		SEID                 S_segSEID;
		ProcDescriptor       S_maxproc;
		SyncEntry  S_proc[ NcoopProc ];
	} SyncBlock;

typedef struct {
		int               S_count;
		ProcDescriptor S_qf, S_ql;
		SyncBlock        *S_syncB;
	} Semaphore;

typedef struct {
		SEID            S_segment;
		ProcDescriptor S_procDesc;
	} SyncMapEntry;

typedef struct {
		SEID                      S_process;
		SyncMapIndex              S_nextseg;
		SyncMapIndex              S_lastseg;
		SyncMapEntry S_map[ NsharedSegs+1 ];
	} SyncMap;

/*
 *      VARIABLES
 */

SyncMap   Sync;         /* Per-process map of segment->process entry */

/*
 *	For testing in multiprogrammed simulation
 */

SyncMap SYNC[NPROCS];
#define Sync (SYNC[currentpd])
