Changeset 167

Show
Ignore:
Timestamp:
03/19/09 23:57:14 (15 years ago)
Author:
bhilburn
Message:

Fixing side-affect of a regex to use strong bit-typing.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/shell/cr_shell.cpp

    r166 r167  
    224224    if (n < 0) 
    225225        error("ERROR reading from socket"); 
    226     //    print32_tf("ReadMessage:%s %d\n",buffer,n); 
     226    //    printf("ReadMessage:%s %d\n",buffer,n); 
    227227 
    228228    return n; 
     
    241241        error("Error sending to client\n"); 
    242242    if(n == 0) 
    243         print32_tf("Client closed the socket.\n"); 
    244  
    245         //print32_tf("SendMessage:%s %d\n",message.c_str(),n);   
     243        printtf("Client closed the socket.\n"); 
     244 
     245        //printf("SendMessage:%s %d\n",message.c_str(),n);       
    246246    return n; 
    247247} 
     
    255255        //int32_t total_bytes;    
    256256 
    257         print32_tf("Cognitive Radio:: Sending Radio Operating Profile to Cognitive Engine.\n\n"); 
     257        printtf("Cognitive Radio:: Sending Radio Operating Profile to Cognitive Engine.\n\n"); 
    258258  
    259259        // utilities 
    260260        // Send number of utilities 
    261         sprint32_tf(counter,"%d",ce_info->numUtilities); 
     261        sprintf(counter,"%d",ce_info->numUtilities); 
    262262        SendMessage(socketfd,counter); 
    263263        // send utility  
     
    266266                SendMessage(socketfd,uList[i]->units); 
    267267                SendMessage(socketfd,uList[i]->goal); 
    268                 sprint32_tf(var,"%f",uList[i]->target); 
     268                sprintf(var,"%f",uList[i]->target); 
    269269                SendMessage(socketfd,var); 
    270270        } 
    271271 
    272272        // parameters 
    273     sprint32_tf(counter,"%i",ce_info->numParameters); 
     273    sprintf(counter,"%i",ce_info->numParameters); 
    274274        SendMessage(socketfd,counter); 
    275275        for(i = 0; i < ce_info->numParameters; i++) { 
    276276                SendMessage(socketfd,pList[i]->name); 
    277277                SendMessage(socketfd,pList[i]->units); 
    278                 sprint32_tf(var,"%f",pList[i]->min); 
    279                 SendMessage(socketfd,var); 
    280                 sprint32_tf(var,"%f",pList[i]->max); 
    281                 SendMessage(socketfd,var); 
    282                 sprint32_tf(var,"%f",pList[i]->step); 
     278                sprintf(var,"%f",pList[i]->min); 
     279                SendMessage(socketfd,var); 
     280                sprintf(var,"%f",pList[i]->max); 
     281                SendMessage(socketfd,var); 
     282                sprintf(var,"%f",pList[i]->step); 
    283283                SendMessage(socketfd,var); 
    284284                 
    285                 sprint32_tf(counter,"%i",pList[i]->numAffects);  
     285                sprintf(counter,"%i",pList[i]->numAffects);  
    286286                SendMessage(socketfd,counter); 
    287287                for(j = 0; j < pList[i]->numAffects; j++) { 
     
    292292 
    293293    // observables 
    294         sprint32_tf(counter,"%i",ce_info->numObservables); 
     294        sprintf(counter,"%i",ce_info->numObservables); 
    295295        SendMessage(socketfd,counter); 
    296296        for(i = 0; i < ce_info->numObservables; i++) { 
    297297                SendMessage(socketfd,oList[i]->name); 
    298298                 
    299                 sprint32_tf(counter,"%i",oList[i]->numAffects);  
     299                sprintf(counter,"%i",oList[i]->numAffects);  
    300300                SendMessage(socketfd,counter); 
    301301                for(j = 0; j < oList[i]->numAffects; j++) { 
     
    309309        string message; 
    310310        n = ReceiveMessage(socketfd, buffer); 
    311     //print32_tf("%s\n", buffer); 
     311    //printf("%s\n", buffer); 
    312312        //cout << message << endl; 
    313         //print32_tf("ACK received.\n"); 
     313        //printf("ACK received.\n"); 
    314314 
    315315} 
     
    332332    for (i = 0; i < num_rows; i++){ 
    333333        for (j = 0; j< num_cols; j++){ 
    334                 sprint32_tf(var,"%f",past_exp[i][j]); 
    335         //print32_tf("%f, \n", past_exp[i][j]); 
    336         //print32_tf("%s, \n", var); 
     334                sprintf(var,"%f",past_exp[i][j]); 
     335        //printf("%f, \n", past_exp[i][j]); 
     336        //printf("%s, \n", var); 
    337337        } 
    338338    } 
    339339     
    340340    // send the number of rows to the ce first 
    341         sprint32_tf(counter,"%d",num_rows); 
     341        sprintf(counter,"%d",num_rows); 
    342342        SendMessage(socketfd,counter); 
    343343    // send the number of columns to the ce 
    344         sprint32_tf(counter,"%d",num_cols); 
     344        sprintf(counter,"%d",num_cols); 
    345345        SendMessage(socketfd,counter); 
    346346    // update ce with experience 
    347347    for (i = 0; i < num_rows; i++){ 
    348348        for (j = 0; j< num_cols; j++){ 
    349                 sprint32_tf(var,"%f",past_exp[i][j]); 
     349                sprintf(var,"%f",past_exp[i][j]); 
    350350                SendMessage(socketfd,var); 
    351351        } 
     
    378378        SendMessage(socketfd,control_msg); 
    379379 
    380     print32_tf("Cognitive Radio:: Here. %i\n\n", socketfd); 
     380    printf("Cognitive Radio:: Here. %i\n\n", socketfd); 
    381381 
    382382        // Send parameter information  
    383     sprint32_tf(counter,"%i",ce_info->numParameters); 
     383    sprintf(counter,"%i",ce_info->numParameters); 
    384384        SendMessage(socketfd,counter); 
    385385        for(i = 0; i < ce_info->numParameters; i++) { 
    386386                SendMessage(socketfd,pList[i]->name); 
    387387                SendMessage(socketfd,pList[i]->units); 
    388                 sprint32_tf(var,"%f",pList[i]->min); 
    389                 SendMessage(socketfd,var); 
    390                 sprint32_tf(var,"%f",pList[i]->max); 
    391                 SendMessage(socketfd,var); 
    392                 sprint32_tf(var,"%f",pList[i]->step); 
    393                 SendMessage(socketfd,var); 
    394                 sprint32_tf(var,"%f",pList[i]->value); 
     388                sprintf(var,"%f",pList[i]->min); 
     389                SendMessage(socketfd,var); 
     390                sprintf(var,"%f",pList[i]->max); 
     391                SendMessage(socketfd,var); 
     392                sprintf(var,"%f",pList[i]->step); 
     393                SendMessage(socketfd,var); 
     394                sprintf(var,"%f",pList[i]->value); 
    395395                SendMessage(socketfd,var); 
    396396                 
     
    429429    if(ce_info->policy_engine == 1) { 
    430430 
    431         print32_tf("Cognitive Radio:: Found Policy Engine!\n"); 
    432         print32_tf("Cognitive Radio:: Validating parameters with Policy Engine\n\n"); 
     431        printf("Cognitive Radio:: Found Policy Engine!\n"); 
     432        printf("Cognitive Radio:: Validating parameters with Policy Engine\n\n"); 
    433433        RequestPolicyValidation(pList,ce_info);  
    434         print32_tf("Cognitive Radio:: Done\n\n"); 
     434        printf("Cognitive Radio:: Done\n\n"); 
    435435 
    436436    } 
     
    503503 
    504504        // update ce with experience 
    505     print32_tf("Cognitive Radio:: Sending Previous Experience to New Cognitive Engine.\n\n"); 
     505    printf("Cognitive Radio:: Sending Previous Experience to New Cognitive Engine.\n\n"); 
    506506    UpdateCEExperience(socketfd, num_rows, num_cols, past_exp);  
    507507 
     
    526526    /* clntSock is connected to a client! */ 
    527527     
    528     print32_tf("Handling client %s\n", inet_ntoa(echoClntAddr.sin_addr)); 
     528    printf("Handling client %s\n", inet_ntoa(echoClntAddr.sin_addr)); 
    529529 
    530530    return clntSock; 
     
    552552    /* Mark the socket so it will listen for incoming connections */ 
    553553    if (listen(sock, 5) < 0) { 
    554         print32_tf("listen() failed\n"); 
     554        printf("listen() failed\n"); 
    555555        return 0; 
    556556    } 
     
    567567    ReceiveMessage(socketfd,buffer); 
    568568 
    569     print32_tf("Cognitive Radio:: Message Received - %s.\n\n", buffer); 
     569    printf("Cognitive Radio:: Message Received - %s.\n\n", buffer); 
    570570 
    571571    if(strcmp(buffer,"c_register") == 0)  
     
    636636    } 
    637637     
    638     print32_tf("Starting server:  Hit return to shutdown\n"); 
     638    printf("Starting server:  Hit return to shutdown\n"); 
    639639    while (running) 
    640640    { 
     
    655655        rc = select(maxDescriptor + 1, &sockSet, NULL, NULL, &selTimeout);  
    656656        if (rc == 0) 
    657             print32_tf("No echo requests for %i secs...Server still alive\n", timeout); 
     657            printf("No echo requests for %i secs...Server still alive\n", timeout); 
    658658        else  
    659659        { 
    660660            if (FD_ISSET(0, &sockSet)) /* Check keyboard */ 
    661661            { 
    662                 print32_tf("Shutting down server\n"); 
     662                printf("Shutting down server\n"); 
    663663                getchar(); 
    664664                running = 0; 
     
    670670                if (FD_ISSET(port, &sockSet)) 
    671671                { 
    672                     print32_tf("Request on port %d:  ", port); 
     672                    printf("Request on port %d:  ", port); 
    673673                        desc_ready -= 1; 
    674674 
     
    688688                            if(new_sd > maxDescriptor)  
    689689                                maxDescriptor = new_sd; 
    690                             print32_tf("New incoming connection - %i\n\n",new_sd); 
     690                            printf("New incoming connection - %i\n\n",new_sd); 
    691691                        } while(new_sd != -1); 
    692692                    } else { 
    693693                         
    694                         print32_tf("Request on already open descriptor.\n\n"); 
     694                        printf("Request on already open descriptor.\n\n"); 
    695695                        HandleTCPClient(port, uList, pList, oList, ce_info); 
    696696 
     
    751751        cout << "Initialize:: Configuration file parsing completed.\n" << endl; 
    752752 
    753     //print32_t_current_config(uList, pList, oList, &ce_info); 
     753    //print_current_config(uList, pList, oList, &ce_info); 
    754754         
    755755   StartServers(uList, pList, oList, ce_info);