DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T p

⟦f9e87839c⟧ TextFile

    Length: 2089 (0x829)
    Types: TextFile
    Names: »prim2qb.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« 
        └─⟦de7628f85⟧ 
            └─⟦this⟧ »isode-6.0/psap/prim2qb.c« 

TextFile

/* prim2qb.c - presentation element to qbuf */

#ifndef	lint
static char *rcsid = "$Header: /f/osi/psap/RCS/prim2qb.c,v 7.0 89/11/23 22:13:13 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/psap/RCS/prim2qb.c,v 7.0 89/11/23 22:13:13 mrose Rel $
 *
 *
 * $Log:	prim2qb.c,v $
 * Revision 7.0  89/11/23  22:13:13  mrose
 * Release 6.0
 * 
 */

/*
 *				  NOTICE
 *
 *    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
 *    this agreement.
 *
 */


/* LINTLIBRARY */

#include <stdio.h>
#include "psap.h"

/* \f

 */

struct qbuf *prim2qb (pe)
register PE    pe;
{
    register struct qbuf *qb,
		         *qp;
    register PE	    p;
    register PElementClass class;
    register PElementID id;

    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;
	
    switch (pe -> pe_form) {
	case PE_FORM_PRIM:
	    if ((qp = str2qb ((char *) pe -> pe_prim, (int) pe -> pe_len, 0))
		    == NULL) {
		pe -> pe_errno = PE_ERR_NMEM;
		goto out;
	    }
	    qb -> qb_len = qp -> qb_len;
	    insque (qp, qb);
	    break;

	case PE_FORM_CONS:
	    if ((p = pe -> pe_cons) == NULLPE)
		break;
	    class = p -> pe_class, id = p -> pe_id;
	    for (p = pe -> pe_cons; p; p = p -> pe_next) {
		register struct qbuf *qpp,
				     *qbp;

		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;
		    goto out;
		}
		if ((qp = prim2qb (p)) == NULL) {
		    pe -> pe_errno = p -> pe_errno;
		    goto out;
		}

		for (qpp = qp -> qb_forw; qpp != qp; qpp = qbp) {
		    qbp = qpp -> qb_forw;

		    remque (qpp);
		    insque (qpp, qb -> qb_back);

		    qb -> qb_len += qpp -> qb_len;
		}
		free ((char *) qp);
	    }
	    break;
    }

    return qb;

out: ;
    qb_free (qb);

    return NULL;
}