# HG changeset patch # User Me@portablequad # Date 1329019738 28800 # Node ID 1bf28dddc45ffc355f3c5c058ed155f1e49cdd4c # Parent d46150af45adf8e814ea46adc8f928e79bb9ee8a Created MC_shared branch diff -r d46150af45ad -r 1bf28dddc45f .brch__MC_shared --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.brch__MC_shared Sat Feb 11 20:08:58 2012 -0800 @@ -0,0 +1,4 @@ +This branch is for the project structure defined Jan 2012.. the #includes reflect this directory structure. + +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. + diff -r d46150af45ad -r 1bf28dddc45f .hgeol --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgeol Sat Feb 11 20:08:58 2012 -0800 @@ -0,0 +1,14 @@ + +[patterns] +**.py = native +**.txt = native +**.c = native +**.h = native +**.cpp = native +**.java = native +**.class = bin +**.jar = bin +**.sh = native +**.pl = native +**.jpg = bin +**.gif = bin diff -r d46150af45ad -r 1bf28dddc45f Param.h --- a/Param.h Tue Feb 07 12:51:29 2012 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * - * Author: SeanHalle@yahoo.com - * - * Created on November 19, 2009, 6:30 PM - */ - -#ifndef _PARAM_H -#define _PARAM_H - -typedef -struct - { int type; - int intValue; - char * strValue; - float floatValue; - } -ParamStruc; - -#define INT_PARAM_TYPE 0 -#define STRING_PARAM_TYPE 1 -#define FLOAT_PARAM_TYPE 2 - -#define PARAM_BAG_HASHSIZE 1024 - -typedef struct _ParamBagHashEntry ParamBagHashEntry; - -struct _ParamBagHashEntry - { - char *key; - ParamStruc *param; - struct _ParamBagHashEntry *next; - } -/*ParamBagHashEntry*/; - - -typedef -struct - { int bagSz; - ParamBagHashEntry* *entries; - } -ParamBag; - - -ParamBag *makeParamBag(); -void readParamFileIntoBag( char *paramFileName, ParamBag * bag ); -ParamStruc *getParamFromBag( char *key, ParamBag * bag ); -int addParamToBag( char* key, ParamStruc *param, ParamBag *bag ); -void freeParamBag( ParamBag *bag ); -//char *paramBagToString( ParamBag * bag ); -ParamStruc *makeParamStruc(); -ParamStruc *makeParamFromStrs( char * type, char *value ); -ssize_t getline( char **lineptr, size_t *n, FILE *stream ); - -#endif /* _PARAM_H */ - diff -r d46150af45ad -r 1bf28dddc45f ParamBag.c --- a/ParamBag.c Tue Feb 07 12:51:29 2012 -0800 +++ b/ParamBag.c Sat Feb 11 20:08:58 2012 -0800 @@ -24,8 +24,8 @@ ParamBag * makeParamBag() { ParamBag * retBag; - retBag = malloc( sizeof( ParamBag ) ); - retBag->entries = malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); + retBag = VMS__malloc( sizeof( ParamBag ) ); + retBag->entries = VMS__malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); retBag->bagSz = PARAM_BAG_HASHSIZE; nullOutParamBagHashEntries( retBag ); @@ -80,7 +80,7 @@ hashEntry = lookupKeyInHash( key, bag ); if( hashEntry == NULL ) { hashIdx = hashKey( key, bag->bagSz ); - hashEntry = (ParamBagHashEntry*) malloc( sizeof( ParamBagHashEntry ) ); + hashEntry = (ParamBagHashEntry*) VMS__malloc( sizeof( ParamBagHashEntry ) ); if( hashEntry == NULL ) return 0; hashEntry->key = strdup( key ); if( hashEntry->key == NULL ) return 0; @@ -118,20 +118,20 @@ freeParamBagHashEntry( ParamBagHashEntry *entry ) { freeParamStruc( entry->param ); - free( entry->key ); //was malloc'd above, so free it - free( entry ); + VMS__free( entry->key ); //was malloc'd above, so free it + VMS__free( entry ); } void freeParamStruc( ParamStruc * param ) - { if( param->type == STRING_PARAM_TYPE ) free( param->strValue ); - free( param ); + { if( param->type == STRING_PARAM_TYPE ) VMS__free( param->strValue ); + VMS__free( param ); } ParamStruc * makeParamStruc() { ParamStruc *retStruc; - retStruc = malloc( sizeof( ParamStruc ) ); + retStruc = VMS__malloc( sizeof( ParamStruc ) ); retStruc->floatValue = 0.0; retStruc->intValue = 0; retStruc->strValue = NULL; @@ -164,7 +164,7 @@ } break; case 's': { retParam->type = STRING_PARAM_TYPE; - retParam->strValue = malloc( strlen(value) + 1); + retParam->strValue = VMS__malloc( strlen(value) + 1); strcpy( retParam->strValue, value ); removeEndWhtSpaceFromStr( retParam->strValue ); } break; diff -r d46150af45ad -r 1bf28dddc45f ParamBag.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ParamBag.h Sat Feb 11 20:08:58 2012 -0800 @@ -0,0 +1,59 @@ +/* + * + * Author: SeanHalle@yahoo.com + * + * Created on November 19, 2009, 6:30 PM + */ + +#ifndef _PARAM_H +#define _PARAM_H + +#include "../../VMS_Implementations/VMS_impl/VMS_primitive_data_types.h" +#include "../../VMS_Implementations/VMS_impl/vmalloc.h" + +typedef +struct + { int type; + int intValue; + char * strValue; + float floatValue; + } +ParamStruc; + +#define INT_PARAM_TYPE 0 +#define STRING_PARAM_TYPE 1 +#define FLOAT_PARAM_TYPE 2 + +#define PARAM_BAG_HASHSIZE 1024 + +typedef struct _ParamBagHashEntry ParamBagHashEntry; + +struct _ParamBagHashEntry + { + char *key; + ParamStruc *param; + struct _ParamBagHashEntry *next; + } +/*ParamBagHashEntry*/; + + +typedef +struct + { int bagSz; + ParamBagHashEntry* *entries; + } +ParamBag; + + +ParamBag *makeParamBag(); +void readParamFileIntoBag( char *paramFileName, ParamBag * bag ); +ParamStruc *getParamFromBag( char *key, ParamBag * bag ); +int addParamToBag( char* key, ParamStruc *param, ParamBag *bag ); +void freeParamBag( ParamBag *bag ); +//char *paramBagToString( ParamBag * bag ); +ParamStruc *makeParamStruc(); +ParamStruc *makeParamFromStrs( char * type, char *value ); +ssize_t getline( char **lineptr, size_t *n, FILE *stream ); + +#endif /* _PARAM_H */ + diff -r d46150af45ad -r 1bf28dddc45f ReadParamsFromFile.c --- a/ReadParamsFromFile.c Tue Feb 07 12:51:29 2012 -0800 +++ b/ReadParamsFromFile.c Sat Feb 11 20:08:58 2012 -0800 @@ -22,7 +22,7 @@ if ( lineptr == NULL || n == NULL) return -1; if (*lineptr == NULL || *n == 0) { *n = 500; //max length of line in a config file - *lineptr = (char *) malloc( *n ); + *lineptr = (char *) VMS__malloc( *n ); if (*lineptr == NULL) return -1; } if( fgets( *lineptr, *n, stream ) ) @@ -43,7 +43,7 @@ char* paramValue;// = malloc( 500 ); //max of 500 chars in value lineSz = 500; //max length of line in a config file - line = (char *) malloc( lineSz ); + line = (char *) VMS__malloc( lineSz ); if( line == NULL ) { printf( "\nIn readParamFileIntoBag: no mem for line\n" ); return; @@ -106,6 +106,6 @@ } } } - free( line ); + VMS__free( line ); }