BS2000-LMS

 view release on metacpan or  search on metacpan

LMS.xs  view on Meta::CPAN

		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.sec_name,
				     l_pTOCElementHash, "secondary_name");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.sec_attr,
				     l_pTOCElementHash, "secondary_attribute");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.user_date,
				     l_pTOCElementHash, "user_date");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.user_time,
				     l_pTOCElementHash, "user_time");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.crea_date,
				     l_pTOCElementHash, "creation_date");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.crea_time,
				     l_pTOCElementHash, "creation_time");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.modif_date,
				     l_pTOCElementHash, "modification_date");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.modif_time,
				     l_pTOCElementHash, "modification_time");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.access_date,
				     l_pTOCElementHash, "access_date");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.access_time,
				     l_pTOCElementHash, "access_time");
		l_uiMode  = (LMSUP_NO!=l_LMS_ElementInformation.p_read_own)<<8;
		l_uiMode |= (LMSUP_NO!=l_LMS_ElementInformation.p_writ_own)<<7;
		l_uiMode |= (LMSUP_NO!=l_LMS_ElementInformation.p_exec_own)<<6;
		l_uiMode |= (LMSUP_NO!=l_LMS_ElementInformation.p_read_grp)<<5;
		l_uiMode |= (LMSUP_NO!=l_LMS_ElementInformation.p_writ_grp)<<4;
		l_uiMode |= (LMSUP_NO!=l_LMS_ElementInformation.p_exec_grp)<<3;
		l_uiMode |= (LMSUP_NO!=l_LMS_ElementInformation.p_read_oth)<<2;
		l_uiMode |= (LMSUP_NO!=l_LMS_ElementInformation.p_writ_oth)<<1;
		l_uiMode |= (LMSUP_NO!=l_LMS_ElementInformation.p_exec_oth);
		PUT_INTEGER_INTO_HASH(l_uiMode, l_pTOCElementHash, "mode");
		PUT_CHAR_INTO_HASH(l_LMS_ElementInformation.hold_state,
				   l_pTOCElementHash, "hold_state");
		PUT_STRING_INTO_HASH(l_LMS_ElementInformation.holder,
				     l_pTOCElementHash, "holder");
		PUT_INTEGER_INTO_HASH(l_LMS_ElementInformation.element_size,
				      l_pTOCElementHash, "element_size");
		/* generate reference to hash and store it in array (no
		   reference counters are incremented here!); the cast here is
		   allowed and neccessary: */
		av_push(l_pTOCArray, newRV_noinc( (SV*) l_pTOCElementHash));
	    }
	    /* every loop after first must use LMSUP_TOC: */
	    if (0 == l_uiIndex)
	      l_LMS_ControlBlock.function = LMSUP_TOC;
	    l_uiIndex++;
	}
	while(l_LMS_ControlBlock.retcode == LMSUP_OK);
	/* release TOC ID (always!!!): */
	release_toc_id(l_iTOC_ID_Number);
	/* set normal return values: */
	if (! copy_returncodes(&l_LMS_ControlBlock, p_pAccessor))
	  XSRETURN_UNDEF;
	if (l_LMS_ControlBlock.retcode != LMSUP_OK  &&
	    l_LMS_ControlBlock.retcode != LMSUP_EOF)
	  XSRETURN_UNDEF;
	/* set return code: */
	RETVAL = l_pTOCArray;
    OUTPUT:
	RETVAL
    CLEANUP:
	/* give up reference to AV (see CookBookA/Ex4 for details): */
	SvREFCNT_dec(RETVAL);


 ########################################################################
 # call:								#
 #	lms_open_get($rAccessor, $rElementDescr);			#
 # parameters:								#
 #	$rAccessor	reference to accessor object			#
 #	$rElementDescr	reference to hash with element description	#
 # description:								#
 #	This function opens a library element for reading.		#
 # returns:								#
 #		new access ID						#
 #	or	undef in case of errors					#
 ########################################################################
int
lms_open_get(HV* p_pAccessor, HV* p_pElementDescriptor)
    PROTOTYPE: \%\%;
    PREINIT:
	struct lmsc_cb l_LMS_ControlBlock = lmsc_cb_proto;
	struct lmsc_ld l_LMS_LibraryDescriptor = lmsc_ld_proto;
	struct lmsc_ed l_LMS_ElementDescriptor = lmsc_ed_proto;
	struct lmsc_rd l_LMS_RecordDescriptor = lmsc_rd_proto;
	SV** l_pScalarValue;
	STRLEN l_iDummy;
    INIT:
	GET_INTEGER_FROM_HASH(l_LMS_ControlBlock.acc, p_pAccessor,
			      "accessor_id");
	l_LMS_ControlBlock.function = LMSUP_OPEN_GET;
	l_LMS_ControlBlock.subcode = LMSUP_UNUSED;
	l_LMS_ControlBlock.ld_return = 'N';
	GET_STRING_FROM_HASH(l_LMS_LibraryDescriptor.name,
			     p_pAccessor, "name");
	GET_STRING_FROM_HASH(l_LMS_LibraryDescriptor.link,
			     p_pAccessor, "link_name");
	GET_OPTIONAL_STRING_FROM_HASH(l_LMS_ElementDescriptor.name,
				      p_pElementDescriptor, "name");
	GET_OPTIONAL_STRING_FROM_HASH(l_LMS_ElementDescriptor.typ,
				      p_pElementDescriptor, "type");
	GET_OPTIONAL_STRING_FROM_HASH(l_LMS_ElementDescriptor.version,
				      p_pElementDescriptor, "version");
    CODE:
	/* call library function: */
	lmsup1(&l_LMS_ControlBlock,
	       &l_LMS_RecordDescriptor,
	       &l_LMS_LibraryDescriptor,
	       &l_LMS_ElementDescriptor);
	/* get normal return values and version in addition: */
	if (! copy_returncodes(&l_LMS_ControlBlock, p_pAccessor))
	  XSRETURN_UNDEF;
	if (l_LMS_ControlBlock.retcode != LMSUP_OK)
	  XSRETURN_UNDEF;
	/* return record access ID: */
	RETVAL = l_LMS_RecordDescriptor.rec_acc_id;
    OUTPUT:
	RETVAL


 ########################################################################
 # call:								#



( run in 0.961 second using v1.01-cache-2.11-cpan-39bf76dae61 )