home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
gdead.berkeley.edu
/
gdead.berkeley.edu.tar
/
gdead.berkeley.edu
/
pub
/
cad-tools
/
ciftomann.tar
/
Lib
/
edgeprocs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-01-28
|
1KB
|
75 lines
#include "aeledge.h"
#include <stdio.h>
char *ProgName;
char *malloc();
/*
* Allocate and initialize a edge structure
*/
AEL_EDGEPTR MakeEdge(x,xend,y,sense,next,last)
int x,xend,y,sense;
AEL_EDGEPTR next,last;
{
AEL_EDGEPTR new;
new = (AEL_EDGE *) malloc (sizeof (AEL_EDGE));
new->x = x;
new->xend = xend;
new->y = y;
new->sense = sense;
new->next = next;
new->last = last;
return(new);
}
panic(string)
char *string;
{
fprintf(stderr,"Panic in %s : %s\n",ProgName,string);
exit(1);
}
/*
* Insert a edge above the pointer E in the active edge list
*/
InsertAbove(E,x,xend,y,sense)
AEL_EDGEPTR E;
int x,xend,y,sense;
{
AEL_EDGEPTR new;
new = MakeEdge(x,xend,y,sense,E,E->last);
E->last->next = new;
E->last = new;
}
/*
* Remove the edge pointed to by Edge from the active edge list
* AEList. Check to see if we are trying to remove the end-of-list
* markers
*/
Remove(AEList,Edge)
AEL_LIST AEList;
AEL_EDGEPTR Edge;
{
if (Edge == AEList.bottom || Edge == AEList.top)
panic("Attempt to remove ends of the AEList");
Edge->last->next = Edge->next;
Edge->next->last = Edge->last;
free(Edge);
}
PrintEdge(E)
AEL_EDGEPTR E;
{
fprintf(stderr,"x=%d,xend=%d,y=%d,sense=%d,next %d,last %d\n",E->x,E->xend,
E->y,E->sense,E->next,E->last);
}