Adding turran work to unify EFL data types and functions.

SVN revision: 35248
devs/devilhorns/wayland_egl
Cedric BAIL 15 years ago
parent e20edb01e2
commit a92e3d6c83
  1. 2
      legacy/eina/AUTHORS
  2. 0
      legacy/eina/COPYING
  3. 0
      legacy/eina/ChangeLog
  4. 139
      legacy/eina/Doxyfile
  5. 0
      legacy/eina/INSTALL
  6. 32
      legacy/eina/Makefile.am
  7. 0
      legacy/eina/NEWS
  8. 0
      legacy/eina/README
  9. 14
      legacy/eina/autogen.sh
  10. 92
      legacy/eina/configure.in
  11. 12
      legacy/eina/eina.pc.in
  12. 9
      legacy/eina/gendoc
  13. 3
      legacy/eina/src/Makefile.am
  14. 33
      legacy/eina/src/include/Eina.h
  15. 20
      legacy/eina/src/include/Makefile.am
  16. 33
      legacy/eina/src/include/eina_error.h
  17. 105
      legacy/eina/src/include/eina_f16p16.h
  18. 16
      legacy/eina/src/include/eina_file.h
  19. 19
      legacy/eina/src/include/eina_hash.h
  20. 33
      legacy/eina/src/include/eina_inlist.h
  21. 22
      legacy/eina/src/include/eina_lalloc.h
  22. 37
      legacy/eina/src/include/eina_list.h
  23. 23
      legacy/eina/src/include/eina_mempool.h
  24. 27
      legacy/eina/src/include/eina_module.h
  25. 148
      legacy/eina/src/include/eina_private.h
  26. 196
      legacy/eina/src/include/eina_rectangle.h
  27. 62
      legacy/eina/src/include/eina_types.h
  28. 21
      legacy/eina/src/lib/Makefile.am
  29. 153
      legacy/eina/src/lib/eina_error.c
  30. 84
      legacy/eina/src/lib/eina_file.c
  31. 473
      legacy/eina/src/lib/eina_hash.c
  32. 161
      legacy/eina/src/lib/eina_inlist.c
  33. 78
      legacy/eina/src/lib/eina_lalloc.c
  34. 1052
      legacy/eina/src/lib/eina_list.c
  35. 151
      legacy/eina/src/lib/eina_mempool.c
  36. 280
      legacy/eina/src/lib/eina_module.c
  37. 46
      legacy/eina/src/lib/eina_value.c
  38. 4
      legacy/eina/src/modules/Makefile.am
  39. 23
      legacy/eina/src/modules/mm_policies/Makefile.am
  40. 830
      legacy/eina/src/modules/mm_policies/ememoa.c
  41. 54
      legacy/eina/src/modules/mm_policies/ememoa_memory_base.h
  42. 29
      legacy/eina/src/modules/mm_policies/ememoa_mempool_error.h
  43. 29
      legacy/eina/src/modules/mm_policies/fixed.c
  44. 50
      legacy/eina/src/modules/mm_policies/mempool_struct.h

@ -0,0 +1,2 @@
Jorge Luis "turran" Zapata <jorgeluis.zapata@gmail.com>
Carsten Haitzler <raster@rasterman.com>

@ -0,0 +1,139 @@
PROJECT_NAME = Eina
PROJECT_NUMBER =
OUTPUT_DIRECTORY = doc
INPUT = ./src/lib
IMAGE_PATH = doc/img
OUTPUT_LANGUAGE = English
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
ENUM_VALUES_PER_LINE = 1
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = NO
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = NO
SHOW_INCLUDE_FILES = NO
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 2
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
SHOW_USED_FILES = NO
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
FILE_PATTERNS =
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 2
IGNORE_PREFIX =
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
GENERATE_MAN = YES
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = YES
GENERATE_XML = NO
XML_SCHEMA =
XML_DTD =
GENERATE_AUTOGEN_DEF = NO
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = NO
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = NO
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = NO
COLLABORATION_GRAPH = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO
GRAPHICAL_HIERARCHY = NO
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 512
MAX_DOT_GRAPH_HEIGHT = 512
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
SEARCHENGINE = NO

@ -0,0 +1,32 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = src
MAINTAINERCLEANFILES = \
Makefile.in \
aclocal.m4 \
config.guess \
config.h.in \
config.sub \
configure \
install-sh \
ltconfig \
ltmain.sh \
missing mkinstalldirs \
stamp-h.in \
build-stamp \
configure-stamp \
depcomp \
eina.pc \
eina_docs.tar.gz
EXTRA_DIST = \
AUTHORS \
COPYING \
gendoc \
Doxyfile \
README \
eina.pc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = eina.pc

