Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TASK_information ( void * )
- {
- char str_data[ 33 ] , str_price[ 33 ] , str_ref[ 33 ] , str_empty[ 33 ] , str_buffer[ 20 ]; int i;
- strcpy ( str_data , " # Data = # " );
- strcpy ( str_price , " # Price = # " );
- strcpy ( str_ref , " # Ref = # " );
- strcpy ( str_empty , " # # " );
- int x , z;
- RInfo Req;
- while ( TRUE ) {
- xQueueReceive ( Mail_I , &Req , portMAX_DELAY );
- vTaskDelay ( 10 );
- printf ( "\n\n\n\n\n\n" );
- if ( Req.ref[ 0 ] == '\0' && Req.x == -1 && Req.z == -1 ) { // SHOW WHOLE WARES
- for ( z = 2; z >= 0; z-- ) {
- printf ( "\n ############################## ############################## ############################## \n" );
- // 1ª LINHA
- for ( x = 0; x <= 2; x++ ) printf ( " # ( %d ) ( %d ) # " , x + 1 , z + 1 );
- printf ( "\n" );
- // 2ª LINHA
- for ( x = 0; x <= 2; x++ ) printf ( str_empty );
- printf ( "\n" );
- // 3ª LINHA
- for ( x = 0; x <= 2; x++ ) {
- if ( Storage[ x ][ z ].used && Storage[ x ][ z ].data != -1 ) {
- strcpy ( str_data , " # Data = # " );
- itoa ( Storage[ x ][ z ].data , str_buffer , 10 );
- for ( i = 0; str_buffer[ i ] != '\0'; i++ ) {
- str_data[ i + 11 ] = str_buffer[ i ];
- }
- printf ( str_data );
- } else printf ( str_empty );
- }
- printf ( "\n" );
- // 4ª LINHA
- for ( x = 0; x <= 2; x++ ) {
- if ( Storage[ x ][ z ].used && Storage[ x ][ z ].price != -1 ) {
- strcpy ( str_price , " # Price = # " );
- itoa ( Storage[ x ][ z ].price , str_buffer , 10 );
- for ( i = 0; str_buffer[ i ] != '\0'; i++ ) {
- str_price[ i + 11 ] = str_buffer[ i ];
- }
- printf ( str_price );
- } else printf ( str_empty );
- }
- printf ( "\n" );
- // 5ª LINHA
- for ( x = 0; x <= 2; x++ ) {
- if ( Storage[ x ][ z ].used && Storage[ x ][ z ].ref[ 0 ] != '\0' ) {
- strcpy ( str_ref , " # Ref = # " );
- for ( i = 0; Storage[ x ][ z ].ref[ i ] != '\0'; i++ ) {
- str_ref[ i + 11 ] = Storage[ x ][ z ].ref[ i ];
- }
- printf ( str_ref );
- } else printf ( str_empty );
- }
- printf ( "\n ############################## ############################## ############################## \n" );
- }
- }
- if ( ( Req.ref[ 0 ] != '\0' ) || ( Req.x != -1 && Req.z != -1 ) ) { // SHOW WARE
- if ( Req.x != -1 && Req.z != -1 ) { x = Req.x - 1; z = Req.z - 1; } // XZ Given
- else if ( Req.ref[ 0 ] != '\0' && !MENU_search_ref ( &x , &z , Req.ref ) ) {// Ref Given
- MENU_ERROR_ref_not_stored ( );
- continue;
- }
- printf ( "\n ##############################" );
- printf ( "\n # ( %d ) ( %d ) #\n" , x + 1 , z + 1 );
- printf ( str_empty ); printf ( "\n" );
- if ( Storage[ x ][ z ].used && Storage[ x ][ z ].data != -1 ) {
- sprintf ( str_buffer , "%d" , Storage[ x ][ z ].data );
- itoa ( Storage[ x ][ z ].data , str_buffer , 10 );
- for ( i = 0; str_buffer[ i ] != '\0'; i++ ) {
- str_data[ i + 11 ] = str_buffer[ i ];
- }
- printf ( str_data ); printf ( "\n" );
- } else {
- printf ( str_empty ); printf ( "\n" );
- }
- if ( Storage[ x ][ z ].used && Storage[ x ][ z ].price != -1 ) {
- sprintf ( str_buffer , "%d" , Storage[ x ][ z ].price );
- itoa ( Storage[ x ][ z ].price , str_buffer , 10 );
- for ( i = 0; str_buffer[ i ] != '\0'; i++ ) {
- str_price[ i + 11 ] = str_buffer[ i ];
- }
- printf ( str_price ); printf ( "\n" );
- } else {
- printf ( str_empty ); printf ( "\n" );
- }
- if ( Storage[ x ][ z ].used && Storage[ x ][ z ].ref != '\0' ) {
- for ( i = 0; Storage[ x ][ z ].ref[ i ] != '\0'; i++ ) {
- str_ref[ i + 11 ] = Storage[ x ][ z ].ref[ i ];
- }
- printf ( str_ref ); printf ( "\n" );
- } else {
- printf ( str_empty ); printf ( "\n" );
- }
- printf ( " ##############################\n" );
- }
- printf ( "\n\n Press Any Key to Continue ..." );
- getch ( );
- xSemaphoreGive ( Menu );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement