summaryrefslogtreecommitdiff
path: root/src/lib/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-09-24 17:06:24 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-24 18:27:37 +0200
commit92da64a532f8c1746d7bd06b66b7ff4409c2ff8c (patch)
tree02e05754553c64c119f2e78194f5527d5cf0ff1e /src/lib/eolian
parent553ce69bade88ac675aa56fcb184240403a12bfc (diff)
eolian: remove support for globals
This was meant to happen but did not previously happen. It is not ideal to do it now but better do it while we still can. In short, this removes one half of the variables API (keeps constants as they are) and repurposes the API to be only for constants. This is also better for consistency to match errors.
Diffstat (limited to 'src/lib/eolian')
-rw-r--r--src/lib/eolian/Eolian.h146
-rw-r--r--src/lib/eolian/database_check.c8
-rw-r--r--src/lib/eolian/database_expr.c2
-rw-r--r--src/lib/eolian/database_validate.c16
-rw-r--r--src/lib/eolian/database_var.c24
-rw-r--r--src/lib/eolian/database_var_api.c15
-rw-r--r--src/lib/eolian/eo_lexer.c4
-rw-r--r--src/lib/eolian/eo_lexer.h14
-rw-r--r--src/lib/eolian/eo_parser.c36
-rw-r--r--src/lib/eolian/eolian_database.c43
-rw-r--r--src/lib/eolian/eolian_database.h9
11 files changed, 83 insertions, 234 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index ed6444ce73..b0d7a4e9ce 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -164,11 +164,11 @@ typedef struct _Eolian_Event Eolian_Event;
164 */ 164 */
165typedef struct _Eolian_Expression Eolian_Expression; 165typedef struct _Eolian_Expression Eolian_Expression;
166 166
167/* Variable information 167/* Constant information
168 * 168 *
169 * @ingroup Eolian 169 * @ingroup Eolian
170 */ 170 */
171typedef struct _Eolian_Variable Eolian_Variable; 171typedef struct _Eolian_Constant Eolian_Constant;
172 172
173/* Error information 173/* Error information
174 * 174 *
@@ -220,7 +220,7 @@ typedef enum
220 EOLIAN_OBJECT_STRUCT_FIELD, 220 EOLIAN_OBJECT_STRUCT_FIELD,
221 EOLIAN_OBJECT_ENUM_FIELD, 221 EOLIAN_OBJECT_ENUM_FIELD,
222 EOLIAN_OBJECT_TYPE, 222 EOLIAN_OBJECT_TYPE,
223 EOLIAN_OBJECT_VARIABLE, 223 EOLIAN_OBJECT_CONSTANT,
224 EOLIAN_OBJECT_EXPRESSION, 224 EOLIAN_OBJECT_EXPRESSION,
225 EOLIAN_OBJECT_FUNCTION, 225 EOLIAN_OBJECT_FUNCTION,
226 EOLIAN_OBJECT_FUNCTION_PARAMETER, 226 EOLIAN_OBJECT_FUNCTION_PARAMETER,
@@ -388,13 +388,6 @@ typedef enum
388 | EOLIAN_MASK_NULL 388 | EOLIAN_MASK_NULL
389} Eolian_Expression_Mask; 389} Eolian_Expression_Mask;
390 390
391typedef enum
392{
393 EOLIAN_VAR_UNKNOWN = 0,
394 EOLIAN_VAR_CONSTANT,
395 EOLIAN_VAR_GLOBAL
396} Eolian_Variable_Type;
397
398typedef union 391typedef union
399{ 392{
400 char c; 393 char c;
@@ -699,7 +692,7 @@ EAPI const char *eolian_object_name_get(const Eolian_Object *obj);
699 * This is the full name, but for C. It is typically derived from the 692 * This is the full name, but for C. It is typically derived from the
700 * regular full name, with namespaces flattened to underscores, but 693 * regular full name, with namespaces flattened to underscores, but
701 * some things may be explicitly renamed. Only classes, types (both 694 * some things may be explicitly renamed. Only classes, types (both
702 * declarations and instances) and variables have C names, as others 695 * declarations and instances) and constants have C names, as others
703 * are never referred to by name directly in C. 696 * are never referred to by name directly in C.
704 * 697 *
705 * @see eolian_object_unit_get 698 * @see eolian_object_unit_get
@@ -1018,7 +1011,7 @@ EAPI unsigned short eolian_unit_version_get(const Eolian_Unit *unit);
1018 * @brief Get an object in a unit by name. 1011 * @brief Get an object in a unit by name.
1019 * 1012 *
1020 * Only objects declared directly within the file can be retrieved, i.e. 1013 * Only objects declared directly within the file can be retrieved, i.e.
1021 * classes, typedecls and variables. 1014 * classes, typedecls and constants.
1022 * 1015 *
1023 * @param[in] unit The unit. 1016 * @param[in] unit The unit.
1024 * @param[in] name The fully namespaced object name. 1017 * @param[in] name The fully namespaced object name.
@@ -1032,7 +1025,7 @@ EAPI const Eolian_Object *eolian_unit_object_by_name_get(const Eolian_Unit *unit
1032 * 1025 *
1033 * The order is not necessarily the declaration order. Only objects declared 1026 * The order is not necessarily the declaration order. Only objects declared
1034 * directly within the file can be retrieved, i.e. classes, typedecls and 1027 * directly within the file can be retrieved, i.e. classes, typedecls and
1035 * variables. 1028 * constants.
1036 * 1029 *
1037 * @param[in] unit The unit. 1030 * @param[in] unit The unit.
1038 * 1031 *
@@ -1060,24 +1053,14 @@ EAPI const Eolian_Class *eolian_unit_class_by_name_get(const Eolian_Unit *unit,
1060EAPI Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit); 1053EAPI Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit);
1061 1054
1062/* 1055/*
1063 * @brief Get a global variable in a unit by name. 1056 * @brief Get a constant in a unit by name.
1064 *
1065 * @param[in] unit The unit.
1066 * @param[in] name the name of the variable
1067 *
1068 * @ingroup Eolian
1069 */
1070EAPI const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name);
1071
1072/*
1073 * @brief Get a constant variable in a unit by name.
1074 * 1057 *
1075 * @param[in] unit The unit. 1058 * @param[in] unit The unit.
1076 * @param[in] name the name of the variable 1059 * @param[in] name the name of the constant
1077 * 1060 *
1078 * @ingroup Eolian 1061 * @ingroup Eolian
1079 */ 1062 */
1080EAPI const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name); 1063EAPI const Eolian_Constant *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name);
1081 1064
1082/* 1065/*
1083 * @brief Get an error declaration in a unit by name. 1066 * @brief Get an error declaration in a unit by name.
@@ -1090,7 +1073,7 @@ EAPI const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *
1090EAPI const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name); 1073EAPI const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name);
1091 1074
1092/* 1075/*
1093 * @brief Get an iterator to all constant variables in the Eolian database. 1076 * @brief Get an iterator to all constants in the Eolian database.
1094 * 1077 *
1095 * @return the iterator or NULL 1078 * @return the iterator or NULL
1096 * 1079 *
@@ -1101,17 +1084,6 @@ EAPI const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit,
1101EAPI Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit); 1084EAPI Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit);
1102 1085
1103/* 1086/*
1104 * @brief Get an iterator to all global variables in the Eolian database.
1105 *
1106 * @return the iterator or NULL
1107 *
1108 * Thanks to internal caching, this is an O(1) operation.
1109 *
1110 * @ingroup Eolian
1111 */
1112EAPI Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit);
1113
1114/*
1115 * @brief Get an iterator to all error declarations in the Eolian database. 1087 * @brief Get an iterator to all error declarations in the Eolian database.
1116 * 1088 *
1117 * @return the iterator or NULL 1089 * @return the iterator or NULL
@@ -1203,7 +1175,7 @@ eolian_state_object_by_name_get(const Eolian_State *state, const char *name)
1203 * 1175 *
1204 * The list follows declaration order in the file. Only objects declared 1176 * The list follows declaration order in the file. Only objects declared
1205 * directly within the file can be retrieved, i.e. classes, typedecls and 1177 * directly within the file can be retrieved, i.e. classes, typedecls and
1206 * variables. 1178 * constants.
1207 * 1179 *
1208 * @param[in] state The state. 1180 * @param[in] state The state.
1209 * @param[in] file_name The file name. 1181 * @param[in] file_name The file name.
@@ -1262,26 +1234,13 @@ eolian_state_classes_get(const Eolian_State *state)
1262} 1234}
1263 1235
1264/* 1236/*
1265 * @brief A helper function to get a global in a state by name.
1266 *
1267 * @see eolian_unit_global_by_name_get
1268 *
1269 * @ingroup Eolian
1270 */
1271static inline const Eolian_Variable *
1272eolian_state_global_by_name_get(const Eolian_State *state, const char *name)
1273{
1274 return eolian_unit_global_by_name_get(EOLIAN_UNIT(state), name);
1275}
1276
1277/*
1278 * @brief A helper function to get a constant in a state by name. 1237 * @brief A helper function to get a constant in a state by name.
1279 * 1238 *
1280 * @see eolian_unit_constant_by_name_get 1239 * @see eolian_unit_constant_by_name_get
1281 * 1240 *
1282 * @ingroup Eolian 1241 * @ingroup Eolian
1283 */ 1242 */
1284static inline const Eolian_Variable * 1243static inline const Eolian_Constant *
1285eolian_state_constant_by_name_get(const Eolian_State *state, const char *name) 1244eolian_state_constant_by_name_get(const Eolian_State *state, const char *name)
1286{ 1245{
1287 return eolian_unit_constant_by_name_get(EOLIAN_UNIT(state), name); 1246 return eolian_unit_constant_by_name_get(EOLIAN_UNIT(state), name);
@@ -1301,19 +1260,7 @@ eolian_state_error_by_name_get(const Eolian_State *state, const char *name)
1301} 1260}
1302 1261
1303/* 1262/*
1304 * @brief Get an iterator to all global variables contained in a file. 1263 * @brief Get an iterator to all constants contained in a file.
1305 *
1306 * @param[in] state The state.
1307 * @param[in] file_name The file name.
1308 *
1309 * Thanks to internal caching, this is an O(1) operation.
1310 *
1311 * @ingroup Eolian
1312 */
1313EAPI Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name);
1314
1315/*
1316 * @brief Get an iterator to all constant variables contained in a file.
1317 * 1264 *
1318 * @param[in] state The state. 1265 * @param[in] state The state.
1319 * @param[in] file_name The file name. 1266 * @param[in] file_name The file name.
@@ -1339,19 +1286,6 @@ EAPI Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state
1339EAPI Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name); 1286EAPI Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name);
1340 1287
1341/* 1288/*
1342 * @brief A helper function to get all globals in a state.
1343 *
1344 * @see eolian_unit_globals_get
1345 *
1346 * @ingroup Eolian
1347 */
1348static inline Eina_Iterator *
1349eolian_state_globals_get(const Eolian_State *state)
1350{
1351 return eolian_unit_globals_get(EOLIAN_UNIT(state));
1352}
1353
1354/*
1355 * @brief A helper function to get all constants in a state. 1289 * @brief A helper function to get all constants in a state.
1356 * 1290 *
1357 * @see eolian_unit_constants_get 1291 * @see eolian_unit_constants_get
@@ -3182,116 +3116,106 @@ EAPI const Eolian_Expression *eolian_expression_unary_expression_get(const Eolia
3182EAPI Eolian_Value eolian_expression_value_get(const Eolian_Expression *expr); 3116EAPI Eolian_Value eolian_expression_value_get(const Eolian_Expression *expr);
3183 3117
3184/* 3118/*
3185 * @brief Get the type of a variable (global, constant) 3119 * @brief Get the documentation of a constant.
3186 *
3187 * @param[in] var the variable.
3188 * @return an Eolian_Type_Type.
3189 *
3190 * @ingroup Eolian
3191 */
3192EAPI Eolian_Variable_Type eolian_variable_type_get(const Eolian_Variable *var);
3193
3194/*
3195 * @brief Get the documentation of a variable.
3196 * 3120 *
3197 * @param[in] var the variable. 3121 * @param[in] var the constant.
3198 * @return the documentation or NULL. 3122 * @return the documentation or NULL.
3199 * 3123 *
3200 * @ingroup Eolian 3124 * @ingroup Eolian
3201 */ 3125 */
3202EAPI const Eolian_Documentation *eolian_variable_documentation_get(const Eolian_Variable *var); 3126EAPI const Eolian_Documentation *eolian_constant_documentation_get(const Eolian_Constant *var);
3203 3127
3204/* 3128/*
3205 * @brief Get the base type of a variable. 3129 * @brief Get the base type of a constant.
3206 * 3130 *
3207 * @param[in] var the variable. 3131 * @param[in] var the constant.
3208 * @return the base type or NULL. 3132 * @return the base type or NULL.
3209 * 3133 *
3210 * @ingroup Eolian 3134 * @ingroup Eolian
3211 */ 3135 */
3212EAPI const Eolian_Type *eolian_variable_base_type_get(const Eolian_Variable *var); 3136EAPI const Eolian_Type *eolian_constant_base_type_get(const Eolian_Constant *var);
3213 3137
3214/* 3138/*
3215 * @brief Get the value of a variable. 3139 * @brief Get the value of a constant.
3216 * 3140 *
3217 * @param[in] var the variable. 3141 * @param[in] var the constant.
3218 * @return the value or NULL. 3142 * @return the value or NULL.
3219 * 3143 *
3220 * @ingroup Eolian 3144 * @ingroup Eolian
3221 */ 3145 */
3222EAPI const Eolian_Expression *eolian_variable_value_get(const Eolian_Variable *var); 3146EAPI const Eolian_Expression *eolian_constant_value_get(const Eolian_Constant *var);
3223 3147
3224/* 3148/*
3225 * @brief A helper function to get the full name of a variable. 3149 * @brief A helper function to get the full name of a constant.
3226 * 3150 *
3227 * @see eolian_object_name_get 3151 * @see eolian_object_name_get
3228 * 3152 *
3229 * @ingroup Eolian 3153 * @ingroup Eolian
3230 */ 3154 */
3231static inline const char * 3155static inline const char *
3232eolian_variable_name_get(const Eolian_Variable *tp) 3156eolian_constant_name_get(const Eolian_Constant *tp)
3233{ 3157{
3234 return eolian_object_name_get(EOLIAN_OBJECT(tp)); 3158 return eolian_object_name_get(EOLIAN_OBJECT(tp));
3235} 3159}
3236 3160
3237/* 3161/*
3238 * @brief A helper function to get the C name of a variable. 3162 * @brief A helper function to get the C name of a constant.
3239 * 3163 *
3240 * @see eolian_object_c_name_get 3164 * @see eolian_object_c_name_get
3241 * 3165 *
3242 * @ingroup Eolian 3166 * @ingroup Eolian
3243 */ 3167 */
3244static inline const char * 3168static inline const char *
3245eolian_variable_c_name_get(const Eolian_Variable *tp) 3169eolian_constant_c_name_get(const Eolian_Constant *tp)
3246{ 3170{
3247 return eolian_object_c_name_get(EOLIAN_OBJECT(tp)); 3171 return eolian_object_c_name_get(EOLIAN_OBJECT(tp));
3248} 3172}
3249 3173
3250/* 3174/*
3251 * @brief A helper function to get the short name of a variable. 3175 * @brief A helper function to get the short name of a constant.
3252 * 3176 *
3253 * @see eolian_object_short_name_get 3177 * @see eolian_object_short_name_get
3254 * 3178 *
3255 * @ingroup Eolian 3179 * @ingroup Eolian
3256 */ 3180 */
3257static inline const char * 3181static inline const char *
3258eolian_variable_short_name_get(const Eolian_Variable *tp) 3182eolian_constant_short_name_get(const Eolian_Constant *tp)
3259{ 3183{
3260 return eolian_object_short_name_get(EOLIAN_OBJECT(tp)); 3184 return eolian_object_short_name_get(EOLIAN_OBJECT(tp));
3261} 3185}
3262 3186
3263/* 3187/*
3264 * @brief A helper function to get the namespaces of a variable. 3188 * @brief A helper function to get the namespaces of a constant.
3265 * 3189 *
3266 * @see eolian_object_namespaces_get 3190 * @see eolian_object_namespaces_get
3267 * 3191 *
3268 * @ingroup Eolian 3192 * @ingroup Eolian
3269 */ 3193 */
3270static inline Eina_Iterator * 3194static inline Eina_Iterator *
3271eolian_variable_namespaces_get(const Eolian_Variable *tp) 3195eolian_constant_namespaces_get(const Eolian_Constant *tp)
3272{ 3196{
3273 return eolian_object_namespaces_get(EOLIAN_OBJECT(tp)); 3197 return eolian_object_namespaces_get(EOLIAN_OBJECT(tp));
3274} 3198}
3275 3199
3276/* 3200/*
3277 * @brief Check if a variable is extern. 3201 * @brief Check if a constant is extern.
3278 * 3202 *
3279 * @param[in] var the variable. 3203 * @param[in] var the constant.
3280 * @return EINA_TRUE if it's extern, EINA_FALSE otherwise. 3204 * @return EINA_TRUE if it's extern, EINA_FALSE otherwise.
3281 * 3205 *
3282 * @ingroup Eolian 3206 * @ingroup Eolian
3283 */ 3207 */
3284EAPI Eina_Bool eolian_variable_is_extern(const Eolian_Variable *var); 3208EAPI Eina_Bool eolian_constant_is_extern(const Eolian_Constant *var);
3285 3209
3286/* 3210/*
3287 * @brief Get whether a variable is beta. 3211 * @brief Get whether a constant is beta.
3288 * 3212 *
3289 * @see eolian_object_is_beta 3213 * @see eolian_object_is_beta
3290 * 3214 *
3291 * @ingroup Eolian 3215 * @ingroup Eolian
3292 */ 3216 */
3293static inline Eina_Bool 3217static inline Eina_Bool
3294eolian_variable_is_beta(const Eolian_Variable *var) 3218eolian_constant_is_beta(const Eolian_Constant *var)
3295{ 3219{
3296 return eolian_object_is_beta(EOLIAN_OBJECT(var)); 3220 return eolian_object_is_beta(EOLIAN_OBJECT(var));
3297} 3221}
diff --git a/src/lib/eolian/database_check.c b/src/lib/eolian/database_check.c
index 4e448cea7a..0626512076 100644
--- a/src/lib/eolian/database_check.c
+++ b/src/lib/eolian/database_check.c
@@ -47,7 +47,7 @@ _check_expr_cb(const Eolian_Object *obj, void *data)
47 switch (obj->type) 47 switch (obj->type)
48 { 48 {
49 case EOLIAN_OBJECT_TYPEDECL: 49 case EOLIAN_OBJECT_TYPEDECL:
50 case EOLIAN_OBJECT_VARIABLE: 50 case EOLIAN_OBJECT_CONSTANT:
51 _add_dep(depset, obj->unit); 51 _add_dep(depset, obj->unit);
52 default: 52 default:
53 break; 53 break;
@@ -195,7 +195,7 @@ _check_typedecl(const Eolian_Typedecl *tp, Eina_Hash *depset, Eina_Hash *chash)
195} 195}
196 196
197static void 197static void
198_check_variable(const Eolian_Variable *v, Eina_Hash *depset, Eina_Hash *chash) 198_check_constant(const Eolian_Constant *v, Eina_Hash *depset, Eina_Hash *chash)
199{ 199{
200 if (_check_cycle(chash, &v->base)) 200 if (_check_cycle(chash, &v->base))
201 return; 201 return;
@@ -230,8 +230,8 @@ _check_unit(const Eolian_Unit *unit)
230 case EOLIAN_OBJECT_TYPEDECL: 230 case EOLIAN_OBJECT_TYPEDECL:
231 _check_typedecl((const Eolian_Typedecl *)obj, depset, chash); 231 _check_typedecl((const Eolian_Typedecl *)obj, depset, chash);
232 break; 232 break;
233 case EOLIAN_OBJECT_VARIABLE: 233 case EOLIAN_OBJECT_CONSTANT:
234 _check_variable((const Eolian_Variable *)obj, depset, chash); 234 _check_constant((const Eolian_Constant *)obj, depset, chash);
235 break; 235 break;
236 default: 236 default:
237 continue; 237 continue;
diff --git a/src/lib/eolian/database_expr.c b/src/lib/eolian/database_expr.c
index c2b6030db1..978f281a8f 100644
--- a/src/lib/eolian/database_expr.c
+++ b/src/lib/eolian/database_expr.c
@@ -512,7 +512,7 @@ eval_exp(const Eolian_Unit *unit, Eolian_Expression *expr,
512 return eval_exp(NULL, expr->expr, mask, out, cb, data); 512 return eval_exp(NULL, expr->expr, mask, out, cb, data);
513 } 513 }
514 514
515 const Eolian_Variable *var = eolian_unit_constant_by_name_get 515 const Eolian_Constant *var = eolian_unit_constant_by_name_get
516 (unit, expr->value.s); 516 (unit, expr->value.s);
517 Eolian_Expression *exp = NULL; 517 Eolian_Expression *exp = NULL;
518 518
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index d0bf40d17a..87d51ac2e1 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -1488,7 +1488,7 @@ _validate_class(Validate_State *vals, Eolian_Class *cl,
1488} 1488}
1489 1489
1490static Eina_Bool 1490static Eina_Bool
1491_validate_variable(Validate_State *vals, Eolian_Variable *var) 1491_validate_constant(Validate_State *vals, Eolian_Constant *var)
1492{ 1492{
1493 if (var->base.validated) 1493 if (var->base.validated)
1494 return EINA_TRUE; 1494 return EINA_TRUE;
@@ -1498,7 +1498,7 @@ _validate_variable(Validate_State *vals, Eolian_Variable *var)
1498 if (!_validate_type(vals, var->base_type)) 1498 if (!_validate_type(vals, var->base_type))
1499 return _reset_stable(vals, was_stable, EINA_FALSE); 1499 return _reset_stable(vals, was_stable, EINA_FALSE);
1500 1500
1501 if (var->value && !_validate_expr(var->value, var->base_type, 0, EINA_FALSE)) 1501 if (!_validate_expr(var->value, var->base_type, 0, EINA_FALSE))
1502 return _reset_stable(vals, was_stable, EINA_FALSE); 1502 return _reset_stable(vals, was_stable, EINA_FALSE);
1503 1503
1504 if (!_validate_doc(var->doc)) 1504 if (!_validate_doc(var->doc))
@@ -1516,10 +1516,10 @@ _typedecl_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
1516} 1516}
1517 1517
1518static Eina_Bool 1518static Eina_Bool
1519_var_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, 1519_constant_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
1520 Eolian_Variable *var, Cb_Ret *sc) 1520 Eolian_Constant *var, Cb_Ret *sc)
1521{ 1521{
1522 return (sc->succ = _validate_variable(sc->vals, var)); 1522 return (sc->succ = _validate_constant(sc->vals, var));
1523} 1523}
1524 1524
1525Eina_Bool 1525Eina_Bool
@@ -1597,11 +1597,7 @@ database_validate(const Eolian_Unit *src)
1597 if (!rt.succ) 1597 if (!rt.succ)
1598 return EINA_FALSE; 1598 return EINA_FALSE;
1599 1599
1600 eina_hash_foreach(src->globals, (Eina_Hash_Foreach)_var_map_cb, &rt); 1600 eina_hash_foreach(src->constants, (Eina_Hash_Foreach)_constant_map_cb, &rt);
1601 if (!rt.succ)
1602 return EINA_FALSE;
1603
1604 eina_hash_foreach(src->constants, (Eina_Hash_Foreach)_var_map_cb, &rt);
1605 if (!rt.succ) 1601 if (!rt.succ)
1606 return EINA_FALSE; 1602 return EINA_FALSE;
1607 1603
diff --git a/src/lib/eolian/database_var.c b/src/lib/eolian/database_var.c
index 5029e52068..a714bd6344 100644
--- a/src/lib/eolian/database_var.c
+++ b/src/lib/eolian/database_var.c
@@ -6,7 +6,7 @@
6#include "eo_lexer.h" 6#include "eo_lexer.h"
7 7
8void 8void
9database_var_del(Eolian_Variable *var) 9database_constant_del(Eolian_Constant *var)
10{ 10{
11 if (!var || eolian_object_unref(&var->base)) return; 11 if (!var || eolian_object_unref(&var->base)) return;
12 eina_stringshare_del(var->base.file); 12 eina_stringshare_del(var->base.file);
@@ -19,29 +19,11 @@ database_var_del(Eolian_Variable *var)
19 free(var); 19 free(var);
20} 20}
21 21
22static void 22void
23database_var_global_add(Eolian_Unit *unit, Eolian_Variable *var) 23database_constant_add(Eolian_Unit *unit, Eolian_Constant *var)
24{
25 EOLIAN_OBJECT_ADD(unit, var->base.name, var, globals);
26 eina_hash_set(unit->state->staging.globals_f, var->base.file, eina_list_append
27 ((Eina_List*)eina_hash_find(unit->state->staging.globals_f, var->base.file), var));
28}
29
30static void
31database_var_constant_add(Eolian_Unit *unit, Eolian_Variable *var)
32{ 24{
33 EOLIAN_OBJECT_ADD(unit, var->base.name, var, constants); 25 EOLIAN_OBJECT_ADD(unit, var->base.name, var, constants);
34 eina_hash_set(unit->state->staging.constants_f, var->base.file, eina_list_append 26 eina_hash_set(unit->state->staging.constants_f, var->base.file, eina_list_append
35 ((Eina_List*)eina_hash_find(unit->state->staging.constants_f, var->base.file), var)); 27 ((Eina_List*)eina_hash_find(unit->state->staging.constants_f, var->base.file), var));
36 database_object_add(unit, &var->base); 28 database_object_add(unit, &var->base);
37} 29}
38
39void
40database_var_add(Eolian_Unit *unit, Eolian_Variable *var)
41{
42 if (var->type == EOLIAN_VAR_GLOBAL)
43 database_var_global_add(unit, var);
44 else
45 database_var_constant_add(unit, var);
46 database_object_add(unit, &var->base);
47}
diff --git a/src/lib/eolian/database_var_api.c b/src/lib/eolian/database_var_api.c
index 099237a8ba..260baa638f 100644
--- a/src/lib/eolian/database_var_api.c
+++ b/src/lib/eolian/database_var_api.c
@@ -5,36 +5,29 @@
5#include <Eina.h> 5#include <Eina.h>
6#include "eolian_database.h" 6#include "eolian_database.h"
7 7
8EAPI Eolian_Variable_Type
9eolian_variable_type_get(const Eolian_Variable *var)
10{
11 EINA_SAFETY_ON_NULL_RETURN_VAL(var, EOLIAN_VAR_UNKNOWN);
12 return var->type;
13}
14
15EAPI const Eolian_Documentation * 8EAPI const Eolian_Documentation *
16eolian_variable_documentation_get(const Eolian_Variable *var) 9eolian_constant_documentation_get(const Eolian_Constant *var)
17{ 10{
18 EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); 11 EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
19 return var->doc; 12 return var->doc;
20} 13}
21 14
22EAPI const Eolian_Type * 15EAPI const Eolian_Type *
23eolian_variable_base_type_get(const Eolian_Variable *var) 16eolian_constant_base_type_get(const Eolian_Constant *var)
24{ 17{
25 EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); 18 EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
26 return var->base_type; 19 return var->base_type;
27} 20}
28 21
29EAPI const Eolian_Expression * 22EAPI const Eolian_Expression *
30eolian_variable_value_get(const Eolian_Variable *var) 23eolian_constant_value_get(const Eolian_Constant *var)
31{ 24{
32 EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL); 25 EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
33 return var->value; 26 return var->value;
34} 27}
35 28
36EAPI Eina_Bool 29EAPI Eina_Bool
37eolian_variable_is_extern(const Eolian_Variable *var) 30eolian_constant_is_extern(const Eolian_Constant *var)
38{ 31{
39 EINA_SAFETY_ON_NULL_RETURN_VAL(var, EINA_FALSE); 32 EINA_SAFETY_ON_NULL_RETURN_VAL(var, EINA_FALSE);
40 return var->is_extern; 33 return var->is_extern;
diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c
index 809e7fae5d..165c8340f2 100644
--- a/src/lib/eolian/eo_lexer.c
+++ b/src/lib/eolian/eo_lexer.c
@@ -1056,8 +1056,8 @@ _node_free(Eolian_Object *obj)
1056 case EOLIAN_OBJECT_TYPE: 1056 case EOLIAN_OBJECT_TYPE:
1057 database_type_del((Eolian_Type *)obj); 1057 database_type_del((Eolian_Type *)obj);
1058 break; 1058 break;
1059 case EOLIAN_OBJECT_VARIABLE: 1059 case EOLIAN_OBJECT_CONSTANT:
1060 database_var_del((Eolian_Variable *)obj); 1060 database_constant_del((Eolian_Constant *)obj);
1061 break; 1061 break;
1062 case EOLIAN_OBJECT_EXPRESSION: 1062 case EOLIAN_OBJECT_EXPRESSION:
1063 database_expr_del((Eolian_Expression *)obj); 1063 database_expr_del((Eolian_Expression *)obj);
diff --git a/src/lib/eolian/eo_lexer.h b/src/lib/eolian/eo_lexer.h
index 3b2bf734ac..706acb028e 100644
--- a/src/lib/eolian/eo_lexer.h
+++ b/src/lib/eolian/eo_lexer.h
@@ -31,7 +31,7 @@ enum Tokens
31 KW(data), KW(destructor), KW(error), KW(event_prefix), KW(events), KW(extends), \ 31 KW(data), KW(destructor), KW(error), KW(event_prefix), KW(events), KW(extends), \
32 KW(free), KW(get), KW(implements), KW(import), KW(interface), \ 32 KW(free), KW(get), KW(implements), KW(import), KW(interface), \
33 KW(keys), KW(legacy), KW(methods), KW(mixin), KW(params), \ 33 KW(keys), KW(legacy), KW(methods), KW(mixin), KW(params), \
34 KW(parse), KW(parts), KW(ptr), KW(set), KW(type), KW(values), KW(var), KW(requires), \ 34 KW(parse), KW(parts), KW(ptr), KW(set), KW(type), KW(values), KW(requires), \
35 \ 35 \
36 KWAT(auto), KWAT(beta), KWAT(by_ref), KWAT(c_name), KWAT(const), \ 36 KWAT(auto), KWAT(beta), KWAT(by_ref), KWAT(c_name), KWAT(const), \
37 KWAT(empty), KWAT(extern), KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), \ 37 KWAT(empty), KWAT(extern), KWAT(free), KWAT(hot), KWAT(in), KWAT(inout), \
@@ -264,16 +264,16 @@ eo_lexer_typedecl_release(Eo_Lexer *ls, Eolian_Typedecl *tp)
264 return (Eolian_Typedecl *)eo_lexer_node_release(ls, (Eolian_Object *)tp); 264 return (Eolian_Typedecl *)eo_lexer_node_release(ls, (Eolian_Object *)tp);
265} 265}
266 266
267static inline Eolian_Variable * 267static inline Eolian_Constant *
268eo_lexer_variable_new(Eo_Lexer *ls) 268eo_lexer_constant_new(Eo_Lexer *ls)
269{ 269{
270 return (Eolian_Variable *)eo_lexer_node_new(ls, sizeof(Eolian_Variable)); 270 return (Eolian_Constant *)eo_lexer_node_new(ls, sizeof(Eolian_Constant));
271} 271}
272 272
273static inline Eolian_Variable * 273static inline Eolian_Constant *
274eo_lexer_variable_release(Eo_Lexer *ls, Eolian_Variable *var) 274eo_lexer_constant_release(Eo_Lexer *ls, Eolian_Constant *var)
275{ 275{
276 return (Eolian_Variable *)eo_lexer_node_release(ls, (Eolian_Object *)var); 276 return (Eolian_Constant *)eo_lexer_node_release(ls, (Eolian_Object *)var);
277} 277}
278 278
279static inline Eolian_Expression * 279static inline Eolian_Expression *
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 879cc0af3a..faaaf4fb3d 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -125,7 +125,7 @@ _eolian_decl_get(Eo_Lexer *ls, const char *name)
125 obj = eina_hash_find(ls->state->staging.unit.objects, name); 125 obj = eina_hash_find(ls->state->staging.unit.objects, name);
126 if (obj && ((obj->type == EOLIAN_OBJECT_CLASS) || 126 if (obj && ((obj->type == EOLIAN_OBJECT_CLASS) ||
127 (obj->type == EOLIAN_OBJECT_TYPEDECL) || 127 (obj->type == EOLIAN_OBJECT_TYPEDECL) ||
128 (obj->type == EOLIAN_OBJECT_VARIABLE))) 128 (obj->type == EOLIAN_OBJECT_CONSTANT)))
129 return obj; 129 return obj;
130 130
131 return NULL; 131 return NULL;
@@ -152,8 +152,8 @@ _eolian_decl_name_get(Eolian_Object *obj)
152 break; 152 break;
153 } 153 }
154 goto end; 154 goto end;
155 case EOLIAN_OBJECT_VARIABLE: 155 case EOLIAN_OBJECT_CONSTANT:
156 return "variable"; 156 return "constant";
157 default: 157 default:
158 break; 158 break;
159 } 159 }
@@ -879,10 +879,10 @@ tags_done:
879 return def; 879 return def;
880} 880}
881 881
882static Eolian_Variable * 882static Eolian_Constant *
883parse_variable(Eo_Lexer *ls, Eina_Bool global) 883parse_constant(Eo_Lexer *ls)
884{ 884{
885 Eolian_Variable *def = eo_lexer_variable_new(ls); 885 Eolian_Constant *def = eo_lexer_constant_new(ls);
886 Eina_Strbuf *buf; 886 Eina_Strbuf *buf;
887 eo_lexer_get(ls); 887 eo_lexer_get(ls);
888 Eina_Stringshare *cname = NULL; 888 Eina_Stringshare *cname = NULL;
@@ -908,11 +908,10 @@ parse_variable(Eo_Lexer *ls, Eina_Bool global)
908 goto tags_done; 908 goto tags_done;
909 } 909 }
910tags_done: 910tags_done:
911 def->type = global ? EOLIAN_VAR_GLOBAL : EOLIAN_VAR_CONSTANT;
912 buf = eina_strbuf_new(); 911 buf = eina_strbuf_new();
913 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf); 912 eo_lexer_dtor_push(ls, EINA_FREE_CB(eina_strbuf_free), buf);
914 eo_lexer_context_push(ls); 913 eo_lexer_context_push(ls);
915 FILL_BASE(def->base, ls, ls->line_number, ls->column, VARIABLE); 914 FILL_BASE(def->base, ls, ls->line_number, ls->column, CONSTANT);
916 parse_name(ls, buf); 915 parse_name(ls, buf);
917 def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf)); 916 def->base.name = eina_stringshare_add(eina_strbuf_string_get(buf));
918 if (cname) 917 if (cname)
@@ -932,17 +931,12 @@ tags_done:
932 check_next(ls, ':'); 931 check_next(ls, ':');
933 def->base_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE)); 932 def->base_type = eo_lexer_type_release(ls, parse_type(ls, EINA_TRUE));
934 /* constants are required to have a value */ 933 /* constants are required to have a value */
935 if (!global) 934 check(ls, '=');
936 check(ls, '='); 935 ls->expr_mode = EINA_TRUE;
937 /* globals can optionally have a value */ 936 eo_lexer_get(ls);
938 if (ls->t.token == '=') 937 def->value = parse_expr(ls);
939 { 938 ls->expr_mode = EINA_FALSE;
940 ls->expr_mode = EINA_TRUE; 939 eo_lexer_expr_release_ref(ls, def->value);
941 eo_lexer_get(ls);
942 def->value = parse_expr(ls);
943 ls->expr_mode = EINA_FALSE;
944 eo_lexer_expr_release_ref(ls, def->value);
945 }
946 check_next(ls, ';'); 940 check_next(ls, ';');
947 FILL_DOC(ls, def, doc); 941 FILL_DOC(ls, def, doc);
948 eo_lexer_dtor_pop(ls); 942 eo_lexer_dtor_pop(ls);
@@ -2401,10 +2395,8 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot)
2401 break; 2395 break;
2402 } 2396 }
2403 case KW_const: 2397 case KW_const:
2404 case KW_var:
2405 { 2398 {
2406 database_var_add(ls->unit, eo_lexer_variable_release(ls, 2399 database_constant_add(ls->unit, eo_lexer_constant_release(ls, parse_constant(ls)));
2407 parse_variable(ls, ls->t.kw == KW_var)));
2408 break; 2400 break;
2409 } 2401 }
2410 case KW_error: 2402 case KW_error:
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index cef722dd95..09eb904992 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -491,7 +491,7 @@ database_doc_token_ref_resolve(const Eolian_Doc_Token *tok,
491 { 491 {
492 case EOLIAN_OBJECT_CLASS: 492 case EOLIAN_OBJECT_CLASS:
493 case EOLIAN_OBJECT_TYPEDECL: 493 case EOLIAN_OBJECT_TYPEDECL:
494 case EOLIAN_OBJECT_VARIABLE: 494 case EOLIAN_OBJECT_CONSTANT:
495 case EOLIAN_OBJECT_ERROR: 495 case EOLIAN_OBJECT_ERROR:
496 /* we only allow certain types to be referenced */ 496 /* we only allow certain types to be referenced */
497 return tp; 497 return tp;
@@ -589,8 +589,7 @@ database_unit_init(Eolian_State *state, Eolian_Unit *unit, const char *file)
589 589
590 unit->children = eina_hash_stringshared_new(NULL); 590 unit->children = eina_hash_stringshared_new(NULL);
591 unit->classes = eina_hash_stringshared_new(EINA_FREE_CB(database_class_del)); 591 unit->classes = eina_hash_stringshared_new(EINA_FREE_CB(database_class_del));
592 unit->globals = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del)); 592 unit->constants = eina_hash_stringshared_new(EINA_FREE_CB(database_constant_del));
593 unit->constants = eina_hash_stringshared_new(EINA_FREE_CB(database_var_del));
594 unit->errors = eina_hash_stringshared_new(EINA_FREE_CB(database_error_del)); 593 unit->errors = eina_hash_stringshared_new(EINA_FREE_CB(database_error_del));
595 unit->aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 594 unit->aliases = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
596 unit->structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del)); 595 unit->structs = eina_hash_stringshared_new(EINA_FREE_CB(database_typedecl_del));
@@ -607,7 +606,6 @@ _unit_contents_del(Eolian_Unit *unit)
607 eina_stringshare_del(unit->file); 606 eina_stringshare_del(unit->file);
608 eina_hash_free(unit->children); 607 eina_hash_free(unit->children);
609 eina_hash_free(unit->classes); 608 eina_hash_free(unit->classes);
610 eina_hash_free(unit->globals);
611 eina_hash_free(unit->constants); 609 eina_hash_free(unit->constants);
612 eina_hash_free(unit->errors); 610 eina_hash_free(unit->errors);
613 eina_hash_free(unit->aliases); 611 eina_hash_free(unit->aliases);
@@ -660,7 +658,6 @@ _state_area_init(Eolian_State *state, Eolian_State_Area *a)
660 a->aliases_f = eina_hash_stringshared_new(NULL); 658 a->aliases_f = eina_hash_stringshared_new(NULL);
661 a->structs_f = eina_hash_stringshared_new(NULL); 659 a->structs_f = eina_hash_stringshared_new(NULL);
662 a->enums_f = eina_hash_stringshared_new(NULL); 660 a->enums_f = eina_hash_stringshared_new(NULL);
663 a->globals_f = eina_hash_stringshared_new(NULL);
664 a->constants_f = eina_hash_stringshared_new(NULL); 661 a->constants_f = eina_hash_stringshared_new(NULL);
665 a->errors_f = eina_hash_stringshared_new(NULL); 662 a->errors_f = eina_hash_stringshared_new(NULL);
666 a->objects_f = eina_hash_stringshared_new(NULL); 663 a->objects_f = eina_hash_stringshared_new(NULL);
@@ -687,7 +684,6 @@ _state_area_contents_del(Eolian_State_Area *a)
687 _hashlist_free(a->aliases_f); 684 _hashlist_free(a->aliases_f);
688 _hashlist_free(a->structs_f); 685 _hashlist_free(a->structs_f);
689 _hashlist_free(a->enums_f); 686 _hashlist_free(a->enums_f);
690 _hashlist_free(a->globals_f);
691 _hashlist_free(a->constants_f); 687 _hashlist_free(a->constants_f);
692 _hashlist_free(a->errors_f); 688 _hashlist_free(a->errors_f);
693 _hashlist_free(a->objects_f); 689 _hashlist_free(a->objects_f);
@@ -906,7 +902,6 @@ _state_clean(Eolian_State *state)
906 902
907 Eolian_Unit *stu = &st->unit; 903 Eolian_Unit *stu = &st->unit;
908 eina_hash_free_buckets(stu->classes); 904 eina_hash_free_buckets(stu->classes);
909 eina_hash_free_buckets(stu->globals);
910 eina_hash_free_buckets(stu->constants); 905 eina_hash_free_buckets(stu->constants);
911 eina_hash_free_buckets(stu->aliases); 906 eina_hash_free_buckets(stu->aliases);
912 eina_hash_free_buckets(stu->structs); 907 eina_hash_free_buckets(stu->structs);
@@ -921,7 +916,6 @@ _state_clean(Eolian_State *state)
921 _hashlist_free_buckets(st->aliases_f); 916 _hashlist_free_buckets(st->aliases_f);
922 _hashlist_free_buckets(st->structs_f); 917 _hashlist_free_buckets(st->structs_f);
923 _hashlist_free_buckets(st->enums_f); 918 _hashlist_free_buckets(st->enums_f);
924 _hashlist_free_buckets(st->globals_f);
925 _hashlist_free_buckets(st->constants_f); 919 _hashlist_free_buckets(st->constants_f);
926 _hashlist_free_buckets(st->objects_f); 920 _hashlist_free_buckets(st->objects_f);
927} 921}
@@ -1010,7 +1004,6 @@ static void
1010_merge_unit(Eolian_Unit *dest, Eolian_Unit *src) 1004_merge_unit(Eolian_Unit *dest, Eolian_Unit *src)
1011{ 1005{
1012 eina_hash_foreach(src->classes, _merge_unit_cb, dest->classes); 1006 eina_hash_foreach(src->classes, _merge_unit_cb, dest->classes);
1013 eina_hash_foreach(src->globals, _merge_unit_cb, dest->globals);
1014 eina_hash_foreach(src->constants, _merge_unit_cb, dest->constants); 1007 eina_hash_foreach(src->constants, _merge_unit_cb, dest->constants);
1015 eina_hash_foreach(src->aliases, _merge_unit_cb, dest->aliases); 1008 eina_hash_foreach(src->aliases, _merge_unit_cb, dest->aliases);
1016 eina_hash_foreach(src->structs, _merge_unit_cb, dest->structs); 1009 eina_hash_foreach(src->structs, _merge_unit_cb, dest->structs);
@@ -1073,7 +1066,6 @@ _merge_staging(Eolian_State *state)
1073 EOLIAN_STAGING_MERGE_LIST(aliases); 1066 EOLIAN_STAGING_MERGE_LIST(aliases);
1074 EOLIAN_STAGING_MERGE_LIST(structs); 1067 EOLIAN_STAGING_MERGE_LIST(structs);
1075 EOLIAN_STAGING_MERGE_LIST(enums); 1068 EOLIAN_STAGING_MERGE_LIST(enums);
1076 EOLIAN_STAGING_MERGE_LIST(globals);
1077 EOLIAN_STAGING_MERGE_LIST(constants); 1069 EOLIAN_STAGING_MERGE_LIST(constants);
1078 EOLIAN_STAGING_MERGE_LIST(objects); 1070 EOLIAN_STAGING_MERGE_LIST(objects);
1079 1071
@@ -1249,17 +1241,6 @@ eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name)
1249} 1241}
1250 1242
1251EAPI Eina_Iterator * 1243EAPI Eina_Iterator *
1252eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name)
1253{
1254 if (!state) return NULL;
1255 Eina_Stringshare *shr = eina_stringshare_add(file_name);
1256 Eina_List *l = eina_hash_find(state->main.globals_f, shr);
1257 eina_stringshare_del(shr);
1258 if (!l) return NULL;
1259 return eina_list_iterator_new(l);
1260}
1261
1262EAPI Eina_Iterator *
1263eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name) 1244eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name)
1264{ 1245{
1265 if (!state) return NULL; 1246 if (!state) return NULL;
@@ -1383,22 +1364,12 @@ eolian_unit_classes_get(const Eolian_Unit *unit)
1383 return (unit ? eina_hash_iterator_data_new(unit->classes) : NULL); 1364 return (unit ? eina_hash_iterator_data_new(unit->classes) : NULL);
1384} 1365}
1385 1366
1386EAPI const Eolian_Variable * 1367EAPI const Eolian_Constant *
1387eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name)
1388{
1389 if (!unit) return NULL;
1390 Eina_Stringshare *shr = eina_stringshare_add(name);
1391 Eolian_Variable *v = eina_hash_find(unit->globals, shr);
1392 eina_stringshare_del(shr);
1393 return v;
1394}
1395
1396EAPI const Eolian_Variable *
1397eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name) 1368eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name)
1398{ 1369{
1399 if (!unit) return NULL; 1370 if (!unit) return NULL;
1400 Eina_Stringshare *shr = eina_stringshare_add(name); 1371 Eina_Stringshare *shr = eina_stringshare_add(name);
1401 Eolian_Variable *v = eina_hash_find(unit->constants, shr); 1372 Eolian_Constant *v = eina_hash_find(unit->constants, shr);
1402 eina_stringshare_del(shr); 1373 eina_stringshare_del(shr);
1403 return v; 1374 return v;
1404} 1375}
@@ -1420,12 +1391,6 @@ eolian_unit_constants_get(const Eolian_Unit *unit)
1420} 1391}
1421 1392
1422EAPI Eina_Iterator * 1393EAPI Eina_Iterator *
1423eolian_unit_globals_get(const Eolian_Unit *unit)
1424{
1425 return (unit ? eina_hash_iterator_data_new(unit->globals) : NULL);
1426}
1427
1428EAPI Eina_Iterator *
1429eolian_unit_errors_get(const Eolian_Unit *unit) 1394eolian_unit_errors_get(const Eolian_Unit *unit)
1430{ 1395{
1431 return (unit ? eina_hash_iterator_data_new(unit->errors) : NULL); 1396 return (unit ? eina_hash_iterator_data_new(unit->errors) : NULL);
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index ab49424cad..3cbf4fbeea 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -39,7 +39,6 @@ struct _Eolian_Unit
39 Eolian_State *state; 39 Eolian_State *state;
40 Eina_Hash *children; 40 Eina_Hash *children;
41 Eina_Hash *classes; 41 Eina_Hash *classes;
42 Eina_Hash *globals;
43 Eina_Hash *constants; 42 Eina_Hash *constants;
44 Eina_Hash *errors; 43 Eina_Hash *errors;
45 Eina_Hash *aliases; 44 Eina_Hash *aliases;
@@ -59,7 +58,6 @@ typedef struct _Eolian_State_Area
59 Eina_Hash *aliases_f; 58 Eina_Hash *aliases_f;
60 Eina_Hash *structs_f; 59 Eina_Hash *structs_f;
61 Eina_Hash *enums_f; 60 Eina_Hash *enums_f;
62 Eina_Hash *globals_f;
63 Eina_Hash *constants_f; 61 Eina_Hash *constants_f;
64 Eina_Hash *errors_f; 62 Eina_Hash *errors_f;
65 Eina_Hash *objects_f; 63 Eina_Hash *objects_f;
@@ -394,10 +392,9 @@ struct _Eolian_Expression
394 Eina_Bool weak_rhs :1; 392 Eina_Bool weak_rhs :1;
395}; 393};
396 394
397struct _Eolian_Variable 395struct _Eolian_Constant
398{ 396{
399 Eolian_Object base; 397 Eolian_Object base;
400 Eolian_Variable_Type type;
401 Eolian_Type *base_type; 398 Eolian_Type *base_type;
402 Eolian_Expression *value; 399 Eolian_Expression *value;
403 Eolian_Documentation *doc; 400 Eolian_Documentation *doc;
@@ -449,8 +446,8 @@ void database_expr_print(Eolian_Expression *expr);
449 446
450/* variables */ 447/* variables */
451 448
452void database_var_del(Eolian_Variable *var); 449void database_constant_del(Eolian_Constant *var);
453void database_var_add(Eolian_Unit *unit, Eolian_Variable *var); 450void database_constant_add(Eolian_Unit *unit, Eolian_Constant *var);
454 451
455/* classes */ 452/* classes */
456void database_class_del(Eolian_Class *cl); 453void database_class_del(Eolian_Class *cl);