Jspice3
grafintr.c File Reference
#include "spice.h"
#include "sced.h"
#include "scedmacs.h"
#include "scedio.h"
Include dependency graph for grafintr.c:

Go to the source code of this file.

Functions

static char * hent_string ()
 
static wordlistGP_wl ()
 
static int select_trace ()
 
static void show_mark ()
 
static int trans_mark ()
 
static char * get_subname ()
 
static struct hyEntselect_point ()
 
static struct hyEntalloc_ent ()
 
static struct hyEntsubckt_point ()
 
static char * nodestring ()
 
static int get_enode ()
 
static int find_wire_node ()
 
static void display_graf_references ()
 
static int nodenum ()
 
wordlistcp_lexer ()
 
void com_graf ()
 
void wl_free ()
 
void ShowOutput (int *LookedAhead)
 
void DoIplot ()
 
void SetIplot ()
 
void ClearIplot ()
 
char * GPstring (int typemask, struct hyEnt **hent)
 
char * GPgetString (struct hyEnt *hent)
 
static char * hent_string (struct ka *AOI, int typemask, struct hyEnt **hret)
 
int GPdeleteGrafRef (struct hyEnt *hent)
 
void GPclearGraf ()
 
static void show_mark (int i, int DorE, int prompt)
 
static int trans_mark (int i)
 
static char * get_subname (struct hyEnt *hent)
 
static struct hyEntselect_point (struct s *CellDesc, struct ka *AOI, int mask)
 
static struct hyEntalloc_ent (long x, long y, struct o *pointer, int reftype, int orient)
 
static struct hyEntsubckt_point (struct o *pointer, char *name, struct ka *AOI, int mask)
 
static char * nodestring (struct hyEnt *h)
 
static int get_enode (int Node, struct o *Pointer)
 
static int find_wire_node (struct o *Pointer)
 
static void display_graf_references (char DisplayOrErase)
 
static int nodenum (struct hyEnt *h)
 

Variables

static struct hyEntGPoint [9]
 
static int DoingIplot
 
int IplotStatusChanged
 
char * MenuGRAF
 
char * MenuIPLOT
 
char * MenuEDIT
 

Function Documentation

static struct hyEnt* alloc_ent ( )
static
static struct hyEnt* alloc_ent ( long  x,
long  y,
struct o pointer,
int  reftype,
int  orient 
)
static

Definition at line 722 of file grafintr.c.

728 {
729  struct hyEnt *h = (struct hyEnt *)tmalloc(sizeof(struct hyEnt));
730 
731  h->hyX = x;
732  h->hyY = y;
733  h->hyPointer = pointer;
734  h->hyRefType = reftype;
735  h->hyOrient = orient;
736  return (h);
737 }
long hyY
Definition: sced.h:180
int hyOrient
Definition: sced.h:186
char * tmalloc()
int hyRefType
Definition: sced.h:188
Definition: sced.h:178
long hyX
Definition: sced.h:179
struct o * hyPointer
Definition: sced.h:183
void ClearIplot ( )

Definition at line 199 of file grafintr.c.

201 {
202  wordlist wl;
203 
204  if (!DoingIplot) return;
205  wl.wl_next = NULL;
206  wl.wl_word = "iplot";
207  (*ft_sced->sc_clriplot)(&wl);
209 }
Definition: library.c:18
static int DoingIplot
Definition: grafintr.c:22
#define NULL
Definition: spdefs.h:121
int IplotStatusChanged
Definition: grafintr.c:23
struct sSCEDitf * ft_sced
Definition: main.c:441
Definition: cpstd.h:21
void(* sc_clriplot)()
Definition: scedio.h:52
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
#define False
Definition: scedstub.c:15
void com_graf ( )
wordlist* cp_lexer ( )
static void display_graf_references ( )
static
static void display_graf_references ( char  DisplayOrErase)
static

Definition at line 882 of file grafintr.c.

885 {
886  int i;
887 
888  for (i = 0; i < 8 && GPoint[i]; i++) {
889  show_mark(i,DisplayOrErase,False);
890  }
891 }
static void show_mark()
static struct hyEnt * GPoint[9]
Definition: grafintr.c:19
#define False
Definition: scedstub.c:15
void DoIplot ( )

Definition at line 161 of file grafintr.c.

163 {
164  wordlist wx,*wl;
165 
166  if (DoingIplot) {
168  DoingIplot = False;
169  ShowPrompt("No plotting during simulation.");
170  }
171  else {
173  DoingIplot = True;
174  ShowPrompt("Will generate plot while simulating.");
175  }
177 }
Definition: library.c:18
static int DoingIplot
Definition: grafintr.c:22
char * MenuIPLOT
Definition: scedintr.c:83
void MenuDeselect()
int IplotStatusChanged
Definition: grafintr.c:23
#define True
Definition: scedstub.c:16
Definition: cpstd.h:21
#define False
Definition: scedstub.c:15
void MenuSelect()
void ShowPrompt(char *str)
Definition: scedstub.c:71
static int find_wire_node ( )
static
static int find_wire_node ( struct o Pointer)
static

Definition at line 865 of file grafintr.c.

