This is h_test.c in view mode; [Download] [Up]
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "hippo.h"
int main()
{
ntuple *nt_list;
display *d_list;
FILE *outfile;
int nnt;
/*
* read in example ntuple
*/
if (h_read("example.hippo",&d_list,&nt_list) != 0)
{
fprintf(stderr,"Error reading file example.hippo\n");
exit(1);
}
/*
* check a few things
*/
for (nnt=0; nt_list[nnt] != NULL; nnt++);
if (nnt != 1)
{
fprintf(stderr,"There are %d ntuples in the file\n",nnt);
fprintf(stderr," There should only be 1!\n");
exit(1);
}
/*
* create display
*/
if ((d_list[0] = h_newDisp(HISTOGRAM)) == NULL)
{
fprintf(stderr,"Error creating display\n");
exit(1);
}
/*
* set display attributes
*/
h_setBinNum(d_list[0],XAXIS,10);
h_bindNtuple( d_list[0], nt_list[0] );
h_bind(d_list[0],XAXIS, 1);
/*
* create line printer output of display
*/
outfile = fopen("h_test.out2","w");
h_fprint(d_list[0],outfile);
/*
* clean up and exit
*/
fclose(outfile);
h_freeDisp(d_list[0]);
h_freeNt(nt_list[0]);
free(nt_list);
free(d_list);
exit(0);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.