EAPI const Eolian_Function * eolian_typedecl_function_pointer_get(const Eolian_Typedecl *tp) { EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); if (eolian_typedecl_type_get(tp) != EOLIAN_TYPEDECL_FUNCTION_POINTER) return NULL; return tp->function_pointer; }
static void _append_defval(const Eolian_Unit *src, Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type *tp) { if (exp) { Eolian_Value val = eolian_expression_eval_type(src, exp, tp); Eina_Stringshare *lit = eolian_expression_value_to_literal(&val); if (lit) { eina_strbuf_append(buf, lit); Eina_Stringshare *exps = eolian_expression_serialize(exp); if (exps && strcmp(lit, exps)) eina_strbuf_append_printf(buf, " /* %s */", exps); eina_stringshare_del(exps); eina_stringshare_del(lit); return; } else WRN("evaluation of default value failed"); } /* default value or fallback */ const Eolian_Type *btp = eolian_type_aliased_base_get(tp); if (eolian_type_is_ptr(btp)) { eina_strbuf_append(buf, "NULL"); return; } const Eolian_Typedecl *tdcl = eolian_type_typedecl_get(btp); if (tdcl && (eolian_typedecl_type_get(tdcl) == EOLIAN_TYPEDECL_STRUCT)) { char *sn = eo_gen_c_full_name_get(eolian_typedecl_full_name_get(tdcl)); eina_strbuf_append_printf(buf, "((%s){0})", sn); free(sn); return; } Eina_Stringshare *ctp = eolian_type_c_type_get(btp); if (strchr(ctp, '*')) { eina_strbuf_append(buf, "NULL"); return; } eina_stringshare_del(ctp); /* enums and remaining regulars... 0 should do */ eina_strbuf_append(buf, "0"); }