869 {
870  struct prpty *PDesc;
871 
872  PDesc = Pointer->oPrptyList;
873  for (; PDesc; PDesc = PDesc->prpty_Succ) {
874  if (PDesc->prpty_Value != P_NODE) continue;
875  return (PDesc->prpty_Data->p_node.enode);
876  }
877  return (-1);
878 }
int prpty_Value
Definition: cdprpty.h:67
int enode
Definition: cdprpty.h:24
struct prp_node p_node
Definition: cdprpty.h:52
#define P_NODE
Definition: cdprpty.h:12
union prp_data * prpty_Data
Definition: cdprpty.h:65
struct prpty * prpty_Succ
Definition: cdprpty.h:66
Definition: cdprpty.h:62
struct prpty * oPrptyList
Definition: cddefs.h:146
static int get_enode ( )
static
static int get_enode ( int  Node,
struct o Pointer 
)
static

Definition at line 825 of file grafintr.c.

833 {
834  struct prpty *PDesc;
835  struct s *CDesc;
836  char *name;
837  int inode = -1;
838 
839  name = ((struct c *)Pointer->oRep)->cMaster->mName;
840  if (OpenCell(name,&CDesc))
841  return (-1);
842 
843  PDesc = CDesc->sPrptyList;
844  for ( ; PDesc; PDesc = PDesc->prpty_Succ) {
845  if (PDesc->prpty_Value != P_NODE) continue;
846  if (Node == PDesc->prpty_Data->p_node.enode) {
847  inode = PDesc->prpty_Data->p_node.inode;
848  break;
849  }
850  }
851  if (inode == -1)
852  return (-1);
853 
854  PDesc = Pointer->oPrptyList;
855  for ( ; PDesc; PDesc = PDesc->prpty_Succ) {
856  if (PDesc->prpty_Value != P_NODE) continue;
857  if (inode == PDesc->prpty_Data->p_node.inode)
858  return (PDesc->prpty_Data->p_node.enode);
859  }
860  return (-1);
861 }
struct prpty * sPrptyList
Definition: cddefs.h:133
int prpty_Value
Definition: cdprpty.h:67
Definition: cddefs.h:119
int enode
Definition: cdprpty.h:24
struct prp_node p_node
Definition: cdprpty.h:52
#define P_NODE
Definition: cdprpty.h:12
int OpenCell()
union prp_data * prpty_Data
Definition: cdprpty.h:65
CDesc
Definition: cd.c:1324
struct o * oRep
Definition: cddefs.h:144
Definition: cddefs.h:177
struct prpty * prpty_Succ
Definition: cdprpty.h:66
int inode
Definition: cdprpty.h:25
Definition: cdprpty.h:62
struct prpty * oPrptyList
Definition: cddefs.h:146
static char* get_subname ( )
static
static char* get_subname ( struct hyEnt hent)
static

Definition at line 551 of file grafintr.c.

554 {
555  char buf[256];
556  char *c;
557  struct parent *p;
558 
559  if (hent->hyRefType == HY_NODE) {
560  if (nodenum(hent) == 0) {
561  /* ground node */
562  return (CopyString("0"));
563  }
564  return (nodestring(hent));
565  }
566 
567  /* device */
568  c = GetName(hent->hyPointer->oPrptyList);
569  sprintf(buf,"%c",*c);
570  p = hent->hyParent;
571  if (p)
572  strcat(buf,":");
573  for ( ; p; p = p->pNext) {
574  c = GetName(p->pPointer->oPrptyList);
575  strcat(buf,c+1);
576  strcat(buf,":");
577  }
578  c = GetName(hent->hyPointer->oPrptyList);
579  strcat(buf,c+1);
580  if (hent->hyRefType == HY_BRAN)
581  strcat(buf,"#branch");
582  strtolower(buf);
583  return (CopyString(buf));
584 }
static char buf[MAXPROMPT]
Definition: arg.c:18
#define HY_BRAN
Definition: sced.h:165
Definition: sced.h:172
char * CopyString()
static char * nodestring()
FILE * p
Definition: proc2mod.c:48
struct parent * pNext
Definition: sced.h:175
struct o * pPointer
Definition: sced.h:173
struct parent * hyParent
Definition: sced.h:185
#define HY_NODE
Definition: sced.h:164
void strtolower()
int hyRefType
Definition: sced.h:188
static double c
Definition: vectors.c:16
char * GetName()
static int nodenum()
struct prpty * oPrptyList
Definition: cddefs.h:146
struct o * hyPointer
Definition: sced.h:183
static wordlist * GP_wl ( )
static

Definition at line 304 of file grafintr.c.

307 {
308  wordlist *wl,*wl1 = NULL;
309  int i;
310  char *name;
311 
312  for (i = 0; i < 8 && GPoint[i]; i++) {
313  name = get_subname(GPoint[i]);
314  if (GPoint[i]->hyRefType == HY_NODE)
315  sprintf(TypeOut,"v(%s)",name);
316  else {
317  strcpy(TypeOut,name);
318  }
319  free(name);
320  if (wl1 == NULL)
321  wl = wl1 = cp_lexer(TypeOut);
322  else {
323  wl->wl_next = cp_lexer(TypeOut);
324  wl = wl->wl_next;
325  }
326  }
327  if (wl1)
328  wl->wl_next = NULL;
329  return (wl1);
330 }
char * strcpy()
Definition: library.c:18
#define HY_NODE
Definition: sced.h:164
#define NULL
Definition: spdefs.h:121
char TypeOut[200]
Definition: init.c:23
Definition: cpstd.h:21
static char * get_subname()
struct wordlist * wl_next
Definition: cpstd.h:23
static struct hyEnt * GPoint[9]
Definition: grafintr.c:19
wordlist * cp_lexer()
void free()
void GPclearGraf ( )

