Changeset 508 for trunk/zoo-project
- Timestamp:
- Oct 8, 2014, 4:28:05 PM (10 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service.h
r507 r508 437 437 tmp->value=zStrdup(v); 438 438 } 439 } 440 441 static void addToMapWithSize(map* m,const char* n,const char* v,int size){ 442 if(hasKey(m,n)==false){ 443 map* _cursor=m; 444 if(_cursor!=NULL){ 445 addToMap(m,n,""); 446 }else{ 447 m=createMap(n,""); 448 } 449 } 450 map *tmp=getMap(m,n); 451 if(tmp->value!=NULL) 452 free(tmp->value); 453 tmp->value=(char*)malloc((size+1)*sizeof(char)); 454 memmove(tmp->value,v,size*sizeof(char)); 455 tmp->value[size]=0; 456 char sin[128]; 457 sprintf(sin,"%ld",size); 458 addToMap(m,"size",sin); 439 459 } 440 460 -
trunk/zoo-project/zoo-kernel/service_internal_php.c
r348 r508 56 56 57 57 php_embed_init(0,NULL,&tsrm_ls); 58 59 fprintf(stderr,"PHP EMBEDED\n");60 58 61 59 zend_try { 62 fprintf(stderr,"PHP EMBEDED include script %s\n",tmp->value);63 60 php_execute_script(&iscript TSRMLS_CC); 64 fprintf(stderr,"PHP EMBEDED include script done\n");65 61 66 62 zval *iargs[3]; … … 68 64 69 65 ZVAL_STRING(&ifunc, s->name, 0); 70 fprintf(stderr,"PHP EMBEDED include script done\n");71 66 iargs[0] = php_Array_from_maps(*main_conf); 72 fprintf(stderr,"PHP EMBEDED include script done\n");73 67 iargs[1] = php_Array_from_maps(*real_inputs); 74 fprintf(stderr,"PHP EMBEDED include script done\n");75 68 iargs[2] = php_Array_from_maps(*real_outputs); 76 fprintf(stderr,"PHP EMBEDED include script done\n");77 69 78 70 call_user_function(EG(function_table), NULL, &ifunc, &iret, 3, iargs TSRMLS_CC); … … 81 73 *real_outputs=php_maps_from_Array(t); 82 74 83 dumpMaps(*real_outputs);84 85 75 char tmp1[1024]; 86 87 sprintf(tmp1,"PHP EMBEDED ran function successfully and return %d !?",Z_STRVAL(iret));88 76 89 77 res=SERVICE_SUCCEEDED; … … 106 94 maps* tmp=t; 107 95 int tres=0; 108 fprintf(stderr,"arra_init\n");109 96 MAKE_STD_ZVAL(mapArray); 110 97 tres=array_init(mapArray); 111 fprintf(stderr,"arra_init %d\n",tres);112 98 while(tmp!=NULL){ 113 99 add_assoc_zval(mapArray,tmp->name,php_Array_from_map(tmp->content)); … … 122 108 map* tmp=t; 123 109 int tres=0; 124 fprintf(stderr,"arra_init\n");125 110 MAKE_STD_ZVAL(mapArray); 126 111 tres=array_init(mapArray); 127 fprintf(stderr,"arra_init\n");128 112 while(tmp!=NULL){ 129 fprintf(stderr,"=> %s %d %s %d \n",tmp->name,strlen(tmp->name),tmp->value,strlen(tmp->value)); 130 tres=add_assoc_string(mapArray,tmp->name,tmp->value,1); 113 map* sMap=getMapArray(tmp,"size",i); 114 if(strncmp(tmp->name,"value",5)==0 && sMap!=NULL){ 115 tres=add_assoc_stringl(mapArray,tmp->name,tmp->value,atoi(sMap->value),1); 116 }else 117 tres=add_assoc_string(mapArray,tmp->name,tmp->value,1); 131 118 tmp=tmp->next; 132 119 } … … 135 122 136 123 maps* php_maps_from_Array(HashTable *t){ 137 //#ifdef DEBUG138 fprintf(stderr,"mapsFromPHPArray start\n");139 //#endif140 124 maps* final_res=NULL; 141 125 maps* cursor=final_res; … … 150 134 zval **ppzval, tmpcopy; 151 135 type = zend_hash_get_current_key_ex(t, &key, &keylen, &idx, 0, NULL); 152 fprintf(stderr,"key : %s\n",key);153 136 if (zend_hash_get_current_data(t, (void**)&ppzval) == FAILURE) { 154 137 /** … … 161 144 */ 162 145 tmpcopy = **ppzval; 163 fprintf(stderr,"key : %s\n",key); 146 #ifdef DEBUG 147 fprintf(stderr,"key : %s\n",key); 148 #endif 164 149 zval_copy_ctor(&tmpcopy); 165 fprintf(stderr,"key : %s\n",key); 150 #ifdef DEBUG 151 fprintf(stderr,"key : %s\n",key); 152 #endif 166 153 /** 167 154 * Reset refcount & Convert … … 178 165 fprintf(stderr,"key : %s\n",key); 179 166 HashTable* t=HASH_OF(*ppzval); 180 fprintf(stderr,"key : %s\n",key); 167 #ifdef DEBUG 168 fprintf(stderr,"key : %s\n",key); 169 #endif 181 170 cursor->content=php_map_from_HasTable(t); 182 171 cursor->next=NULL; … … 185 174 else 186 175 addMapsToMaps(&final_res,cursor); 187 fprintf(stderr,"key : %s\n",key); 176 #ifdef DEBUG 177 fprintf(stderr,"key : %s\n",key); 178 #endif 188 179 /** 189 180 * Toss out old copy … … 201 192 final_res=NULL; 202 193 char key[1024]; 203 for(zend_hash_internal_pointer_reset(t); 204 zend_hash_has_more_elements(t) == SUCCESS; 205 zend_hash_move_forward(t)) { 206 char *key; 207 uint keylen; 208 ulong idx; 209 int type; 210 zval **ppzval, tmpcopy; 194 for(zend_hash_internal_pointer_reset(t); 195 zend_hash_has_more_elements(t) == SUCCESS; 196 zend_hash_move_forward(t)) { 197 char *key; 198 uint keylen; 199 ulong idx; 200 int type; 201 int len; 202 zval **ppzval, tmpcopy; 211 203 type = zend_hash_get_current_key_ex(t, &key, &keylen, &idx, 0, NULL); 212 204 if (zend_hash_get_current_data(t, (void**)&ppzval) == FAILURE) { … … 223 215 */ 224 216 INIT_PZVAL(&tmpcopy); 225 convert_to_string(&tmpcopy); 226 if( final_res==NULL){227 fprintf(stderr,"%s => %s\n",key,Z_STRVAL(tmpcopy));228 final_res=createMap(key,Z_STRVAL(tmpcopy));217 convert_to_string(&tmpcopy); 218 if(strncmp(key,"value")==0){ 219 len=Z_STRLEN_P(varcopy); 220 addToMapWithSize(final_res,key,Z_STRVAL_P(tmpcopy),len); 229 221 } 230 222 else{ 231 fprintf(stderr,"%s => %s\n",key,Z_STRVAL(tmpcopy)); 232 addMapToMap(&final_res,createMap(key,Z_STRVAL(tmpcopy))); 223 if(final_res==NULL){ 224 #ifdef DEBUG 225 fprintf(stderr,"%s => %s\n",key,Z_STRVAL(tmpcopy)); 226 #endif 227 final_res=createMap(key,Z_STRVAL(tmpcopy)); 228 } 229 else{ 230 #ifdef DEBUG 231 fprintf(stderr,"%s => %s\n",key,Z_STRVAL(tmpcopy)); 232 #endif 233 addToMap(&final_res,key,Z_STRVAL(tmpcopy)); 234 } 233 235 } 234 236 /* Toss out old copy */ -
trunk/zoo-project/zoo-kernel/service_internal_python.c
r505 r508 502 502 PyString_AsStringAndSize(value,&buffer,&size); 503 503 #endif 504 if(res!=NULL){ 505 addToMap(res,PyString_AsString(key),""); 506 }else{ 507 res=createMap(PyString_AsString(key),""); 508 } 509 map* tmpR=getMap(res,"value"); 510 free(tmpR->value); 511 tmpR->value=(char*)malloc((size+1)*sizeof(char)); 512 memmove(tmpR->value,buffer,size*sizeof(char)); 513 tmpR->value[size]=0; 514 char sin[1024]; 515 sprintf(sin,"%ld",size); 516 addToMap(res,"size",sin); 504 addToMapWithSize(res,"value",buffer,size); 517 505 }else{ 518 506 char* lkey=PyString_AsString(key); -
trunk/zoo-project/zoo-kernel/ulinet.c
r492 r508 61 61 if(strncmp("Set-Cookie: ",buffer,12)==0){ 62 62 int i; 63 char env[ 1024];64 char path[ 1024];65 char domain[ 1024];63 char env[256]; 64 char path[256]; 65 char domain[256]; 66 66 char* tmp; 67 67 for(i=0;i<12;i++)
Note: See TracChangeset
for help on using the changeset viewer.