0
-void arrayInit(dplVal *type,
dplVal *name) {
0
+void arrayInit(dplVal *type,
dplVal *name) {
0
/* set array specific data and pass thru type */
0
- printf("init array (type = %d,name = %s)\n",
type->type,name->value.str.val);
0
+ printf("init array (type = %d,name = %s)\n",
type->type, name->value.str.val);
0
/* init the variable */
0
- variableInit(&array,
name);
0
+ variableInit(&array,
name);
0
-void arrayCreate(dplVal *type,
dplVal *name,dplVal *value) {
0
+void arrayCreate(dplVal *type,
dplVal *name, dplVal *value) {
0
- printf("creating array (type = %d,name = %s)\n",
type->type,name->value.str.val);
0
+ printf("creating array (type = %d,name = %s)\n",
type->type, name->value.str.val);
0
/* validate the value being assigned MUST BE AN ARRAY */
0
if(value->isArray != TRUE ) {
0
- dplError(DPL_WARNINGL,
"value being assigned to array must be an array");
0
+ dplError(DPL_WARNINGL,
"value being assigned to array must be an array");
0
/* assign in the values passed by the array */
0
for(i.value.ival = 0; i.value.ival < elementCount; i.value.ival++) {
0
/* fetch the element value from ht */
0
- if(dplHashIndexFind(value->value.array.elements,i.value.ival,(void **) &ivalue) == FAILURE) {
0
- dplError(DPL_CORE,"error extracting element %d from ht",i.value.ival);
0
+ if(dplHashIndexFind(value->value.array.elements, i.value.ival, (void **) &ivalue) == FAILURE) {
0
+ dplError(DPL_CORE,"error extracting element %d from ht", i.value.ival);
0
/* assign to right index */
0
- arrayAssign(name,
&i,ivalue);
0
+ arrayAssign(name,
&i, ivalue);
0
-void arrayAssign(dplVal *name,
dplVal *element,dplVal *value) {
0
+void arrayAssign(dplVal *name,
dplVal *element, dplVal *value) {
0
- printf("assigning array (name = %s,element = %d)\n",
name->value.str.val,element->value.ival);
0
+ printf("assigning array (name = %s,element = %d)\n",
name->value.str.val, element->value.ival);
0
- if(variableFetch(&array,name) == FAILURE) {
0
- dplError(DPL_WARNINGL,"array was not initialized.");
0
+ if(variableFetch(&array, name) == FAILURE) {
0
+ dplError(DPL_WARNINGL, "array was not initialized.");
0
- printf("array check (init = %d,
ce = %d)\n",array.value.array.elements->isInit,array.value.array.currentElement);
0
+ printf("array check (init = %d,
ce = %d)\n", array.value.array.elements->isInit, array.value.array.currentElement);
0
/* check if element exists */
0
- if(arrayElementExists(&array,
element) == TRUE) {
0
+ if(arrayElementExists(&array,
element) == TRUE) {
0
- printf("element %d in array %s exists...updating\n",
element->value.ival,name->value.str.val);
0
+ printf("element %d in array %s exists...updating\n",
element->value.ival, name->value.str.val);
0
/* perform a hash update */
0
- if(dplHashUpdateIndexElement(array.value.array.elements,element->value.ival,value,sizeof(dplVal)) == FAILURE) {
0
- dplError(DPL_CORE,"failed updating index %d in %s",element->value.ival,name->value.str.val);
0
+ if(dplHashUpdateIndexElement(array.value.array.elements, element->value.ival, value, sizeof(dplVal)) == FAILURE) {
0
+ dplError(DPL_CORE, "failed updating index %d in %s", element->value.ival, name->value.str.val);
0
- printf("updated array element %d successfully\n",
element->value.ival);
0
+ printf("updated array element %d successfully\n",
element->value.ival);
0
- printf("element %d in array %s does not exist...adding\n",
element->value.ival,name->value.str.val);
0
+ printf("element %d in array %s does not exist...adding\n",
element->value.ival, name->value.str.val);
0
/* perform a hash add */
0
- if(dplHashAddIndexElement(array.value.array.elements,element->value.ival,value,sizeof(dplVal)) == FAILURE) {
0
- dplError(DPL_CORE,"failed adding index %d in %s",element->value.ival,name->value.str.val);
0
+ if(dplHashAddIndexElement(array.value.array.elements, element->value.ival, value, sizeof(dplVal)) == FAILURE) {
0
+ dplError(DPL_CORE,"failed adding index %d in %s", element->value.ival, name->value.str.val);
0
/* commit the changes of the array back */
0
- if(dplHashUpdateElement(&_global(vst),name->value.str.val,name->value.str.len + 1,&array,sizeof(dplVal)) == FAILURE) {
0
- dplError(DPL_CORE,"failed udpating the array %s",name->value.str.val);
0
+ if(dplHashUpdateElement(&_global(vst), name->value.str.val, name->value.str.len + 1, &array, sizeof(dplVal)) == FAILURE) {
0
+ dplError(DPL_CORE, "failed udpating the array %s", name->value.str.val);
0
-void passArrayValue(dplVal *result,
dplVal *value,int init) {
0
+void passArrayValue(dplVal *result,
dplVal *value, int init) {
0
static int elementCount = 0;
0
result->isArray = TRUE;
0
result->value.array.elements = (HashTable *) malloc(sizeof(HashTable));
0
- if(dplHashInit(result->value.array.elements,20,NULL) == FAILURE) {
0
- dplError(DPL_CORE,"array pass hash tbl failed init");
0
+ if(dplHashInit(result->value.array.elements, 20, NULL) == FAILURE) {
0
+ dplError(DPL_CORE, "array pass hash tbl failed init");
0
- if(dplHashAddIndexElement(result->value.array.elements,elementCount,value,sizeof(dplVal)) == FAILURE) {
0
- dplError(DPL_CORE,"failed adding elements");
0
+ if(dplHashAddIndexElement(result->value.array.elements, elementCount, value, sizeof(dplVal)) == FAILURE) {
0
+ dplError(DPL_CORE, "failed adding elements");
0
int arrayElementExists(dplVal *array,dplVal *element) {
0
- if(dplHashIndexFind(array->value.array.elements,
element->value.ival,(void **) &tmp) == FAILURE) {
0
+ if(dplHashIndexFind(array->value.array.elements,
element->value.ival, (void **) &tmp) == FAILURE) {
0
-void arrayElementFetch(dplVal *result,
dplVal *_array,dplVal *element) {
0
+void arrayElementFetch(dplVal *result,
dplVal *_array, dplVal *element) {
0
dplVal array, *elementData;
0
/* check to see if we need to fetch the array */
0
if(_array->isArray != TRUE) {
0
- if(variableFetch(&array,_array) == FAILURE) {
0
- dplError(DPL_CORE,"failed fetching array %s in arrayElementFetch",_array->value.str.val);
0
+ if(variableFetch(&array, _array) == FAILURE) {
0
+ dplError(DPL_CORE, "failed fetching array %s in arrayElementFetch", _array->value.str.val);
0
- arrayValueCopy(&array,
_array);
0
+ arrayValueCopy(&array,
_array);
0
- printf("arrayElementFetch array check (init = %d,
ce = %d,elements = %d)\n",array.value.array.elements->isInit,array.value.array.currentElement,array.value.array.elements->numElements);
0
+ printf("arrayElementFetch array check (init = %d,
ce = %d, elements = %d)\n", array.value.array.elements->isInit, array.value.array.currentElement, array.value.array.elements->numElements);
0
/* fetch the element data */
0
- if(dplHashIndexFind(array.value.array.elements,element->value.ival,(void **) &elementData) == FAILURE) {
0
- dplError(DPL_WARNINGL,"cannot fetch element %d of array %s",element->value.ival,_array->value.str.val);
0
+ if(dplHashIndexFind(array.value.array.elements, element->value.ival, (void **) &elementData) == FAILURE) {
0
+ dplError(DPL_WARNINGL, "cannot fetch element %d of array %s", element->value.ival, _array->value.str.val);
0
- printf("fetched element %d from array %s successfully\n",
element->value.ival,_array->value.str.val);
0
+ printf("fetched element %d from array %s successfully\n",
element->value.ival, _array->value.str.val);
0
if(elementData->isArray == TRUE) {
0
- arrayValueCopy(result,
elementData);
0
+ arrayValueCopy(result,
elementData);
0
- valueCopy(result,
elementData);
0
+ valueCopy(result,
elementData);
0
- if(variableFetch(&array,arrayName) == FAILURE) {
0
- dplError(DPL_CORE,"failed fetching array");
0
+ if(variableFetch(&array, arrayName) == FAILURE) {
0
+ dplError(DPL_CORE, "failed fetching array");
0
/* preform dump - make sure a stderr redirect is ineffect to make easier reading */
0
- dplHashIndexDump(array.value.array.elements,
FALSE);
0
+ dplHashIndexDump(array.value.array.elements,
FALSE);