|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T q
Length: 2917 (0xb65) Types: TextFile Names: »qb2pe.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« └─⟦d3ac74d73⟧ └─⟦this⟧ »isode-5.0/psap/qb2pe.c«
/* qb2pe.c - create a variable-depth Inline CONStructor PElement */ #ifndef lint static char *rcsid = "$Header: /f/osi/psap/RCS/qb2pe.c,v 6.0 89/03/18 23:39:08 mrose Rel $"; #endif /* * $Header: /f/osi/psap/RCS/qb2pe.c,v 6.0 89/03/18 23:39:08 mrose Rel $ * * * $Log: qb2pe.c,v $ * Revision 6.0 89/03/18 23:39:08 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" #include "tailor.h" /* \f */ PE qb2pe_aux (); /* \f */ PE qb2pe (qb, len, depth, result) register struct qbuf *qb; int len, depth; int *result; { char *sp; register struct qbuf *qp, *qpp; PE pe; *result = PS_ERR_NONE; if (depth <= 0) return NULLPE; if ((qp = qb -> qb_forw) != qb && qp -> qb_forw == qb) sp = qp -> qb_data; else { qp = NULL; if ((sp = qb2str (qb)) == NULL) { *result = PS_ERR_NMEM; return NULLPE; } } if (pe = qb2pe_aux (sp, len, depth, result)) { if (qp) { pe -> pe_realbase = (char *) qp; remque (qp); } else { pe -> pe_realbase = sp; for (qp = qb -> qb_forw; qp != qb; qp = qpp) { qpp = qp -> qb_forw; remque (qp); free ((char *) qp); } } pe -> pe_inline = 0; } else if (qp == NULL) free (sp); #ifdef DEBUG if (pe && (psap_log -> ll_events & LLOG_PDUS)) pe2text (psap_log, pe, 1, len); #endif return pe; } /* \f */ static PE qb2pe_aux (s, len, depth, result) register char *s; register int len; int depth; int *result; { int i; register PElementData data; register PE pe, p, q; PE *r, *rp; depth--; if ((pe = str2pe (s, len, &i, result)) == NULLPE) return NULLPE; if (pe -> pe_form == PE_FORM_ICONS) { pe -> pe_form = PE_FORM_CONS; pe -> pe_prim = NULLPED, pe -> pe_inline = 0; pe -> pe_len -= pe -> pe_ilen; p = NULLPE, r = &pe -> pe_cons; for (s += pe -> pe_ilen, len -= pe -> pe_ilen; len > 0; s += i, len -= i) { if ((p = str2pe (s, len, &i, result)) == NULLPE) goto out; if (p -> pe_form == PE_FORM_ICONS) { if (depth > 0) { if ((q = qb2pe_aux ((char *) p -> pe_prim, i, depth, result)) == NULLPE) goto out; pe_free (p); p = q; } else { if ((data = PEDalloc (i)) == NULL) { *result = PS_ERR_NMEM; goto out; } PEDcpy (p -> pe_prim, data, i); p -> pe_prim = data, p -> pe_inline = 0; } } *r = p, rp = r, r = &p -> pe_next; } if (p && p -> pe_class == PE_CLASS_UNIV && p -> pe_id == PE_UNIV_EOC) { pe_free (p); *rp = NULLPE; } } return pe; out: ; pe_free (pe); return NULLPE; }