fermilib_h

/*
**	Copyright 1997, Universities Research Association.  All rights reserved.
*/
/******************************************************************************/
/* fermilib.h
**
**	This is a header file containing function prototypes for
**	routines in the Fermi library (FERMILIB).
**
**	V0.0	B S Hendricks / Accelerator Controls		22-Apr-97
**	Created
**
*/
/******************************************************************************/

#ifndef FERMILIB_DEFINED			/* do this only once */
#define	FERMILIB_DEFINED

#include "vaxtypes.h"
#include "ssdef.h"

/******************************************************************************/
/* 
**	defined constants for argument values
*/
/******************************************************************************/

#define	LIB_M_VM_BOUNDARY_TAGS	1
#define	LIB_M_VM_GET_FILL0	2
#define	LIB_M_VM_GET_FILL1	4
#define	LIB_M_VM_FREE_FILL0	8
#define	LIB_M_VM_FREE_FILL1	16
#define	LIB_M_VM_EXTEND_AREA	32
#define	LIB_M_VM_NO_EXTEND	64
#define	LIB_M_VM_TAIL_LARGE	128


/******************************************************************************/
/* 
**	returned status definitions for FERMILIB routines
*/
/******************************************************************************/


/******************************************************************************/
/*
**	function prototypes for modules in FERMILIB
*/
/******************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

/* Error codes from SYS$COMMON:[SYSLIB]LIBDEF.H and perhaps other VMS headers */
#define LIB__ONEENTQUE		(1409049)
#define LIB__BADBLOADR		(1409636)
#define LIB__BADBLOSIZ		(1409644)
#define LIB__INSVIRMEM		(1409556)
#define LIB__QUEWASEMP		(1409772)

#define LNM_ENV_PREFIX "LNM_"
#define LNM_PATH "/usr/local/xaps/logicals/"
#define LNM_GROUP 0
#define LNM_PROCESS 1
#define DAYS_OFFSET 40587 /* diff between unix and vms epoch */

int lib_create_vm_zone(int*, int const* = 0, int const* = 0, unsigned long const* = 0,
		       int const* = 0, int const* = 0, int const* = 0, int const* = 0, int const* = 0,
		       int const* = 0, char const* = 0, int (*)(int const*, void**, int const*) = 0,
		       int (*)(int const*, void* const*, int const*) = 0);
int lib_free_vm(size_t const*, void* const*, int const* = 0);
int lib_get_vm(size_t const*, void**, int const* = 0);
int lib_insque(void *new_entry, void *previous_entry);
int lib_insque_tail(void *new_entry, void *header);
void lib_movc5(int const* lSrc, void const* pSrc, char const* fc, int const* lDst, void* pDst);
int lib_remque(void *link, void *removed_entry);
int lib_reset_vm_zone(int const*);
char* getlnm(char const *);
int setlnm(char const *, char const *, int = LNM_GROUP);
int clrlnm(char const *, int = LNM_GROUP);
void lstlnm(int = LNM_GROUP);
int sys_gettim(vmstime *date_time);
int lib_establish(int (*handler_func)(int *, int *));
void _lib_stop(unsigned, char*, unsigned);
void _lib_signal(unsigned, char*, unsigned);

// AST serialization 
int sys_setast(unsigned char);
void astEnter();
void astExit();

#ifdef __cplusplus
}
#endif


/******************************************************************************/
/*
**	equivalent name definitions
*/
/******************************************************************************/

#define LIB_CREATE_VM_ZONE		lib_create_vm_zone
#define LIB_FREE_VM			lib_free_vm
#define LIB_GET_VM			lib_get_vm
#define	LIB_INSQUE			lib_insque
#define LIB_MOVC5			lib_movc5
#define	LIB_REMQUE			lib_remque
#define LIB_RESET_VM_ZONE		lib_reset_vm_zone
#define SYS_GETTIM			sys_gettim
#define	LIB_ESTABLISH			lib_establish

#define lib_stop(status,...)   	_lib_stop(status, __FILE__, __LINE__)
#define LIB_STOP(status,...)	lib_stop(status)
#define lib_signal(status,...)	_lib_signal(status, __FILE__, __LINE__)
#define LIB_SIGNAL(status,...) 	lib_signal(status)

#endif