1*17239Sralph /*	hpoint.c	1.1	84/10/08	*/
2*17239Sralph /*
3*17239Sralph  * This file contains routines for manipulating the point data
4*17239Sralph  * structures for the gremlin picture editor.
5*17239Sralph  */
6*17239Sralph 
7*17239Sralph #include "gprint.h"
8*17239Sralph 
9*17239Sralph /* imports from C */
10*17239Sralph 
11*17239Sralph extern char *malloc();
12*17239Sralph 
13*17239Sralph 
14*17239Sralph /*
15*17239Sralph  * Return pointer to empty point list.
16*17239Sralph  */
17*17239Sralph POINT *
PTInit()18*17239Sralph PTInit()
19*17239Sralph {
20*17239Sralph     return((POINT *) NULL);
21*17239Sralph }
22*17239Sralph 
23*17239Sralph 
24*17239Sralph /*
25*17239Sralph  * This routine creates a new point with coordinates x and y and
26*17239Sralph  * links it into the pointlist.
27*17239Sralph  */
28*17239Sralph POINT *
PTMakePoint(x,y,pplist)29*17239Sralph PTMakePoint(x, y, pplist)
30*17239Sralph float x, y;
31*17239Sralph POINT **pplist;
32*17239Sralph {
33*17239Sralph     register POINT *point;
34*17239Sralph 
35*17239Sralph     if (Nullpoint(point = *pplist)) {	/* empty list */
36*17239Sralph 	*pplist = (POINT *) malloc(sizeof(POINT));
37*17239Sralph 	point = *pplist;
38*17239Sralph     }
39*17239Sralph     else {
40*17239Sralph 	while (!Nullpoint(point->nextpt))
41*17239Sralph 	    point = point->nextpt;
42*17239Sralph 	point->nextpt = (POINT *) malloc(sizeof(POINT));
43*17239Sralph 	point = point->nextpt;
44*17239Sralph     }
45*17239Sralph 
46*17239Sralph     point->x = x;
47*17239Sralph     point->y = y;
48*17239Sralph     point->nextpt = PTInit();
49*17239Sralph     return(point);
50*17239Sralph }  /* end PTMakePoint */
51