This is plcont.c in view mode; [Download] [Up]
/* Draws a contour plot from data in *z[], using the subarray */
/* from kx to lx in the x direction and from ky to ly in the y */
/* direction. The array of contour levels is clevel(nlevel), and */
/* "pltr" is the name of a subroutine which transforms array indicies */
/* into world coordinates */
#include "plplot.h"
#include <stdio.h>
#if defined(PLSTDC) && defined(STDLIB)
#include <stdlib.h>
#else
extern char *malloc();
extern void free();
#endif
void plcont(z,nx,ny,kx,lx,ky,ly,clevel,nlevel,pltr)
int nx, ny, kx, lx, ky, ly, nlevel;
FLOAT **z, *clevel;
void (*pltr)();
{
int i, mx, my, nstor, *heapc;
mx = lx - kx + 1;
my = ly - ky + 1;
if (kx < 1 || lx > nx || kx >= lx || ky < 1 || ky > ny || ky >= ly)
plexit("Argument error in plcont.");
nstor = mx*my/5;
if(( heapc = (int *)malloc((mx+2*nstor)*sizeof(int))) == NULL)
plexit("Out of memory in plcont.");
for (i=0; i<nlevel; i++) {
plcntr(z,nx,ny,kx,lx,ky,ly,clevel[i],&heapc[0],
&heapc[nx],&heapc[nx+nstor],nstor,pltr);
}
free((VOID *)heapc);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.