LCOV - code coverage report
Current view: top level - gui/source - gui_error_info_printer.c (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.61.0_covts Lines: 0 49 0.0 %
Date: 2024-10-26 21:44:38 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* File: gui_error_info_printer.c; Copyright and License: see below */
       2             : 
       3             : #include "gui_error_info_printer.h"
       4             : #include "u8/u8_trace.h"
       5             : #include "u8/u8_log.h"
       6             : #include <assert.h>
       7             : 
       8           0 : void gui_error_info_printer_init ( gui_error_info_printer_t *this_ )
       9             : {
      10           0 :     U8_TRACE_BEGIN();
      11             : 
      12           0 :     (*this_).dummy = 0;  /* prevent warnings on uninitialized usage */
      13             : 
      14           0 :     U8_TRACE_END();
      15           0 : }
      16             : 
      17           0 : void gui_error_info_printer_destroy ( gui_error_info_printer_t *this_ )
      18             : {
      19           0 :     U8_TRACE_BEGIN();
      20             : 
      21           0 :     U8_TRACE_END();
      22           0 : }
      23             : 
      24           0 : u8_error_t gui_error_info_printer_show_error_info ( gui_error_info_printer_t *this_,
      25             :                                                     const u8_error_info_t *err_info,
      26             :                                                     utf8stringbuf_t out_buf )
      27             : {
      28           0 :     U8_TRACE_BEGIN();
      29           0 :     u8_error_t result = U8_ERROR_NONE;
      30             : 
      31             :     /* update content text: */
      32           0 :     switch ( u8_error_info_get_error( err_info ) )
      33             :     {
      34           0 :         case U8_ERROR_LEXICAL_STRUCTURE:
      35             :         {
      36           0 :             result |= utf8stringbuf_append_str( out_buf, "Lexical error in input" );
      37             :         }
      38           0 :         break;
      39             : 
      40           0 :         case U8_ERROR_PARSER_STRUCTURE:
      41             :         {
      42           0 :             result |= utf8stringbuf_append_str( out_buf, "Parser error in input" );
      43             :         }
      44           0 :         break;
      45             : 
      46           0 :         case U8_ERROR_STRING_BUFFER_EXCEEDED:
      47             :         {
      48           0 :             result |= utf8stringbuf_append_str( out_buf, "String too long in input" );
      49             :         }
      50           0 :         break;
      51             : 
      52           0 :         case U8_ERROR_VALUE_OUT_OF_RANGE:
      53             :         {
      54           0 :             result |= utf8stringbuf_append_str( out_buf, "Illegal value in input" );
      55             :         }
      56           0 :         break;
      57             : 
      58           0 :         default:
      59             :         {
      60           0 :             result |= utf8stringbuf_append_str( out_buf, "Error x" );
      61           0 :             result |= utf8stringbuf_append_hex( out_buf, u8_error_info_get_error( err_info ) );
      62           0 :             result |= utf8stringbuf_append_str( out_buf, " occurred" );
      63             :         }
      64           0 :         break;
      65             :     }
      66             : 
      67           0 :     switch ( u8_error_info_get_unit ( err_info ) )
      68             :     {
      69           0 :         case U8_ERROR_INFO_UNIT_LINE:
      70             :         {
      71           0 :             result |= utf8stringbuf_append_str( out_buf, " at line " );
      72           0 :             result |= utf8stringbuf_append_int( out_buf, u8_error_info_get_line( err_info ) );
      73             :         }
      74           0 :         break;
      75             : 
      76           0 :         case U8_ERROR_INFO_UNIT_NAME:
      77             :         {
      78           0 :             result |= utf8stringbuf_append_str( out_buf, " at name " );
      79           0 :             result |= utf8stringbuf_append_str( out_buf, u8_error_info_get_name( err_info ) );
      80             :         }
      81           0 :         break;
      82             : 
      83           0 :         case U8_ERROR_INFO_UNIT_LINE_NAME:
      84             :         {
      85           0 :             result |= utf8stringbuf_append_str( out_buf, " at name " );
      86           0 :             result |= utf8stringbuf_append_str( out_buf, u8_error_info_get_name( err_info ) );
      87           0 :             result |= utf8stringbuf_append_str( out_buf, " at line " );
      88           0 :             result |= utf8stringbuf_append_int( out_buf, u8_error_info_get_line( err_info ) );
      89             :         }
      90           0 :         break;
      91             : 
      92           0 :         default:
      93             :         {
      94             :             /* no further information to add */
      95             :         }
      96           0 :         break;
      97             :     }
      98             : 
      99           0 :     U8_TRACE_END_ERR( result );
     100           0 :     return result;
     101             : }
     102             : 
     103             : 
     104             : /*
     105             : Copyright 2022-2024 Andreas Warnke
     106             : 
     107             : Licensed under the Apache License, Version 2.0 (the "License");
     108             : you may not use this file except in compliance with the License.
     109             : You may obtain a copy of the License at
     110             : 
     111             :     http://www.apache.org/licenses/LICENSE-2.0
     112             : 
     113             : Unless required by applicable law or agreed to in writing, software
     114             : distributed under the License is distributed on an "AS IS" BASIS,
     115             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     116             : See the License for the specific language governing permissions and
     117             : limitations under the License.
     118             : */

Generated by: LCOV version 1.16