|
|
1.1 ! root 1: /* prim2bit.c - presentation element to bit string */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/psap/RCS/prim2bit.c,v 7.0 89/11/23 22:13:09 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/psap/RCS/prim2bit.c,v 7.0 89/11/23 22:13:09 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: prim2bit.c,v $ ! 12: * Revision 7.0 89/11/23 22:13:09 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: ! 35: PE prim2bit (pe) ! 36: register PE pe; ! 37: { ! 38: int i; ! 39: register PElementData bp; ! 40: register PElementLen len; ! 41: register PE p; ! 42: ! 43: switch (pe -> pe_form) { ! 44: case PE_FORM_PRIM: /* very paranoid... */ ! 45: if ((bp = pe -> pe_prim) && (len = pe -> pe_len)) { ! 46: if ((i = *bp & 0xff) > 7) ! 47: return pe_seterr (pe, PE_ERR_BITS, NULLPE); ! 48: pe -> pe_nbits = ((len - 1) * 8) - i; ! 49: } ! 50: else ! 51: pe -> pe_nbits = 0; ! 52: break; ! 53: ! 54: case PE_FORM_CONS: ! 55: pe -> pe_nbits = 0; ! 56: for (p = pe -> pe_cons; p; p = p -> pe_next) { ! 57: if (prim2bit (p) == NULLPE) ! 58: return NULLPE; ! 59: pe -> pe_nbits += p -> pe_nbits; ! 60: } ! 61: break; ! 62: } ! 63: ! 64: return pe; ! 65: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.