Eolian: remove Ecore_File dependency

This commit is contained in:
Daniel Zaoui 2014-03-03 18:00:45 +02:00
parent 1904466ebc
commit 49822ec28d
3 changed files with 22 additions and 25 deletions

View File

@ -1011,7 +1011,6 @@ EFL_PLATFORM_DEPEND([EOLIAN], [evil])
### Checks for libraries ### Checks for libraries
EFL_INTERNAL_DEPEND_PKG([EOLIAN], [eina]) EFL_INTERNAL_DEPEND_PKG([EOLIAN], [eina])
EFL_INTERNAL_DEPEND_PKG([EOLIAN], [ecore-file])
### Checks for header files ### Checks for header files

View File

@ -1,7 +1,6 @@
#include <getopt.h> #include <getopt.h>
#include <Eina.h> #include <Eina.h>
#include <Ecore_File.h>
#include "Eolian.h" #include "Eolian.h"
#include "legacy_generator.h" #include "legacy_generator.h"
@ -31,6 +30,17 @@ _include_guard_enclose(const char *fname, const char *fbody)
return eina_strbuf_string_steal(incguard); return eina_strbuf_string_steal(incguard);
} }
static const char *
_filename_get(const char *path)
{
char *result = NULL;
if (!path) return NULL;
if ((result = strrchr(path, '/'))) result++;
else result = (char *)path;
return result;
}
static Eina_Bool static Eina_Bool
_generate_h_file(char *filename, const char *classname, Eina_Bool append) _generate_h_file(char *filename, const char *classname, Eina_Bool append)
{ {
@ -74,7 +84,7 @@ _generate_h_file(char *filename, const char *classname, Eina_Bool append)
if (htext) if (htext)
{ {
char *fcontent = _include_guard_enclose(ecore_file_file_get(filename), htext); char *fcontent = _include_guard_enclose(_filename_get(filename), htext);
fputs(fcontent, fd); fputs(fcontent, fd);
free(fcontent); free(fcontent);
} }
@ -161,7 +171,7 @@ _generate_legacy_header_file(char *filename, const char *classname, Eina_Bool ap
if (ltext) if (ltext)
{ {
char *fcontent = _include_guard_enclose(ecore_file_file_get(filename), ltext); char *fcontent = _include_guard_enclose(_filename_get(filename), ltext);
fputs(fcontent, fd); fputs(fcontent, fd);
free(fcontent); free(fcontent);
} }
@ -276,25 +286,19 @@ int main(int argc, char **argv)
case 'I': case 'I':
{ {
const char *dir = optarg; const char *dir = optarg;
if (ecore_file_is_dir(dir)) Eina_Iterator *dir_files;
char *file;
/* Get all files from directory. Not recursively!!! */
dir_files = eina_file_ls(dir);
EINA_ITERATOR_FOREACH(dir_files, file)
{ {
Eina_List *dir_files; if (eina_str_has_suffix(file, EO_SUFFIX))
char *file;
/* Get all files from directory. Not recursively!!!*/
dir_files = ecore_file_ls(dir);
EINA_LIST_FREE(dir_files, file)
{ {
char *filepath = malloc(strlen(dir) + 1 + strlen(file) + 1); /* Allocated string will be freed during deletion of "included_files" list. */
sprintf(filepath, "%s/%s", dir, file); included_files = eina_list_append(included_files, strdup(file));
if ((!ecore_file_is_dir(filepath)) && eina_str_has_suffix(filepath, EO_SUFFIX))
{
/* Allocated string will be freed during deletion of "included_files" list. */
included_files = eina_list_append(included_files, strdup(filepath));
}
free(filepath);
free(file);
} }
} }
eina_iterator_free(dir_files);
break; break;
} }
default: help = EINA_TRUE; default: help = EINA_TRUE;

View File

@ -1,6 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <Eina.h> #include <Eina.h>
#include "eo_lexer.h" #include "eo_lexer.h"
@ -1134,11 +1133,6 @@ eo_tokenizer_database_fill(const char *filename)
return EINA_FALSE; return EINA_FALSE;
} }
if (access(filename, F_OK) != 0)
{
ERR("error accessing file %s : %s", filename, strerror(errno));
return EINA_FALSE;
}
if (!eo_tokenizer_walk(toknz, filename)) return EINA_FALSE; if (!eo_tokenizer_walk(toknz, filename)) return EINA_FALSE;
EINA_LIST_FOREACH(toknz->classes, k, kls) EINA_LIST_FOREACH(toknz->classes, k, kls)