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