-+-+-+-+-+-+-+-+ START OF PART 197 -+-+-+-+-+-+-+-+ X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setbackgroundcolourind(C(Pint) wsid, C(Pint) index) XPreANSI(Pint wsid) XPreANSI(Pint index) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPint`7D`7Bindex`7D`7Bcolour index`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the colour representation of the X** zeroth entry in the X** colour table of workstation \pardesc`7Bwsid`7D, to be same as the X** entry \pardesc`7Bindex`7D in the colour table.`7D X*/ X`7B X Pcobundl colour; X Pint err; X X pinqcolourrep(wsid, index, PREALIZED, &err, &colour); `20 X if (err == 0) X psetcolourrep(wsid, 0, &colour); X`7D /* ptk_setbackgroundcolourind */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setbackgroundcolour(C(Pint) wsid, C(Pchar *) colourname) XPreANSI(Pint wsid) XPreANSI(Pchar *colourname) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPchar *`7D`7Bcolourname`7D`7Bcolour name`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the colour representation of the X** zeroth entry in the X** colour table of workstation \pardesc`7Bwsid`7D, to be that X** specified by \pardesc`7Bcolourname`7D in the CNS.`7D X*/ X`7B X Pcobundl rgb; X Pint err; X X convertcolourname(colourname, &rgb, &err); X if ((err == 0) `7C`7C (err == 2)) X psetcolourrep(wsid, 0, &rgb); X`7D /* ptk_setbackgroundcolour */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setlinecolour(C(Pint) wsid, C(Pchar *) colourname) XPreANSI(Pint wsid) XPreANSI(Pchar *colourname) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPchar *`7D`7Bcolourname`7D`7Bcolour name`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the polyline colour index to be that specifie Vd by the given X** colour name in the `7B\tt "colourindex"`7D hashtable. The colour represen Vtation X** is set in the workstation colour table if necessary.`7D X*/ X`7B X Pint cindex; X X setcolourrep(wsid, colourname, &cindex); X if (cindex != -1) X psetlinecolourind(cindex); X`7D /* ptk_setlinecolour */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setmarkercolour(C(Pint) wsid, C(Pchar *) colourname) XPreANSI(Pint wsid) XPreANSI(Pchar *colourname) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPchar *`7D`7Bcolourname`7D`7Bcolour name`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the polymarker colour index to be that specif Vied by the given X** colour name in the `7B\tt "colourindex"`7D hashtable. The colour represen Vtation X** is set in the workstation colour table if necessary.`7D X*/ X`7B X Pint cindex; X X setcolourrep(wsid, colourname, &cindex); X if (cindex != -1) X psetmarkercolourind(cindex); X`7D /* ptk_setmarkercolour */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setintcolour(C(Pint) wsid, C(Pchar *) colourname) XPreANSI(Pint wsid) XPreANSI(Pchar *colourname) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPchar *`7D`7Bcolourname`7D`7Bcolour name`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the interior colour index to be that specifie Vd by the given X** colour name in the `7B\tt "colourindex"`7D hashtable. The colour represen Vtation X** is set in the workstation colour table if necessary.`7D X*/ X`7B X Pint cindex; X X setcolourrep(wsid, colourname, &cindex); X if (cindex != -1) X psetintcolourind(cindex); X`7D /* ptk_setintcolour */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_setedgecolour(C(Pint) wsid, C(Pchar *) colourname) XPreANSI(Pint wsid) XPreANSI(Pchar *colourname) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPchar *`7D`7Bcolourname`7D`7Bcolour name`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the edge colour index to be that specified by V the given X** colour name in the `7B\tt "colourindex"`7D hashtable. The colour represen Vtation X** is set in the workstation colour table if necessary.`7D X*/ X`7B X Pint cindex; X X setcolourrep(wsid, colourname, &cindex); X if (cindex != -1) X psetedgecolourind(cindex); X`7D /* ptk_setedgecolour */ X X/*-------------------------------------------------------------------------- V*/ X X/*function:external*/ Xextern void ptk_settextcolour(C(Pint) wsid, C(Pchar *) colourname) XPreANSI(Pint wsid) XPreANSI(Pchar *colourname) X/* X** \parambegin X** \param`7BPint`7D`7Bwsid`7D`7Bworkstation identifier`7D`7BIN`7D X** \param`7BPchar *`7D`7Bcolourname`7D`7Bcolour name`7D`7BIN`7D X** \param`7BPint`7D`7Bindex`7D`7Bcolour index`7D`7BIN`7D X** \paramend X** \blurb`7BThis function sets the text colour index to be that specified by V the given X** colour name in the `7B\tt "colourindex"`7D hashtable. The colour represen Vtation X** is set in the workstation colour table if necessary.`7D X*/ X`7B X Pint cindex; X X setcolourrep(wsid, colourname, &cindex); X if (cindex != -1) X psettextcolourind(cindex); X`7D /* ptk_settextcolour */ X X/*-------------------------------------------------------------------------- V*/ X X/* end of cns.c */ $ CALL UNPACK [.SOURCE.LIBRARY]CNS.C;1 56690461 $ create 'f' X/*-------------------------------------------------------------------------- V-- X X Module name: PHIGS Debugger. X X Author: Steve Larkin. X X Function: This module contains the PHIGS Debugger. X X Dependencies: X X Internal function list:`20 X X External function list:`20 X X Modification history: (Version), (Date), (name), (Description). X X 1.0, 23rd August 1988, S. Larkin, First version. X X 2.0, 30th October 1991, G. Williams, Translated to C. X X---------------------------------------------------------------------------- V*/ X X#include X#include X#include X#include "ptk.h" X X/*-------------------------------------------------------------------------- V*/ X X/* debugger data structures */ X Xtypedef enum X`7B X PTKEOK, X PTKEBREAK, X PTKESTRUCTEND, X PTKEDEBUGEND, X PTKEEXECUTE X`7D ptketraversalstate; X Xtypedef enum X`7B X PTKEBREAKPT, X PTKETRACEPT, X PTKEWATCHPT, X PTKENOOP X`7D ptkeoperationtype; X Xtypedef struct ptksdebuginfo X`7B X Pint debugstid; X Pint workingstid; X Pint debugelptr; X Pint workingelptr; X Pint elemcount; X Peltype eltype; X`7D ptksdebuginfo; X Xtypedef struct ptksdebugstack`20 X`7B X ptksdebuginfo debuginfo; X struct ptksdebugstack *next; X`7D ptksdebugstack; X Xtypedef struct ptksexeclist X`7B X Pint stid; X Pint numelems; X Pintlst bkpts; X Pintlst tcpts; X struct ptksexeclist *next; X`7D ptksexeclist; X Xstatic ptksdebugstack *debugstack = NULL; Xstatic ptksexeclist *stpoints = NULL; X Xstatic ptksdebuginfo currentinfo; Xstatic Pint elembuffer; Xstatic Pint structbuffer; Xstatic Pint structwindow, topologywindow, contentwindow, terminalwindow; Xstatic Pint elementwindow; Xstatic ptkboolean elemposted = FALSE; Xstatic Pint dbgcount = 0; Xstatic Pint elemcontent, structcontent, currentcontent; Xstatic Pint debugstackdepth = 0; Xstatic Pint debugwsid, debugrootstid; Xstatic Pint debugmenuid, windowmenuid, topologymenuid, contentmenuid; Xstatic Pint structmenuid, terminalmenuid, toptypemenuid; Xstatic Pint tslmenuid, tsl2menuid; Xstatic Pint rot3d1, rot3d2, rot2d1, rot2d2, rot1d; Xstatic Pint topology, topologystid; Xstatic ptketraversalstate traversalstate; Xstatic Ppoint3 origin = `7B0.0, 0.0, 0.0`7D; Xstatic Pintlst contentset, incl, excl; Xstatic Pint contentname, inclnames`5B2`5D; Xstatic Plimit topview = `7B0.0, 1.0, 0.0, 1.0`7D; Xstatic Pint curmenu = 0; Xstatic Pint curwindow = 0; Xstatic Pint lastcount, laststruct; Xstatic Pfloat devx, devy, devz; Xstatic Plimit echoarea; X X/* debugger attributes */ Xstatic Pint menucolourind = 0; Xstatic Pint windowcolourind = 0; Xstatic Pint menutextcolourind = 1; Xstatic Pint bannercolourind = 1; Xstatic Pint bannertextcolourind = 0; Xstatic Pint menutextfont = 1; Xstatic Pint windowtextfont = 1; Xstatic Pint backgroundcolourind = 0; Xstatic Pint tlcolourind = 1; Xstatic Pint brcolourind = 1; Xstatic Pint arrowcolourind = 0; Xstatic Pint arrowedgecolourind = 1; X X/*-------------------------------------------------------------------------- V*/ X Xstatic void ptk_transformlimits(C(Plimit *) lims, C(Pmatrix) mat) XPreANSI(Plimit *lims) XPreANSI(Pmatrix mat) X`7B X Ppoint minbox, maxbox; X X minbox = ptk_point(lims->xmin, lims->ymin); X maxbox = ptk_point(lims->xmax, lims->ymax); X minbox = ptk_transform(mat, &minbox); X maxbox = ptk_transform(mat, &maxbox); X *lims = ptk_limit(minbox.x, maxbox.x, minbox.y, maxbox.y); X`7D /* ptk_transformlimits */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void ptk_scalelimits(C(Ppoint *) scale, C(Plimit *) lims) XPreANSI(Ppoint *scale) XPreANSI(Plimit *lims) X`7B X Ppoint minbox, maxbox; X Ppoint shift, size; X Pmatrix mat; X X minbox = ptk_point(lims->xmin, lims->ymin); X maxbox = ptk_point(lims->xmax, lims->ymax); X size = ptk_subv(&maxbox, &minbox); X shift = ptk_point(minbox.x + (size.x / 2.0), minbox.y + (size.y / 2.0)); X shift = ptk_scalev(&shift, -1.0); X ptk_shift(&shift, PREPLACE, mat); X ptk_scale(scale, PPOSTCONCATENATE, mat); X shift = ptk_scalev(&shift, -1.0); X ptk_shift(&shift, PPOSTCONCATENATE, mat); X ptk_transformlimits(lims, mat); X`7D /* ptk_scalelimits */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void ptk_shiftlimits(C(Ppoint *) shift, C(Plimit *) lims) XPreANSI(Ppoint *shift) XPreANSI(Plimit *lims) X`7B X Ppoint minbox, maxbox; X Pmatrix mat; X X minbox = ptk_point(lims->xmin, lims->ymin); X maxbox = ptk_point(lims->xmax, lims->ymax); X ptk_shift(shift, PREPLACE, mat); X minbox = ptk_transform(mat, &minbox); X maxbox = ptk_transform(mat, &maxbox); X *lims = ptk_limit(minbox.x, maxbox.x, minbox.y, maxbox.y); X`7D /* ptk_shiftlimits */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void ptk_stackdebug(C(ptksdebuginfo *) info) XPreANSI(ptksdebuginfo *info) X`7B X ptksdebugstack *stackitem; X X stackitem = (ptksdebugstack *)malloc(sizeof(ptksdebugstack)); X stackitem->next = debugstack; X debugstack = stackitem; X stackitem->debuginfo = *info; X debugstackdepth++; X`7D /* ptk_stackdebug */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void ptk_unstackdebug(C(ptksdebuginfo *) info) XPreANSI(ptksdebuginfo *info) X`7B X ptksdebugstack *stackitem; X `20 X if (debugstack != NULL) X `7B X *info = debugstack->debuginfo; X stackitem = debugstack->next; X free(debugstack); X debugstack = stackitem; X debugstackdepth--; X `7D X`7D /* ptk_unstackdebug */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic ptkboolean findstpoint(C(Pint) stid, C(ptksexeclist **) list)`20 XPreANSI(Pint stid) XPreANSI(ptksexeclist **list) X`7B X *list = stpoints; X while (*list != NULL) X `7B `20 X if ((*list)->stid == stid) X `7B X return TRUE; X `7D X else X *list = (*list)->next; X `7D X return FALSE; X`7D /* findstpoint */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic ptkboolean findbreakpoint(C(Pint) stid, C(Pint) elemptr) XPreANSI(Pint stid) XPreANSI(Pint elemptr) X`7B X ptksexeclist *ptr; X X if (findstpoint(stid, &ptr)) X if (inintlst(elemptr, &ptr->bkpts) != -1) X return TRUE; X return FALSE; X`7D /* findbreakpoint */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic ptkboolean findtracepoint(C(Pint) stid, C(Pint) elemptr) XPreANSI(Pint stid) XPreANSI(Pint elemptr) X`7B X ptksexeclist *ptr; X X if (findstpoint(stid, &ptr)) X if (inintlst(elemptr, &ptr->tcpts) != -1) X return TRUE; X return FALSE; X`7D /* findtracepoint */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic deletebreakpt(C(Pint) stid, C(Pint) elemptr) XPreANSI(Pint stid) XPreANSI(Pint elemptr) X`7B X ptksexeclist *ptr; X X if (findstpoint(stid, &ptr)) X `7B X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "struct$content-pts")); X/* poffsetelemptr(1); */ X psetelemptrlabel(elemptr); X ptk_delelem(2); X `7D X`7D /* deletebreakpt */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic deletetracept(C(Pint) stid, C(Pint) elemptr) XPreANSI(Pint stid) XPreANSI(Pint elemptr) X`7B X ptksexeclist *ptr; X X if (findstpoint(stid, &ptr)) X `7B X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "struct$content-pts")); X/* poffsetelemptr(1); */ X psetelemptrlabel(elemptr + ptr->numelems); X ptk_delelem(2); X `7D X`7D /* deletetracept */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic drawbreakpt(C(Pint) stid, C(Pint) elemptr) XPreANSI(Pint stid) XPreANSI(Pint elemptr) X`7B X ptksexeclist *ptr; X Ppoint pts`5B5`5D; X Pint ind; X X if (findstpoint(stid, &ptr)) X `7B X if ((ind = inintlst(elemptr, &ptr->bkpts)) != -1) X `7B X psetelemptr(0); X psetelemptrlabel(ptk_stringtoint("label", "struct$content-pts")); X plabel(elemptr); X pts`5B0`5D = ptk_point(0.025, 1.0 - (0.1 * ptr->bkpts.integers`5Bind`5 VD) - 0.025); X pts`5B1`5D = ptk_point(0.675, pts`5B0`5D.y); X pts`5B2`5D = ptk_point(0.675, pts`5B0`5D.y - 0.05); X pts`5B3`5D = ptk_point(0.025, pts`5B2`5D.y); X pts`5B4`5D = pts`5B0`5D; +-+-+-+-+-+-+-+- END OF PART 197 +-+-+-+-+-+-+-+-