Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > Histogram
comparison DblHist.c @ 14:1fbaedaac2c7
made defualt brch pure C (no VMS__malloc..)
| author | Me@portablequad |
|---|---|
| date | Sat, 11 Feb 2012 19:19:06 -0800 |
| parents | 060d63cb5d34 |
| children | 32489b8b763c |
comparison
equal
deleted
inserted
replaced
| 3:4282b2b416a0 | 4:1144f8131cf3 |
|---|---|
| 6 * | 6 * |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include "Histogram.h" | 10 #include "Histogram.h" |
| 11 #include "../vmalloc.h" | |
| 12 | 11 |
| 13 | 12 |
| 14 /*This Histogram Abstract Data Type has a number of bins, the starting | 13 /*This Histogram Abstract Data Type has a number of bins, the starting |
| 15 * value, and the width of each bin, as a float, all chosen at creation. | 14 * value, and the width of each bin, as a float, all chosen at creation. |
| 16 * | 15 * |
| 27 makeDblHistogram( int32 numBins, float64 startOfRange, float64 binWidth ) | 26 makeDblHistogram( int32 numBins, float64 startOfRange, float64 binWidth ) |
| 28 { | 27 { |
| 29 DblHist *hist; | 28 DblHist *hist; |
| 30 int i; | 29 int i; |
| 31 | 30 |
| 32 hist = VMS__malloc( sizeof(DblHist) ); | 31 hist = malloc( sizeof(DblHist) ); |
| 33 hist->bins = VMS__malloc( numBins * sizeof(int) ); | 32 hist->bins = malloc( numBins * sizeof(int) ); |
| 34 | 33 |
| 35 hist->numBins = numBins; | 34 hist->numBins = numBins; |
| 36 hist->binWidth = binWidth; | 35 hist->binWidth = binWidth; |
| 37 hist->endOfRange = startOfRange + hist->binWidth * numBins; | 36 hist->endOfRange = startOfRange + hist->binWidth * numBins; |
| 38 hist->startOfRange = startOfRange; | 37 hist->startOfRange = startOfRange; |
| 101 | 100 |
| 102 | 101 |
| 103 void | 102 void |
| 104 freeDblHist( DblHist *hist ) | 103 freeDblHist( DblHist *hist ) |
| 105 { | 104 { |
| 106 VMS__free( hist->bins ); | 105 free( hist->bins ); |
| 107 VMS__free( hist ); | 106 free( hist ); |
| 108 } | 107 } |
