#include <stdbool.h>
#include <dlog.h>
+#include "system_info_type.h"
#ifndef API
#define API __attribute__ ((visibility("default")))
#define _E(fmt, args...) SLOGE(fmt, ##args)
#define _I(fmt, args...) SLOGI(fmt, ##args)
-#define PLATFORM_TAG "platform"
-#define CUSTOM_TAG "custom"
+#define TAG_TYPE_PLATFORM_STR "platform"
+#define TAG_TYPE_CUSTOM_STR "custom"
#define BOOL_TYPE "bool"
#define INT_TYPE "int"
#define DBL_TYPE "double"
#define STR_TYPE "string"
-typedef enum {
- SYSTEM_INFO_DATA_TYPE_STRING,
- SYSTEM_INFO_DATA_TYPE_INT,
- SYSTEM_INFO_DATA_TYPE_DOUBLE,
- SYSTEM_INFO_DATA_TYPE_BOOL
-} system_info_data_type_e;
+enum language {
+ DEFAULT = 0, /* Without language property */
+ C = 1, /* C and C++ */
+ WEB = 2, /* Web (JS, html) */
+ DOTNET = 3, /* C# */
+ LANG_MAX = 8
+};
-int system_info_ini_get_string(char *ini_file, char *key, char **output);
-int system_info_get_value_from_config_xml(char *feature_tag, const char *name_field, char *type_field, char **value);
-int system_info_get_type_from_config_xml(const char *feature_tag,
- const char *name_field, char *type_field, size_t len);
+struct runtime {
+ enum language lang; /* Lauguage used by runtime */
+ char *xml_prop; /* Property name in model-config */
+ char *runtime_type; /* Value of RUNTIME_TYPE env */
+};
-int system_info_get_file(const char *key, void **value);
-int system_info_get_type_file(const char *key);
+/**
+ * Notice
+ *
+ * In current, each runtime_type has their own prefix with length = RT_PREFIX.
+ * So, system-info check only first RT_PREFIX characters for performance.
+ * If you add another language with having same prefix, you should change this logic.
+ */
+#define RT_PREFIX 2
+static const struct runtime runtime[LANG_MAX] = {
+ { C, "capi", "capp" },
+ { C, "capi", "c++app" },
+ { WEB, "webapi", "webapp" },
+ { DOTNET, "csapi", "dotnet" },
+ { LANG_MAX, NULL, NULL }
+};
+
+#define NUM_HASH_FILE 10
+static inline unsigned long simple_hash(const char *str)
+{
+ unsigned long ret = 0;
+ int c;
+
+ while ((c = *str++) != 0)
+ ret += c;
+
+ return ret % NUM_HASH_FILE;
+}
+
+int system_info_get_file(const char *key, char *value, size_t len);
+int system_info_get_type_file(const char *key, system_info_type_e *type);
int external_get_value(const char *tag, const char *key, const char *type, char **value);
+int external_get_type(const char *tag, const char *key, char **type);
#ifdef __cplusplus
}