Definition at line 364 of file grafintr.c.

365 {
366  while (GPoint[0]) {
367  HYdel(GPoint[0]);
368  (void)GPdeleteGrafRef(GPoint[0]);
369  }
371 }
int GPdeleteGrafRef(struct hyEnt *hent)
Definition: grafintr.c:334
int IplotStatusChanged
Definition: grafintr.c:23
#define True
Definition: scedstub.c:16
void HYdel()
static struct hyEnt * GPoint[9]
Definition: grafintr.c:19
int GPdeleteGrafRef ( struct hyEnt hent)

Definition at line 334 of file grafintr.c.

340 {
341  struct parent *p, *pnext;
342  int i;
343 
344  if (!hent)
345  return (False);
346  for (i = 0; i < 8; i++)
347  if (GPoint[i] == hent)
348  break;
349  if (i == 8)
350  return (False);
351  for (p = hent->hyParent; p; p = pnext) {
352  pnext = p->pNext;
353  txfree((char*)p);
354  }
355  txfree((char*)hent);
356  for ( ; i < 8; i++)
357  GPoint[i] = GPoint[i+1];
358  GPoint[i] = NULL;
359  return (True);
360 }
Definition: sced.h:172
FILE * p
Definition: proc2mod.c:48
struct parent * pNext
Definition: sced.h:175
struct parent * hyParent
Definition: sced.h:185
void txfree()
#define NULL
Definition: spdefs.h:121
#define True
Definition: scedstub.c:16
static struct hyEnt * GPoint[9]
Definition: grafintr.c:19
#define False
Definition: scedstub.c:15
char* GPgetString ( struct hyEnt hent)

Definition at line 239 of file grafintr.c.

245 {
246  char *name, buf[128];
247  struct ka AOI;
248  struct hyEnt *newent;
249  struct parent *p, *pnext;
250  int Delta = 5; /* some slop, should already be centered */
251  char *s;
252 
253  if (!hent)
254  return (NULL);
255 
256  AOI.kaLeft = hent->hyX - Delta;
257  AOI.kaRight = hent->hyX + Delta;
258  AOI.kaBottom = hent->hyY - Delta;
259  AOI.kaTop = hent->hyY + Delta;
260 
261  s = hent_string(&AOI,hent->hyRefType,&newent);
262  if (s) {
263  for (p = hent->hyParent; p; p = pnext) {
264  pnext = p->pNext;
265  txfree((char*)p);
266  }
267  *hent = *newent;
268  txfree((char*)newent);
269  }
270  return (s);
271 }
static char buf[MAXPROMPT]
Definition: arg.c:18
Definition: sced.h:172
Definition: cddefs.h:119
FILE * p
Definition: proc2mod.c:48
struct parent * pNext
Definition: sced.h:175
Definition: sced.h:111
long hyY
Definition: sced.h:180
static char * hent_string()
struct parent * hyParent
Definition: sced.h:185
void txfree()
#define NULL
Definition: spdefs.h:121
int hyRefType
Definition: sced.h:188
Definition: sced.h:178
long hyX
Definition: sced.h:179
char* GPstring ( int  typemask,
struct hyEnt **  hent 
)

Definition at line 213 of file grafintr.c.

218 {
219  struct ka AOI;
220  int Delta;
221 
223  return (NULL);
224  if (SCursor.kcInFine == True)
225  Delta = 5.0/View->kvFineRatio;
226  else
227  Delta = 5.0/View->kvCoarseRatio;
228 
229  AOI.kaLeft = SCursor.kcX - Delta;
230  AOI.kaRight = SCursor.kcX + Delta;
231  AOI.kaBottom = SCursor.kcY - Delta;
232  AOI.kaTop = SCursor.kcY + Delta;
233 
234  return (hent_string(&AOI,typemask,hent));
235 }
double kvFineRatio
Definition: sced.h:154
struct kc SCursor
Definition: init.c:21
double kvCoarseRatio
Definition: sced.h:155
Definition: sced.h:111
long kcY
Definition: sced.h:102
static char * hent_string()
int kpPointCoarseWindow
Definition: sced.h:258
#define NULL
Definition: spdefs.h:121
struct kp Parameters
Definition: init.c:19
#define True
Definition: scedstub.c:16
struct kv * View
Definition: init.c:17
long kcX
Definition: sced.h:102
int kcInFine
Definition: sced.h:105
static char* hent_string ( )
static
static char* hent_string ( struct ka AOI,
int  typemask,
struct hyEnt **  hret 
)
static

Definition at line 275 of file grafintr.c.

