/* <lbrdef.h>
 *
 *	LBRUSR -- types of libraries
 */
#ifndef _LBRDEF_H
#define _LBRDEF_H

/* Define the library types */
#define LBR$C_TYP_UNK	0	/* unknown/unspecified library type */
#define LBR$C_TYP_OBJ	1	/* object/shareable image library */
#define LBR$C_TYP_MLB	2	/* macro library */
#define LBR$C_TYP_HLP	3	/* help file library */
#define LBR$C_TYP_TXT	4	/* text library */
#define LBR$C_TYP_SHSTB 5	/* shareable image symbol library */
#define LBR$C_TYP_NCS	6	/* NCS library */
#define LBR$C_TYP_DECMX 6	/* maximum Digital library type defined */
#define LBR$C_TYP_EOBJ	7	/* Alpha object library */
#define LBR$C_TYP_ESHSTB 8	/* Alpha shareable image symbol library */
#define ELBR$C_TYP_DECMX 8	/* maximum Digital (Alpha) library type defined */
#define LBR$C_TYP_RDEC	127	/* types between DECMX and RDEC are */
/*   reserved to Digital */
#define LBR$C_TYP_USRLW 128	/* user library types range from 128 */
#define LBR$C_TYP_USRHI 255	/* to 255. */

/* function codes for lbr$flush */
#define LBR$C_FLUSHDATA 1	/* flush data blocks from cache */
#define LBR$C_FLUSHALL	0	/* flush data blocks, then index blocks */

/* librarian fixed parameters */
#define LBR$C_MAXRECSIZ 2048	/* maximum record size allowed */
#define LBR$C_PAGESIZE	512	/* size of memory page */
#define LBR$C_HASHSIZE	512	/* size of hash table ** must be power of 2 ** */
#define LBR$C_TEXTPAGE	508	/* no. of useable bytes on a text page */
#define LBR$C_DEXTQ	50	/* library default extend quantity */
#define LBR$C_MAXCTL	16	/* maximum number of open libraries */
#define LBR$C_MAXHDRSIZ 128	/* maximum length of module header */
				/* (max user length is: lbr$c_maxhdrsiz-mhd$c_length) */
#define LBR$C_DEFENTALL 300	/* number of entries to allocate by default */
#define LBR$C_RETRYOPEN 120	/* number of times to retry open on RMS$_FLK */
#define LBR$C_RETRYWAIT 1	/* number of seconds to wait */
#define LBR$C_MINREAD	2	/* minimum number of blocks to read */
#define LBR$C_MAXREAD	100	/* max blocks can ever read */
#define LBR$C_MEMXTRA	50	/* number blocks to expand region by above and beyond lbr$gl_maxread */
#define LBR$C_PUTBUFSIZ 30	/* block size of VM empty cache buffer */
#define LBR$C_FLSHBFSIZ 1	/* block size of stack mt_cache buffer */
#define LBR$C_MAXIDXRD	20	/* maximum blocks in one index read */
#define LBR$C_MAXKEYLEN 128	/* maximum length of an ASCII keyword, at most N, */
				/* where 3*(N+7) < or = 506 */
#define LBR$C_MAXLUHREC 32768	/* maximum library update history record length */

/* librarian fixed parameters for ALPHA */
#define ELBR$C_MAXRECSIZ 8192	/* maximum record size allowed */

/* LBR$INI_CONTROL argument list */
#define LBR$C_CREATE	0	/* create a new library */
#define LBR$C_READ	1	/* read an existing library */
#define LBR$C_UPDATE	2	/* update an exisiting library */
#define LBR$C_MAXFUNC	2	/* maximum legal function */
struct lbrdef {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_ic_ctltbl;	/* control index address */
    unsigned long lbr$l_ic_func;	/* function */
    unsigned long lbr$l_ic_type;	/* type of library expected to open */
};

/* LBR$OPEN argument list */
struct lbrdef1 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_op_ctltbl;	/* control index address */
    unsigned long lbr$l_op_fns;		/* address of string descriptor for filename */
    unsigned long lbr$l_op_creopt;	/* address of create options array */
    unsigned long lbr$l_op_dns;		/* address of descriptor for default name string */
    unsigned long lbr$l_op_rlfna;	/* address of NAM block for related file */
    unsigned long lbr$l_op_rns;		/* address of descriptor for related filename string */
    unsigned long lbr$l_op_rnslen;	/* address of longword to store resultant filename string length */
};

/* LBR$CLOSE argument list */
struct lbrdef2 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_cl_ctltbl;	/* control index address */
};

/* LBR$GET_HEADER argument list */
struct lbrdef3 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_gh_ctltbl;	/* address of control index */
    unsigned long lbr$l_gh_retary;	/* address of 128-longword array for return info */
};

