Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > Histogram
changeset 14:1fbaedaac2c7
made defualt brch pure C (no VMS__malloc..)
| author | Me@portablequad |
|---|---|
| date | Sat, 11 Feb 2012 19:19:06 -0800 |
| parents | 2409ce192375 |
| children | 32489b8b763c |
| files | .brch__default .hgeol DblHist.c FloatHist.c Histogram.c Histogram.h primitive_data_types.h |
| diffstat | 7 files changed, 181 insertions(+), 125 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/.brch__default Sat Feb 11 19:19:06 2012 -0800 1.3 @@ -0,0 +1,1 @@ 1.4 +The default branch is for use with normal C code. Other branches specialize the library for use with VMS.. they may need VMS header files, and the working directory may be located at various different positions relative to the VMS implementation. 1.5 \ No newline at end of file
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/.hgeol Sat Feb 11 19:19:06 2012 -0800 2.3 @@ -0,0 +1,14 @@ 2.4 + 2.5 +[patterns] 2.6 +**.py = native 2.7 +**.txt = native 2.8 +**.c = native 2.9 +**.h = native 2.10 +**.cpp = native 2.11 +**.java = native 2.12 +**.class = bin 2.13 +**.jar = bin 2.14 +**.sh = native 2.15 +**.pl = native 2.16 +**.jpg = bin 2.17 +**.gif = bin
3.1 --- a/DblHist.c Thu Feb 09 15:53:03 2012 +0100 3.2 +++ b/DblHist.c Sat Feb 11 19:19:06 2012 -0800 3.3 @@ -8,7 +8,6 @@ 3.4 3.5 #include <stdio.h> 3.6 #include "Histogram.h" 3.7 -#include "../vmalloc.h" 3.8 3.9 3.10 /*This Histogram Abstract Data Type has a number of bins, the starting 3.11 @@ -29,8 +28,8 @@ 3.12 DblHist *hist; 3.13 int i; 3.14 3.15 - hist = VMS__malloc( sizeof(DblHist) ); 3.16 - hist->bins = VMS__malloc( numBins * sizeof(int) ); 3.17 + hist = malloc( sizeof(DblHist) ); 3.18 + hist->bins = malloc( numBins * sizeof(int) ); 3.19 3.20 hist->numBins = numBins; 3.21 hist->binWidth = binWidth; 3.22 @@ -103,6 +102,6 @@ 3.23 void 3.24 freeDblHist( DblHist *hist ) 3.25 { 3.26 - VMS__free( hist->bins ); 3.27 - VMS__free( hist ); 3.28 + free( hist->bins ); 3.29 + free( hist ); 3.30 }
4.1 --- a/FloatHist.c Thu Feb 09 15:53:03 2012 +0100 4.2 +++ b/FloatHist.c Sat Feb 11 19:19:06 2012 -0800 4.3 @@ -7,7 +7,6 @@ 4.4 */ 4.5 #include <stdio.h> 4.6 #include "Histogram.h" 4.7 -#include "../vmalloc.h" 4.8 4.9 /*This Histogram Abstract Data Type has a number of bins, the starting 4.10 * value, and the width of each bin, as a float, all chosen at creation. 4.11 @@ -27,8 +26,8 @@ 4.12 FloatHist *hist; 4.13 int i; 4.14 4.15 - hist = VMS__malloc( sizeof(FloatHist) ); 4.16 - hist->bins = VMS__malloc( numBins * sizeof(int) ); 4.17 + hist = malloc( sizeof(FloatHist) ); 4.18 + hist->bins = malloc( numBins * sizeof(int) ); 4.19 4.20 hist->numBins = numBins; 4.21 hist->binWidth = binWidth; 4.22 @@ -101,6 +100,6 @@ 4.23 void 4.24 freeFloatHist( FloatHist *hist ) 4.25 { 4.26 - VMS__free( hist->bins ); 4.27 - VMS__free( hist ); 4.28 + free( hist->bins ); 4.29 + free( hist ); 4.30 }
5.1 --- a/Histogram.c Thu Feb 09 15:53:03 2012 +0100 5.2 +++ b/Histogram.c Sat Feb 11 19:19:06 2012 -0800 5.3 @@ -7,9 +7,6 @@ 5.4 */ 5.5 #include <stdio.h> 5.6 #include "Histogram.h" 5.7 -#include "../VMS.h" 5.8 -#include "../vutilities.h" 5.9 -#include "../vmalloc.h" 5.10 5.11 //External variables for saving of the histogram 5.12 //These have to be defined by to plugins in order to enable VMS to print this 5.13 @@ -38,8 +35,8 @@ 5.14 int32 i; 5.15 5.16 5.17 - hist = VMS__malloc( sizeof(Histogram) ); 5.18 - hist->bins = VMS__malloc( numBins * sizeof(int32) ); 5.19 + hist = malloc( sizeof(Histogram) ); 5.20 + hist->bins = malloc( numBins * sizeof(int32) ); 5.21 5.22 hist->numBins = numBins; 5.23 hist->binWidth = (endOfRange - startOfRange) / numBins; 5.24 @@ -75,16 +72,16 @@ 5.25 { 5.26 Histogram *hist; 5.27 5.28 - hist = VMS__malloc( sizeof(Histogram) ); 5.29 - hist->bins = VMS__malloc( numBins * sizeof(int32) ); 5.30 + hist = malloc( sizeof(Histogram) ); 5.31 + hist->bins = malloc( numBins * sizeof(int32) ); 5.32 5.33 - makeHist_helper( hist, numBins, startOfRange, binWidth,VMS__strDup(name)); 5.34 + makeHist_helper( hist, numBins, startOfRange, binWidth,strDup(name)); 5.35 5.36 return hist; 5.37 } 5.38 5.39 Histogram * 5.40 -makeFixedBinHistExt( int32 numBins, int32 startOfRange, int32 binWidth, 5.41 +makeFixedBinHist( int32 numBins, int32 startOfRange, int32 binWidth, 5.42 char *name ) 5.43 5.44 { 5.45 @@ -349,13 +346,6 @@ 5.46 void 5.47 freeHist( Histogram *hist ) 5.48 { 5.49 - VMS__free( hist->bins ); 5.50 - VMS__free( hist->name ); 5.51 - VMS__free( hist ); 5.52 - } 5.53 -void 5.54 -freeHistExt( Histogram *hist ) 5.55 - { 5.56 free( hist->bins ); 5.57 free( hist->name ); 5.58 free( hist );
6.1 --- a/Histogram.h Thu Feb 09 15:53:03 2012 +0100 6.2 +++ b/Histogram.h Sat Feb 11 19:19:06 2012 -0800 6.3 @@ -1,99 +1,99 @@ 6.4 -/* 6.5 - * Copyright 2010 OpenSourceStewardshipFoundation.org 6.6 - * Licensed under GNU General Public License version 2 6.7 - * 6.8 - * Author: seanhalle@yahoo.com 6.9 - * 6.10 - */ 6.11 - 6.12 -#include "../../VMS_Implementations/VMS_impl/VMS_primitive_data_types.h" 6.13 - 6.14 -#ifndef _HISTOGRAM_H 6.15 -#define _HISTOGRAM_H 6.16 - 6.17 -typedef struct 6.18 - { 6.19 - char *name; 6.20 - int32 startOfRange; 6.21 - int32 endOfRange; 6.22 - int32 numBins; 6.23 - int32 binWidth; 6.24 - int32 *bins; 6.25 - } 6.26 -Histogram; 6.27 - 6.28 -typedef struct 6.29 - { 6.30 - float32 startOfRange; 6.31 - float32 endOfRange; 6.32 - int32 numBins; 6.33 - float32 binWidth; 6.34 - int32 *bins; 6.35 - } 6.36 -FloatHist; 6.37 - 6.38 -typedef struct 6.39 - { 6.40 - float64 startOfRange; 6.41 - float64 endOfRange; 6.42 - int32 numBins; 6.43 - float64 binWidth; 6.44 - int32 *bins; 6.45 - } 6.46 -DblHist; 6.47 - 6.48 -Histogram * 6.49 -makeHistogram( int32 numBins, int32 startOfRange, int32 endOfRange ); 6.50 - 6.51 -Histogram * 6.52 -makeFixedBinHist( int32 numBins, int32 startOfRange, int32 binWidth, 6.53 - char *name ); 6.54 - 6.55 -Histogram * 6.56 -makeFixedBinHistExt( int32 numBins, int32 startOfRange, int32 binWidth, 6.57 - char *name ); 6.58 - 6.59 -void inline 6.60 -addToHist( int32 value, Histogram *hist ); 6.61 - 6.62 -void inline 6.63 -addIntervalToHist( uint32 startIntvl, uint32 endIntvl, Histogram *hist ); 6.64 - 6.65 -void inline 6.66 -subIntervalFromHist( int32 startIntvl, int32 endIntvl, Histogram *hist ); 6.67 - 6.68 -void 6.69 -saveHistToFile(Histogram *hist); 6.70 - 6.71 -void 6.72 -printHist( Histogram *hist ); 6.73 - 6.74 -FloatHist * 6.75 -makeFloatHistogram( int numBins, float32 startOfRange, float32 binWidth ); 6.76 - 6.77 -void 6.78 -addToFloatHist( float32 value, FloatHist *hist ); 6.79 - 6.80 -void 6.81 -printFloatHist( FloatHist *hist ); 6.82 - 6.83 -void 6.84 -freeHistExt( Histogram *hist ); 6.85 - 6.86 -void 6.87 -freeHist( Histogram *hist ); 6.88 - 6.89 -DblHist * 6.90 -makeDblHistogram( int numBins, float64 startOfRange, float64 binWidth ); 6.91 - 6.92 -void 6.93 -addToDblHist( float64 value, DblHist *hist ); 6.94 - 6.95 -void 6.96 -printDblHist( DblHist *hist ); 6.97 - 6.98 -void 6.99 -freeDblHist( DblHist *hist ); 6.100 - 6.101 -#endif /* _HISTOGRAM_H */ 6.102 - 6.103 +/* 6.104 + * Copyright 2010 OpenSourceStewardshipFoundation.org 6.105 + * Licensed under GNU General Public License version 2 6.106 + * 6.107 + * Author: seanhalle@yahoo.com 6.108 + * 6.109 + */ 6.110 + 6.111 +#include "primitive_data_types.h" 6.112 + 6.113 +#ifndef _HISTOGRAM_H 6.114 +#define _HISTOGRAM_H 6.115 + 6.116 +typedef struct 6.117 + { 6.118 + char *name; 6.119 + int32 startOfRange; 6.120 + int32 endOfRange; 6.121 + int32 numBins; 6.122 + int32 binWidth; 6.123 + int32 *bins; 6.124 + } 6.125 +Histogram; 6.126 + 6.127 +typedef struct 6.128 + { 6.129 + float32 startOfRange; 6.130 + float32 endOfRange; 6.131 + int32 numBins; 6.132 + float32 binWidth; 6.133 + int32 *bins; 6.134 + } 6.135 +FloatHist; 6.136 + 6.137 +typedef struct 6.138 + { 6.139 + float64 startOfRange; 6.140 + float64 endOfRange; 6.141 + int32 numBins; 6.142 + float64 binWidth; 6.143 + int32 *bins; 6.144 + } 6.145 +DblHist; 6.146 + 6.147 +Histogram * 6.148 +makeHistogram( int32 numBins, int32 startOfRange, int32 endOfRange ); 6.149 + 6.150 +Histogram * 6.151 +makeFixedBinHist( int32 numBins, int32 startOfRange, int32 binWidth, 6.152 + char *name ); 6.153 + 6.154 +Histogram * 6.155 +makeFixedBinHistExt( int32 numBins, int32 startOfRange, int32 binWidth, 6.156 + char *name ); 6.157 + 6.158 +void inline 6.159 +addToHist( int32 value, Histogram *hist ); 6.160 + 6.161 +void inline 6.162 +addIntervalToHist( uint32 startIntvl, uint32 endIntvl, Histogram *hist ); 6.163 + 6.164 +void inline 6.165 +subIntervalFromHist( int32 startIntvl, int32 endIntvl, Histogram *hist ); 6.166 + 6.167 +void 6.168 +saveHistToFile(Histogram *hist); 6.169 + 6.170 +void 6.171 +printHist( Histogram *hist ); 6.172 + 6.173 +FloatHist * 6.174 +makeFloatHistogram( int numBins, float32 startOfRange, float32 binWidth ); 6.175 + 6.176 +void 6.177 +addToFloatHist( float32 value, FloatHist *hist ); 6.178 + 6.179 +void 6.180 +printFloatHist( FloatHist *hist ); 6.181 + 6.182 +void 6.183 +freeHistExt( Histogram *hist ); 6.184 + 6.185 +void 6.186 +freeHist( Histogram *hist ); 6.187 + 6.188 +DblHist * 6.189 +makeDblHistogram( int numBins, float64 startOfRange, float64 binWidth ); 6.190 + 6.191 +void 6.192 +addToDblHist( float64 value, DblHist *hist ); 6.193 + 6.194 +void 6.195 +printDblHist( DblHist *hist ); 6.196 + 6.197 +void 6.198 +freeDblHist( DblHist *hist ); 6.199 + 6.200 +#endif /* _HISTOGRAM_H */ 6.201 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/primitive_data_types.h Sat Feb 11 19:19:06 2012 -0800 7.3 @@ -0,0 +1,53 @@ 7.4 +/* 7.5 + * Copyright 2009 OpenSourceStewardshipFoundation.org 7.6 + * Licensed under GNU General Public License version 2 7.7 + * 7.8 + * Author: seanhalle@yahoo.com 7.9 + * 7.10 + 7.11 + */ 7.12 + 7.13 +#ifndef _BLIS_PRIMITIVE_DATA_TYPES_H 7.14 +#define _BLIS_PRIMITIVE_DATA_TYPES_H 7.15 + 7.16 + 7.17 +/*For portability, need primitive data types that have a well defined 7.18 + * size, and well-defined layout into bytes 7.19 + *To do this, provide BLIS standard aliases for all primitive data types 7.20 + *These aliases must be used in all BLIS functions instead of the ANSI types 7.21 + * 7.22 + *These definitions will be replaced inside each specialization module 7.23 + * according to the compiler used in that module and the hardware being 7.24 + * specialized to. 7.25 + */ 7.26 +/* 7.27 +#define int8 char 7.28 +#define uint8 char 7.29 +#define int16 short 7.30 +#define uint16 unsigned short 7.31 +#define int32 int 7.32 +#define uint32 unsigned int 7.33 +#define int64 long long 7.34 +#define uint64 unsigned long long 7.35 +#define float32 float 7.36 +#define float64 double 7.37 +*/ 7.38 +typedef char bool8; 7.39 +typedef char int8; 7.40 +typedef char uint8; 7.41 +typedef short int16; 7.42 +typedef unsigned short uint16; 7.43 +typedef int int32; 7.44 +typedef unsigned int uint32; 7.45 +typedef long long int64; 7.46 +typedef unsigned long long uint64; 7.47 +typedef float float32; 7.48 +typedef double float64; 7.49 +//typedef double double float128; 7.50 +#define float128 double double 7.51 + 7.52 +#define TRUE 1 7.53 +#define FALSE 0 7.54 + 7.55 +#endif /* _BLIS_PRIMITIVE_DATA_TYPES_H */ 7.56 +