281 {
282  struct hyEnt *h;
283  struct parent *p, *pnext;
284  char *name, buf[128];
285 
286  *hret = NULL;
287  h = select_point(Parameters.kpCellDesc,AOI,typemask);
288  if (h == NULL) return (NULL);
289  name = get_subname(h);
290  if (name == NULL)
291  return (NULL);
292  if (h->hyRefType == HY_NODE)
293  sprintf(buf,"v(%s)",name);
294  else {
295  strcpy(buf,name);
296  }
297  *hret = h;
298  free(name);
299  return (CopyString(buf));
300 }
static char buf[MAXPROMPT]
Definition: arg.c:18
Definition: sced.h:172
char * strcpy()
char * CopyString()
struct s * kpCellDesc
Definition: sced.h:207
FILE * p
Definition: proc2mod.c:48
#define HY_NODE
Definition: sced.h:164
#define NULL
Definition: spdefs.h:121
struct kp Parameters
Definition: init.c:19
int hyRefType
Definition: sced.h:188
Definition: sced.h:178
static char * get_subname()
static struct hyEnt * select_point()
void free()
static int nodenum ( )
static
static int nodenum ( struct hyEnt h)
static

Definition at line 895 of file grafintr.c.

898 {
899  struct prpty *PDesc;
900  long X, Y;
901 
902  if (h->hyRefType != HY_NODE)
903  return (-1);
904  if (h->hyPointer->oType == CDWIRE)
905  return (find_wire_node(h->hyPointer));
906 
907  PDesc = h->hyPointer->oPrptyList;
908  for (; PDesc; PDesc = PDesc->prpty_Succ) {
909  if (PDesc->prpty_Value != P_NODE) continue;
910  X = PDesc->prpty_Data->p_node.x;
911  Y = PDesc->prpty_Data->p_node.y;
912  if (h->hyX == X && h->hyY == Y) {
913  return (PDesc->prpty_Data->p_node.enode);
914  }
915  }
916  return (-1);
917 }
static int find_wire_node()
int prpty_Value
Definition: cdprpty.h:67
char oType
Definition: cddefs.h:148
int enode
Definition: cdprpty.h:24
struct prp_node p_node
Definition: cdprpty.h:52
int x
Definition: cdprpty.h:26
#define P_NODE
Definition: cdprpty.h:12
long hyY
Definition: sced.h:180
union prp_data * prpty_Data
Definition: cdprpty.h:65
long X
Definition: actions.c:450
#define HY_NODE
Definition: sced.h:164
int hyRefType
Definition: sced.h:188
int y
Definition: cdprpty.h:27
#define CDWIRE
Definition: cddefs.h:47
struct prpty * prpty_Succ
Definition: cdprpty.h:66
long hyX
Definition: sced.h:179
long Y
Definition: actions.c:450
Definition: cdprpty.h:62
struct prpty * oPrptyList
Definition: cddefs.h:146
struct o * hyPointer
Definition: sced.h:183
static char* nodestring ( )
static
static char* nodestring ( struct hyEnt h)
static

Definition at line 770 of file grafintr.c.

773 {
774  struct parent *p, *pp, *pTmp;
775  char buf[256], *c;
776  int node, nnode;
777 
778  pp = NULL;
779 
780  /* copy new reversed list */
781  pTmp = NULL;
782  for (p = h->hyParent; p; p = p->pNext) {
783  pp = (struct parent *)tmalloc(sizeof(struct parent));
784  pp->pPointer = p->pPointer;
785  pp->pNext = pTmp;
786  pTmp = pp;
787  }
788 
789  /* walk back up node naming hierarchy */
790  node = nodenum(h);
791  for (; pp; pp = p) {
792  p = pp->pNext;
793  nnode = get_enode(node,pp->pPointer);
794  if (nnode == -1)
795  break;
796  node = nnode;
797  free(pp);
798  }
799 
800  /* reverse the list */
801  pTmp = NULL;
802  for (; pp; pp = p) {
803  p = pp->pNext;
804  pp->pNext = pTmp;
805  pTmp = pp;
806  }
807  pp = pTmp;
808 
809  /* create text and free */
810  *buf = '\0';
811  for (; pp; pp = p) {
812  p = pp->pNext;
813  c = GetName(pp->pPointer->oPrptyList);
814  strcat(buf,c+1);
815  strcat(buf,":");
816  free(pp);
817  }
818  strtolower(buf);
819  sprintf(buf + strlen(buf),"%d",node);
820  return (CopyString(buf));
821 }
static char buf[MAXPROMPT]
Definition: arg.c:18
Definition: sced.h:172
char * CopyString()
Definition: objects.c:1183
FILE * p
Definition: proc2mod.c:48
struct parent * pNext
Definition: sced.h:175
struct o * pPointer
Definition: sced.h:173
static int get_enode()
char * tmalloc()
struct parent * hyParent
Definition: sced.h:185
#define NULL
Definition: spdefs.h:121
void strtolower()
static double c
Definition: vectors.c:16
char * GetName()
static int nodenum()
struct prpty * oPrptyList
Definition: cddefs.h:146
void free()
static struct hyEnt* select_point ( )
static
static struct hyEnt* select_point ( struct s CellDesc,
struct ka AOI,
int  mask 
)
static

Definition at line 588 of file grafintr.c.