/* LBR$SET_INDEX argument list */
struct lbrdef4 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_si_ctltbl;	/* control index address */
    unsigned long lbr$l_si_idxnum;	/* address of index number */
};

/* LBR$LOOKUP_KEY argument list */
struct lbrdef5 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_lk_ctltbl;	/* control index address */
    unsigned long lbr$l_lk_keynam;	/* address of string descriptor or binary value */
    unsigned long lbr$l_lk_txtrfa;	/* address of quadword to return RFA if found */
};

/* LBR$INSERT_KEY argument list */
struct lbrdef6 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_ik_ctltbl;	/* control index address */
    unsigned long lbr$l_ik_keynam;	/* address of string descriptor or binary value */
    unsigned long lbr$l_ik_txtrfa;	/* address of RFA of text */
};

#if 0
/* LBR$REPLACE_MOD argument list */
struct lbrdefX {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_rm_ctltbl;	/* control index address */
    unsigned long lbr$l_rm_keynam;	/* address of string descriptor or binary value */
    unsigned long lbr$l_rm_txtrfa;	/* RFA of new text */
};
#endif

/* LBR$REPLACE_KEY argument list */
struct lbrdef7 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_rk_ctltbl;	/* control index address */
    unsigned long lbr$l_rk_keynam;	/* address of string descriptor or binary value */
    unsigned long lbr$l_rk_oldrfa;	/* address of RFA of old text */
    unsigned long lbr$l_rk_newrfa;	/* address of RFA of new text */
};

/* LBR$DELETE_KEY argument list */
struct lbrdef8 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_dk_ctltbl;	/* control index address */
    unsigned long lbr$l_dk_keynam;	/* address of string descriptor or binary value */
};

/* LBR$DELETE_DATA argument list */
struct lbrdef9 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_dd_ctltbl;	/* control index address */
    unsigned long lbr$l_dd_txtrfa;	/* address of RFA to delete from */
};

/* LBR$GET_RECORD argument list */
struct lbrdef10 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_gr_ctltbl;	/* control index address */
    unsigned long lbr$l_gr_bufdes;	/* address of descriptor of buffer */
    unsigned long lbr$l_gr_buflen;	/* address of longword to return record size */
};

/* LBR$PUT_RECORD argument list */
struct lbrdef11 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_pr_ctltbl;	/* control index address */
    unsigned long lbr$l_pr_bufdes;	/* address of descriptor of buffer to output */
    unsigned long lbr$l_pr_txtrfa;	/* address of quadword to return RFA of text record */
};

/* LBR$PUT_END argument list */
struct lbrdef12 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_pe_ctltbl;	/* control index address */
};

/* LBR$SEARCH argument list */
struct lbrdef13 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_sr_ctltbl;	/* control index address */
    unsigned long lbr$l_sr_idxnum;	/* address of index number */
    unsigned long lbr$l_sr_rfa;		/* address of RFA to search index for */
    unsigned long lbr$l_sr_usrtn;	/* user routine to call on match */
};

/* Argument list for user routine called by LBR$SEARCH */
struct lbrdef14 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_su_keydes;	/* address of string descriptor or binary value */
    unsigned long lbr$l_su_txtrfa;	/* address of array containing rfa of module */
};

/* LBR$GET_INDEX argument list */
struct lbrdef15 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_gi_ctltbl;	/* control index address */
    unsigned long lbr$l_gi_idxnum;	/* index number */
    unsigned long lbr$l_gi_usrtn;	/* user routine to call for each entry */
};

/* Argument list for user routine called by LBR$GET_INDEX */
struct lbrdef16 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_gu_keyadr;	/* address of descriptor or binary value */
    unsigned long lbr$l_gu_txtrfa;	/* rFA of associated text */
};

/* Types of operations logged */
#define LBR$C_ADDMOD	1	/* add module */
#define LBR$C_DELMOD	2	/* delete module */
#define LBR$C_REPMOD	3	/* replace module */

/* LBR$ADD_UPDATE argument list */
struct lbrdef17 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_au_ctltbl;	/* control index address */
    unsigned long lbr$l_au_flags;	/* flags */
    unsigned long lbr$l_au_keynam;	/* address of string descriptor or binary value */
};

/* LBR$GET_UPDATES argument list */
struct lbrdef18 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_gu_ctltbl;	/* control index address */
    unsigned long lbr$l_gu_usrtn;	/* user routine to call for each update */
};

/* argument list for user routine called by LBR$GET_UPDATES */
struct lbrdef19 {
    unsigned	: 32;			/* long fill; argument count */
    unsigned long lbr$l_uu_updesc;	/* string descriptor for history line */
};

#endif	/*_LBRDEF_H*/