@ -0,0 +1,14 @@
#!/bin/sh
rm -rf autom4te.cache
rm -f aclocal.m4 ltmain.sh
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1
echo "Running autoheader..." ; autoheader || exit 1
echo "Running autoconf..." ; autoconf || exit 1
echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
if [ -z "$NOCONFIGURE" ]; then
./configure "$@"
fi

@ -0,0 +1,92 @@
# get rid of that stupid cache mechanism
rm -f config.cache
AC_INIT(eina, 0.0.1, enlightenment-devel@lists.sourceforge.net)
AC_PREREQ(2.52)
AC_CONFIG_SRCDIR(configure.in)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_ISC_POSIX
AM_INIT_AUTOMAKE(1.6 dist-bzip2)
AM_CONFIG_HEADER(config.h)
AC_LIBTOOL_WIN32_DLL
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
AC_PROG_LIBTOOL
VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
AC_SUBST(version_info)
# Checks for programs
AC_PROG_CC
# Checks for libraries
# Checks for header files
AC_HEADER_ASSERT
AC_HEADER_DIRENT
AC_HEADER_TIME
# Checks for types
# Checks for structures
# Checks for compiler characteristics
AC_C_CONST
AC_C_BIGENDIAN
AC_PROG_CC_STDC
if ! test "${VMIC}" = "x" ; then
CFLAGS="${CFLAGS} -Wall -W -Wextra" # -Werror
fi
# Checks for linker characteristics
lt_enable_auto_import=""
case "$host_os" in
mingw*|cegcc*)
lt_enable_auto_import="-Wl,--enable-auto-import"
;;
esac
AC_SUBST(lt_enable_auto_import)
# Checks for library functions
## Make the debug preprocessor configurable
AC_CONFIG_FILES([
Makefile
eina.pc
src/Makefile
src/include/Makefile
src/lib/Makefile
src/modules/Makefile
src/modules/mm_policies/Makefile
])
AC_OUTPUT
#####################################################################
## Info
echo
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo
echo "Configuration Options Summary:"
echo
echo "Installation Path.........: $prefix"
echo
echo "Now type 'make' ('gmake' on some systems) to compile $PACKAGE,"
echo "and then afterwards as root (or the user who will install this), type"
echo "'make install'. Change users with 'su' or 'sudo' appropriately."
echo

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Eina
Description: Eina
Requires:
Version: @VERSION@
Libs: -L${libdir} -leina
Libs.private: -lm -ldl
Cflags: -I${includedir} -I${includedir}/eina

@ -0,0 +1,9 @@
#!/bin/sh
rm -rf ./doc/html ./doc/latex ./doc/man
mkdir -p ./doc/html ./doc/latex ./doc/man 2>/dev/null
doxygen
#cp doc/img/*.png doc/html/
rm -f edata_docs.tar ecore_docs.tar.gz
tar -cvf edata_docs.tar doc/html doc/man doc/latex
gzip -9f edata_docs.tar
exit 0

@ -0,0 +1,3 @@
SUBDIRS = lib include modules
MAINTAINERCLEANFILES = Makefile.in

@ -0,0 +1,33 @@
#ifndef EINA_H_
#define EINA_H_
/**
* @mainpage Eina
* @file Eina.h
* @brief Contains list, hash, debugging and tree functions.
* TODO add debug functions, magic functions, etc
*/
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "eina_types.h"
#include "eina_f16p16.h"
#include "eina_rectangle.h"
#include "eina_inlist.h"
#include "eina_file.h"
#include "eina_list.h"
#include "eina_hash.h"
#include "eina_lalloc.h"
#include "eina_module.h"
#include "eina_mempool.h"
#include "eina_error.h"
#ifdef __cplusplus
}
#endif
#endif /* EINA_H */

@ -0,0 +1,20 @@
MAINTAINERCLEANFILES = Makefile.in
EINAHEADERS = \
eina_error.h \
eina_f16p16.h \
eina_hash.h \
eina_lalloc.h \
eina_inlist.h \
eina_list.h \
eina_file.h \
eina_mempool.h \
eina_module.h \
eina_rectangle.h \
eina_types.h
include_HEADERS = \
Eina.h
installed_headersdir = $(prefix)/include/eina
installed_headers_DATA = $(EINAHEADERS)