593 {
594  struct g *GenDesc;
595  struct o *Pointer;
596  struct p *Path;
597  struct prpty *PDesc;
598  struct ka InvAOI;
599  struct hyEnt *h;
600  char *name,**b;
601  int i,Layer;
602  long X,Y,Width,*xy;
603  long X1,Y1;
604 
605 
606  InvAOI = *AOI;
607  TInverse();
608  TInversePoint(&InvAOI.kaLeft,&InvAOI.kaBottom);
609  TInversePoint(&InvAOI.kaRight,&InvAOI.kaTop);
610 
611  /* first check the wires */
612  if (mask & HY_NODE) {
613 
614  if (Not CDInitGen(CellDesc,1,AOI->kaLeft,AOI->kaBottom,
615  AOI->kaRight,AOI->kaTop,&GenDesc)) MallocFailed();
616  loop {
617  CDGen(CellDesc,GenDesc,&Pointer);
618  if (Pointer == NULL) break;
619  if (Pointer->oInfo == SQ_GONE) continue;
620  if (Pointer->oType != CDWIRE) continue;
621  CDWire(Pointer,&Layer,&Width,&Path);
622 
623  if ((xy = InPath((int)(AOI->kaRight - AOI->kaLeft)/2,
624  Path,(InvAOI.kaRight + InvAOI.kaLeft)/2,
625  (InvAOI.kaTop + InvAOI.kaBottom)/2)) == NULL)
626  continue;
627  tfree(GenDesc);
628  return (alloc_ent(*xy, *(xy+1), Pointer, HY_NODE, MARK_NONE));
629  }
630  }
631 
632  /* no wire selected, try the devices */
633 
634  if (Not CDInitGen(CellDesc,0,AOI->kaLeft,AOI->kaBottom,
635  AOI->kaRight,AOI->kaTop,&GenDesc)) MallocFailed();
636  loop {
637  CDGen(CellDesc,GenDesc,&Pointer);
638  if (Pointer == NULL) break;
639  if (Pointer->oInfo == SQ_GONE) continue;
640 
641  /* first check the nodes */
642  if (mask & HY_NODE) {
643  PDesc = Pointer->oPrptyList;
644  for (; PDesc; PDesc = PDesc->prpty_Succ) {
645  if (PDesc->prpty_Value != P_NODE) continue;
646  X = PDesc->prpty_Data->p_node.x;
647  Y = PDesc->prpty_Data->p_node.y;
648 
649  if (InBox(X,Y,&InvAOI)) {
650  tfree(GenDesc);
651  return (alloc_ent(X, Y, Pointer, HY_NODE, MARK_NONE));
652  }
653  }
654  }
655  /* no matching nodes */
656 
657  name = ((struct c *)Pointer->oRep)->cMaster->mName;
658 
659  if (!IsCellInLib(name)) {
660  /* a subcircuit */
661  h = subckt_point(Pointer,name,AOI,mask);
662  if (h) {
663  tfree(GenDesc);
664  return (h);
665  }
666  else
667  continue;
668  }
669 
670  PDesc = Pointer->oPrptyList;
671  for ( ; PDesc; PDesc = PDesc->prpty_Succ)
672  if (PDesc->prpty_Value == P_BRANCH) break;
673  if (PDesc == NULL) {
674  /* not a "branch" device */
675  if (mask & HY_DEVN) {
676  /* just want device's name */
677  CDBB(CellDesc,Pointer,&X,&Y,&X1,&Y1);
678  X = (X+X1)/2;
679  Y = (Y+Y1)/2;
680  tfree(GenDesc);
681  return (alloc_ent(X, Y, Pointer, HY_DEVN, MARK_NONE));
682  }
683  else
684  continue;
685  }
686 
687  /* is a "branch" device */
688  X = PDesc->prpty_Data->p_branch.x;
689  Y = PDesc->prpty_Data->p_branch.y;
690  if (InBox(X,Y,&InvAOI)) {
691  /* pointing at the "branch" area */
692 
693  if (mask & HY_BRAN) {
694  X1 = PDesc->prpty_Data->p_branch.r1;
695  Y1 = PDesc->prpty_Data->p_branch.r2;
696  if (X1 == 0) {
697  if (Y1 == 1)
698  i = MARK_UP;
699  else
700  i = MARK_DN;
701  }
702  else {
703  if (X1 == 1)
704  i = MARK_RT;
705  else
706  i = MARK_LT;
707  }
708  tfree(GenDesc);
709  return (alloc_ent(X, Y, Pointer, HY_BRAN, i));
710  }
711  }
712  if (mask & HY_DEVN) {
713  tfree(GenDesc);
714  return (alloc_ent(X, Y, Pointer, HY_DEVN, MARK_NONE));
715  }
716  }
717  return (NULL);
718 }
#define MARK_DN
Definition: scedmacs.h:29
#define loop
Definition: cdmacs.h:11
int struct o * Pointer
Definition: cd.c:1311
#define HY_BRAN
Definition: sced.h:165
int prpty_Value
Definition: cdprpty.h:67
void TInverse()
Definition: xforms.c:271
#define SQ_GONE
Definition: sced.h:347
long kaRight
Definition: sced.h:112
#define MARK_LT
Definition: scedmacs.h:32
char oType
Definition: cddefs.h:148
long kaBottom
Definition: sced.h:112
#define Not
Definition: cdmacs.h:16
struct prp_node p_node
Definition: cdprpty.h:52
int x
Definition: cdprpty.h:26
void CDGen()
int InBox()
#define P_NODE
Definition: cdprpty.h:12
Definition: sced.h:111
#define P_BRANCH
Definition: cdprpty.h:15
void CDWire()
#define MARK_UP
Definition: scedmacs.h:31
Definition: cddefs.h:215
int x
Definition: cdprpty.h:39
union prp_data * prpty_Data
Definition: cdprpty.h:65
int r2
Definition: cdprpty.h:42
void MallocFailed()
Definition: scedintr.c:857
long X
Definition: actions.c:450
#define HY_NODE
Definition: sced.h:164
#define tfree(x)
Definition: cdmacs.h:22
int CDInitGen()
#define NULL
Definition: spdefs.h:121
#define HY_DEVN
Definition: sced.h:166
long kaTop
Definition: sced.h:112
long * InPath()
static struct hyEnt * alloc_ent()
Definition: sced.h:178
struct o * oRep
Definition: cddefs.h:144
long kaLeft
Definition: sced.h:112
int y
Definition: cdprpty.h:27
Definition: cddefs.h:142
int y
Definition: cdprpty.h:40
struct prp_branch p_branch
Definition: cdprpty.h:54
Definition: cddefs.h:177
int Layer
Definition: cd.c:1908
#define CDWIRE
Definition: cddefs.h:47
static struct hyEnt * subckt_point()
struct prpty * prpty_Succ
Definition: cdprpty.h:66
int r1
Definition: cdprpty.h:41
#define MARK_RT
Definition: scedmacs.h:30
int CDBB()
Definition: cddefs.h:227
void TInversePoint()
int IsCellInLib()
long Y
Definition: actions.c:450
Definition: cdprpty.h:62
short oInfo
Definition: cddefs.h:147
struct prpty * oPrptyList
Definition: cddefs.h:146
#define MARK_NONE
Definition: scedmacs.h:28
static int select_trace ( )
static

