Annotation of 43BSDReno/contrib/isode-beta/psap/pe_pullup.c, revision 1.1

1.1     ! root        1: /* pe_pullup.c - "pullup" a presentation element */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/psap/RCS/pe_pullup.c,v 7.0 89/11/23 22:13:06 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/psap/RCS/pe_pullup.c,v 7.0 89/11/23 22:13:06 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       pe_pullup.c,v $
        !            12:  * Revision 7.0  89/11/23  22:13:06  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include <stdio.h>
        !            31: #include "psap.h"
        !            32: 
        !            33: 
        !            34: PElementData   pe_pullup_aux ();
        !            35: 
        !            36: /*  */
        !            37: 
        !            38: int    pe_pullup (pe)
        !            39: register PE    pe;
        !            40: {
        !            41:     PElementLen            len;
        !            42:     register PElementData dp;
        !            43:     register PE            p;
        !            44: 
        !            45:     if (pe -> pe_form != PE_FORM_CONS)
        !            46:        return OK;
        !            47: 
        !            48:     if ((dp = pe_pullup_aux (pe, &len)) == NULLPED)
        !            49:        return NOTOK;
        !            50: 
        !            51:     for (p = pe -> pe_cons; p; p = p -> pe_next)
        !            52:        pe_free (p);
        !            53: 
        !            54:     pe -> pe_form = PE_FORM_PRIM;
        !            55:     pe -> pe_len = len;
        !            56:     pe -> pe_prim = dp;
        !            57: 
        !            58:     return OK;
        !            59: }
        !            60: 
        !            61: /*  */
        !            62: 
        !            63: static PElementData  pe_pullup_aux (pe, len)
        !            64: register PE    pe;
        !            65: register int   *len;
        !            66: {
        !            67:     register int    i,
        !            68:                     k;
        !            69:     int     j;
        !            70:     register PElementClass class;
        !            71:     register PElementID id;
        !            72:     register PElementData dp,
        !            73:                          ep,
        !            74:                          fp;
        !            75:     register PE            p;
        !            76: 
        !            77:     switch (pe -> pe_form) {
        !            78:        case PE_FORM_PRIM: 
        !            79:            if ((dp = PEDalloc (i = pe -> pe_len)) == NULLPED)
        !            80:                return NULLPED;
        !            81:            PEDcpy (pe -> pe_prim, dp, i);
        !            82:            break;
        !            83: 
        !            84:        case PE_FORM_CONS: 
        !            85:            dp = NULLPED, i = 0;
        !            86:            class = pe -> pe_class, id = pe -> pe_id;
        !            87:            for (p = pe -> pe_cons; p; p = p -> pe_next) {
        !            88:                if (p -> pe_class != class
        !            89:                        || p -> pe_id != id
        !            90:                        || (ep = pe_pullup_aux (p, &j)) == NULLPED) {
        !            91:                    if (dp)
        !            92:                        PEDfree (dp);
        !            93:                    return NULLPED;
        !            94:                }
        !            95:                if (dp) {
        !            96:                    if ((fp = PEDrealloc (dp, k = i + j)) == NULLPED) {
        !            97:                        PEDfree (dp);
        !            98:                        return NULLPED;
        !            99:                    }
        !           100:                    PEDcpy (ep, fp + i, j);
        !           101:                    dp = fp, i = k;
        !           102:                }
        !           103:                else
        !           104:                    dp = ep, i += j;
        !           105:            }
        !           106:            break;
        !           107: 
        !           108:        case PE_FORM_ICONS:
        !           109:            return NULLPED;
        !           110:     }
        !           111: 
        !           112:     *len = i;
        !           113:     return (dp);
        !           114: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.