summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeeyong Um <conr2d@gmail.com>2018-05-01 01:25:39 +0900
committerJeeyong Um <conr2d@gmail.com>2018-05-01 04:46:47 +0900
commit0b9e9499386ed9b9c40c15a6a02b1d9020b57319 (patch)
tree0ba1e462ad6bbadb5fdb18f07101dd00f41f224e
parent31ec772c555a37405289ce8290008eab88648fc7 (diff)
edje_cc: Use macro to get rid of repeated section
-rw-r--r--src/bin/edje/edje_cc_handlers.c121
1 files changed, 31 insertions, 90 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 78cadd0a6f..7f5981895c 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -9044,40 +9044,37 @@ st_collections_group_parts_part_description_inherit(void)
9044 * referenced 9044 * referenced
9045 */ 9045 */
9046 9046
9047 ed->size_class = STRDUP(ed->size_class); 9047#define IMPORT_DATA(TYPE, NAME, CONTAINER) \
9048 if ((ed->size_class) && (pcp->import)) 9048 if ((NAME) && (pcp->import)) \
9049 { 9049 { \
9050 Edje_Size_Class *sc; 9050 TYPE *dt; \
9051 Edje_Size_Class_Parser *scp; 9051 TYPE ## _Parser *dtp; \
9052 Eina_List *l; 9052 Eina_List *l; \
9053 Eina_Bool overriden = EINA_FALSE; 9053 Eina_Bool overriden = EINA_FALSE; \
9054 9054 EINA_LIST_FOREACH(edje_file->CONTAINER, l, dt) \
9055 EINA_LIST_FOREACH(edje_file->size_classes, l, sc) 9055 { \
9056 { 9056 if (!strcmp(NAME, dt->name)) \
9057 if (!strcmp(ed->size_class, sc->name)) 9057 { \
9058 { 9058 overriden = EINA_TRUE; \
9059 overriden = EINA_TRUE; 9059 break; \
9060 break; 9060 } \
9061 } 9061 } \
9062 } 9062 if (!overriden) \
9063 9063 { \
9064 if (!overriden) 9064 EINA_LIST_FOREACH(edje_file_import->CONTAINER, l, dt) \
9065 { 9065 { \
9066 EINA_LIST_FOREACH(edje_file_import->size_classes, l, sc) 9066 dtp = mem_alloc(SZ(TYPE ## _Parser)); \
9067 { 9067 memcpy(dtp, dt, sizeof(TYPE)); \
9068 if (!strcmp(ed->size_class, sc->name)) 9068 dtp->imported = EINA_TRUE; \
9069 { 9069 edje_file->CONTAINER = eina_list_append(edje_file->CONTAINER, dtp); \
9070 scp = mem_alloc(SZ(Edje_Size_Class_Parser)); 9070 break; \
9071 memcpy(scp, sc, sizeof(Edje_Size_Class)); 9071 } \
9072 scp->imported = EINA_TRUE; 9072 } \
9073
9074 edje_file->size_classes = eina_list_append(edje_file->size_classes, scp);
9075 break;
9076 }
9077 }
9078 }
9079 } 9073 }
9080 9074
9075 ed->size_class = STRDUP(ed->size_class);
9076 IMPORT_DATA(Edje_Size_Class, ed->size_class, size_classes);
9077
9081 ed->color_class = STRDUP(ed->color_class); 9078 ed->color_class = STRDUP(ed->color_class);
9082 if ((ed->color_class) && (pcp->import)) 9079 if ((ed->color_class) && (pcp->import))
9083 { 9080 {
@@ -9160,66 +9157,10 @@ st_collections_group_parts_part_description_inherit(void)
9160 ted->text.text.str = STRDUP(ted->text.text.str); 9157 ted->text.text.str = STRDUP(ted->text.text.str);
9161 ted->text.domain = STRDUP(ted->text.domain); 9158 ted->text.domain = STRDUP(ted->text.domain);
9162 ted->text.text_class = STRDUP(ted->text.text_class); 9159 ted->text.text_class = STRDUP(ted->text.text_class);
9163 if ((ted->text.text_class) && (pcp->import))
9164 {
9165 Edje_Text_Class *tc;
9166 Edje_Text_Class_Parser *tcp;
9167 Eina_List *l;
9168 Eina_Bool overriden = EINA_FALSE;
9169
9170 EINA_LIST_FOREACH(edje_file->text_classes, l, tc)
9171 {
9172 if (!strcmp(ted->text.text_class, tc->name))
9173 {
9174 overriden = EINA_TRUE;
9175 break;
9176 }
9177 }
9178
9179 if (!overriden)
9180 {
9181 EINA_LIST_FOREACH(edje_file_import->text_classes, l, tc)
9182 {
9183 tcp = mem_alloc(SZ(Edje_Text_Class_Parser));
9184 memcpy(tcp, tc, sizeof(Edje_Text_Class));
9185 tcp->imported = EINA_TRUE;
9186
9187 edje_file->text_classes = eina_list_append(edje_file->text_classes, tcp);
9188 break;
9189 }
9190 }
9191 }
9192 ted->text.font.str = STRDUP(ted->text.font.str); 9160 ted->text.font.str = STRDUP(ted->text.font.str);
9193 9161
9194 if ((ted->text.style.str) && (pcp->import)) 9162 IMPORT_DATA(Edje_Text_Class, ted->text.text_class, text_classes);
9195 { 9163 IMPORT_DATA(Edje_Style, ted->text.style.str, styles);
9196 Edje_Style *stl;
9197 Edje_Style_Parser *stlp;
9198 Eina_List *l;
9199 Eina_Bool overriden = EINA_FALSE;
9200
9201 EINA_LIST_FOREACH(edje_file->styles, l, stl)
9202 {
9203 if (!strcmp(ted->text.style.str, stl->name))
9204 {
9205 overriden = EINA_TRUE;
9206 break;
9207 }
9208 }
9209
9210 if (!overriden)
9211 {
9212 EINA_LIST_FOREACH(edje_file_import->styles, l, stl)
9213 {
9214 stlp = mem_alloc(SZ(Edje_Style_Parser));
9215 memcpy(stlp, stl, sizeof(Edje_Style));
9216 stlp->imported = EINA_TRUE;
9217
9218 edje_file->styles = eina_list_append(edje_file->styles, stlp);
9219 break;
9220 }
9221 }
9222 }
9223 9164
9224 _filter_copy(&ted->filter, &tparent->filter); 9165 _filter_copy(&ted->filter, &tparent->filter);
9225 data_queue_copied_part_nest_lookup(pc, &(tparent->text.id_source), &(ted->text.id_source), &ted->text.id_source_part); 9166 data_queue_copied_part_nest_lookup(pc, &(tparent->text.id_source), &(ted->text.id_source), &ted->text.id_source_part);