Definition at line 375 of file grafintr.c.

378 {
379  struct ka AOI;
380  int i, j, Delta;
381  struct hyEnt *h;
382  struct parent *p, *pnext;
383  char *s1, *s2;
384 
385  if (SCursor.kcInFine == True)
386  Delta = 5.0/View->kvFineRatio;
387  else
388  Delta = 5.0/View->kvCoarseRatio;
389 
390  AOI.kaLeft = SCursor.kcX - Delta;
391  AOI.kaRight = SCursor.kcX + Delta;
392  AOI.kaBottom = SCursor.kcY - Delta;
393  AOI.kaTop = SCursor.kcY + Delta;
394 
396  if (h == NULL) return (True);
397 
398  /* is it already selected? */
399  for (i = 0; i < 8; i++) {
400  if (!GPoint[i])
401  continue;
402 
403  if (h->hyRefType == GPoint[i]->hyRefType) {
404  s1 = get_subname(h);
405  s2 = get_subname(GPoint[i]);
406  j = strcmp(s1,s2);
407  free(s1);
408  free(s2);
409  if (!j)
410  break;
411  }
412  }
413  if (i < 8) {
414 
415  show_mark(i,ERASE,True);
416  /* erase renumbered marks */
417  for (j = i+1; j < 8 && GPoint[j]; j++)
418  show_mark(j,ERASE,False);
419  HYdel(GPoint[i]);
420  (void)GPdeleteGrafRef(GPoint[i]);
421  /* redraw renumbered marks */
422  for (; i < 8 && GPoint[i]; i++)
424  for (p = h->hyParent; p; p = pnext) {
425  pnext = p->pNext;
426  free(p);
427  }
428  free(h);
429  }
430  else {
431 
432  for (i = 0; i < 8; i++)
433  if (!GPoint[i]) break;
434 
435  if (i == 8) {
436  for (p = h->hyParent; p; p = pnext) {
437  pnext = p->pNext;
438  free(p);
439  }
440  free(h);
441  return (False);
442  }
443 
444  GPoint[i] = h;
445  HYadd(h);
446 
448  }
450  return (True);
451 }
#define HY_BRAN
Definition: sced.h:165
Definition: sced.h:172
void HYadd()
double kvFineRatio
Definition: sced.h:154
struct kc SCursor
Definition: init.c:21
double kvCoarseRatio
Definition: sced.h:155
#define ERASE
Definition: scedmacs.h:11
struct s * kpCellDesc
Definition: sced.h:207
FILE * p
Definition: proc2mod.c:48
struct parent * pNext
Definition: sced.h:175
Definition: sced.h:111
int GPdeleteGrafRef(struct hyEnt *hent)
Definition: grafintr.c:334
long kcY
Definition: sced.h:102
struct parent * hyParent
Definition: sced.h:185
#define HY_NODE
Definition: sced.h:164
#define NULL
Definition: spdefs.h:121
struct kp Parameters
Definition: init.c:19
int IplotStatusChanged
Definition: grafintr.c:23
int hyRefType
Definition: sced.h:188
#define True
Definition: scedstub.c:16
void HYdel()
struct kv * View
Definition: init.c:17
Definition: sced.h:178
#define DISPLAY
Definition: scedmacs.h:12
static void show_mark()
static char * get_subname()
long kcX
Definition: sced.h:102
static struct hyEnt * select_point()
static struct hyEnt * GPoint[9]
Definition: grafintr.c:19
#define False
Definition: scedstub.c:15
int kcInFine
Definition: sced.h:105
void free()
void SetIplot ( )

Definition at line 181 of file grafintr.c.

