#include "defs.h" /* * Delete the current item. * * h = zero or current item entry * t = item type */ delitem(h, t) REG DL h; CHAR t; { chkhd(h, "cwBL"); moveup(h, adr(succ(h->type, h)) - adr(h)); } /* * Delete all points along a path between two specified points. * * h = item header * input = two cursor positions (the closest points are used) */ delpath(h) REG DL h; { REG DL pa, pb; DL1 p1, p2; chkhd(h, "wBL"); must(cursor(p1)); pa = findpt(h, p1); if(pa==0) error("point not found"); wchar(pa, '@'); while(cursor(p2)==SP) { pb = findpt(h, p2); if(pb==0) error("point not found"); wchar(pb, '@'); if(rempath(h, pa, pb)==0) error("segment not found"); if((pa=findpt(h,p2))==0) break; } } /* * Remove a path * * h = 'w' entry */ LOC INT rempath(h, pa, pb) REG DL h; DL pa, pb; { REG DL p, q; INT sa, sb; q = succa(h); while( (p=q)->type!=h->type ) { q = succa(p); if( (sa=xysame(p,pa)) || (sb=xysame(p,pb)) ) { if(sa) { if(xysame(q,pb)==0) continue; } elif(sb) { if(xysame(q,pa)==0) continue; } if(p->flag&END) continue; p->flag |= END; q->flag |= START; h->flag |= DIRTY; return(1); } } return(0); } /* * delete a shape occurence. * * h is addr of head item */ delshape(h) REG DL h; { REG DL p; DL1 p1; chkhd(h, "cBL"); must(cursor(p1)); if(p = finda(h, p1)){ delete(succa(p)); delete(p); } else error("shape not found"); } /* * Delete the closest entry to the cursor of a given type. * * h = item head * t = entry type to delete * input = cursor position */ delthing(h, t) REG DL h; { REG DL p; DL1 p1; chkhd(h, "wcLBM"); must(cursor(p1)); if(p = findclose(t, h, p1)){ delete(p); } else error("not found"); } /* * Leave only the end-points of a wire. * * h = pointer to 'w' entry */ delwire(h) DL h; { REG DL p; chkhd(h, "w"); p = h; while(p) { switch(p->type) { case 'e': case 'v': case 'V': delete(p); break; default: p=nexta('w',p); } } } /* * delete extent for a shape * */ delx(h) DL h; { REG DL p; chkhd(h, "L"); p = h; while(p){ if(p->type=='x') delete(p); else p=nexta('L',p); } }