|
|
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: 5259 (0x148b)
Types: TextFile
Notes: UNIX file
Names: »ccontrol.c«
└─⟦26887b7e0⟧ Bits:30009717 Comet 32 harddisk image
└─⟦28c352965⟧ »/a« UNIX Filesystem
└─⟦this⟧ »usr/src/gks/comet/ccontrol.c«
#include "../h/vdi.h"
#include "../h/vdii.h"
#define NO_WSS 1 /* Number of simultaneous active workstations allowed.*/
Wss wss[NO_WSS]; /* Workstation state lists.*/
Bool wssalloc[NO_WSS] = {FALSE};
/* Allocate the first available wss and return pointer to it, else NULL.*/
Wss*
getwss()
{ int i;
for (i = 0; i < NO_WSS; i++)
if (!wssalloc[i])
{ wssalloc[i] = TRUE;
return (&wss[i]);
}
return (NULL);
}
/* Deallocate the wss pointed to by the parameter.*/
frewss(wst)
Wss *wst;
{ int i;
for (i = 0; i < NO_WSS; i++)
if (wst == &wss[i])
{ wssalloc[i] = FALSE;
return;
}
fprintf(stderr, "frewss: invalid pointer to ws state list.\n");
return;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1ope - OPEN WORKSTATION.
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Wss *
dt1ope( wsd) /* OPEN WORKSTATION */
Wsd *wsd; /* Workstation description table.*/
{ /* Get a workstation state list, return NULL if none available.*/
if ((ws = getwss()) == NULL)
return(ws);
/* Initialize values in the workstation state table.*/
ws->ws_wsd = wsd;
#if DBG > 0
printf("gksdev = %s\n",dev);
#endif
initgraph();
ws->ws_ncolr = wsd->wd_ncolr;
ws->ws_colr = wsd->wd_colr;
ws->ws_imprg = wsd->wd_imprg;
ws->ws_waitr = TRUE; /* Set so dt1upd will do the right thing.*/
ws->ws_emty = FALSE; /* Set so dt1upd will do the right thing.*/
ws->ws_reqw.n_ll.n_x = 0.0;
ws->ws_reqw.n_ll.n_y = 0.0;
ws->ws_reqw.n_ur.n_x = 1.0;
ws->ws_reqw.n_ur.n_y = 1.0;
ws->ws_reqv = wsd->wd_dlim;
ws->ws_nfup = TRUE; /* Set so dt1upd will do the right thing.*/
ws->ws_cps = 960;
ws->dtr.xm = (Real)(wsd->wd_alim.a_ur.a_x - wsd->wd_alim.a_ll.a_x)/
(wsd->wd_dlim.d_ur.d_x - wsd->wd_dlim.d_ll.d_x);
ws->dtr.xa = (Real)(wsd->wd_alim.a_ll.a_x) -
(Real)(wsd->wd_dlim.d_ll.d_x) * ws->dtr.xm;
ws->dtr.ym = (Real)(wsd->wd_alim.a_ur.a_y - wsd->wd_alim.a_ll.a_y)/
(wsd->wd_dlim.d_ur.d_y - wsd->wd_dlim.d_ll.d_y);
ws->dtr.ya = (Real)(wsd->wd_alim.a_ll.a_y) -
(Real)(wsd->wd_dlim.d_ll.d_y) * ws->dtr.ym;
ws->curc = ws->ws_reqw;
ws->ncht = 0.01;
ws->mtyp = 1;
ws->macol = 1;
ws->txcol = 1;
ws->fcol = 1;
ws->plci = 1;
ws->clpin = TRUE;
ws->cpa.a_x = -1;
ws->cpa.a_y = -1;
/* To set ws_curw, ws_curv, clip, wtr, csp, cht,
ws_waitr, ws_emty and ws_nfup, call update workstation.*/
dt1upd(PERFORM);
/* To set cha and cva, call set character alignment.*/
dt1cal(LEFT, BASE);
/* To set tpa, call set text path.*/
dt1tpa(RRIGHT);
return (ws);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1clo - CLOSE WORKSTAITON.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
dt1clo() /* CLOSE WORKSTATION */
{ Ac p; /* Lower left corner of device.*/
/* Reset character size to default.*/
dt1cht((Charhtn)0.01);
/* Leave graphics mode.*/
exitgraph();
/* Flush buffers to finish output of the last frame.*/
dt1upd(SUPPRESS);
/* Free the workstation state list.*/
frewss(ws);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1cle - CLEAR WORKSTATION.
*
*
* Process - All of the following actions are executed in the given
* sequence:
* a) All deferred actions for the specified workstation
* are executed (without intermediate clearing of the
* display surface).
* b) The display surface is set to a clear state according
* to the control flag as follows:
* CONDITIONALLY:
* The display surface is cleared only if the "display
* surface empty" entry in the workstation's state
* list is NOT EMPTY.
* ALWAYS:
* the display surface is cleared.
* c) The "set of
* stored segments for this workstation" in the
* workstation state list is set to "empty".
* d) The switch "new frame action necessary at update" in
* the workstation state list is set to NO.
* e) The switch "display surface empty" in the workstation
* state list is set to EMPTY.
*
* Output -
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
dt1cle(cf) /* CLEAR WORKSTATION */
Clearf cf; /* Control flag.*/
{ if (cf == CONDITIONALLY)
{ if (ws->ws_emty == FALSE) {
cleardisplay();
ws->ws_emty = TRUE;
ws->ws_nfup = FALSE;
}
}
else {
cleardisplay();
ws->ws_emty = TRUE;
ws->ws_nfup = FALSE;
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1upd - UPDATE WORKSTATION.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
dt1upd(rf) /* UPDATE WORKSTATION */
Regenf rf;
{ int numsyn;
if ((rf == PERFORM) && ((ws->ws_nfup == TRUE) || (ws->ws_waitr == TRUE)))
{ /* Clear display surface if necessary.*/
if (ws->ws_emty == FALSE)
cleardisplay();
ws->ws_emty = TRUE;
ws->ws_nfup = FALSE;
/* Update workstation transformation if necessary.*/
if (ws->ws_waitr == TRUE)
{ ws->ws_curw = ws->ws_reqw;
ws->ws_curv = ws->ws_reqv;
t1cwst();
}
}
}