/ src / core / info.c
info.c
 1  // SPDX-FileCopyrightText: 2023-2024 Le'Sec Core collective
 2  //
 3  // SPDX-License-Identifier: LGPL-3.0-or-later
 4  
 5  #include <lscore/info.h>
 6  
 7  #define str(x) #x
 8  #define str2(x) str(x)
 9  
10  #define nelems(a) (sizeof(a) / sizeof(a[0]))
11  
12  static char *data[] = {
13    str2(LSC_CORE_MAJOR_VERSION), // [0]
14    str2(LSC_CORE_MINOR_VERSION), // [1]
15    str2(LSC_CORE_PATCH_VERSION), // [2]
16    str2(LSC_PLUGIN_DIR),         // [3]
17    str2(LSC_PLUGIN_SUFFIX),      // [4]
18  };
19  
20  LE_STATUS LSC_core_info(int index, const char **info)
21  {
22    if (index < 0 || index >= nelems(data))
23      return LE_STS_ERROR;
24    *info = data[index];
25    return LE_STS_SUCCESS;
26  }