changeset 20:cd8275f62ee1 pure_C

added pure C brch
author Me@portablequad
date Mon, 13 Feb 2012 12:57:42 -0800
parents 24800f145c32
children
files DblHist.c FloatHist.c Histogram.c Histogram.h __brch__MC_shared __brch__pure_C
diffstat 6 files changed, 22 insertions(+), 24 deletions(-) [+]
line diff
     1.1 --- a/DblHist.c	Mon Feb 13 12:50:42 2012 -0800
     1.2 +++ b/DblHist.c	Mon Feb 13 12:57:42 2012 -0800
     1.3 @@ -28,8 +28,8 @@
     1.4     DblHist *hist;
     1.5     int i;
     1.6  
     1.7 -   hist = VMS_int__malloc( sizeof(DblHist) );
     1.8 -   hist->bins = VMS_int__malloc( numBins * sizeof(int) );
     1.9 +   hist = malloc( sizeof(DblHist) );
    1.10 +   hist->bins = malloc( numBins * sizeof(int) );
    1.11  
    1.12     hist->numBins      = numBins;
    1.13     hist->binWidth     = binWidth;
    1.14 @@ -102,6 +102,6 @@
    1.15  void
    1.16  freeDblHist( DblHist *hist )
    1.17   {
    1.18 -   VMS_int__free( hist->bins );
    1.19 -   VMS_int__free( hist );
    1.20 +   free( hist->bins );
    1.21 +   free( hist );
    1.22   }
     2.1 --- a/FloatHist.c	Mon Feb 13 12:50:42 2012 -0800
     2.2 +++ b/FloatHist.c	Mon Feb 13 12:57:42 2012 -0800
     2.3 @@ -26,8 +26,8 @@
     2.4     FloatHist *hist;
     2.5     int i;
     2.6  
     2.7 -   hist = VMS_int__malloc( sizeof(FloatHist) );
     2.8 -   hist->bins = VMS_int__malloc( numBins * sizeof(int) );
     2.9 +   hist = malloc( sizeof(FloatHist) );
    2.10 +   hist->bins = malloc( numBins * sizeof(int) );
    2.11  
    2.12     hist->numBins      = numBins;
    2.13     hist->binWidth     = binWidth;
    2.14 @@ -100,6 +100,6 @@
    2.15  void
    2.16  freeFloatHist( FloatHist *hist )
    2.17   {
    2.18 -   VMS_int__free( hist->bins );
    2.19 -   VMS_int__free( hist );
    2.20 +   free( hist->bins );
    2.21 +   free( hist );
    2.22   }
     3.1 --- a/Histogram.c	Mon Feb 13 12:50:42 2012 -0800
     3.2 +++ b/Histogram.c	Mon Feb 13 12:57:42 2012 -0800
     3.3 @@ -34,8 +34,8 @@
     3.4     int32 i;
     3.5  
     3.6  
     3.7 -   hist = VMS_int__malloc( sizeof(Histogram) );
     3.8 -   hist->bins = VMS_int__malloc( numBins * sizeof(int32) );
     3.9 +   hist = malloc( sizeof(Histogram) );
    3.10 +   hist->bins = malloc( numBins * sizeof(int32) );
    3.11  
    3.12     hist->numBins      = numBins;
    3.13     hist->binWidth     = (endOfRange - startOfRange) / numBins;
    3.14 @@ -71,10 +71,10 @@
    3.15   {
    3.16     Histogram *hist;
    3.17  
    3.18 -   hist = VMS_int__malloc( sizeof(Histogram) );
    3.19 -   hist->bins = VMS_int__malloc( numBins * sizeof(int32) );
    3.20 +   hist = malloc( sizeof(Histogram) );
    3.21 +   hist->bins = malloc( numBins * sizeof(int32) );
    3.22  
    3.23 -   makeHist_helper( hist, numBins, startOfRange, binWidth,VMS_int__strDup(name));
    3.24 +   makeHist_helper( hist, numBins, startOfRange, binWidth,strDup(name));
    3.25  
    3.26     return hist;
    3.27   }
    3.28 @@ -345,9 +345,9 @@
    3.29  void
    3.30  freeHist( Histogram *hist )
    3.31   {
    3.32 -   VMS_int__free( hist->bins );
    3.33 -   VMS_int__free( hist->name );
    3.34 -   VMS_int__free( hist );
    3.35 +   free( hist->bins );
    3.36 +   free( hist->name );
    3.37 +   free( hist );
    3.38   }
    3.39  void
    3.40  freeHistExt( Histogram *hist )
     4.1 --- a/Histogram.h	Mon Feb 13 12:50:42 2012 -0800
     4.2 +++ b/Histogram.h	Mon Feb 13 12:57:42 2012 -0800
     4.3 @@ -6,10 +6,6 @@
     4.4   * 
     4.5   */
     4.6  
     4.7 -#include "../../VMS_Implementations/VMS_impl/VMS.h"
     4.8 -#include "../../VMS_Implementations/VMS_impl/vmalloc.h"
     4.9 -#include "../../VMS_Implementations/VMS_impl/vutilities.h"
    4.10 -
    4.11  #ifndef _HISTOGRAM_H
    4.12  #define	_HISTOGRAM_H
    4.13  
     5.1 --- a/__brch__MC_shared	Mon Feb 13 12:50:42 2012 -0800
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,4 +0,0 @@
     5.4 -This branch is for the project structure defined Jan 2012..  the #includes reflect this directory structure.
     5.5 -
     5.6 -More importantly, the MC_shared  version of VMS requires a separat malloc implemeted by VMS code..  so this branch has modified the library to use the VMS-specific malloc.
     5.7 -
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/__brch__pure_C	Mon Feb 13 12:57:42 2012 -0800
     6.3 @@ -0,0 +1,6 @@
     6.4 +
     6.5 +This branch is for use in pure C code (*not* inside VMS-based language application code)
     6.6 +
     6.7 +There are two versions of the library -- one for pure C use, the other for use inside VMS or within applications written in a VMS-based language (IE, inside a top-level function or a call descendant of a top-level function) -- but only when the VMS is the "MC_shared" version.
     6.8 +
     6.9 +The reason is that VMS that uses shared memory on multicores moves the SlaveVPs around among cores.  But, the libC and glibC malloc stores info at the top of the stack (a "clever" hack), for a speed improvement.  So, when VMS manipulates the stack pointer, and/or moves Slaves to different cores, the "free" seg faults (that was FUN to figure out ; )  So, this version of VMS implements its own malloc. 
    6.10 \ No newline at end of file