#ifndef _GEOMCLASS_SM_
#define _GEOMCLASS_SM_
/*
 * Declarations for shared-memory geometry objects.
 * $Header: /usr2/gcg/ngrap/src/lib/oogl/libgeom/RCS/geomclass_sm.h,v 1.1 91/01/15 17:23:45 gunn Exp Locker: gunn $
 *
 * $Log:	geomclass_sm.h,v $
 * Revision 1.1  91/01/15  17:23:45  gunn
 * Initial revision
 * 
 * Revision 1.2  90/05/07  14:19:59  meuer
 * Automatic prepending of file /u/gcg/grap/document/copyright.
 * 
 * Revision 1.1  89/12/27  09:29:00  meuer
 * Initial revision
 * 
 */

/* typedef struct GeomSMSym  GeomSMSym;	*/

/* struct GeomSMSym {		*/
/* 	char	*s_here;	/* Addr of this GeomSMSym (owner's space) */
/* 	long	s_size;		/* sizeof(Object) */
/* 	char	*s_obj;		/* Object */
/* 	int	s_version;	/* Might be good for something, else 0 */
/* 	GeomSMSym *s_lnext;	/* Addr of left child symbol, else 0 */
/* 	GeomSMSym *s_rnext;	/* Addr of right child */
/* 	long	s_lock;		/* what to lock with; encoded; 0 if not set */
/* 	unsigned char        s_namelen;	/* Length of name */
/* 	char	s_name[1];	/* NUL-terminated symbol name, var. size */
/* };	*/

/* typedef struct GeomSMRegion {	*/
/* 	char *sm_base;		/* Base address where shared mem is mapped */
/* 	long  sm_mapped;	/* Amount of shared memory currently mapped */
/* 	int   sm_fd;		/* File descriptor of backing store file */
/* 	short	sm_ro;		/* Flag: map read-only */
/* 	short	sm_nseg;
/* #define MAXSMSEG 16
/* 	long  sm_shift;	/* {addr in our space} - {addr in creator's space} */
/* 	GeomSMSym *sm_mysym; /* Indicates process' interest in that SM */
/* 	struct arena *sm_arena;	/* private per-SM malloc static data */
/* 	struct classtab *sm_ctab; /* Known classes in this SM */
/* 	int sm_shmid[MAXSMSEG];
/* 	int sm_semid[MAXSMSEG];
/* } GeomSMRegion;

  */

#define	IsInSM(addr, sm)   ((sm)->sm_base <= (char *)(addr) && \
			     (char *)(addr) < (sm)->sm_base + (sm)->sm_mapped)

#define	GeomRefreshSM(sm)  ((sm)->sm_mapped < ROOTSYM(sm)->s_size ? GeomRemapSM(sm) : (sm)->sm_mapped)

#define	ROOTSYM(sm)	((GeomSMSym *)(sm)->sm_base)

#define	GOffset(sym, type, ptr)  ((type *)(((char *)(ptr)) + \
				   (((char *)(sym)) - (sym)->s_here)))

#define	MAXSM		4	/* Max number of simultaneous shared mem's */

#define	SM_MAGIC  0x4AB3B8B9	/* s_version field for SM root symbol */

#endif _GEOMCLASS_SM_
