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