rnsl

Load a list of strings expanded by the shell
git clone git://git.meso-star.fr/rnsl.git
Log | Files | Refs | README | LICENSE

rnsl.h (3087B)


      1 /* Copyright (C) 2022, 2023 Centre National de la Recherche Scientifique
      2  * Copyright (C) 2022, 2023 Institut Pierre-Simon Laplace
      3  * Copyright (C) 2022, 2023 Institut de Physique du Globe de Paris
      4  * Copyright (C) 2022, 2023 |Méso|Star> (contact@meso-star.com)
      5  * Copyright (C) 2022, 2023 Observatoire de Paris
      6  * Copyright (C) 2022, 2023 Université de Reims Champagne-Ardenne
      7  * Copyright (C) 2022, 2023 Université de Versaille Saint-Quentin
      8  * Copyright (C) 2022, 2023 Université Paul Sabatier
      9  *
     10  * This program is free software: you can redistribute it and/or modify
     11  * it under the terms of the GNU General Public License as published by
     12  * the Free Software Foundation, either version 3 of the License, or
     13  * (at your option) any later version.
     14  *
     15  * This program is distributed in the hope that it will be useful,
     16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     18  * GNU General Public License for more details.
     19  *
     20  * You should have received a copy of the GNU General Public License
     21  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     22 
     23 #ifndef RNSL_H
     24 #define RNSL_H
     25 
     26 #include <rsys/rsys.h>
     27 
     28 /* Library symbol management */
     29 #if defined(RNSL_SHARED_BUILD) /* Build shared library */
     30   #define RNSL_API extern EXPORT_SYM
     31 #elif defined(RNSL_STATIC) /* Use/build static library */
     32   #define RNSL_API extern LOCAL_SYM
     33 #else /* Use shared library */
     34   #define RNSL_API extern IMPORT_SYM
     35 #endif
     36 
     37 /* Helper macro that asserts if the invocation of the rnsl function `Func'
     38  * returns an error. One should use this macro on suvm function calls for
     39  * which no explicit error checking is performed */
     40 #ifndef NDEBUG
     41   #define RNSL(Func) ASSERT(rnsl_ ## Func == RES_OK)
     42 #else
     43   #define RNSL(Func) rnsl_ ## Func
     44 #endif
     45 
     46 struct rnsl_create_args {
     47   struct logger* logger; /* May be NULL <=> default logger */
     48   struct mem_allocator* allocator; /* NULL <=> use default allocator */
     49   int verbose; /* Verbosity level */
     50 };
     51 #define RNSL_CREATE_ARGS_DEFAULT__ {NULL, NULL, 0}
     52 static const struct rnsl_create_args RNSL_CREATE_ARGS_DEFAULT =
     53   RNSL_CREATE_ARGS_DEFAULT__;
     54 
     55 /* Forward declaration of external data types */
     56 struct logger;
     57 struct mem_allocator;
     58 
     59 /* Forward declaration of opaque data types */
     60 struct rnsl;
     61 
     62 BEGIN_DECLS
     63 
     64 /*******************************************************************************
     65  * API of the Rad-Net file list 
     66  ******************************************************************************/
     67 RNSL_API res_T
     68 rnsl_create
     69   (const struct rnsl_create_args* args,
     70    struct rnsl** rnsl);
     71 
     72 RNSL_API res_T
     73 rnsl_ref_get
     74   (struct rnsl* rnsl);
     75 
     76 RNSL_API res_T
     77 rnsl_ref_put
     78   (struct rnsl* rnsl);
     79 
     80 RNSL_API res_T
     81 rnsl_load
     82   (struct rnsl* rnsl,
     83    const char* filename);
     84 
     85 RNSL_API res_T
     86 rnsl_load_stream
     87   (struct rnsl* rnsl,
     88    FILE* stream,
     89    const char* stream_name);
     90 
     91 RNSL_API size_t
     92 rnsl_get_strings_count
     93   (const struct rnsl* rnsl);
     94 
     95 RNSL_API const char*
     96 rnsl_get_string
     97   (const struct rnsl* rnsl,
     98    const size_t istring);
     99 
    100 END_DECLS
    101 
    102 #endif /* RNSL_H */