Merge branch 'topic/sync-to-go-2'
[s-roff.git] / src / pre-grn / hpoint.cpp
blob0c4a87afc1305f9fe42ece597e28034f431f7ca3
1 /*
2 * This file contains routines for manipulating the point data structures
3 * for the gremlin picture editor.
4 */
5 /* Last non-groff version: hpoint.c 1.1 84/10/08 */
7 #include "config.h"
8 #include "grn-config.h"
10 #include <stdlib.h>
12 #include "gprint.h"
15 * Return pointer to empty point list.
17 POINT *
18 PTInit()
20 return ((POINT *) NULL);
24 * This routine creates a new point with coordinates x and y and links it
25 * into the pointlist.
27 POINT *
28 PTMakePoint(double x,
29 double y,
30 POINT **pplist)
32 register POINT *pt;
34 if (Nullpoint(pt = *pplist)) { /* empty list */
35 *pplist = (POINT *) malloc(sizeof(POINT));
36 pt = *pplist;
37 } else {
38 while (!Nullpoint(pt->nextpt))
39 pt = pt->nextpt;
40 pt->nextpt = (POINT *) malloc(sizeof(POINT));
41 pt = pt->nextpt;
44 pt->x = x;
45 pt->y = y;
46 pt->nextpt = PTInit();
47 return (pt);
48 } /* end PTMakePoint */
50 // s-it2-mode