/* prim2qb.c - presentation element to qbuf */
static char *rcsid
= "$Header: /f/osi/psap/RCS/prim2qb.c,v 7.1 91/02/22 09:36:24 mrose Interim $";
* $Header: /f/osi/psap/RCS/prim2qb.c,v 7.1 91/02/22 09:36:24 mrose Interim $
* Revision 7.1 91/02/22 09:36:24 mrose
* Revision 7.0 89/11/23 22:13:13 mrose
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
struct qbuf
*prim2qb (pe
)
register struct qbuf
*qb
,
register PElementClass
class;
if ((qb
= (struct qbuf
*) malloc (sizeof *qb
)) == NULL
)
return pe_seterr (pe
, PE_ERR_NMEM
, (struct qbuf
*) NULL
);
qb
-> qb_forw
= qb
-> qb_back
= qb
;
qb
-> qb_data
= NULL
, qb
-> qb_len
= 0;
if ((qp
= str2qb ((char *) pe
-> pe_prim
, (int) pe
-> pe_len
, 0))
pe
-> pe_errno
= PE_ERR_NMEM
;
qb
-> qb_len
= qp
-> qb_len
;
if ((p
= pe
-> pe_cons
) == NULLPE
)
class = p
-> pe_class
, id
= p
-> pe_id
;
for (p
= pe
-> pe_cons
; p
; p
= p
-> pe_next
) {
register struct qbuf
*qpp
,
if ((p
-> pe_class
!= class || p
-> pe_id
!= id
)
&& (p
-> pe_class
!= PE_CLASS_UNIV
|| p
-> pe_id
!= PE_PRIM_OCTS
)) {
pe
-> pe_errno
= PE_ERR_TYPE
;
if ((qp
= prim2qb (p
)) == NULL
) {
pe
-> pe_errno
= p
-> pe_errno
;
for (qpp
= qp
-> qb_forw
; qpp
!= qp
; qpp
= qbp
) {
insque (qpp
, qb
-> qb_back
);
qb
-> qb_len
+= qpp
-> qb_len
;