-+-+-+-+-+-+-+-+ START OF PART 198 -+-+-+-+-+-+-+-+ X ppolyline(5, pts); X `7D X `7D X`7D /* drawbreakpt */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic drawtracept(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->tcpts)) != -1) X `7B X plabel(elemptr + ptr->numelems); X pts`5B0`5D = ptk_point(0.025, 1.0 - (0.1 * ptr->tcpts.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; X ppolyline(5, pts); X `7D X `7D X`7D /* drawtracept */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic drawbreakpts(C(Pint) stid) XPreANSI(Pint stid) X`7B X ptksexeclist *ptr; X Pint i; X Ppoint pts`5B5`5D; X X psetlinetype(PLN_DASH); X plabel(ptk_stringtoint("label", "struct$content-pts")); X if (findstpoint(stid, &ptr)) X `7B X for (i = 0; i < ptr->bkpts.number; i++) X `7B X plabel(ptr->bkpts.integers`5Bi`5D); X pts`5B0`5D = ptk_point(0.025, 1.0 - (0.1 * ptr->bkpts.integers`5Bi`5D) V - 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; X ppolyline(5, pts); X `7D X `7D X`7D /* drawbreakpts */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic drawtracepts(C(Pint) stid) XPreANSI(Pint stid) X`7B X ptksexeclist *ptr; X Pint i; X Ppoint pts`5B5`5D; X X psetlinetype(PLN_DOT); X if (findstpoint(stid, &ptr)) X `7B X for (i = 0; i < ptr->tcpts.number; i++) X `7B X plabel(ptr->bkpts.integers`5Bi`5D + ptr->numelems); `20 X pts`5B0`5D = ptk_point(0.025, 1.0 - (0.1 * ptr->tcpts.integers`5Bi`5D) V - 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; X ppolyline(5, pts); X `7D X `7D X`7D /* drawtracepts */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic Pint getcopystid(C(Pint) stid) XPreANSI(Pint stid) X/* map from real structure id to copy id */ X`7B X Pchar str`5B20`5D; X X sprintf(str, "dbg$st%d", stid); X return ptk_stringtoint("structureid", str); X`7D /* getcopystid */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void copynetwork() X`7B X Pint i, j, tot, err, elptr, lstnum, stid, numelems; X Pchar str`5B20`5D; X Pintlst ids; X ptkselcontent elcont; X Pchar *buffer; X ptkboolean finished; X Peltype eltype; X Psrchstatus srchstat; X X ptk_inqstructnetids(debugrootstid, 0, &ids, &tot); X ids.integers = (Pint *)calloc(tot, sizeof(Pint)); X ptk_inqstructnetids(debugrootstid, tot, &ids, &tot); X eltype = PEL_EXECUTE_STRUCTURE; X for (i = 0; i < tot; i++) X `7B X sprintf(str, "dbg$st%d", ids.integers`5Bi`5D); X stid = ptk_stringtoint("structureid", str); X numelems = ptk_elemcount(ids.integers`5Bi`5D); X ptk_openstruct(stid); X ptk_seteditmode(PEDIT_INSERT); X pcopyallelemsstruct(ids.integers`5Bi`5D); X ptk_unseteditmode(); X psetelemptr(0); X finished = FALSE; X ptk_seteditmode(PEDIT_REPLACE); X j = 0; X while ((!finished) && (j <= numelems)) X `7B X ptk_findelemtype(&eltype, 1, PFORWARD, &srchstat, &elptr, &lstnum); X if (srchstat == PSUCCESS) X `7B X psetelemptr(elptr); X ptk_inqcurelemtypesizecontent(&err, &buffer, &elcont); X pexecutestruct(getcopystid(elcont.eldata.idata)); X poffsetelemptr(1); X j = elptr + 1; X `7D X else X finished = TRUE; X `7D X ptk_unseteditmode(); X ptk_closestruct(); X `7D X free(ids.integers); X`7D /* copynetwork */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic Pint createnewstructid() X/* working network */ X`7B X Pchar str`5B20`5D; X X sprintf(str, "wkdbg$st%d", dbgcount); X dbgcount++; X return ptk_stringtoint("structureid", str); X`7D /* createnewstructid */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void deletecopynetwork() X/* delete the copy of the debugging structure network */ X`7B X Pint i, tot; X Pchar str`5B20`5D; X Pintlst ids; X X /* delete copy network */ X sprintf(str, "dbg$st%d", debugrootstid); X#ifdef SUN X pdelstructnet(ptk_stringtoint("structureid", str), PDELETE); X#endif X ptk_inqstructnetids(debugrootstid, 0, &ids, &tot); X ids.integers = (Pint *)calloc(tot, sizeof(Pint)); X ptk_inqstructnetids(debugrootstid, tot, &ids, &tot); X for (i = 0; i < tot; i++) X `7B X sprintf(str, "dbg$st%d", ids.integers`5Bi`5D); X#ifdef VMS X pdelstruct(ptk_stringtoint("structureid", str)); X#endif X ptk_delstring("structureid", str); X `7D X free(ids.integers); X`7D X X/*-------------------------------------------------------------------------- V*/ X Xstatic void clearstructid() X/* weird DEC PHIGS bug in DELETE STRUCTURE NETWORK, X** delete each structure in turn. X*/ X`7B X Pint i, tot; X Pchar str`5B20`5D; X Pintlst ids; X `20 X /* delete working network */ X sprintf(str, "wkdbg$st%d", 0); X#ifdef SUN X pdelstructnet(ptk_stringtoint("structureid", str), PDELETE); X#endif X for (i = 0; i < dbgcount; i++) X `7B X sprintf(str, "wkdbg$st%d", i); X#ifdef VMS X pdelstruct(ptk_stringtoint("structureid", str)); X#endif X ptk_delstring("structureid", str); X `7D X`7D /* clearstructid */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void setupdebugger(C(void)) X`7B X elembuffer = ptk_stringtoint("structureid", "dbg$elembuffer"); X elemcontent = ptk_stringtoint("structureid", "dbg$elemcontent"); X structcontent = ptk_stringtoint("structureid", "dbg$structcontent"); X topology = ptk_stringtoint("topologyid", "dbg$topology");`20 X`7D /* setupdebugger */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void initialisedebugger(C(Pint) stid) XPreANSI(Pint stid) X`7B X Pint err; X Pintlst stlist; X X traversalstate = PTKEOK; X currentinfo.debugstid = stid; X currentinfo.debugelptr = currentinfo.workingelptr = 1; X currentinfo.elemcount = ptk_elemcount(stid); X X currentinfo.workingstid = createnewstructid(); X stlist.number = 1; X stlist.integers = &stid; X ptk_setcameraworld(structwindow, &stlist); X ptk_posttowindow(structwindow, currentinfo.workingstid); X ptk_createtopology(topology, stid, &err); X ptk_posttowindow(topologywindow, topology);`20 X ptk_settopologyhighlightnode(topology, stid); X X contentset.number = 1; X contentset.integers = &contentname; X contentname = ptk_stringtoint("name", "name$contents"); X ptk_openstruct(structcontent); X paddnameset(&contentset); X ptk_structcontent(debugwsid, stid, 0, 0, 1, 1, &err); X currentcontent = stid; X premovenameset(&contentset); X drawbreakpts(stid); X drawtracepts(stid); X ptk_closestruct(); X ptk_posttowindow(contentwindow, structcontent); X ptk_setcontentviewrange(contentwindow, 0, 10); X if (currentinfo.elemcount > 0) X `7B X ptk_inqelemtype(stid, 1, &err, ¤tinfo.eltype); X `7D X else X currentinfo.eltype = PEL_NIL; X ptk_openstruct(elembuffer); X ptk_copyelem(stid, 1); X ptk_closestruct(); X X /* make topology and structure content pickable */ X ptk_inqtopologyname(topology, &inclnames`5B0`5D, &err); X ptk_inqtopologystructid(topology, &topologystid, &err); X incl.number = 2; X incl.integers = inclnames; X inclnames`5B1`5D = contentname; X excl.number = 0; X psetpickfilter(debugwsid, 1, &incl, &excl); X X ptk_posttowindow(elementwindow, elemcontent); X predrawallstruct(debugwsid, PALWAYS); X`7D /* initialisedebugger */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void cleardebugger(C(void)) X`7B `20 X pemptystruct(elembuffer); X pemptystruct(elemcontent); X pemptystruct(structcontent); X `20 X /* delete working network */ X clearstructid(); X dbgcount = 0; X X /* clear windows */ X ptk_unpostallfromwindow(structwindow); X ptk_unpostallfromwindow(topologywindow);`20 X ptk_unpostallfromwindow(contentwindow); X ptk_unpostallfromwindow(elementwindow);`20 X X /* clear topology */ X ptk_deltopology(topology); X X /* initialise TSL */ X ptk_inittsl(); X`7D /* cleardebugger */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void restarttraversal() X`7B X cleardebugger(); X initialisedebugger(debugrootstid); X currentinfo.debugelptr = currentinfo.workingelptr = 0; X`7D /* restarttraversal */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void updateelembuffer(C(Peltype) eltype) XPreANSI(Peltype eltype) X`7B X ptk_openstruct(elembuffer); X ptk_seteditmode(PEDIT_REPLACE); X if (eltype == PEL_EXECUTE_STRUCTURE) X ptk_copyelem(currentinfo.debugstid, currentinfo.debugelptr); X else X ptk_copyelem(getcopystid(currentinfo.debugstid), currentinfo.debugelptr) V; X ptk_unseteditmode(); X ptk_closestruct(); `20 X`7D /* updateelembuffer */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void updatestructcontent(C(Pint) structid, C(Pint) elptr, X C(Pint) range1, C(Pint) range2) XPreANSI(Pint structid) XPreANSI(Pint elptr) XPreANSI(Pint range1) XPreANSI(Pint range2) X`7B X Pint err; X X pemptystruct(structcontent); X ptk_openstruct(structcontent); X paddnameset(&contentset); X ptk_structcontent(debugwsid, structid, 0, 0, elptr, 1, &err); X currentcontent = structid; X premovenameset(&contentset); X drawbreakpts(structid); X drawtracepts(structid); X ptk_closestruct(); `20 X ptk_posttowindow(contentwindow, structcontent); X ptk_setcontentviewrange(contentwindow, range1, range2); X`7D /* updatestructcontent */ X X/*-------------------------------------------------------------------------- V*/ X Xstatic void do_next_elem(C(void)) X`7B X Pint err, count, structid, elptr, lenstr; X ptkselcontent elcont; X Pchar *buffer, name`5B80`5D; X ptksdebuginfo temp; X X ptk_tsltraversenext(); `20 X traversalstate = PTKEOK; X if (findtracepoint(currentinfo.debugstid, currentinfo.debugelptr)) X `7B X ptk_inttostring("structureid", currentinfo.debugstid, 80, name, &lenstr) V; X if (lenstr == 0) X sprintf(name, "%d\0", currentinfo.debugstid);`20 X ptk_printfterminal(terminalwindow,`20 X "tracepoint reached at structure %s, element %d.\n", X name, currentinfo.debugelptr); X predrawallstruct(debugwsid, PALWAYS); X `7D X if (currentinfo.eltype == PEL_EXECUTE_STRUCTURE) X `7B X traversalstate = PTKEEXECUTE; X temp = currentinfo; X temp.debugelptr++; X temp.workingelptr++; X ptk_stackdebug(&temp); `20 X ptk_inqelemtypesizecontent(elembuffer, 1, &err, &buffer, &elcont); X currentinfo.debugstid = elcont.eldata.idata; X free(buffer); X currentinfo.debugelptr = 1; X currentinfo.elemcount = ptk_elemcount(currentinfo.debugstid); X `20 X if (currentinfo.elemcount > 0) X `7B X ptk_inqelemtype(currentinfo.debugstid, currentinfo.debugelptr,`20 X &err, ¤tinfo.eltype); X updateelembuffer(currentinfo.eltype); X `7D X else X currentinfo.eltype = PEL_NIL; X /* create new working structure */ X ptk_openstruct(currentinfo.workingstid); X currentinfo.workingstid = createnewstructid(); X currentinfo.workingelptr = 1; X pexecutestruct(currentinfo.workingstid); X ptk_closestruct(); X /* update topology */ X ptk_settopologyhighlightnode(topology, currentinfo.debugstid); X /* update structure content */ X updatestructcontent(currentinfo.debugstid, 1, 0, 10); X `7D X else X `7B X if (currentinfo.eltype != PEL_NIL) X `7B X ptk_openstruct(currentinfo.workingstid); X ptk_copyelem(elembuffer, 1); X ptk_closestruct(); X `7D X X currentinfo.workingelptr++; X currentinfo.debugelptr++; X X if (currentinfo.elemcount < currentinfo.debugelptr) X `7B X if (currentinfo.elemcount == currentinfo.debugelptr - 1) X `7B X lastcount = currentinfo.elemcount; X laststruct = currentinfo.debugstid; X `7D X /* reached end of structure */ X traversalstate = PTKESTRUCTEND; X if (debugstack == NULL) X traversalstate = PTKEDEBUGEND; X else X `7B X do X`09`7B X ptk_unstackdebug(¤tinfo); X `7D while ((currentinfo.debugelptr > currentinfo.elemcount) && X (debugstack != NULL)); X if (debugstack != NULL) X`09`7B X count = 10; X elptr = currentinfo.debugelptr; X structid = currentinfo.debugstid; X `7D X else X`09`7B X count = elptr = lastcount; X structid = laststruct; X `7D X /* update topology */ X ptk_settopologyhighlightnode(topology, structid); X /* update structure content */ X updatestructcontent(structid, elptr, count - 10, count); X `7D X `7D X else X `7B X if (currentcontent != currentinfo.debugstid) X updatestructcontent(currentinfo.debugstid, currentinfo.debugelptr, X currentinfo.debugelptr, currentinfo.debugelptr + 10); X else X ptk_setstructcontentelemptr(structcontent, currentinfo.debugelptr); X `7D X if (currentinfo.elemcount >= currentinfo.debugelptr) X `7B X ptk_inqelemtype(currentinfo.debugstid, currentinfo.debugelptr,`20 X &err, ¤tinfo.eltype); X updateelembuffer(currentinfo.eltype); X `7D X else X currentinfo.eltype = PEL_NIL; X `7D +-+-+-+-+-+-+-+- END OF PART 198 +-+-+-+-+-+-+-+-