|
|
1.1 ! root 1: /* bit2prim.c - bit string to presentation element */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/psap/RCS/bit2prim.c,v 7.0 89/11/23 22:12:31 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/psap/RCS/bit2prim.c,v 7.0 89/11/23 22:12:31 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: bit2prim.c,v $ ! 12: * Revision 7.0 89/11/23 22:12:31 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: PE bit2prim_aux (); ! 35: ! 36: /* */ ! 37: ! 38: PE bit2prim (pe) ! 39: register PE pe; ! 40: { ! 41: if (pe == NULLPE) ! 42: return NULLPE; ! 43: ! 44: switch (pe -> pe_form) { ! 45: case PE_FORM_PRIM: ! 46: if (pe -> pe_prim == NULLPED) { ! 47: if ((pe -> pe_prim = PEDalloc (1)) == NULLPED) ! 48: return NULLPE; ! 49: pe -> pe_len = 1; ! 50: pe -> pe_nbits = 0; ! 51: } ! 52: /* and fall */ ! 53: ! 54: case PE_FORM_CONS: ! 55: if (bit2prim_aux (pe) == NULLPE) ! 56: return NULLPE; ! 57: break; ! 58: } ! 59: ! 60: return pe; ! 61: } ! 62: ! 63: /* */ ! 64: ! 65: static PE bit2prim_aux (pe) ! 66: register PE pe; ! 67: { ! 68: int i; ! 69: register PE p; ! 70: ! 71: if (pe == NULLPE) ! 72: return NULLPE; ! 73: ! 74: switch (pe -> pe_form) { ! 75: case PE_FORM_PRIM: ! 76: if (pe -> pe_prim && pe -> pe_len) { ! 77: if ((i = (((pe -> pe_len - 1) * 8) - pe -> pe_nbits)) > 7) ! 78: return pe_seterr (pe, PE_ERR_BITS, NULLPE); ! 79: pe -> pe_prim[0] = i & 0xff; ! 80: ! 81: } ! 82: break; ! 83: ! 84: case PE_FORM_CONS: ! 85: for (p = pe -> pe_cons; p; p = p -> pe_next) ! 86: if (bit2prim (p) == NULLPE) ! 87: return NULLPE; ! 88: break; ! 89: } ! 90: ! 91: return pe; ! 92: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.