forked from enlightenment/efl
Eolian/Generator: support common descriptions for properties.
This commit is contained in:
parent
af513b6af3
commit
dedd8cef64
|
@ -114,7 +114,6 @@ eo_fundef_generate(const Eolian_Class *class, const Eolian_Function *func, Eolia
|
|||
}
|
||||
eina_iterator_free(itr);
|
||||
}
|
||||
const char *funcdesc = eolian_function_description_get(func, ftype);
|
||||
Eina_Strbuf *str_func = eina_strbuf_new();
|
||||
if (scope == EOLIAN_SCOPE_PROTECTED)
|
||||
eina_strbuf_append_printf(str_func, "#ifdef %s_PROTECTED\n", class_env.upper_classname);
|
||||
|
@ -127,7 +126,12 @@ eo_fundef_generate(const Eolian_Class *class, const Eolian_Function *func, Eolia
|
|||
eina_strbuf_append_printf(str_func, "\n");
|
||||
|
||||
Eina_Strbuf *linedesc = eina_strbuf_new();
|
||||
eina_strbuf_append(linedesc, funcdesc ? funcdesc : "No description supplied.");
|
||||
const char *common_desc = eolian_function_description_get(func, EOLIAN_UNRESOLVED);
|
||||
const char *specific_desc = (ftype == EOLIAN_PROP_SET || ftype == EOLIAN_PROP_GET) ?
|
||||
eolian_function_description_get(func, ftype) : NULL;
|
||||
if (!common_desc && !specific_desc) eina_strbuf_append(linedesc, "No description supplied.");
|
||||
if (common_desc) eina_strbuf_append_printf(linedesc, "%s\n", common_desc);
|
||||
if (specific_desc) eina_strbuf_append(linedesc, specific_desc);
|
||||
if (eina_strbuf_length_get(linedesc))
|
||||
{
|
||||
eina_strbuf_replace_all(linedesc, "\n", "\n * ");
|
||||
|
|
|
@ -90,9 +90,13 @@ _eapi_decl_func_generate(const Eolian_Class *class, const Eolian_Function *funci
|
|||
eina_strbuf_append(fparam, "const ");
|
||||
eina_strbuf_append_printf(fparam, "%s *obj", class_env.full_classname);
|
||||
}
|
||||
const char *desc = eolian_function_description_get(funcid, ftype);
|
||||
Eina_Strbuf *linedesc = eina_strbuf_new();
|
||||
eina_strbuf_append(linedesc, desc ? desc : "No description supplied.");
|
||||
const char *common_desc = eolian_function_description_get(funcid, EOLIAN_UNRESOLVED);
|
||||
const char *specific_desc = (ftype == EOLIAN_PROP_SET || ftype == EOLIAN_PROP_GET) ?
|
||||
eolian_function_description_get(funcid, ftype) : NULL;
|
||||
if (!common_desc && !specific_desc) eina_strbuf_append(linedesc, "No description supplied.");
|
||||
if (common_desc) eina_strbuf_append_printf(linedesc, "%s\n", common_desc);
|
||||
if (specific_desc) eina_strbuf_append(linedesc, specific_desc);
|
||||
if (eina_strbuf_length_get(linedesc))
|
||||
{
|
||||
eina_strbuf_replace_all(linedesc, "\n", "\n * ");
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
#ifndef _EOLIAN_OUTPUT_H_
|
||||
#define _EOLIAN_OUTPUT_H_
|
||||
|
||||
#ifndef _CLASS_SIMPLE_EO_CLASS_TYPE
|
||||
#define _CLASS_SIMPLE_EO_CLASS_TYPE
|
||||
|
||||
typedef Eo Class_Simple;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _CLASS_SIMPLE_EO_TYPES
|
||||
#define _CLASS_SIMPLE_EO_TYPES
|
||||
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Class Desc Simple
|
||||
*/
|
||||
#define CLASS_SIMPLE_CLASS class_simple_class_get()
|
||||
|
||||
const Eo_Class *class_simple_class_get(void) EINA_CONST;
|
||||
|
||||
/**
|
||||
*
|
||||
* Common desc for a
|
||||
* comment a.set
|
||||
*
|
||||
* @param[in] value Value description
|
||||
*
|
||||
*/
|
||||
EOAPI Eina_Bool evas_obj_simple_a_set(int value);
|
||||
|
||||
/**
|
||||
*
|
||||
* Common desc for a
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
EOAPI int evas_obj_simple_a_get(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* No description supplied.
|
||||
*
|
||||
*
|
||||
*/
|
||||
EOAPI void evas_obj_simple_b_set(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* comment foo
|
||||
*
|
||||
*
|
||||
* @param[in] a a
|
||||
* @param[inout] b No description supplied.
|
||||
* @param[out] c No description supplied.
|
||||
*
|
||||
*/
|
||||
EOAPI char * evas_obj_simple_foo(int a, char *b, double *c);
|
||||
|
||||
/**
|
||||
*
|
||||
* No description supplied.
|
||||
*
|
||||
* @param[in] x No description supplied.
|
||||
*
|
||||
*/
|
||||
EOAPI int evas_obj_simple_bar(int x);
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,63 @@
|
|||
#ifndef _EOLIAN_OUTPUT_H_
|
||||
#define _EOLIAN_OUTPUT_H_
|
||||
|
||||
#ifndef _CLASS_SIMPLE_EO_CLASS_TYPE
|
||||
#define _CLASS_SIMPLE_EO_CLASS_TYPE
|
||||
|
||||
typedef Eo Class_Simple;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _CLASS_SIMPLE_EO_TYPES
|
||||
#define _CLASS_SIMPLE_EO_TYPES
|
||||
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Class Desc Simple
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Common desc for a
|
||||
* comment a.set
|
||||
*
|
||||
* @param[in] value Value description
|
||||
*/
|
||||
EAPI Eina_Bool evas_object_simple_a_set(Class_Simple *obj, int value);
|
||||
|
||||
/**
|
||||
*
|
||||
* Common desc for a
|
||||
*
|
||||
*
|
||||
*/
|
||||
EAPI int evas_object_simple_a_get(const Class_Simple *obj);
|
||||
|
||||
/**
|
||||
*
|
||||
* No description supplied.
|
||||
*
|
||||
*/
|
||||
EAPI void evas_object_simple_b_set(Class_Simple *obj);
|
||||
|
||||
/**
|
||||
*
|
||||
* comment foo
|
||||
*
|
||||
*
|
||||
* @param[in] a a
|
||||
* @param[inout] b No description supplied.
|
||||
* @param[out] c No description supplied.
|
||||
*/
|
||||
EAPI char *evas_object_simple_foo(Class_Simple *obj, int a, char *b, double *c);
|
||||
|
||||
/**
|
||||
*
|
||||
* No description supplied.
|
||||
*
|
||||
* @param[in] x No description supplied.
|
||||
*/
|
||||
EAPI int evas_object_simple_bar(Class_Simple *obj, int x);
|
||||
|
||||
#endif
|
|
@ -156,11 +156,31 @@ START_TEST(eolian_override_generation)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(eolian_functions_descriptions)
|
||||
{
|
||||
char output_filepath[PATH_MAX] = "";
|
||||
snprintf(output_filepath, PATH_MAX, "%s/eolian_output.h",
|
||||
#ifdef HAVE_EVIL
|
||||
(char *)evil_tmpdir_get()
|
||||
#else
|
||||
"/tmp"
|
||||
#endif
|
||||
);
|
||||
remove(output_filepath);
|
||||
fail_if(0 != _eolian_gen_execute(PACKAGE_DATA_DIR"/data/class_simple.eo", "--eo --gh", output_filepath));
|
||||
fail_if(!_files_compare(PACKAGE_DATA_DIR"/data/class_simple_ref_eo.h", output_filepath));
|
||||
remove(output_filepath);
|
||||
fail_if(0 != _eolian_gen_execute(PACKAGE_DATA_DIR"/data/class_simple.eo", "--legacy --gh", output_filepath));
|
||||
fail_if(!_files_compare(PACKAGE_DATA_DIR"/data/class_simple_ref_legacy.h", output_filepath));
|
||||
}
|
||||
END_TEST
|
||||
|
||||
void eolian_generation_test(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, eolian_types_generation);
|
||||
tcase_add_test(tc, eolian_default_values_generation);
|
||||
tcase_add_test(tc, eolian_override_generation);
|
||||
tcase_add_test(tc, eolian_dev_impl_code);
|
||||
tcase_add_test(tc, eolian_functions_descriptions);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue