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 b

⟦945104389⟧ TextFile

    Length: 2474 (0x9aa)
    Types: TextFile
    Names: »b_output.BSD4_n.c«

Derivation

└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89
    └─⟦this⟧ »./tex82/Unsupported/MFpxl/mflib/b_output.BSD4_n.c« 
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12
    └─⟦beba6c409⟧ »unix3.0/Unsupported.tar.Z« 
        └─⟦25c524ae4⟧ 
            └─⟦this⟧ »Unsupported/MFpxl/mflib/b_output.BSD4_n.c« 

TextFile


#ifndef lint
static char RCSid[] = "$Header: b_output.c,v 1.0 86/01/31 14:58:36 richards Released $";
#endif

/*
 *	Byte output routines: a compiler independent set of routines for
 *				writing byte files for the MF utilities
 *
 *
 *		procedure bwritebyte(var bf: bytefile, n: integer);
 *			{ write next byte of byte file as byte n	}
 *
 *		procedure bwrite2bytes(var bf: bytefile, n: integer);
 *		procedure bwrite3bytes(var bf: bytefile, n: integer);
 *		procedure bwrite4bytes(var bf: bytefile, n: integer);
 *			{ similar to bwritebyte; but writes 2, 3, or 4	}
 *			{ bytes, (either as signed or unsigned values)	}
 *
 *		procedure bwritebuf(
 *			var	bf:	bytefile;
 *			var	buf:	packed array [] of eightbits;
 *				first:	integer;
 *				last:	integer );
 *			{ write a block of bytes from buf[first..last]	}
 *
 *
 */

#include <stdio.h>
#include "mftypes.h"

/*
 * procedure bwritebyte(var f: bytefile, n: integer);
 *
 *	write "n" as next byte to bytefile "bf".
 */

void bwritebyte(bf, n)
    bytefile	*bf;
    integer	n;
{
    register	FILE *fp = bf->b_fp;

    if (fp)
	(void)putc(n, fp);
    if (bf->b_locptr)
	*bf->b_locptr += 1;
}
 
/*
 * and the remaining bwriteXbyte procedures:
 */

void bwrite2bytes(bf, n)
    bytefile	*bf;
    register	integer n;
{
    register	FILE *fp = bf->b_fp;

    if (fp) {
	(void)putc((n >> 8), fp);
	(void)putc(       n, fp);
    }
    if (bf->b_locptr)
	*bf->b_locptr += 2;
}

void bwrite3bytes(bf, n)
    bytefile	*bf;
    register	integer n;
{
    register	FILE *fp = bf->b_fp;

    if (fp) {
	(void)putc((n >> 16), fp);
	(void)putc((n >>  8), fp);
	(void)putc(        n, fp); 
    }
    if (bf->b_locptr)
	*bf->b_locptr += 3;
}

void bwrite4bytes(bf, n)
    bytefile	*bf;
    register	integer n;
{
    register	FILE *fp = bf->b_fp;

    if (fp) {
	(void) putc((n >> 24), fp);
	(void) putc((n >> 16), fp);
	(void) putc((n >>  8), fp);
	(void) putc(        n, fp); 
    }
    if (bf->b_locptr)
	*bf->b_locptr += 4;
}

/*
 * procedure bwritebuf(
 *		var	bf: bytefile;
 *		var	buf: packed array[] of eightbits;
 *			first, last: integer);
 *
 *	write a block buffer of an array of "eightbits" to file "f"
 */

void bwritebuf(bf, buf, first, last)
    bytefile	*bf;
    eightbits	*buf;
    integer	first, last;
{
    register	FILE *fp = bf->b_fp;
    register	eightbits *bp, *ep;

    for (bp = &(buf[first]), ep = &(buf[last]); bp <= ep; bp++)
	(void) putc(*bp, fp);
    if (bf->b_locptr)
	*bf->b_locptr += (last-first+1);
}