Init
This commit is contained in:
25
ucbcmd/plot/libplot/dumb/Makefile
Executable file
25
ucbcmd/plot/libplot/dumb/Makefile
Executable file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
#ident "@(#)Makefile 1.2 92/12/16 SMI"
|
||||
#
|
||||
# Copyright (c) 1989 by Sun Microsystems, Inc.
|
||||
#
|
||||
|
||||
LIBRARY= ../libdumb.a
|
||||
|
||||
OBJECTS = arc.o box.o circle.o close.o cont.o dot.o erase.o label.o \
|
||||
line.o linemod.o move.o open.o point.o space.o subr.o
|
||||
|
||||
# include library definitions
|
||||
include ../../../../lib/Makefile.lib
|
||||
|
||||
BUILD.AR = $(AR) $(ARFLAGS) $@ `$(LORDER) $(AROBJS) | $(TSORT)`
|
||||
|
||||
|
||||
CLOBBERFILES= $(LIBRARY)
|
||||
|
||||
.KEEP_STATE:
|
||||
|
||||
all: $(LIBS)
|
||||
|
||||
include ../../../../lib/Makefile.targ
|
||||
|
||||
27
ucbcmd/plot/libplot/dumb/arc.c
Executable file
27
ucbcmd/plot/libplot/dumb/arc.c
Executable file
@@ -0,0 +1,27 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)arc.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
arc(xc,yc,xbeg,ybeg,xend,yend)
|
||||
int xc,yc,xbeg,ybeg,xend,yend;
|
||||
{
|
||||
}
|
||||
30
ucbcmd/plot/libplot/dumb/box.c
Executable file
30
ucbcmd/plot/libplot/dumb/box.c
Executable file
@@ -0,0 +1,30 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)box.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
box(x0, y0, x1, y1)
|
||||
{
|
||||
move(x0, y0);
|
||||
cont(x0, y1);
|
||||
cont(x1, y1);
|
||||
cont(x1, y0);
|
||||
cont(x0, y0);
|
||||
move(x1, y1);
|
||||
}
|
||||
22
ucbcmd/plot/libplot/dumb/circle.c
Executable file
22
ucbcmd/plot/libplot/dumb/circle.c
Executable file
@@ -0,0 +1,22 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)circle.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
circle(){
|
||||
}
|
||||
37
ucbcmd/plot/libplot/dumb/close.c
Executable file
37
ucbcmd/plot/libplot/dumb/close.c
Executable file
@@ -0,0 +1,37 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)close.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include <signal.h>
|
||||
#include "dumb.h"
|
||||
|
||||
closepl()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for(j=0; j<LINES; j++){
|
||||
for(i=0; i<COLS; i++){
|
||||
printf("%c", screenmat[i][j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
signal(SIGINT, SIG_IGN);
|
||||
exit(0);
|
||||
}
|
||||
32
ucbcmd/plot/libplot/dumb/cont.c
Executable file
32
ucbcmd/plot/libplot/dumb/cont.c
Executable file
@@ -0,0 +1,32 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)cont.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
cont(x, y)
|
||||
int x,y;
|
||||
{
|
||||
int x1, y1;
|
||||
x1 = x;
|
||||
y1 = y;
|
||||
scale(x1, y1);
|
||||
dda_line('*', currentx, currenty, x, y);
|
||||
}
|
||||
23
ucbcmd/plot/libplot/dumb/dot.c
Executable file
23
ucbcmd/plot/libplot/dumb/dot.c
Executable file
@@ -0,0 +1,23 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)dot.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
dot(){
|
||||
}
|
||||
42
ucbcmd/plot/libplot/dumb/dumb.h
Executable file
42
ucbcmd/plot/libplot/dumb/dumb.h
Executable file
@@ -0,0 +1,42 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)dumb.h 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This accepts plot file formats and produces the appropriate plots
|
||||
* for dumb terminals. It can also be used for printing terminals and
|
||||
* lineprinter listings, although there is no way to specify number of
|
||||
* lines and columns different from your terminal. This would be easy
|
||||
* to change, and is left as an exercise for the reader.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define scale(x,y) y = LINES-1-(LINES*y/rangeY +minY); x = COLS*x/rangeX + minX
|
||||
|
||||
extern int minX, rangeX; /* min and range of x */
|
||||
extern int minY, rangeY; /* min and range of y */
|
||||
extern int currentx, currenty;
|
||||
extern int COLS, LINES;
|
||||
|
||||
/* A very large screen! (probably should use malloc) */
|
||||
#define MAXCOLS 132
|
||||
#define MAXLINES 90
|
||||
|
||||
extern char screenmat[MAXCOLS][MAXLINES];
|
||||
31
ucbcmd/plot/libplot/dumb/erase.c
Executable file
31
ucbcmd/plot/libplot/dumb/erase.c
Executable file
@@ -0,0 +1,31 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)erase.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
erase()
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
for(i=0;i<COLS;i++)
|
||||
for(j=0;j<LINES;j++)
|
||||
screenmat[i][j] = ' ';
|
||||
}
|
||||
34
ucbcmd/plot/libplot/dumb/label.c
Executable file
34
ucbcmd/plot/libplot/dumb/label.c
Executable file
@@ -0,0 +1,34 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)label.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
label(string)
|
||||
char *string;
|
||||
{
|
||||
while(*string != '\0' && currentx < COLS){
|
||||
screenmat[currentx][currenty] = *string++;
|
||||
currentx++;
|
||||
}
|
||||
if(currentx == COLS)
|
||||
currentx = currentx-1;
|
||||
|
||||
}
|
||||
37
ucbcmd/plot/libplot/dumb/line.c
Executable file
37
ucbcmd/plot/libplot/dumb/line.c
Executable file
@@ -0,0 +1,37 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)line.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
line(x0, y0, x1, y1)
|
||||
int x0, y0, x1, y1;
|
||||
{
|
||||
int x,y;
|
||||
|
||||
scale(x0, y0);
|
||||
x = x1;
|
||||
y = y1;
|
||||
scale(x, y);
|
||||
currentx = x0;
|
||||
currenty = y0;
|
||||
screenmat[currentx][currenty] = '*';
|
||||
dda_line('*', x0, y0, x1, y1);
|
||||
}
|
||||
25
ucbcmd/plot/libplot/dumb/linemod.c
Executable file
25
ucbcmd/plot/libplot/dumb/linemod.c
Executable file
@@ -0,0 +1,25 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)linemod.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
linemod(s)
|
||||
char *s;
|
||||
{
|
||||
}
|
||||
30
ucbcmd/plot/libplot/dumb/move.c
Executable file
30
ucbcmd/plot/libplot/dumb/move.c
Executable file
@@ -0,0 +1,30 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)move.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
move(x,y)
|
||||
int x,y;
|
||||
{
|
||||
scale(x, y);
|
||||
currentx = x;
|
||||
currenty = y;
|
||||
}
|
||||
70
ucbcmd/plot/libplot/dumb/open.c
Executable file
70
ucbcmd/plot/libplot/dumb/open.c
Executable file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)open.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This accepts plot file formats and produces the appropriate plots
|
||||
* for dumb terminals. It can also be used for printing terminals and
|
||||
* lineprinter listings, although there is no way to specify number of
|
||||
* lines and columns different from your terminal. This would be easy
|
||||
* to change, and is left as an exercise for the reader.
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include "dumb.h"
|
||||
|
||||
int minX, rangeX; /* min and range of x */
|
||||
int minY, rangeY; /* min and range of y */
|
||||
int currentx,currenty;
|
||||
int COLS,LINES;
|
||||
|
||||
/* A very large screen! (probably should use malloc) */
|
||||
char screenmat[MAXCOLS][MAXLINES];
|
||||
|
||||
openpl()
|
||||
{
|
||||
void closepl();
|
||||
int i, j;
|
||||
char *term, *getenv();
|
||||
char bp[1024];
|
||||
|
||||
term = getenv("TERM");
|
||||
tgetent(bp, term);
|
||||
|
||||
COLS = tgetnum("co");
|
||||
if (COLS > MAXCOLS)
|
||||
COLS = MAXCOLS;
|
||||
if (COLS < 0)
|
||||
COLS = 48; /* lower bound on # of cols? */
|
||||
COLS--; /* prevent auto wrap */
|
||||
|
||||
LINES = tgetnum("li");
|
||||
if (LINES > MAXLINES)
|
||||
LINES = MAXLINES;
|
||||
if (LINES < 0)
|
||||
LINES = 20; /* lower bound on # of lines? */
|
||||
|
||||
for(i=0; i<COLS; i++)
|
||||
for(j=0; j<LINES; j++)
|
||||
screenmat[i][j] = ' ';
|
||||
|
||||
signal(SIGINT, closepl);
|
||||
currentx = currenty = 0;
|
||||
}
|
||||
31
ucbcmd/plot/libplot/dumb/point.c
Executable file
31
ucbcmd/plot/libplot/dumb/point.c
Executable file
@@ -0,0 +1,31 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)point.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
point(x, y)
|
||||
int x,y;
|
||||
{
|
||||
scale(x, y);
|
||||
currentx = x;
|
||||
currenty = y;
|
||||
screenmat[currentx][currenty] = '*';
|
||||
}
|
||||
31
ucbcmd/plot/libplot/dumb/space.c
Executable file
31
ucbcmd/plot/libplot/dumb/space.c
Executable file
@@ -0,0 +1,31 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)space.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
space(x0, y0, x1, y1)
|
||||
int x0, y0, x1, y1;
|
||||
{
|
||||
minX = x0;
|
||||
rangeX = x1 -x0;
|
||||
minY = y0;
|
||||
rangeY = y1 - y0;
|
||||
}
|
||||
60
ucbcmd/plot/libplot/dumb/subr.c
Executable file
60
ucbcmd/plot/libplot/dumb/subr.c
Executable file
@@ -0,0 +1,60 @@
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "@(#)subr.c 1.1 90/08/19 SMI" /* SVr4.0 1.1 */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#include "dumb.h"
|
||||
|
||||
/* Does not plot first point -- assumed that it is already plotted */
|
||||
dda_line(ch, x0, y0, x1, y1)
|
||||
char ch;
|
||||
int x0, y0; /* already transformed to screen coords */
|
||||
int x1, y1; /* untransformed */
|
||||
{
|
||||
int length, i;
|
||||
double deltaX, deltaY;
|
||||
double x, y;
|
||||
double floor();
|
||||
int abs();
|
||||
|
||||
scale(x1, y1);
|
||||
|
||||
length = abs(x1 - x0);
|
||||
if (abs(y1 -y0) > length)
|
||||
length = abs(y1 - y0);
|
||||
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
deltaX = (double) (x1 - x0)/(double) length;
|
||||
deltaY = (double) (y1 - y0)/(double) length;
|
||||
|
||||
x = (double) x0 + 0.5;
|
||||
y = (double) y0 + 0.5;
|
||||
|
||||
for (i=0; i < length; ++i) {
|
||||
x += deltaX;
|
||||
y += deltaY;
|
||||
x0 = floor(x);
|
||||
y0 = floor(y);
|
||||
currentx = x0;
|
||||
currenty = y0;
|
||||
screenmat[currentx][currenty] = ch;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user