@ -0,0 +1,33 @@
#ifndef EINA_ERROR_H_
#define EINA_ERROR_H_
#define EINA_ERROR_PERR(fmt, ...) \
eina_error_print(EINA_ERROR_LEVEL_ERR, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define EINA_ERROR_PINFO(fmt, ...) \
eina_error_print(EINA_ERROR_LEVEL_INFO, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define EINA_ERROR_PWARN(fmt, ...) \
eina_error_print(EINA_ERROR_LEVEL_WARN, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define EINA_ERROR_PDBG(fmt, ...) \
eina_error_print(EINA_ERROR_LEVEL_DBG, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
typedef enum _Eina_Error_Level
{
EINA_ERROR_LEVEL_ERR,
EINA_ERROR_LEVEL_WARN,
EINA_ERROR_LEVEL_INFO,
EINA_ERROR_LEVEL_DBG,
EINA_ERROR_LEVELS
} Eina_Error_Level;
EAPI int eina_error_init(void);
EAPI int eina_error_shutdown(void);
EAPI int eina_error_register(const char *msg);
EAPI const char * eina_error_msg_get(int error);
EAPI void eina_error_print(Eina_Error_Level level, const char *file,
const char *function, int line, const char *fmt, ...);
EAPI void eina_error_log_level_set(Eina_Error_Level level);
#endif /*EINA_ERROR_H_*/

@ -0,0 +1,105 @@
#ifndef EINA_F16P16_H_
#define EINA_F16P16_H_
/**
* To be documented
* FIXME: To be fixed
*/
typedef int32_t Eina_F16p16;
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_F16p16 eina_f16p16_int_from(int32_t v)
{
return v << 16;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline int32_t eina_f16p16_int_to(Eina_F16p16 v)
{
return v >> 16;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_F16p16 eina_f16p16_float_from(float v)
{
Eina_F16p16 r;
r = (Eina_F16p16)(v * 65536.0 + (v < 0 ? -0.5 : 0.5));
return r;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline float eina_f16p16_float_to(Eina_F16p16 v)
{
float r;
r = v / 65536.0;
return r;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_F16p16 eina_f16p16_add(Eina_F16p16 a, Eina_F16p16 b)
{
return a + b;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_F16p16 eina_f16p16_sub(Eina_F16p16 a, Eina_F16p16 b)
{
return a - b;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_F16p16 eina_f16p16_mul(Eina_F16p16 a, Eina_F16p16 b)
{
return (a * b) >> 16;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_F16p16 eina_f16p16_sqrt(Eina_F16p16 a)
{
unsigned int root, remHi, remLo, testDiv, count;
root = 0; /* Clear root */
remHi = 0; /* Clear high part of partial remainder */
remLo = a; /* Get argument into low part of partial remainder */
count = (15 + (16 >> 1)); /* Load loop counter */
do
{
remHi = (remHi << 2) | (remLo >> 30);
remLo <<= 2; /* get 2 bits of arg */
root <<= 1; /* Get ready for the next bit in the root */
testDiv = (root << 1) + 1; /* Test radical */
if (remHi >= testDiv)
{
remHi -= testDiv;
root++;
}
} while (count-- != 0);
return (root);
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline unsigned int eina_f16p16_fracc_get(Eina_F16p16 v)
{
return (v & 0xffff);
}
#endif /*EINA_F16P16_H_*/

@ -0,0 +1,16 @@
#ifndef EINA_FILE_H_
#define EINA_FILE_H_
/**
* @defgroup File_Group Memory File
* @{
*/
typedef void (*Eina_File_Dir_List_Cb)(const char *name, const char *path, void *data);
EAPI void eina_file_dir_list(const char *dir, int recursive, Eina_File_Dir_List_Cb cb, void *data);
EAPI void eina_file_path_nth_get(const char *path, int n, char **left, char **right);
/** @} */
#endif /*EINA_FILE_H_*/

@ -0,0 +1,19 @@
#ifndef EINA_HASH_H_
#define EINA_HASH_H_
/**
*
*/
typedef struct _Eina_Hash Eina_Hash;
EAPI Eina_Hash *eina_hash_add (Eina_Hash *hash, const char *key, const void *data);
EAPI Eina_Hash *eina_hash_direct_add (Eina_Hash *hash, const char *key, const void *data);
EAPI Eina_Hash *eina_hash_del (Eina_Hash *hash, const char *key, const void *data);
EAPI void *eina_hash_find(const Eina_Hash *hash, const char *key);
EAPI void *eina_hash_modify(Eina_Hash *hash, const char *key, const void *data);
EAPI int eina_hash_size(const Eina_Hash *hash);
EAPI void eina_hash_free(Eina_Hash *hash);
EAPI void eina_hash_foreach(const Eina_Hash *hash, Eina_Bool (*func) (const Eina_Hash *hash, const char *key, void *data, void *fdata),
const void *fdata);
#endif /*EINA_HASH_H_*/

@ -0,0 +1,33 @@
#ifndef EINA_INLIST_H_
#define EINA_INLIST_H_
/**
* @defgroup Inline_List_Group Inline List
* @{
*/
/* TODO change the prototype to use an Eina_Inlist */
typedef struct _Eina_Inlist Eina_Inlist;
struct _Eina_Inlist
{
Eina_Inlist *next;
Eina_Inlist *prev;
Eina_Inlist *last;
};
EAPI void * eina_inlist_append(void *in_list, void *in_item);
EAPI void * eina_inlist_prepend(void *in_list, void *in_item);
EAPI void * eina_inlist_append_relative(void *in_list, void *in_item, void *in_relative);
EAPI void * eina_inlist_prepend_relative(void *in_list, void *in_item, void *in_relative);
EAPI void * eina_inlist_remove(void *in_list, void *in_item);
EAPI void * eina_inlist_find(void *in_list, void *in_item);
//typedef Eina_Bool (*Eina_Iterator_Func)(Eina_Inlist *l, void *data);
#define EINA_ITER_NEXT(list, l) for (l = (Eina_Inlist *)list; l; l = l->next)
#define EINA_ITER_LAST(list, l) for (l = ((Eina_Inlist *)list)->last; l; l = l->prev)
/** @} */
#endif /*EINA_INLIST_H_*/

@ -0,0 +1,22 @@
#ifndef EINA_LALLOC_H_
#define EINA_LALLOC_H_
/**
* @defgroup Array_Group Array
* @{
*/
typedef void (*Eina_Array_Alloc) (void *user_data, int num);
#define EINA_ARRAY_ALLOC(function) ((Eina_Array_Alloc)function)
typedef void (*Eina_Array_Free) (void *user_data);
#define EINA_ARRAY_FREE(function) ((Eina_Array_Free)function)
typedef struct _Eina_Array Eina_Array;
EAPI void eina_array_free(Eina_Array *a);
EAPI Eina_Array *eina_array_new(void *data, Eina_Array_Alloc alloc_cb, Eina_Array_Free free_cb, int num_init);
EAPI void eina_array_elements_add(Eina_Array *a, int num);
EAPI void eina_array_element_add(Eina_Array *a);
/** @} */
#endif

@ -0,0 +1,37 @@
#ifndef EINA_LIST_H_
#define EINA_LIST_H_
/**
* @defgroup List_Group List
* @{
*/
typedef struct _Eina_List Eina_List;
EAPI Eina_List *eina_list_append (Eina_List *list, const void *data);
EAPI Eina_List *eina_list_prepend (Eina_List *list, const void *data);
EAPI Eina_List *eina_list_append_relative (Eina_List *list, const void *data, const void *relative);
EAPI Eina_List *eina_list_append_relative_list (Eina_List *list, const void *data, Eina_List *relative);
EAPI Eina_List *eina_list_prepend_relative (Eina_List *list, const void *data, const void *relative);
EAPI Eina_List *eina_list_prepend_relative_list (Eina_List *list, const void *data, Eina_List *relative);
EAPI Eina_List *eina_list_remove (Eina_List *list, const void *data);
EAPI Eina_List *eina_list_remove_list (Eina_List *list, Eina_List *remove_list);
EAPI Eina_List *eina_list_promote_list (Eina_List *list, Eina_List *move_list);
EAPI void *eina_list_find(const Eina_List *list, const void *data);
EAPI Eina_List *eina_list_find_list (const Eina_List *list, const void *data);
EAPI Eina_List *eina_list_free (Eina_List *list);
EAPI Eina_List *eina_list_last (const Eina_List *list);
EAPI Eina_List *eina_list_next (const Eina_List *list);
EAPI Eina_List *eina_list_prev (const Eina_List *list);
EAPI void *eina_list_data(const Eina_List *list);
EAPI int eina_list_count(const Eina_List *list);
EAPI void *eina_list_nth(const Eina_List *list, int n);
EAPI Eina_List *eina_list_nth_list (const Eina_List *list, int n);
EAPI Eina_List *eina_list_reverse (Eina_List *list);
EAPI Eina_List *eina_list_sort (Eina_List *list, int size, int(*func)(void*,void*));
EAPI int eina_list_alloc_error(void);
/** @} */
#endif /* EINA_LIST_H_ */

@ -0,0 +1,23 @@
#ifndef EINA_MEMPOOL_H_
#define EINA_MEMPOOL_H_
/**
* @defgroup Memory_Pool_Group Memory Pool
* @{
*/
typedef struct _Eina_Mempool Eina_Mempool;
EAPI int eina_mempool_init(void);
EAPI int eina_mempool_shutdown(void);
EAPI void eina_mempool_delete(Eina_Mempool *mp);
EAPI Eina_Mempool * eina_mempool_new_from_buffer(const char *name, void *buffer,
unsigned int size, const char *options, ...);
EAPI Eina_Mempool * eina_mempool_new(const char *name, unsigned int size, const char
*options, ...);
EAPI void * eina_mempool_realloc(Eina_Mempool *mp, void *element, unsigned int size);
EAPI void * eina_mempool_alloc(Eina_Mempool *mp, unsigned int size);
EAPI void eina_mempool_free(Eina_Mempool *mp, void *element);
/** @} */
#endif /* EINA_MEMPOOL_H_ */

@ -0,0 +1,27 @@
#ifndef EINA_MODULE_H_
#define EINA_MODULE_H_
/**
* @defgroup Module_Group Module
* @{
*/
typedef struct _Eina_Module Eina_Module;
typedef int (*Eina_Module_Cb)(Eina_Module *m, void *data);
EAPI Eina_Module * eina_module_new(const char *file);
EAPI void eina_module_free(Eina_Module *m);
EAPI void eina_module_unload(Eina_Module *m);
EAPI char * eina_module_path_get(Eina_Module *m);
EAPI char * eina_module_name_get(Eina_Module *m);
EAPI void * eina_module_symbol_get(Eina_Module *m, const char *symbol);
EAPI Eina_List * eina_module_list_get(const char *path, unsigned int recursive, Eina_Module_Cb cb, void *data);
EAPI void eina_module_list_load(Eina_List *list);
EAPI void eina_module_list_unload(Eina_List *list);
EAPI void eina_module_list_free(Eina_List *list);
/** @} */
#endif /*EINA_MODULE_H_*/

@ -0,0 +1,148 @@
#ifndef EINA_PRIVATE_H_
#define EINA_PRIVATE_H_
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <stddef.h>
#include <unistd.h>
#include <signal.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <dirent.h>
#define DEBUG
#include <assert.h>
#ifndef PATH_MAX
# define PATH_MAX 4096
#endif
#ifndef MIN
# define MIN(x, y) (((x) > (y)) ? (y) : (x))
#endif
#ifndef MAX
# define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef ABS
# define ABS(x) ((x) < 0 ? -(x) : (x))
#endif
#ifndef CLAMP
# define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
#endif
#define READBUFSIZ 65536
#define EINA_MAGIC_NONE 0x1234fedc
#define EINA_MAGIC_EXE 0xf7e812f5
#define EINA_MAGIC_TIMER 0xf7d713f4
#define EINA_MAGIC_IDLER 0xf7c614f3
#define EINA_MAGIC_IDLE_ENTERER 0xf7b515f2
#define EINA_MAGIC_IDLE_EXITER 0xf7601afd
#define EINA_MAGIC_FD_HANDLER 0xf7a416f1
#define EINA_MAGIC_EVENT_HANDLER 0xf79317f0
#define EINA_MAGIC_EVENT_FILTER 0xf78218ff
#define EINA_MAGIC_EVENT 0xf77119fe
#define EINA_MAGIC_ANIMATOR 0xf7643ea5
#define EINA_MAGIC Eina_Magic __magic
#define EINA_MAGIC_SET(d, m) (d)->__magic = (m)
#define EINA_MAGIC_CHECK(d, m) ((d) && ((d)->__magic == (m)))
#define EINA_MAGIC_FAIL(d, m, fn) _eina_magic_fail((d), (d) ? (d)->__magic : 0, (m), (fn));
/* undef the following, we want out version */
#undef FREE
#define FREE(ptr) free(ptr); ptr = NULL;
#undef IF_FREE
#define IF_FREE(ptr) if (ptr) free(ptr); ptr = NULL;
#undef IF_FN_DEL
#define IF_FN_DEL(_fn, ptr) if (ptr) { _fn(ptr); ptr = NULL; }
inline void eina_print_warning(const char *function, const char *sparam);
/* convenience macros for checking pointer parameters for non-NULL */
#undef CHECK_PARAM_POINTER_RETURN
#define CHECK_PARAM_POINTER_RETURN(sparam, param, ret) \
if (!(param)) \
{ \
eina_print_warning(__FUNCTION__, sparam); \
return ret; \
}
#undef CHECK_PARAM_POINTER
#define CHECK_PARAM_POINTER(sparam, param) \
if (!(param)) \
{ \
eina_print_warning(__FUNCTION__, sparam); \
return; \
}
typedef unsigned int Eina_Magic;
typedef struct _Eina_List2 Eina_List2;
typedef struct _Eina_List2_Data Eina_List2_Data;
struct _Eina_List2
{
Eina_List2 *next, *prev;
Eina_List2 *last;
};
struct _Eina_List2_Data
{
Eina_List2 __list_data;
void *data;
};
#ifndef EINA_H
#endif
EAPI void _eina_magic_fail(void *d, Eina_Magic m, Eina_Magic req_m, const char *fname);
EAPI void *_eina_list2_append (void *in_list, void *in_item);
EAPI void *_eina_list2_prepend (void *in_list, void *in_item);
EAPI void *_eina_list2_append_relative (void *in_list, void *in_item, void *in_relative);
EAPI void *_eina_list2_prepend_relative (void *in_list, void *in_item, void *in_relative);
EAPI void *_eina_list2_remove (void *in_list, void *in_item);
EAPI void *_eina_list2_find (void *in_list, void *in_item);
void _eina_fps_debug_init(void);
void _eina_fps_debug_shutdown(void);
void _eina_fps_debug_runtime_add(double t);
extern int _eina_fps_debug;
/* old code finish */
/* mp */
typedef struct _Eina_Mempool_Backend
{
void *(*init)(void *buffer, unsigned int size, const char *options, va_list args);
void (*free)(void *data, void *element);
void *(*alloc)(void *data, unsigned int size);
void *(*realloc)(void *data, void *element, unsigned int size);
void (*garbage_collect)(void);
void (*statistics)(void);
void (*shutdown)(void *data);
} Eina_Mempool_Backend;
#endif /* EINA_PRIVATE_H_ */

@ -0,0 +1,196 @@
#ifndef EINA_RECTANGLE_H_
#define EINA_RECTANGLE_H_
/**
* @file
* @{
*/
/**
* To be documented
* FIXME: To be fixed
*/
typedef struct _Eina_Rectangle
{
int x;
int y;
int w;
int h;
} Eina_Rectangle;
/**
* To be documented
* FIXME: To be fixed
* Is it needed??
*/
static inline int
eina_spans_intersect(int c1, int l1, int c2, int l2)
{
return (!(((c2 + l2) <= c1) || (c2 >= (c1 + l1))));
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_Bool
eina_rectangle_is_empty(Eina_Rectangle *r)
{
return ((r->w < 1) || (r->h < 1));
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline void
eina_rectangle_coords_from(Eina_Rectangle *r, int x, int y, int w, int h)
{
r->x = x;
r->y = y;
r->w = w;
r->h = h;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_Bool
eina_rectangles_intersect(Eina_Rectangle *r1, Eina_Rectangle *r2)
{
return (eina_spans_intersect(r1->x, r1->w, r2->x, r2->w) && eina_spans_intersect(r1->y, r1->h, r2->y, r2->h));
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_Bool
eina_rectangle_hspan_inside(Eina_Rectangle *r, int x, int l)
{
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_Bool
eina_rectangle_vspan_inside(Eina_Rectangle *r, int y, int l)
{
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_Bool
eina_rectangle_xcoord_inside(Eina_Rectangle *r, int x)
{
return ((x >= r->x) && (x < (r->x + r->w)));
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_Bool
eina_rectangle_ycoord_inside(Eina_Rectangle *r, int y)
{
return ((y >= r->y) && (y < (r->y + r->h)));
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_Bool
eina_rectangle_coords_inside(Eina_Rectangle *r, int x, int y)
{
return (eina_rectangle_xcoord_inside(r, x) && eina_rectangle_ycoord_inside(r, y));
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline void
eina_rectangle_union(Eina_Rectangle *dst, Eina_Rectangle *src)
{
/* left */
if (dst->x > src->x)
{
dst->w += dst->x - src->x;
dst->x = src->x;
}
/* right */
if ((dst->x + dst->w) < (src->x + src->w))
dst->w = src->x + src->w;
/* top */
if (dst->y > src->y)
{
dst->h += dst->y - src->y;
dst->y = src->y;
}
/* bottom */
if ((dst->y + dst->h) < (src->y + src->h))
dst->h = src->y + src->h;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline Eina_Bool
eina_rectangle_intersection(Eina_Rectangle *dst, Eina_Rectangle *src)
{
if (!(eina_rectangles_intersect(dst, src)))
return EINA_FALSE;
/* left */
if (dst->x < src->x)
{
dst->w += dst->x - src->x;
dst->x = src->x;
if (dst->w < 0)
dst->w = 0;
}
/* right */
if ((dst->x + dst->w) > (src->x + src->w))
dst->w = src->x + src->w - dst->x;
/* top */
if (dst->y < src->y)
{
dst->h += dst->y - src->y;
dst->y = src->y;
if (dst->h < 0)
dst->h = 0;
}
/* bottom */
if ((dst->y + dst->h) > (src->y + src->h))
dst->h = src->y + src->h - dst->y;
return EINA_TRUE;
}
/**
* Rescale the coordinates from @in as if it where relative to @out
*/
static inline void
eina_rectangle_rescale_in(Eina_Rectangle *out, Eina_Rectangle *in, Eina_Rectangle *res)
{
res->x = in->x - out->x;
res->y = in->y - out->y;
res->w = in->w;
res->h = in->h;
}
/**
* To be documented
* FIXME: To be fixed
*/
static inline void
eina_rectangle_rescale_out(Eina_Rectangle *out, Eina_Rectangle *in, Eina_Rectangle *res)
{
res->x = out->x + in->x;
res->y = out->y + in->y;
res->w = out->w;
res->h = out->h;
}
/** @} */
#endif /*_ENESIM_RECTANGLE_H_*/

@ -0,0 +1,62 @@
#ifndef EINA_TYPES_H_
#define EINA_TYPES_H_
#ifdef EAPI
# undef EAPI
#endif
#ifdef _WIN32
# ifdef EFL_EINA_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif /* ! DLL_EXPORT */
# else
# define EAPI __declspec(dllimport)
# endif /* ! EFL_EINA_BUILD */
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
# else
# define EAPI
# endif
#endif
/* remove this TRUE/FALSE redifinitions */
#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif
typedef enum {
EINA_FALSE = 0,
EINA_TRUE = 1
} Eina_Bool;
EAPI extern const unsigned int eina_prime_table[];
#define EINA_SORT_MIN 0
#define EINA_SORT_MAX 1
typedef void (*Eina_For_Each) (void *value, void *user_data);
#define EINA_FOR_EACH(function) ((Eina_For_Each)function)
typedef void (*Eina_Free_Cb) (void *data);
#define EINA_FREE_CB(func) ((Eina_Free_Cb)func)
typedef unsigned int (*Eina_Hash_Cb) (const void *key);
#define EINA_HASH_CB(function) ((Eina_Hash_Cb)function)
typedef int (*Eina_Compare_Cb) (const void *data1, const void *data2);
#define EINA_COMPARE_CB(function) ((Eina_Compare_Cb)function)
#endif /*EINA_TYPES_H_*/

@ -0,0 +1,21 @@
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = \
-I$(top_srcdir)/src/include
lib_LTLIBRARIES = libeina.la
libeina_la_SOURCES = \
eina_error.c \
eina_hash.c \
eina_lalloc.c \
eina_inlist.c \
eina_file.c \
eina_mempool.c \
eina_list.c \
eina_module.c \
eina_value.c
libeina_la_LIBADD = -ldl
libeina_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@
libeina_la_DEPENDENCIES = $(top_builddir)/config.h

@ -0,0 +1,153 @@
#include "Eina.h"
#include "eina_private.h"
/* TODO
* + printing errors to stdout or stderr can be implemented
* using a queue, usful for multiple threads printing
* + add a wapper for assert?
* + add common error numbers, messages
* + add a calltrace of erros, not only store the last error but a list of them
* and also store the function that set it
*/
/*============================================================================*
* Local *
*============================================================================*/
static int _curr = 1;
static int _init_count = 0;
static Eina_List *_error_list;
static int _err;
#define RED "\033[31;1m"
#define GREEN "\033[32;1m"
#define YELLOW "\033[33;1m"
#define WHITE "\033[37;1m"
#define NOTHING "\033[0m"
#ifdef DEBUG
static _error_level = EINA_ERROR_LEVEL_DBG;
#else
static _error_level = EINA_ERROR_LEVEL_ERR;
#endif
static char *_colors[EINA_ERROR_LEVELS] = {
[EINA_ERROR_LEVEL_ERR] = RED,
[EINA_ERROR_LEVEL_WARN] = YELLOW,
[EINA_ERROR_LEVEL_INFO] = NOTHING,
[EINA_ERROR_LEVEL_DBG] = GREEN,
};
static void _error_print(Eina_Error_Level level, const char *file,
const char *fnc, int line, const char *fmt, va_list args)
{
if (level <= _error_level)
{
printf("%s", _colors[level]);
printf("[%s:%d] %s() ", file, line, fnc);
printf("%s", _colors[EINA_ERROR_LEVEL_INFO]);
vprintf(fmt, args);
}
}
/*============================================================================*
* Global *
*============================================================================*/
void eina_error_magic_check(unsigned int magic, unsigned int cmp)
{
assert(magic == cmp);
}
/*============================================================================*
* API *
*============================================================================*/
/**
*
*/
EAPI int eina_error_init(void)
{
if (!_init_count)
{
char *level;
/* TODO register the eina's basic errors */
/* TODO load the environment variable for getting the log level */
if (level = getenv("EINA_ERROR_LEVEL"))
{
_error_level = atoi(level);
}
}
/* get all the modules */
return ++_init_count;
}
/**
*
*/
EAPI int eina_error_shutdown(void)
{
if (!_init_count)
return _init_count;
_init_count--;
if (!_init_count)
{
/* remove the error strings */
while (_error_list)
{
free(eina_list_data(_error_list));
_error_list = eina_list_free(_error_list);
}
}
return _init_count;
}
/**
* Register a new error type
* @param str The description of the error
* @return The unique number identifier for this error
*/
EAPI int eina_error_register(const char *msg)
{
char *str;
str = strdup(msg);
_error_list = eina_list_append(_error_list, str);
return ++_curr;
}
/**
*
*/
EAPI int eina_error_get(void)
{
return _err;
}
/**
*
*/
EAPI int eina_error_set(int err)
{
_err = err;
}
/**
* Given an error number return the description of it
* @param error The error number
* @return The description of the error
*/
EAPI const char * eina_error_msg_get(int error)
{
return eina_list_nth(_error_list, error);
}
/**
*
*/
EAPI void eina_error_print(Eina_Error_Level level, const char *file,
const char *fnc, int line, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
_error_print(level, file, fnc, line, fmt, args);
va_end(args);
}
/**
*
*/
EAPI void eina_error_log_level_set(Eina_Error_Level level)
{
_error_level = level;
}

@ -0,0 +1,84 @@
#include "Eina.h"
#include "eina_private.h"
/*============================================================================*
* API *
*============================================================================*/
/**
* Lis all files on the directory calling the function for every file found
* @param recursive Iterate recursively in the directory
*/
EAPI void eina_file_dir_list(const char *dir, int recursive, Eina_File_Dir_List_Cb cb, void *data)
{
struct dirent *de;
DIR *d;
assert(cb);
d = opendir(dir);
if (!d)
return;
while (de = readdir(d))
{
int length;
if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, ".."))
continue;
cb(de->d_name, dir, data);
/* d_type is only available on linux and bsd (_BSD_SOURCE) */
if ((recursive) && (de->d_type == DT_DIR))
{
char path[PATH_MAX];
snprintf(path, PATH_MAX, "%s/%s", dir, de->d_name);
eina_file_dir_list(path, recursive, cb, data);
}
}
closedir(d);
}
/**
*
*/
EAPI void eina_file_path_nth_get(const char *path, int n, char **left, char **right)
{
char *p;
char *end;
char *tmp;
char *delim;
int inc;
int num = 0;
if (!left && !right)
return;
if (n > 0)
{
p = (char *)path;
inc = 1;
end = (char *)path + strlen(path);
}
else
{
p = (char *)path + strlen(path);
inc = -1;
end = (char *)path;
}
for (tmp = p; tmp != end, num != n; tmp += inc)
{
if (*tmp == '/')
{
num += inc;
delim = tmp;
}
}
if (left)
{
*left = strndup(path, delim - path + 1);
}
if (right)
{
*right = strdup(delim + 1);
}
}

@ -0,0 +1,473 @@
#include "Eina.h"
#include "eina_private.h"
/*============================================================================*
* Local *
*============================================================================*/
typedef struct _Eina_Hash_El Eina_Hash_El;
struct _Eina_Hash
{
int population;
Eina_Inlist *buckets[256];
};
struct _Eina_Hash_El
{
Eina_Inlist _list_data;
const char *key;
void *data;
};
static inline int _eina_hash_gen(const char *key);
static int _eina_hash_alloc_error = 0;
static inline int _eina_hash_gen(const char *key)
{
unsigned int hash_num = 5381;
const unsigned char *ptr;
if (!key)