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

⟦83752d2dc⟧ TextFile

    Length: 2006 (0x7d6)
    Types: TextFile
    Names: »prim2qb.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/psap/prim2qb.c« 

TextFile

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

#ifndef	lint
static char *rcsid = "$Header: /f/osi/psap/RCS/prim2qb.c,v 6.0 89/03/18 23:38:56 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/psap/RCS/prim2qb.c,v 6.0 89/03/18 23:38:56 mrose Rel $
 *
 *
 * $Log:	prim2qb.c,v $
 * Revision 6.0  89/03/18  23:38:56  mrose
 * Release 5.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) {
		    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);
		    qb -> qb_len += qpp -> qb_len;
		    insque (qpp, qb -> qb_back);
		}
		free ((char *) qp);
	    }
	    break;
    }

    return qb;

out: ;
    qb_free (qb);

    return NULL;
}