star-phor-input

File format for describing photoreactor configurations
git clone https://www.edstar.cnrs.fr/git/star-phor-input.git
Log | Files | Refs | README | LICENSE

sphin_c.h (1918B)


      1 /* Copyright (C) 2024-2026 Centre National de la Recherche Scientifique
      2  * Copyright (C) 2024-2026 Clermont Auvergne INP
      3  * Copyright (C) 2024-2026 INSA Lyon
      4  * Copyright (C) 2024-2026 Institut Mines Télécom Albi-Carmaux
      5  * Copyright (C) 2024-2026 Institut National Polytechnique de Toulouse
      6  * Copyright (C) 2024-2026 |Méso|Star> (contact@meso-star.com)
      7  * Copyright (C) 2024-2026 PhotonLyX (info@photonlyx.com)
      8  * Copyright (C) 2024-2026 Université de Lorraine
      9  * Copyright (C) 2024-2026 Université Paul Sabatier
     10  * Copyright (C) 2024-2026 Université Toulouse - Jean Jaurès
     11  *
     12  * This program is free software: you can redistribute it and/or modify
     13  * it under the terms of the GNU General Public License as published by
     14  * the Free Software Foundation, either version 3 of the License, or
     15  * (at your option) any later version.
     16  *
     17  * This program is distributed in the hope that it will be useful,
     18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     20  * GNU General Public License for more details.
     21  *
     22  * You should have received a copy of the GNU General Public License
     23  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     24 
     25 #ifndef SPHIN_C_H
     26 #define SPHIN_C_H
     27 
     28 #include <rsys/logger.h>
     29 #include <rsys/ref_count.h>
     30 
     31 /* Helper macros for logging */
     32 #define LOG__(Dev, Lvl, Type, ...) { \
     33   if ((Dev)->verbose >= (Lvl)) \
     34     logger_print((Dev)->logger, Type, __VA_ARGS__); \
     35 } (void)0
     36 #define ERROR(Dev, ...) LOG__(Dev, 1, LOG_ERROR,   __VA_ARGS__)
     37 #define WARN(Dev, ...) LOG__(Dev, 2, LOG_WARNING, __VA_ARGS__)
     38 #define INFO(Dev, ...) LOG__(Dev, 3, LOG_OUTPUT,  __VA_ARGS__)
     39 
     40 /* Forward declarations */
     41 struct logger;
     42 struct mem_allocator;
     43 
     44 struct sphin {
     45   /* Log */
     46   struct logger* logger;
     47   int verbose;
     48 
     49   /* Memory management */
     50   struct mem_allocator* allocator;
     51   ref_T ref;
     52 };
     53 
     54 #endif /* SPHIN_C_H */