|
|
DataMuseum.dkPresents historical artifacts from the history of: ICL Comet 32 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about ICL Comet 32 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 5639 (0x1607)
Types: TextFile
Notes: UNIX file
Names: »coutput.old«
└─⟦26887b7e0⟧ Bits:30009717 Comet 32 harddisk image
└─⟦28c352965⟧ »/a« UNIX Filesystem
└─⟦this⟧ »usr/src/gks/comet/coutput.old«
#include "../h/vdi.h"
#include "../h/vdii.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1pln - POLYLINE.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
dt1pln(n, p) /* POLYLINE */
Size n;
Nc *p;
{ int i;
Ac q1, q2;
/* Set current position to impossible value to force move to first pt.*/
ws->cpa.a_x = -1;
ws->cpa.a_y = -1;
#if DBG > 0
printf("polyline=%f %f %f %f\n",p->n_x,p->n_y,(p+1)->n_x,(p+1)->n_y);
#endif
/* Send each line to the clipper and possibly on to the terminal.*/
t1wstr(p[0], &q1);
for (i = 1; i < n; i++)
{ t1wstr(p[i], &q2);
t1clln(q1, q2);
q1 = q2;
ws->cpa.a_x = q2.a_x;
ws->cpa.a_y = q2.a_y;
#if DBG > 0
printf("q2=%d %d\n",q2.a_x,q2.a_y);
#endif
}
ws->ws_emty = FALSE;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1pmk - POLYMARKER.
*
* rwsimon - 15 Sep 82
*
* Environment - Computer-indept., system-indept., C, VDI.
* Tektronix 4010 series, required function.
*
* Input - ws = pointer to workstation state table.
* n = number of markers. Range: (1..n).
* p = coordinates of markers. Range: NDC.
*
* Process - A sequence of markers is generated to identify all the
* given positions. The polymarker attribute entries in
* the device are bound to the primitive when it
* is created. These attribute entries are
* polymarker type and polymarker colour index.
*
* Output -
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
dt1pmk(n, p) /* POLYMARKER */
Size n;
Nc *p;
{ int i,txci;
Ac q;
static char mark[4][2] = {"+", "*", "o", "x"};
Charhtn svcht;
Horal svcha;
Veral svcva;
/* Set current position to impossible value to force move to first pt.*/
ws->cpa.a_x = -1;
ws->cpa.a_y = -1;
/* Perform workstation transformation from NDC to AC for each point.*/
/* Clip each point and possibly send it on to the terminal.*/
if (ws->mtyp == 1)
for (i = 0; i < n; i++)
{ t1wstr(p[i], &q);
t1clpt(q);
ws->cpa.a_x = q.a_x;
ws->cpa.a_y = q.a_y;
}
else
{ /* Use hardware characters for all markers except point.*/
svcht = ws->ncht;
dt1cht(.01);
txci = ws->txcol;
dt1tco(ws->macol);
svcha = ws->cha;
svcva = ws->cva;
dt1cal(CENTRE, HALF);
for (i = 0; i < n; i++)
dt1txt(&p[i], mark[ws->mtyp - 2]);
dt1cht(svcht);
dt1cal(svcha, svcva);
dt1tco(txci);
}
ws->ws_emty = FALSE;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1txt - TEXT.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
dt1txt(p, s) /* TEXT */
Nc *p;
String s;
{ Ac q; /* Position of next character in address coords.*/
Nc r;
/* Emulate character alignment.*/
r = *p;
emuchal(&r, s);
/* Perform workstation transformation from NDC to AC on position.*/
t1wstr(r, &q);
ws->cpa.a_x = q.a_x;
ws->cpa.a_y = q.a_y;
/* Loop thru all characters in string s till find terminator.*/
for (; *s != '\0'; s++)
{ /* Clip each character and possibly send on to device.*/
#if DBG > 0
printf("charpos = %d %d\n",q.a_x,q.a_y);
#endif
t1clch(q, *s);
/* Update q for next clip.*/
switch (ws->tpa) {
case RRIGHT:
q.a_x = q.a_x + ws->csp.a_x;
break;
case DOWN:
q.a_y = q.a_y - ws->csp.a_y;
break;
case UP:
q.a_y = q.a_y + ws->csp.a_y;
break;
case LLEFT:
q.a_x = q.a_x - ws->csp.a_x;
break;
default :
q.a_x = q.a_x + ws->csp.a_x;
break;
}
}
ws->ws_emty = FALSE;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* emuchal - Emulate character alignment.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
emuchal(q, s)
Nc *q;
String s;
{ Nc cat;
Nrect tr;
/* Inquire text extent.*/
dt1ite(q, s, &cat, &tr);
/* Set text position to (LEFT, BASE).*/
/* Have to raise text slightly, as it comes out too low.*/
q->n_x = tr.n_ll.n_x;
q->n_y = cat.n_y + (tr.n_ur.n_y - tr.n_ll.n_y)/12;
}
#define DDBG 0
/********************************************************************
*
* dt1far FILL AREA.
*
*********************************************************************/
dt1far (n,p)
Size n;
Nc *p;
{ Nc q[2];
Arect farrec;
Ac q1;
Int i,j,k,tplci;
if (ws->fis == HOLLOW){
#if DDBG > 0
printf("HOLLOW dt1far is called\n");
#endif
tplci = ws->plci;
printf("fcol = %d\n",ws->plci);
dt1lco(ws->fcol);
dt1pln(n,p);
/* Close the polygon. */
q[0] = p[0];
q[1] = p[n - 1];
dt1pln(2, q);
dt1lco(tplci);
} else {
#if DDBG > 0
printf("SOLID dt1far is called\n");
#endif
/* Interior style is SOLID */
q[0] = q[1] = p[0];
for (i=1; i<n; i++){
/* Get max y-coordinate */
if ((p+i)->n_y > q[1].n_y)
q[1].n_y = (p+i)->n_y;
/* Get min y-coordinate */
if ((p+i)->n_y < q[0].n_y)
q[0].n_y = (p+i)->n_y;
/* Get max x-coordinate */
if ((p+i)->n_x > q[1].n_x)
q[1].n_x = (p+i)->n_x;
/* Get min x-coordinate */
if ((p+i)->n_x < q[0].n_x)
q[0].n_x = (p+i)->n_x;
}
t1wstr(q[0],&q1);
if (t1code(q1) > 0) goto err;
farrec.a_ll.a_x = q1.a_x;
farrec.a_ll.a_y = q1.a_y;
t1wstr(q[1],&q1);
if (t1code(q1) > 0) goto err;
farrec.a_ur.a_x = q1.a_x;
farrec.a_ur.a_y = q1.a_y;
#if DDBG > 0
printf("farrec.ur= %d %d\n",q1.a_x,q1.a_y);
#endif
tplci = ws->plci;
dt1lco(8); /* Invisible colour */
dt1pln(n,p);
/* Close the polygon. */
q[0] = p[0];
q[1] = p[n - 1];
dt1pln(2, q);
ws->plci = tplci;
dt1lco(tplci);
fill(&farrec,n,p);
dt1pln(n,p);
dt1pln(2, q);
}
err: ;
}