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 - download
Index: ┃ T m

⟦8b4a5b2e0⟧ TextFile

    Length: 3640 (0xe38)
    Types: TextFile
    Names: »manregis.c«

Derivation

└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
    └─ ⟦this⟧ »cph85dist/mandelbrot/manregis.c« 

TextFile

/*
 * Display Mandelbrot set pixels.
 *
 * This version uses the Regis display protocol (for Dec VT125,
 * VT240, and PRO-350).  It should be "fairly" easy to adapt
 * it for other displays.
 */

#include	<stdio.h>
#include	<ctype.h>
#ifdef vms
#include	errno
#define	IO_ERROR	errno
#endif
#define FALSE	0
#define TRUE	1
#define	EOS	'\0'

/*
 * The Regis screen is fixed at 767 horizontal by 479 vertical pixels.
 * Although there is are relative coordinate system commands, we don't bother.
 * XORIGIN and YORIGIN define the lower-left corner of the Mandelbrot display.
 */

#define	MAX_NPIXEL	400
#define	SMAXX		768
#define SMAXY		480
#define XORIGIN		300
#define YORIGIN		425
#define GRAY_SCALE	13		/* Density ranges from 0 to 12	*/
#define	TICK		8		/* Length of boarder tick-marks	*/
#define	CXSIZE		8		/* Character width		*/
#define	CYSIZE		10		/* Character height		*/
/*
 * Globalize these values for the main display code.
 */
int	max_npixel = MAX_NPIXEL;
int	smaxx = SMAXX;
int	smaxy = SMAXY;
int	xorigin = XORIGIN;
int	yorigin = YORIGIN;
int	gray_scale = GRAY_SCALE;	/* Make known to mandisp.c	*/
int	tick = TICK;
int	cxsize = CXSIZE;
int	cysize = CYSIZE;

/*
 * Display routines for the bit-map display.
 *	dsp_init()		Initialize for bit-map writing, clear screen.
 *	dsp_done()		Done writing to the bit-map (don't clear)
 *	dsp_finis()		All done (about to exit to o.s., clear screen)
 *	dsp_move(r,c)		Move bitmap cursor to to this row-column
 *	dsp_endline()		Finish off a scanline
 *	dsp_draw(d,len)		Draw a horizontal line of the selected density
 *	dsp_text(r,c,t)		Write text string from this position
 *	dsp_line(x,yf,xt,yt)	Draw line from [xf,yf] to [xt,yt]
 */

dsp_init()
/*
 * Start writing to the bitmap display.
 */
{
	printf("\33P1pS[0,0]S(E)S(C0)");	/* Regis initialize	*/
	printf("S(M0(L0)1(L25)2(L50)3(L75))");	/* Regis Luminance	*/
}

dsp_done()
/*
 * Stop writing to the bitmap (don't clear it).
 */
{
	printf("\033\\");
	fflush(stdout);
}

dsp_finis()
/*
 * Exiting, clear display.
 */
{
	printf("\033P1pS(E)\033\\");
	fflush(stdout);
}

dsp_move(row, col)
int		row, col;
/*
 * Move bitmap cursor to this position.
 */
{
	printf("P[%d,%d]", row, col);
}

dsp_endline()
/*
 * Executed at the end of a scan line.
 */
{
	printf("W(I3)W(P1)");		/* Reset density to known state	*/
	fflush(stdout);
}

char	*dens_command[GRAY_SCALE] = {	/* Regis display controls	*/
	"W(I0)",			/*  0 == black			*/
	"W(I1)W(P6)",			/*  1 == dim,  sparse dots	*/
	"W(I1)W(P4)",			/*  2 == dim,  half-dense dots	*/
	"W(I1)W(P5)",			/*  3 == dim,  dense dots	*/
	"W(I1)W(P1)",			/*  4 == dim,  full line	*/
	"W(I2)W(P6)",			/*  5 == mid,  sparse dots	*/
	"W(I2)W(P4)",			/*  6 == mid,  half-dense dots	*/
	"W(I2)W(P5)",			/*  7 == mid,  dense dots	*/
	"W(I2)W(P1)",			/*  8 == mid,  full line	*/
	"W(I3)W(P6)",			/*  9 == full, sparse dots	*/
	"W(I3)W(P4)",			/* 10 == full, half-dense dots	*/
	"W(I3)W(P5)",			/* 11 == full, dense dots	*/
	"W(I3)W(P1)",			/* 12 == full, full line	*/
};

dsp_draw(density, length)
int		density;
int		length;
/*
 * Draw a line of this density.
 * On entrance, cursor is at the left edge of the line.
 * Leave the cursor at the end of the line.
 */
{
	if (density < 0)
	    density = 0;
	else if (density >= GRAY_SCALE)
	    density = GRAY_SCALE - 1;
	printf("%sV[+%d]", dens_command[density], length);
}


dsp_text(row, col, text)
int		row, col;
char		*text;		/* Must not contain a single quote "'"	*/
{
	dsp_move(row, col);
	printf("T'%s'", text);
}

dsp_line(xfrom, yfrom, xto, yto)
int		xfrom, yfrom;
int		xto,   yto;
/*
 * Draw a line
 */
{
	dsp_move(xfrom, yfrom);
	printf("V[%d,%d]", xto, yto);
}