summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-05-27 18:15:05 +0300
committerAvi Levin <avi.levin@samsung.com>2015-05-27 18:15:05 +0300
commitaba0e1432e13832d34e9c97e990ae3618a6eadb7 (patch)
treea18a412e41da360b45180da7ecfb62c4385189ee
Eolian_info: new tool for extracting info on eolian classes
First commit
-rw-r--r--CMakeLists.txt71
-rw-r--r--build/.cla.dot.swpbin0 -> 12288 bytes
-rw-r--r--cmake/Modules/EFLCheck.cmake12
-rw-r--r--cmake/Modules/FindCGraph.cmake41
-rw-r--r--cmake/Modules/FindCheck.cmake32
-rw-r--r--cmake/Modules/FindFfi.cmake40
-rw-r--r--cmake/Modules/FindGvc.cmake41
-rw-r--r--cmake_uninstall.cmake.in21
-rw-r--r--makefile13
-rw-r--r--notes22
-rw-r--r--src/bin/.CMakeLists.txt.swpbin0 -> 12288 bytes
-rw-r--r--src/bin/.main.c.swpbin0 -> 28672 bytes
-rw-r--r--src/bin/CMakeLists.txt34
-rw-r--r--src/bin/main.c330
14 files changed, 657 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..3a37e9a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,71 @@
1cmake_minimum_required(VERSION 2.8.1)
2
3set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
4
5project(EOINFO)
6string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
7
8# define var EGUI_IS_RELEASE to activate install scripts
9if (NOT CMAKE_BUILD_TYPE)
10 set(CMAKE_BUILD_TYPE Release)
11endif(NOT CMAKE_BUILD_TYPE)
12
13string(TOLOWER ${CMAKE_BUILD_TYPE} EOINFO_BUILD_TYPE)
14#string(COMPARE EQUAL ${EOINFO_BUILD_TYPE} release EOINFO_IS_RELEASE)
15
16set(EOINFO_COMMON_DEFINITIONS -DEFL_EO_API_SUPPORT -DEFL_BETA_API_SUPPORT)
17add_definitions(${EOINFO_COMMON_DEFINITIONS})
18
19find_package(Eina REQUIRED)
20find_package(Eo REQUIRED)
21find_package(Eolian REQUIRED)
22find_package(Ecore REQUIRED)
23find_package(Efreet REQUIRED)
24include(EFLCheck)
25
26#######################################
27## Some of following libraries are included into libc on different distributions.
28## So try to locate them.
29## If library not found, supposing that it is included somethere.
30#######################################
31#finding dl library
32find_library(DL dl)
33if(${DL} STREQUAL DL-NOTFOUND)
34 set(DL_LIBRARY "")
35else()
36 set(DL_LIBRARY ${DL})
37endif()
38mark_as_advanced(DL_LIBRARY)
39
40#finding m library
41find_library(M m)
42if(${M} STREQUAL M-NOTFOUND)
43 set(M_LIBRARY "")
44else()
45 set(M_LIBRARY ${M})
46endif()
47mark_as_advanced(M_LIBRARY)
48
49#finding rt library
50find_library(RT rt)
51if(${RT} STREQUAL RT-NOTFOUND)
52 set(RT_LIBRARY "")
53else()
54 set(RT_LIBRARY ${RT})
55endif()
56mark_as_advanced(RT_LIBRARY)
57######################################
58
59# uninstall target
60configure_file(
61 "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
62 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
63 IMMEDIATE @ONLY)
64
65add_custom_target(uninstall
66 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
67
68#add_subdirectory(src/lib)
69add_subdirectory(src/bin)
70#add_subdirectory(src/tests)
71#add_subdirectory(data/config)
diff --git a/build/.cla.dot.swp b/build/.cla.dot.swp
new file mode 100644
index 0000000..8da3e66
--- /dev/null
+++ b/build/.cla.dot.swp
Binary files differ
diff --git a/cmake/Modules/EFLCheck.cmake b/cmake/Modules/EFLCheck.cmake
new file mode 100644
index 0000000..f729325
--- /dev/null
+++ b/cmake/Modules/EFLCheck.cmake
@@ -0,0 +1,12 @@
1include(CTest)
2ENABLE_TESTING()
3add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
4
5find_package(Check)
6set (CHECK_ENABLED ${CHECK_FOUND})
7
8set(EFL_COVERAGE false CACHE BOOL "Whether coverage support should be built.'")
9if (EFL_COVERAGE)
10 include(EFLlcov REQUIRED)
11 ENABLE_COVERAGE()
12endif (EFL_COVERAGE)
diff --git a/cmake/Modules/FindCGraph.cmake b/cmake/Modules/FindCGraph.cmake
new file mode 100644
index 0000000..200efe1
--- /dev/null
+++ b/cmake/Modules/FindCGraph.cmake
@@ -0,0 +1,41 @@
1# - Try to find GraphViz
2# Once done this will define
3# CGRAPH_FOUND - System has GraphViz
4# CGRAPH_INCLUDE_DIRS - The GraphViz include directories
5# CGRAPH_LIBRARIES - The libraries needed to use GraphViz
6# CGRAPH_LDFLAGS_OTHER - Other LDFLAGS needed te use GraphViz
7# CGRAPH_DEFINITIONS - Compiler switches required for using GraphViz
8
9find_package(PkgConfig)
10if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
11 # "QUIET" was introduced in 2.8.2
12 set(_QUIET QUIET)
13endif ()
14pkg_check_modules(PC_LIBCGRAPH ${_QUIET} libcgraph)
15
16set (CGRAPH_MIN_VERSION "2.35.0.0")
17if ("${PC_LIBCGRAPH_VERSION}" VERSION_LESS ${CGRAPH_MIN_VERSION})
18 MESSAGE(STATUS "libcgraph version required: ${CGRAPH_MIN_VERSION}. Current version: ${PC_LIBCGRAPH_VERSION}.")
19else()
20 SET(LIBCGRAPH_REQUIRED_VERSION 1)
21endif()
22
23if (LIBCGRAPH_REQUIRED_VERSION)
24 find_path(CGRAPH_INCLUDE_DIR cgraph.h
25 HINTS ${PC_LIBCGRAPH_INCLUDEDIR} ${PC_LIBCCGRAPH_INCLUDE_DIRS}
26 PATH_SUFFIXES cgraph )
27
28 find_library(CGRAPH_LIBRARY NAMES cgraph libcgraph
29 HINTS ${PC_LIBCGRAPH_LIBDIR} ${PC_LIBCGRAPH_LIBRARY_DIRS} )
30
31 set(CGRAPH_INCLUDE_DIRS ${CGRAPH_INCLUDE_DIR})
32 set(CGRAPH_LIBRARIES ${CGRAPH_LIBRARY} )
33
34 #include(FindPackageHandleStandardArgs)
35 # handle the QUIETLY and REQUIRED arguments and set EINA_FOUND to TRUE
36 # if all listed variables are TRUE
37 find_package_handle_standard_args(cgraph DEFAULT_MSG
38 CGRAPH_LIBRARY)
39endif (LIBCGRAPH_REQUIRED_VERSION)
40
41mark_as_advanced(CGRAPH_INCLUDE_DIR CGRAPH_LIBRARY)
diff --git a/cmake/Modules/FindCheck.cmake b/cmake/Modules/FindCheck.cmake
new file mode 100644
index 0000000..13ed8e9
--- /dev/null
+++ b/cmake/Modules/FindCheck.cmake
@@ -0,0 +1,32 @@
1# - Try to find check
2# Once done this will define
3# CHECK_FOUND - System has check
4# CHECK_INCLUDE_DIRS - The check include directories
5# CHECK_LIBRARIES - The libraries needed to use check
6# CHECK_DEFINITIONS - Compiler switches required for using check
7
8find_package(PkgConfig)
9if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
10 # "QUIET" was introduced in 2.8.2
11 set(_QUIET QUIET)
12endif ()
13pkg_check_modules(PC_LIBCHECK ${_QUIET} check)
14set(CHECK_DEFINITIONS ${PC_LIBCHECK_CFLAGS_OTHER})
15
16find_path(CHECK_INCLUDE_DIR check.h
17 HINTS ${PC_LIBCHECK_INCLUDEDIR} ${PC_LIBCHECK_INCLUDE_DIRS}
18 PATH_SUFFIXES check )
19
20find_library(CHECK_LIBRARY NAMES check
21 HINTS ${PC_LIBCHECK_LIBDIR} ${PC_LIBCHECK_LIBRARY_DIRS} )
22
23set(CHECK_LIBRARIES ${CHECK_LIBRARY} )
24set(CHECK_INCLUDE_DIRS ${CHECK_INCLUDE_DIR} )
25
26include(FindPackageHandleStandardArgs)
27# handle the QUIETLY and REQUIRED arguments and set CHECK_FOUND to TRUE
28# if all listed variables are TRUE
29find_package_handle_standard_args(check DEFAULT_MSG
30 CHECK_LIBRARY CHECK_INCLUDE_DIR)
31
32mark_as_advanced(CHECK_INCLUDE_DIR CHECK_LIBRARY )
diff --git a/cmake/Modules/FindFfi.cmake b/cmake/Modules/FindFfi.cmake
new file mode 100644
index 0000000..c9224d1
--- /dev/null
+++ b/cmake/Modules/FindFfi.cmake
@@ -0,0 +1,40 @@
1# - Try to find ffi
2# Once done this will define
3# FFI_FOUND - System has ffi
4# FFI_INCLUDE_DIRS - The ffi include directories
5# FFI_LIBRARIES - The libraries needed to use ffi
6# FFI_LDFLAGS_OTHER - Other LDFLAGS needed te use ffi.
7# FFI_DEFINITIONS - Compiler switches required for using ffi
8
9find_package(PkgConfig)
10if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
11 # "QUIET" was introduced in 2.8.2
12 set(_QUIET QUIET)
13endif ()
14pkg_check_modules(PC_LIBFFI ${_QUIET} libffi)
15#set(FFI_DEFINITIONS ${PC_LIBFFI_CFLAGS_OTHER})
16#set(FFI_LDFLAGS_OTHER ${PC_LIBFFI_LDFLAGS_OTHER})
17
18# before verison 2.8.11 variable CMAKE_LIBRARY_ARCHITECTURE wasn't automatically added to search path
19if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS "2.8.11")
20 set(FIND_PATH_HINTS ${PC_LIBFFI_INCLUDEDIR}/${CMAKE_LIBRARY_ARCHITECTURE})
21endif ()
22
23find_path(FFI_INCLUDE_DIR ffi.h
24 HINTS ${PC_LIBFFI_INCLUDEDIR} ${PC_LIBFFI_INCLUDE_DIRS}
25 ${FIND_PATH_HINTS}
26 )
27
28find_library(FFI_LIBRARY NAMES ffi libffi
29 HINTS ${PC_LIBFFI_LIBDIR} ${PC_LIBFFI_LIBRARY_DIRS})
30
31set(FFI_INCLUDE_DIRS ${FFI_INCLUDE_DIR})
32set(FFI_LIBRARIES ${FFI_LIBRARY})
33
34#include(FindPackageHandleStandardArgs)
35# handle the QUIETLY and REQUIRED arguments and set EINA_FOUND to TRUE
36# if all listed variables are TRUE
37find_package_handle_standard_args(ffi DEFAULT_MSG
38 FFI_LIBRARY)
39
40mark_as_advanced(FFI_INCLUDE_DIRS FFI_LIBRARY)
diff --git a/cmake/Modules/FindGvc.cmake b/cmake/Modules/FindGvc.cmake
new file mode 100644
index 0000000..5bcb911
--- /dev/null
+++ b/cmake/Modules/FindGvc.cmake
@@ -0,0 +1,41 @@
1# - Try to find GraphViz
2# Once done this will define
3# GVC_FOUND - System has GraphViz
4# GVC_INCLUDE_DIRS - The GraphViz include directories
5# GVC_LIBRARIES - The libraries needed to use GraphViz
6# GVC_LDFLAGS_OTHER - Other LDFLAGS needed te use GraphViz
7# GVC_DEFINITIONS - Compiler switches required for using GraphViz
8
9find_package(PkgConfig)
10if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER "2.8.1")
11 # "QUIET" was introduced in 2.8.2
12 set(_QUIET QUIET)
13endif ()
14
15pkg_check_modules(PC_LIBGVC ${_QUIET} libgvc)
16set (LIBGVC_MIN_VERSION "2.35.0.0")
17if ("${PC_LIBGVC_VERSION}" VERSION_LESS ${LIBGVC_MIN_VERSION})
18 MESSAGE(STATUS "libgvc version required: ${LIBGVC_MIN_VERSION}. Current version: ${PC_LIBGVC_VERSION}.")
19else()
20 SET(LIBGVC_REQUIRED_VERSION 1)
21endif()
22
23if (LIBGVC_REQUIRED_VERSION)
24 find_path(GVC_INCLUDE_DIR gvc.h
25 HINTS ${PC_LIBGVC_INCLUDEDIR} ${PC_LIBCGVC_INCLUDE_DIRS}
26 PATH_SUFFIXES gvc )
27
28 find_library(GVC_LIBRARY NAMES gvc libgvc
29 HINTS ${PC_LIBGVC_LIBDIR} ${PC_LIBGVC_LIBRARY_DIRS} )
30
31 set(GVC_INCLUDE_DIRS ${GVC_INCLUDE_DIR})
32 set(GVC_LIBRARIES ${GVC_LIBRARY} )
33
34 #include(FindPackageHandleStandardArgs)
35 # handle the QUIETLY and REQUIRED arguments and set EINA_FOUND to TRUE
36 # if all listed variables are TRUE
37 find_package_handle_standard_args(gvc DEFAULT_MSG
38 GVC_LIBRARY)
39endif (LIBGVC_REQUIRED_VERSION)
40
41mark_as_advanced(GVC_INCLUDE_DIR GVC_LIBRARY)
diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in
new file mode 100644
index 0000000..2037e36
--- /dev/null
+++ b/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
1if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2 message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
3endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4
5file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
6string(REGEX REPLACE "\n" ";" files "${files}")
7foreach(file ${files})
8 message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
9 if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10 exec_program(
11 "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12 OUTPUT_VARIABLE rm_out
13 RETURN_VALUE rm_retval
14 )
15 if(NOT "${rm_retval}" STREQUAL 0)
16 message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
17 endif(NOT "${rm_retval}" STREQUAL 0)
18 else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
19 message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
20 endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
21endforeach(file)
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..20f7f4f
--- /dev/null
+++ b/makefile
@@ -0,0 +1,13 @@
1
2CC=gcc
3COMMON_FLAGS=`pkg-config --libs --cflags eina eolian`
4EXTRA_FLAGS=`pkg-config --libs --cflags evas elementary`
5
6SIMPLE= main.c
7all: simple
8simple: $(SIMPLE)
9 $(CC) -DEFL_EO_API_SUPPORT -DEFL_BETA_API_SUPPORT -o $@ $(SIMPLE) $(COMMON_FLAGS)
10clean:
11 @echo "Cleaning up built objects..."
12 @rm -Rf *.o
13
diff --git a/notes b/notes
new file mode 100644
index 0000000..f23452f
--- /dev/null
+++ b/notes
@@ -0,0 +1,22 @@
1dot -Tpng class.dot -o class.png
2
3efreet.config.home.get = get the user home directory
4to save in ~/.config/app/
5
6name:value
7
8efreet_init();
9223
10224
11225 Efreet_Ini *conf = efreet_ini_new("/home/avilog/git/umleo/test.ini");
12226 efreet_ini_section_set(conf, "default");
13227 printf("%s\n", efreet_ini_string_get(conf, "name"));
14228
15229 efreet_ini_free(conf);
16230
17231 goto end;*/
18efreet_shutdown();
19
20
21./src/bin/eo_info_cmd --mode i_t -I /home/avilog/git/efl1/efl/src/lib/ -I /home/avilog/git/efl1/elementary/src/lib/ --class elm_layout.eo
22
diff --git a/src/bin/.CMakeLists.txt.swp b/src/bin/.CMakeLists.txt.swp
new file mode 100644
index 0000000..aab6e4e
--- /dev/null
+++ b/src/bin/.CMakeLists.txt.swp
Binary files differ
diff --git a/src/bin/.main.c.swp b/src/bin/.main.c.swp
new file mode 100644
index 0000000..8518e0c
--- /dev/null
+++ b/src/bin/.main.c.swp
Binary files differ
diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt
new file mode 100644
index 0000000..352c47e
--- /dev/null
+++ b/src/bin/CMakeLists.txt
@@ -0,0 +1,34 @@
1#include_directories (${CMAKE_SOURCE_DIR}/src/lib)
2#include_directories (${CMAKE_SOURCE_DIR}/src/bin/eo_info)
3
4#link_directories (${CMAKE_SOURCE_DIR}/src/lib)
5#link_directories (${PC_LIBELEMENTARY_LIBRARY_DIRS})
6
7set(TARGET eo_info_cmd)
8
9set(EOLIAN_INCLUDE_FLAG -I \"${EOLIAN_EO_DIR}/eo-1\" -I${CMAKE_CURRENT_SOURCE_DIR})
10
11add_executable(${TARGET} main.c)
12
13# this puts "/build_dir/data/config" path to erigo_cmd
14set_property(TARGET ${TARGET}
15 PROPERTY COMPILE_DEFINITIONS PACKAGE_DATA_DIR="${CMAKE_BINARY_DIR}/data")
16include_directories(
17 ${EINA_INCLUDE_DIRS}
18 ${EOLIAN_INCLUDE_DIRS}
19 ${ECORE_INCLUDE_DIRS}
20 ${EFREET_INCLUDE_DIRS}
21 )
22target_link_libraries (${TARGET}
23 ${EINA_LIBRARIES}
24 ${EOLIAN_LIBRARIES}
25 ${ECORE_LIBRARIES}
26 ${EFREET_LIBRARIES}
27 )
28
29# Save current dir because we want to know path to soutce file to build erigo
30SET(EOINFO_BINARY_SRC ${CMAKE_CURRENT_LIST_DIR})
31# Save build path of erigo_cmd, because we want to copy egui to the same folder
32SET(EOINFO_BINARY_BLD ${CMAKE_CURRENT_BINARY_DIR})
33
34#add_subdirectory(gui)
diff --git a/src/bin/main.c b/src/bin/main.c
new file mode 100644
index 0000000..2933193
--- /dev/null
+++ b/src/bin/main.c
@@ -0,0 +1,330 @@
1#define _GNU_SOURCE
2#include <stdio.h>
3#include <getopt.h>
4#include <Eina.h>
5#include <Eolian.h>
6#include <Efreet.h>
7
8int _eolian_info_log_dom;
9
10
11/*
12 *
13 * ** ./src/bin/eo_info_cmd --mode i_t -I /home/avilog/git/efl1/efl/src/lib/ -I /home/avilog/git/efl1/elementary/src/lib/ --class elm_layout.eo
14 *
15 */
16
17
18#ifdef ERR
19# undef ERR
20#endif
21#define ERR(...) EINA_LOG_DOM_ERR(_eolian_info_log_dom, __VA_ARGS__)
22
23#ifdef DBG
24# undef DBG
25#endif
26#define DBG(...) EINA_LOG_DOM_DBG(_eolian_info_log_dom, __VA_ARGS__)
27
28#ifdef INF
29# undef INF
30#endif
31#define INF(...) EINA_LOG_DOM_INFO(_eolian_info_log_dom, __VA_ARGS__)
32
33#ifdef WRN
34# undef WRN
35#endif
36#define WRN(...) EINA_LOG_DOM_WARN(_eolian_info_log_dom, __VA_ARGS__)
37
38#ifdef CRIT
39# undef CRIT
40#endif
41#define CRIT(...) EINA_LOG_DOM_CRIT(_eolian_info_log_dom, __VA_ARGS__)
42
43const Eolian_Class* queue[200];
44int queue_size=0;
45
46void _push_queue(const Eolian_Class* cl){
47
48 queue[queue_size]=cl;
49
50 queue_size++;
51}
52
53const Eolian_Class* _pop_queue(){
54
55 queue_size--;
56 if(queue_size<0)
57 return NULL;
58
59 return queue[queue_size];
60}
61
62void _print_class(const Eolian_Class *_win_kl)
63{
64 printf("Class %s\n", eolian_class_file_get(_win_kl));
65 Eina_Iterator *lst_events = eolian_class_events_get(_win_kl);
66 const Eolian_Event* event;
67 if(lst_events)
68 printf("Events: ");
69 EINA_ITERATOR_FOREACH(lst_events, event){
70 printf(" %s ", eolian_event_name_get(event));
71 }
72 if(lst_events)
73 printf("\n");
74 eina_iterator_free(lst_events);
75}
76
77typedef struct
78{
79 EINA_INLIST;
80 const char *class, *parent;
81} _Class_Node;
82
83void _print_graph( Eina_Inlist *classes_list ){
84
85 _Class_Node *node = NULL;
86 Eina_Inlist *nnode;
87
88
89printf("digraph Couriers { \n\
90 fontname = \"Bitstream Vera Sans\" \n\
91 fontsize = 8 \n\
92\n\
93 node [ \n\
94 fontname = \"Bitstream Vera Sans\"\n \
95 fontsize = 8\n \
96 shape = \"record\"\n \
97 ]\n \
98\n\
99 edge [\n\
100 arrowtail = \"empty\" \n\
101 ]\n");
102
103
104 EINA_INLIST_FOREACH_SAFE(classes_list, nnode, node)
105 {
106 // printf("class name %s\n", node->class);
107 printf("\"%s\" -> \"%s\" [dir=back]\n", node->parent, node->class);
108 }
109
110 printf("}\n");
111
112 EINA_INLIST_FOREACH_SAFE(classes_list, nnode, node)
113 {
114 classes_list = eina_inlist_remove(classes_list,
115 EINA_INLIST_GET(node));
116
117 free(node);
118 }
119
120}
121
122void _prints_inherit_tree(const char* class_path)
123{
124 const char *ekl;
125
126 int depth = 0;
127
128 eolian_file_parse(class_path);
129 const Eolian_Class *_win_kl = eolian_class_get_by_file(class_path);
130 if(!_win_kl){
131
132 ERR("Class %s no found", class_path);
133 return;
134 }
135
136 _push_queue(_win_kl);
137 int count_cur = 1, count_childs = 0;
138 _print_class(_win_kl);
139 printf("\n**Depth: %d**\n", depth);
140
141 while((_win_kl = _pop_queue())){
142 Eina_Iterator *lst = eolian_class_inherits_get(_win_kl);
143
144 if(count_cur==0){
145 count_cur = count_childs;
146 count_childs =0;
147 depth++;
148 printf("\n** Depth: %d **\n", depth);
149 }
150 count_cur--;
151 EINA_ITERATOR_FOREACH(lst, ekl){
152
153 _win_kl=eolian_class_get_by_name(ekl);
154
155 _print_class(_win_kl);
156
157 _push_queue(_win_kl);
158 count_childs++;
159 // _prints_inherits_recur(_win_kl, depth+1);
160 }
161 eina_iterator_free(lst);
162
163 }
164
165}
166
167void _prints_inherits_from(const char* class_path){
168
169 eolian_all_eo_files_parse();
170 Eina_Iterator *lst = eolian_all_classes_get();
171 const Eolian_Class *ekl = eolian_class_get_by_file(class_path);
172 const char* class_name = eolian_class_full_name_get(ekl);
173 Eina_Inlist *classes_list = NULL;
174
175 EINA_ITERATOR_FOREACH(lst, ekl){
176 if(!ekl) continue;
177 Eina_Iterator *lst_i = eolian_class_inherits_get(ekl);
178 if(!lst_i) continue;
179
180 const char *ekl_i;
181 EINA_ITERATOR_FOREACH(lst_i, ekl_i){
182// printf("i class name %s\n", ekl_i);
183 if(!strcmp(ekl_i, class_name)){
184
185 _Class_Node* d = malloc(sizeof(*d));
186 d->class = eolian_class_file_get(ekl);
187 d->parent = class_name;
188 classes_list = eina_inlist_append(classes_list, EINA_INLIST_GET(d));
189 // printf("adding class name %s\n", eolian_class_file_get(ekl));
190
191 }
192 }
193
194 eina_iterator_free(lst_i);
195
196 }
197 eina_iterator_free(lst);
198_print_graph(classes_list);
199//// printf("this class name %s\n", eolian_class_full_name_get(_win_kl));
200}
201
202typedef struct
203{
204 const char *name_l, *name_s;
205 void (*func)(const char*);
206} _mode;
207
208static _mode _modes[] = { {"inheritance_tree", "i_t", _prints_inherit_tree},
209 {"inherited_from", "i_f", _prints_inherits_from}, {NULL, NULL, NULL}};
210
211int main(int argc, char **argv)
212{
213 int ret = 1;
214 char* path = "/home/avilog/git/efl1/elementary/src/lib/elm_layout.eo";//argv[1];
215 char *class_path ="elm_layout.eo";// argv[2];
216 char* mode=NULL, *output = NULL;
217 Eina_Bool help = EINA_FALSE, show = EINA_FALSE;
218
219 eina_init();
220 eolian_init();
221
222 const char *log_dom = "eolian_info";
223 _eolian_info_log_dom = eina_log_domain_register(log_dom, EINA_COLOR_GREEN);
224 if (_eolian_info_log_dom < 0)
225 {
226 EINA_LOG_ERR("Could not register log domain: %s", log_dom);
227 goto end;
228 }
229
230
231 static struct option long_options[] =
232 {
233 /* These options set a flag. */
234 {"verbose", no_argument, 0, 'v'},
235 {"help", no_argument, 0, 'h'},
236 {"mode", required_argument, 0, 'm'},
237 {"output", required_argument, 0, 'o'},
238 {"class", required_argument, 0, 'c'},
239 {"include", required_argument, 0, 'I'},
240 {0, 0, 0, 0}
241 };
242 int long_index =0, opt;
243 while ((opt = getopt_long(argc, argv,"vho:I:", long_options, &long_index )) != -1)
244 {
245 switch (opt) {
246 case 0: break;
247 case 'v': show = EINA_TRUE; break;
248 case 'h': help = EINA_TRUE; break;
249 case 'o':
250 {
251 printf("setting output to %s\n", optarg);
252 output = optarg;
253 }
254 case 'm':
255 {
256 printf("setting mode to %s\n", optarg);
257 mode = optarg;
258 }
259 break;
260 case 'c':
261 {
262 printf("setting class to %s\n", optarg);
263 class_path = optarg;
264 }
265 break;
266 case 'I':
267 {
268 const char *dir = optarg;
269 printf("scanning%s\n", optarg);
270 if (!eolian_directory_scan(dir))//todo works even if dir dont exist
271 {
272 ERR("Failed to scan %s", dir);
273 goto end;
274 }
275 break;
276 }
277 default: help = EINA_TRUE;
278 }
279 }
280 if(!mode){
281 ERR("No mode specified");
282 goto end;
283
284 }
285
286
287 if (help)
288 {
289 printf("Usage: %s [-h/--help] [-v/--verbose] [--mode/-m mode] [--class/-c class_path] [--include/-I path] [--output/-o outfile]\n", argv[0]);
290 printf(" --help/-h Print that help\n");
291 printf(" --mode/-m choose one off:\n");
292 _mode *current_m = _modes;
293
294 while(current_m != NULL ){
295 printf("%s or short version: %s\n", current_m->name_l, current_m->name_s);
296
297 current_m++;
298 }
299 printf(" --output/-o Force output filename to 'outfile'\n");
300 ret = 0;
301 goto end;
302 }
303
304
305 _mode *current_m = _modes;
306
307 while(current_m != NULL ){
308
309 if(!strcmp(current_m->name_s, mode) || !strcmp(current_m->name_l, mode)){
310
311 printf("found the mode!\n");
312 current_m->func(class_path);
313 break;
314 }
315
316 current_m++;
317 }
318
319end:
320
321 eina_log_timing(_eolian_info_log_dom,
322 EINA_LOG_STATE_START,
323 EINA_LOG_STATE_SHUTDOWN);
324 eina_log_domain_unregister(_eolian_info_log_dom);
325 _eolian_info_log_dom = -1;
326
327 eolian_shutdown();
328 eina_shutdown();
329 return ret;
330}