183 {
184  wordlist wl;
185 
186  if (!DoingIplot) return;
187  wl.wl_prev = NULL;
188  wl.wl_next = GP_wl();
189  wl.wl_word = "graf";
190  if (wl.wl_next) {
191  (*ft_sced->sc_setiplot)(&wl);
192  wl_free(wl.wl_next);
193  }
195 }
static wordlist * GP_wl()
Definition: grafintr.c:304
Definition: library.c:18
void wl_free()
static int DoingIplot
Definition: grafintr.c:22
struct wordlist * wl_prev
Definition: cpstd.h:24
#define NULL
Definition: spdefs.h:121
int IplotStatusChanged
Definition: grafintr.c:23
struct sSCEDitf * ft_sced
Definition: main.c:441
Definition: cpstd.h:21
void(* sc_setiplot)()
Definition: scedio.h:51
struct wordlist * wl_next
Definition: cpstd.h:23
char * wl_word
Definition: cpstd.h:22
#define False
Definition: scedstub.c:15
static void show_mark ( )
static
static void show_mark ( int  i,
int  DorE,
int  prompt 
)
static

Definition at line 455 of file grafintr.c.

460 {
461  long x, y;
462  struct parent *p;
463  int orient;
464 
465  x = GPoint[i]->hyX;
466  y = GPoint[i]->hyY;
467 
468  for (p = GPoint[i]->hyParent; p; p = p->pNext) {
470  TPremultiply();
471  }
472 
473  TPoint(&x,&y);
474  orient = trans_mark(i);
475 
476  for (p = GPoint[i]->hyParent; p; p = p->pNext) {
477  TPop();
478  }
479 
480  if (DorE == DISPLAY) {
481  ShowMarker(DISPLAY,HighlightingColor,x,y,300,i+2,orient);
482  if (prompt) {
483  if (GPoint[i]->hyRefType == HY_NODE)
484  sprintf(TypeOut,"Trace %d: v(%s)",i+1,get_subname(GPoint[i]));
485  else
486  sprintf(TypeOut,"Trace %d: %s",i+1,get_subname(GPoint[i]));
488  }
489  }
490  else {
491  if (prompt) {
492  ShowPrompt("Trace deleted.");
493  }
494  ShowMarker(ERASE,HighlightingColor,x,y,300,i+2,orient);
495  }
496 }
void TPoint()
Definition: sced.h:172
static void prompt()
Definition: lexical.c:350
void SetTransform()
#define ERASE
Definition: scedmacs.h:11
FILE * p
Definition: proc2mod.c:48
struct parent * pNext
Definition: sced.h:175
struct o * pPointer
Definition: sced.h:173
long hyY
Definition: sced.h:180
#define HY_NODE
Definition: sced.h:164
char TypeOut[200]
Definition: init.c:23
void TPremultiply()
Definition: xforms.c:216
#define DISPLAY
Definition: scedmacs.h:12
static char * get_subname()
void ShowMarker()
static struct hyEnt * GPoint[9]
Definition: grafintr.c:19
void TPop()
Definition: xforms.c:64
long hyX
Definition: sced.h:179
static int trans_mark()
void ShowPrompt(char *str)
Definition: scedstub.c:71
#define HighlightingColor
Definition: sced.h:74
void ShowOutput ( int *  LookedAhead)

Definition at line 81 of file grafintr.c.

