Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.06 KB | None | 0 0
  1. void TASK_information ( void * )
  2. {
  3.     char str_data[ 33 ] , str_price[ 33 ] , str_ref[ 33 ] , str_empty[ 33 ] , str_buffer[ 20 ]; int i;
  4.     strcpy ( str_data , " # Data  =                    # " );
  5.     strcpy ( str_price , " # Price =                    # " );
  6.     strcpy ( str_ref , " # Ref   =                    # " );
  7.     strcpy ( str_empty , " #                            # " );
  8.     int x , z;
  9.     RInfo Req;
  10.     while ( TRUE ) {
  11.         xQueueReceive ( Mail_I , &Req , portMAX_DELAY );
  12.         vTaskDelay ( 10 );
  13.         printf ( "\n\n\n\n\n\n" );
  14.         if ( Req.ref[ 0 ] == '\0' && Req.x == -1 && Req.z == -1 ) { // SHOW WHOLE WARES
  15.             for ( z = 2; z >= 0; z-- ) {
  16.                 printf ( "\n ##############################  ##############################  ############################## \n" );
  17.                 // 1ª LINHA
  18.                 for ( x = 0; x <= 2; x++ ) printf ( " #         ( %d ) ( %d )        # " , x + 1 , z + 1 );
  19.                 printf ( "\n" );
  20.                 // 2ª LINHA
  21.                 for ( x = 0; x <= 2; x++ ) printf ( str_empty );
  22.                 printf ( "\n" );
  23.                 // 3ª LINHA
  24.                 for ( x = 0; x <= 2; x++ ) {
  25.                     if ( Storage[ x ][ z ].used && Storage[ x ][ z ].data != -1 ) {
  26.                         strcpy ( str_data , " # Data  =                    # " );
  27.                         itoa ( Storage[ x ][ z ].data , str_buffer , 10 );
  28.                         for ( i = 0; str_buffer[ i ] != '\0'; i++ ) {
  29.                             str_data[ i + 11 ] = str_buffer[ i ];
  30.                         }
  31.                         printf ( str_data );
  32.                     } else printf ( str_empty );
  33.                 }
  34.                 printf ( "\n" );
  35.                 // 4ª LINHA
  36.                 for ( x = 0; x <= 2; x++ ) {
  37.                     if ( Storage[ x ][ z ].used && Storage[ x ][ z ].price != -1 ) {
  38.                         strcpy ( str_price , " # Price =                    # " );
  39.                         itoa ( Storage[ x ][ z ].price , str_buffer , 10 );
  40.                         for ( i = 0; str_buffer[ i ] != '\0'; i++ ) {
  41.                             str_price[ i + 11 ] = str_buffer[ i ];
  42.                         }
  43.                         printf ( str_price );
  44.                     } else printf ( str_empty );
  45.                 }
  46.                 printf ( "\n" );
  47.                 // 5ª LINHA
  48.                 for ( x = 0; x <= 2; x++ ) {
  49.                     if ( Storage[ x ][ z ].used && Storage[ x ][ z ].ref[ 0 ] != '\0' ) {
  50.                         strcpy ( str_ref , " # Ref   =                    # " );
  51.                         for ( i = 0; Storage[ x ][ z ].ref[ i ] != '\0'; i++ ) {
  52.                             str_ref[ i + 11 ] = Storage[ x ][ z ].ref[ i ];
  53.                         }
  54.                         printf ( str_ref );
  55.                     } else printf ( str_empty );
  56.                 }
  57.                 printf ( "\n ##############################  ##############################  ############################## \n" );
  58.             }
  59.         }
  60.         if ( ( Req.ref[ 0 ] != '\0' ) || ( Req.x != -1 && Req.z != -1 ) ) {             // SHOW WARE
  61.             if ( Req.x != -1 && Req.z != -1 ) { x = Req.x - 1; z = Req.z - 1; }         // XZ Given
  62.             else if ( Req.ref[ 0 ] != '\0' && !MENU_search_ref ( &x , &z , Req.ref ) ) {// Ref Given
  63.                 MENU_ERROR_ref_not_stored ( );
  64.                 continue;
  65.             }
  66.             printf ( "\n ##############################" );
  67.             printf ( "\n #         ( %d ) ( %d )        #\n" , x + 1 , z + 1 );
  68.             printf ( str_empty );  printf ( "\n" );
  69.             if ( Storage[ x ][ z ].used && Storage[ x ][ z ].data != -1 ) {
  70.                 sprintf ( str_buffer , "&#37;d" , Storage[ x ][ z ].data );
  71.                 itoa ( Storage[ x ][ z ].data , str_buffer , 10 );
  72.                 for ( i = 0; str_buffer[ i ] != '\0'; i++ ) {
  73.                     str_data[ i + 11 ] = str_buffer[ i ];
  74.                 }
  75.                 printf ( str_data );  printf ( "\n" );
  76.             } else {
  77.                 printf ( str_empty );  printf ( "\n" );
  78.             }
  79.             if ( Storage[ x ][ z ].used && Storage[ x ][ z ].price != -1 ) {
  80.                 sprintf ( str_buffer , "&#37;d" , Storage[ x ][ z ].price );
  81.                 itoa ( Storage[ x ][ z ].price , str_buffer , 10 );
  82.                 for ( i = 0; str_buffer[ i ] != '\0'; i++ ) {
  83.                     str_price[ i + 11 ] = str_buffer[ i ];
  84.                 }
  85.                 printf ( str_price );  printf ( "\n" );
  86.             } else {
  87.                 printf ( str_empty );  printf ( "\n" );
  88.             }
  89.             if ( Storage[ x ][ z ].used && Storage[ x ][ z ].ref != '\0' ) {
  90.                 for ( i = 0; Storage[ x ][ z ].ref[ i ] != '\0'; i++ ) {
  91.                     str_ref[ i + 11 ] = Storage[ x ][ z ].ref[ i ];
  92.                 }
  93.                 printf ( str_ref );  printf ( "\n" );
  94.             } else {
  95.                 printf ( str_empty );  printf ( "\n" );
  96.             }
  97.             printf ( " ##############################\n" );
  98.         }
  99.         printf ( "\n\n Press Any Key to Continue ..." );
  100.         getch ( );
  101.         xSemaphoreGive ( Menu );
  102.     }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement