include define MSIZE 4. # Mark size # SPADDN -- Add a node for cubic spline fit. procedure spaddn (gp, wx, wy, x, y, npts) pointer gp # GIO pointer real wx # X point to insert real wy # Y point to insert double x[npts] # Independent variable double y[npts] # Dependent variable int npts # Number of points int i, j begin # Find the place to insert the new point. if (x[1] < x[npts]) for (i = npts; (i > 0) && (wx < x[i]); i = i - 1) ; else for (i = npts; (i > 0) && (wx > x[i]); i = i - 1) ; # Shift the data to insert the new point. for (j = npts; j > i; j = j - 1) { x[j+1] = x[j] y[j+1] = y[j] } # Add the new point and increment the number of points. i = i + 1 x[i] = wx y[i] = wy npts = npts + 1 # Mark the point call gmark (gp, real (x[i]), real (y[i]), GM_PLUS, MSIZE, MSIZE) end