home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d2xx
/
d222
/
plplot.lha
/
Plplot
/
src
/
source.zoo
/
plstyl.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-15
|
1KB
|
51 lines
/* Set up a new line style of "nels" elements, with mark and space */
/* lengths given by arrays "mk" and "sp". */
#include "plplot.h"
#include "declare.h"
void plstyl(nels,mk,sp)
int nels,mk[],sp[];
{
int i;
if ((nels < 0) || (nels > 10)) {
fatal("Broken lines cannot have <0 or >10 elements");
}
nms = nels;
for (i=0; i<nels; i++) {
mark[i] = mk[i];
space[i] = sp[i];
if ((mk[i] < 0) || (sp[i] < 0))
fatal("Mark and space lengths must be > 0 in PLSTYL");
}
curel = 0;
pendn = 1;
timecnt = 0;
alarm = mark[curel];
}
/* Updates line style variables, called whenever alarm goes off */
void plupd()
{
while ( timecnt >= alarm ) {
if (pendn != 0) {
pendn = 0;
timecnt = timecnt - alarm;
alarm = space[curel];
}
else {
pendn = 1;
timecnt = timecnt - alarm;
curel = curel + 1;
if (curel >= nms) curel = 0;
alarm = mark[curel];
}
}
}