84 {
85  char buf[128],*name;
86  char *s, *t;
87  wordlist *wl, opt;
88  int i;
89 
91  ShowPrompt("Pop to top level first.");
92  return;
93  }
95  ShowPrompt("Select nodes/branches, graf button to plot, undo clears all.");
97 
99 
100  loop {
101  switch (PointLoop(LookedAhead)) {
102  case PL_UND:
104  GPclearGraf();
105  ShowPrompt("All traces cleared (can't be undone).");
106  continue;
107  case PL_ESC:
108  goto quit;
109  case PL_PCW:
110  if (select_trace()) continue;
111  ShowPromptAndWait("Limit eight traces.");
112  continue;
113  case PL_CMD:
114  if (Matching(MenuGRAF)) {
115  opt.wl_next = GP_wl();
116  opt.wl_word = "-t";
117  opt.wl_prev = NULL;
118  com_graf(&opt);
119  wl_free(opt.wl_next);
120  if (!dispdev->windows && !dispdev->hardcopy)
123  (void)CheckError();
124  ShowPrompt("Select nodes/branches or press ESC to quit.");
125  *LookedAhead = False;
126  }
127  else if (Matching(MenuEDIT)) {
129  opt.wl_next = GP_wl();
130  opt.wl_word = "-t";
131  opt.wl_prev = NULL;
132  s = wl_flatten(&opt);
133  wl_free(opt.wl_next);
134  ShowPrompt("graf");
135  t = FBEdit(s);
136  ErasePrompt();
138  free(s);
139  if (t) {
140  wl = cp_lexer(t);
141  com_graf(wl);
142  wl_free(wl);
143  if (!dispdev->windows && !dispdev->hardcopy)
146  (void)CheckError();
147  }
148  *LookedAhead = False;
149  }
150  else
151  goto quit;
152  }
153  }
154 quit:
157 }
#define PL_ESC
Definition: sced.h:62
void ErasePrompt()
Definition: viewport.c:538
static char buf[MAXPROMPT]
Definition: arg.c:18
#define loop
Definition: cdmacs.h:11
#define PL_UND
Definition: sced.h:63
Definition: cddefs.h:119
static wordlist * GP_wl()
Definition: grafintr.c:304
int PointLoop()
static void display_graf_references()
#define ERASE
Definition: scedmacs.h:11
struct s * kpCellDesc
Definition: sced.h:207
DISPDEVICE * dispdev
Definition: display.c:112
#define PL_PCW
Definition: sced.h:65
void com_graf()
struct s * kpTopDesc
Definition: sced.h:213
bool hardcopy
Definition: plotdev.h:64
Definition: library.c:18
void wl_free()
#define Matching(string)
Definition: scedmacs.h:63
void ShowPromptAndWait()
bool windows
Definition: plotdev.h:61
struct wordlist * wl_prev
Definition: cpstd.h:24
void MenuDeselect()
#define NULL
Definition: spdefs.h:121
struct kp Parameters
Definition: init.c:19
char * MenuGRAF
Definition: scedintr.c:78
#define DISPLAY
Definition: scedmacs.h:12
void RedisplaySCED()
Definition: cpstd.h:21
struct wordlist * wl_next
Definition: cpstd.h:23
char * FBEdit()
GRAPH * currentgraph
Definition: graphdb.c:21
char * wl_word
Definition: cpstd.h:22
#define False
Definition: scedstub.c:15
void GPclearGraf()
Definition: grafintr.c:364
static int select_trace()
Definition: grafintr.c:375
#define PL_CMD
Definition: sced.h:64
char * MenuEDIT
Definition: scedintr.c:75
void ConnectRecursive()
wordlist * cp_lexer()
char * wl_flatten()
Definition: cddefs.h:192
void MenuSelect()
void ShowPrompt(char *str)
Definition: scedstub.c:71
void free()
int CheckError()
Definition: scedintr.c:696
static struct hyEnt* subckt_point ( )
static
static struct hyEnt* subckt_point ( struct o pointer,
char *  name,
struct ka AOI,
int  mask 
)
static

Definition at line 741 of file grafintr.c.

747 {
748  struct s *NewDesc;
749  struct hyEnt *h = NULL;
750  struct parent *p;
751 
752  if (!OpenCell(name,&NewDesc)) {
753  SetTransform(pointer);
754  TPremultiply();
755  h = select_point(NewDesc,AOI,mask);
756  TPop();
757  }
758 
759  if (h) {
760  p = (struct parent *)tmalloc(sizeof(struct parent));
761  p->pPointer = pointer;
762  p->pNext = h->hyParent;
763  h->hyParent = p;
764  }
765  return (h);
766 }
Definition: sced.h:172
Definition: cddefs.h:119
void SetTransform()
FILE * p
Definition: proc2mod.c:48
struct parent * pNext
Definition: sced.h:175
struct o * pPointer
Definition: sced.h:173
int OpenCell()
char * tmalloc()
struct parent * hyParent
Definition: sced.h:185
#define NULL
Definition: spdefs.h:121
void TPremultiply()
Definition: xforms.c:216
Definition: sced.h:178
static struct hyEnt * select_point()
void TPop()
Definition: xforms.c:64
static int trans_mark ( )
static
static int trans_mark ( int  i)
static

Definition at line 500 of file grafintr.c.

502 {
503  long X,Y,X1,Y1;
504  int orient;
505 
506  switch (GPoint[i]->hyOrient) {
507  default:
508  case MARK_NONE:
509  return (MARK_NONE);
510  case MARK_DN:
511  X = 0;
512  Y = -1;
513  break;
514  case MARK_RT:
515  X = 1;
516  Y = 0;
517  break;
518  case MARK_UP:
519  X = 0;
520  Y = 1;
521  break;
522  case MARK_LT:
523  X = -1;
524  Y = 0;
525  break;
526  }
527  X1 = 0;
528  Y1 = 0;
529  TPoint(&X,&Y);
530  TPoint(&X1,&Y1);
531  X -= X1;
532  Y -= Y1;
533 
534  if (X == 0) {
535  if (Y == 1)
536  orient = MARK_UP;
537  else
538  orient = MARK_DN;
539  }
540  else {
541  if (X == 1)
542  orient = MARK_RT;
543  else
544  orient = MARK_LT;
545  }
546  return (orient);
547 }
#define MARK_DN
Definition: scedmacs.h:29
void TPoint()
#define MARK_LT
Definition: scedmacs.h:32
#define MARK_UP
Definition: scedmacs.h:31
long X
Definition: actions.c:450
#define MARK_RT
Definition: scedmacs.h:30
static struct hyEnt * GPoint[9]
Definition: grafintr.c:19
long Y
Definition: actions.c:450
#define MARK_NONE
Definition: scedmacs.h:28
void wl_free ( )

Variable Documentation

int DoingIplot
static

Definition at line 22 of file grafintr.c.

struct hyEnt* GPoint[9]
static

Definition at line 19 of file grafintr.c.

int IplotStatusChanged

Definition at line 23 of file grafintr.c.

char* MenuEDIT

Definition at line 75 of file scedintr.c.

char* MenuGRAF

Definition at line 78 of file scedintr.c.

char* MenuIPLOT

Definition at line 83 of file scedintr.c.