star-uvm

Spatial structuring of unstructured volumetric meshes
git clone git://git.meso-star.fr/star-uvm.git
Log | Files | Refs | README | LICENSE

suvm_c.h (1962B)


      1 /* Copyright (C) 2020-2023 |Méso|Star> (contact@meso-star.com)
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 3 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     15 
     16 #ifndef SUVM_C_H
     17 #define SUVM_C_H
     18 
     19 #include "suvm_backend.h"
     20 #include <rsys/rsys.h>
     21 
     22 static FINLINE res_T
     23 rtc_error_to_res_T(const enum RTCError err)
     24 {
     25   switch(err) {
     26     case RTC_ERROR_NONE: return RES_OK;
     27     case RTC_ERROR_UNKNOWN: return RES_UNKNOWN_ERR;
     28     case RTC_ERROR_INVALID_ARGUMENT: return RES_BAD_ARG;
     29     case RTC_ERROR_INVALID_OPERATION: return RES_BAD_ARG;
     30     case RTC_ERROR_OUT_OF_MEMORY: return RES_MEM_ERR;
     31     case RTC_ERROR_UNSUPPORTED_CPU: return RES_BAD_ARG;
     32     case RTC_ERROR_CANCELLED: return RES_UNKNOWN_ERR;
     33     default: FATAL("Unreachable code\n"); break;
     34   }
     35 }
     36 
     37 static INLINE const char*
     38 rtc_error_string(const enum RTCError err)
     39 {
     40   const char* str = NULL;
     41   switch(err) {
     42     case RTC_ERROR_NONE: str = "No error"; break;
     43     case RTC_ERROR_UNKNOWN: str = "Unknown error"; break;
     44     case RTC_ERROR_INVALID_ARGUMENT: str = "Invalid argument"; break;
     45     case RTC_ERROR_INVALID_OPERATION: str = "Invalid operation"; break;
     46     case RTC_ERROR_OUT_OF_MEMORY: str = "Out of memory"; break;
     47     case RTC_ERROR_UNSUPPORTED_CPU: str = "Unsupported CPU"; break;
     48     case RTC_ERROR_CANCELLED: str = "Cancelled operation"; break;
     49     default: FATAL("Unreachable code\n"); break;
     50   }
     51   return str;
     52 }
     53 
     54 #endif /* SUVM_C_H */