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 s

⟦99f20cc67⟧ TextFile

    Length: 1460 (0x5b4)
    Types: TextFile
    Names: »strb2bitstr.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦041b9c0f8⟧ »EurOpenD22/isode/pepsy.system-6.0.Z« 
        └─⟦d49939f05⟧ 
            └─⟦6a28ec38e⟧ »pepsy.tar« 
                └─⟦this⟧ »pepsy/strb2bitstr.c« 

TextFile

/* strb2bitstr.c - string of bits to bit string */

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

/* 
 * $Header: /f/osi/psap/RCS/strb2bitstr.c,v 6.0 89/03/18 23:39:32 mrose Rel $
 *
 *
 * $Log:	strb2bitstr.c,v $
 * Revision 6.0  89/03/18  23:39:32  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

 */

PE	strb2bitstr (cp, len, class, id)
register char  *cp;
register int     len;
PElementClass class;
PElementID id;
{
    register int    i,
		    j,
                    bit,
		    mask;
    register PE	    p;

    if ((p = pe_alloc (class, PE_FORM_PRIM, id)) == NULLPE)
	return NULLPE;

    p = prim2bit (p);
    if (len > 0 && bit_off (p, len - 1) == NOTOK) {
no_mem: ;
        pe_free (p);
        return NULLPE;
    }

#ifdef	FAST
    if (p->pe_form == PE_FORM_PRIM) {
	bcopy(cp, p->pe_prim + 1, (len + 7)/8);
	return p;
    }
#endif
    for (bit = (*cp & 0xff), i = 0, mask = 1 << (j = 7); i < len; i++) {
	if ((bit & mask) && bit_on (p, i) == NOTOK)
	    goto no_mem;
	if (j-- == 0)
	    bit = *++cp & 0xff, mask = 1 << (j = 7);
	else
	    mask >>= 1;
    }

    return p;
}