diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/Edoors.h (renamed from src/include/Eiotas.h) | 26 | ||||
-rw-r--r-- | src/include/edoors_board.h (renamed from src/include/eiotas_board.h) | 48 | ||||
-rw-r--r-- | src/include/edoors_door.h (renamed from src/include/eiotas_door.h) | 48 | ||||
-rw-r--r-- | src/include/edoors_iota.h | 96 | ||||
-rw-r--r-- | src/include/edoors_link.h (renamed from src/include/eiotas_link.h) | 28 | ||||
-rw-r--r-- | src/include/edoors_main.h (renamed from src/include/eiotas_main.h) | 50 | ||||
-rw-r--r-- | src/include/edoors_particle.h (renamed from src/include/eiotas_particle.h) | 106 | ||||
-rw-r--r-- | src/include/edoors_room.h (renamed from src/include/eiotas_room.h) | 46 | ||||
-rw-r--r-- | src/include/edoors_spin.h | 129 | ||||
-rw-r--r-- | src/include/edoors_userbits.h | 90 | ||||
-rw-r--r-- | src/include/eiotas_iota.h | 96 | ||||
-rw-r--r-- | src/include/eiotas_spin.h | 129 | ||||
-rw-r--r-- | src/include/eiotas_userbits.h | 90 |
13 files changed, 491 insertions, 491 deletions
diff --git a/src/include/Eiotas.h b/src/include/Edoors.h index 4ae6c2c..2c34aa3 100644 --- a/src/include/Eiotas.h +++ b/src/include/Edoors.h @@ -1,4 +1,4 @@ -/* EIOTAS +/* EDOORS * Copyright (C) 2012 Jérémy Zurcher * * This library is free software; you can redistribute it and/or @@ -16,27 +16,27 @@ * if not, see <http://www.gnu.org/licenses/>. */ -#ifndef __EIOTAS_H__ -#define __EIOTAS_H__ +#ifndef __EDOORS_H__ +#define __EDOORS_H__ #ifdef __cplusplus extern "C" { #endif -#include "eiotas_main.h" +#include "edoors_main.h" -#include "eiotas_particle.h" -#include "eiotas_iota.h" -#include "eiotas_link.h" -#include "eiotas_room.h" -#include "eiotas_door.h" -#include "eiotas_board.h" -#include "eiotas_spin.h" +#include "edoors_particle.h" +#include "edoors_iota.h" +#include "edoors_link.h" +#include "edoors_room.h" +#include "edoors_door.h" +#include "edoors_board.h" +#include "edoors_spin.h" -#include "eiotas_userbits.h" +#include "edoors_userbits.h" #ifdef __cplusplus } #endif -#endif // __EIOTAS_H__ +#endif // __EDOORS_H__ diff --git a/src/include/eiotas_board.h b/src/include/edoors_board.h index f12f8fc..a04e325 100644 --- a/src/include/eiotas_board.h +++ b/src/include/edoors_board.h @@ -1,4 +1,4 @@ -/* EIOTAS +/* EDOORS * Copyright (C) 2012 Jérémy Zurcher * * This library is free software; you can redistribute it and/or @@ -16,37 +16,37 @@ * if not, see <http://www.gnu.org/licenses/>. */ -#ifndef __EIOTAS_BOARD_H__ -#define __EIOTAS_BOARD_H__ +#ifndef __EDOORS_BOARD_H__ +#define __EDOORS_BOARD_H__ -#include "eiotas_iota.h" -#include "eiotas_room.h" -#include "eiotas_userbits.h" +#include "edoors_iota.h" +#include "edoors_room.h" +#include "edoors_userbits.h" #include <eina_hash.h> /** - * @typedef Eiotas_Board + * @typedef Edoors_Board * Type for a Particle Merging Door. */ -typedef struct _Eiotas_Board Eiotas_Board; +typedef struct _Edoors_Board Edoors_Board; /** - * @struct _Eiotas_Board + * @struct _Edoors_Board * Struct for a Particle Merging Door. */ -struct _Eiotas_Board { - Eiotas_Iota iota; /**< structural info */ - Eiotas_User_Bits user_bits; /**< user bits */ +struct _Edoors_Board { + Edoors_Iota iota; /**< structural info */ + Edoors_User_Bits user_bits; /**< user bits */ Eina_Hash *postponed; /**< TODO Particles */ }; /** - * @defgroup Eiotas_Board Eiotas_Board + * @defgroup Edoors_Board Edoors_Board * - * A Eiota_Board holds @ref Eiotas_Particle received. - * When two @ref Eiotas_Particle with the same link_value exists, they are merged together - * and delivered to user code through Eiotas_Receive_Particle callback. + * A Edoors_Board holds @ref Edoors_Particle received. + * When two @ref Edoors_Particle with the same link_value exists, they are merged together + * and delivered to user code through Edoors_Receive_Particle callback. * * @{ */ @@ -54,27 +54,27 @@ struct _Eiotas_Board { /** * @brief Free allocated resources. * - * @param board The @ref Eiotas_Board to free. + * @param board The @ref Edoors_Board to free. * * This function will free all it's user data using user_bits ... FIXME */ -void eiotas_board_free(Eiotas_Board *board); +void edoors_board_free(Edoors_Board *board); /** * @brief Allocate the resources. * * @param name The name of this door. - * @param parent The direct hierarchical parent @ref Eiotas_Room. - * @param user_bits A Eiotas_User_Bits initilized with user side pointers. + * @param parent The direct hierarchical parent @ref Edoors_Room. + * @param user_bits A Edoors_User_Bits initilized with user side pointers. * - * @return the new allocated @ref Eiotas_Board @c NULL on failure + * @return the new allocated @ref Edoors_Board @c NULL on failure * - * @see Eiotas_User_Bits + * @see Edoors_User_Bits */ -EAPI Eiotas_Board* eiotas_board_add(const char* name, const Eiotas_Room *parent, Eiotas_User_Bits *user_bits); +EAPI Edoors_Board* edoors_board_add(const char* name, const Edoors_Room *parent, Edoors_User_Bits *user_bits); /** * @} */ -#endif // __EIOTAS_BOARD_H__ +#endif // __EDOORS_BOARD_H__ diff --git a/src/include/eiotas_door.h b/src/include/edoors_door.h index 6d7e481..0017e73 100644 --- a/src/include/eiotas_door.h +++ b/src/include/edoors_door.h @@ -1,4 +1,4 @@ -/* EIOTAS +/* EDOORS * Copyright (C) 2012 Jérémy Zurcher * * This library is free software; you can redistribute it and/or @@ -16,36 +16,36 @@ * if not, see <http://www.gnu.org/licenses/>. */ -#ifndef __EIOTAS_DOOR_H__ -#define __EIOTAS_DOOR_H__ +#ifndef __EDOORS_DOOR_H__ +#define __EDOORS_DOOR_H__ -#include "eiotas_iota.h" -#include "eiotas_room.h" -#include "eiotas_userbits.h" +#include "edoors_iota.h" +#include "edoors_room.h" +#include "edoors_userbits.h" #include <eina_types.h> /** - * @typedef Eiotas_Door + * @typedef Edoors_Door * Type for a basic Door. */ -typedef struct _Eiotas_Door Eiotas_Door; +typedef struct _Edoors_Door Edoors_Door; /** - * @struct _Eiotas_Door + * @struct _Edoors_Door * Struct for a basic Door. */ -struct _Eiotas_Door { - Eiotas_Iota iota; /**< structural info */ - Eiotas_User_Bits user_bits; /**< user bits */ +struct _Edoors_Door { + Edoors_Iota iota; /**< structural info */ + Edoors_User_Bits user_bits; /**< user bits */ }; /** - * @defgroup Eiotas_Door Eiotas_Door + * @defgroup Edoors_Door Edoors_Door * - * A Eiota_Door is the main structure used to interact with user code. - * @ref Eiotas_Particle sent to user code are, follower and sent releaseed - * through eiotas_spin_release_particle if not cprrectly managed by user code. + * A Edoors_Door is the main structure used to interact with user code. + * @ref Edoors_Particle sent to user code are, follower and sent releaseed + * through edoors_spin_release_particle if not cprrectly managed by user code. * * @{ */ @@ -53,27 +53,27 @@ struct _Eiotas_Door { /** * @brief Free allocated resources. * - * @param door The @ref Eiotas_Door to free. + * @param door The @ref Edoors_Door to free. * * This function will free all it's user data using user_bits ... FIXME */ -void eiotas_door_free(Eiotas_Door *door); +void edoors_door_free(Edoors_Door *door); /** * @brief Allocate the resources. * * @param name The name of this door. - * @param parent The direct hierarchical parent @ref Eiotas_Room. - * @param user_bits A Eiotas_User_Bits initilized with user side pointers. + * @param parent The direct hierarchical parent @ref Edoors_Room. + * @param user_bits A Edoors_User_Bits initilized with user side pointers. * - * @return the new allocated @ref Eiotas_Door @c NULL on failure + * @return the new allocated @ref Edoors_Door @c NULL on failure * - * @see Eiotas_User_Bits + * @see Edoors_User_Bits */ -EAPI Eiotas_Door* eiotas_door_add(const char* name, const Eiotas_Room *parent, Eiotas_User_Bits *user_bits); +EAPI Edoors_Door* edoors_door_add(const char* name, const Edoors_Room *parent, Edoors_User_Bits *user_bits); /** * @} */ -#endif // __EIOTAS_DOOR_H__ +#endif // __EDOORS_DOOR_H__ diff --git a/src/include/edoors_iota.h b/src/include/edoors_iota.h new file mode 100644 index 0000000..e6aaf64 --- /dev/null +++ b/src/include/edoors_iota.h @@ -0,0 +1,96 @@ +/* EDOORS + * Copyright (C) 2012 Jérémy Zurcher + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __EDOORS_IOTA_H__ +#define __EDOORS_IOTA_H__ + +#include <eina_stringshare.h> + +/** + * @enum _Edoors_Type + * List of available Edoors_Iota + */ +typedef enum _Edoors_Type +{ + EDOORS_TYPE_SPIN=0, + EDOORS_TYPE_ROOM, + EDOORS_TYPE_DOOR, + EDOORS_TYPE_BOARD, + EDOORS_TYPE_COUNT +} Edoors_Type; + +/** + * @typedef Edoors_Iota + * Type for structural and hierachical info + */ +typedef struct _Edoors_Iota Edoors_Iota; + +/** + * @struct _Edoors_Iota + * Struct for structural and hierachical info. + */ +struct _Edoors_Iota { + Edoors_Type type; /**< type of the iota */ + Edoors_Iota *spin; /**< top level iota which is a @ref Edoors_Spin */ + Edoors_Iota *parent; /**< direct parent in the hierarchy */ + Eina_Stringshare *name; /**< iota's name */ + Eina_Stringshare *path; /**< full path to this @ref Edoors_Iota */ +}; + +/** + * @defgroup Edoors_Iota Edoors_Iota + * + * This is the structural info stored in each @ref Edoors_Room, @ref Edoors_Door, @ref Edoors_Board + * + * @{ + */ + +/** + * @brief Print iota information using EINA_LOG_DBG. + * + * @param iota The @ref Edoors_Iota to show. + */ +EAPI void edoors_iota_show(Edoors_Iota *iota); + +/** + * @brief Free allocated resources. + * + * @param iota The @ref Edoors_Iota to free. + * + */ +void edoors_iota_free(Edoors_Iota *iota); + +/** + * @brief Require a @ref Edoors_Particle from the free list. + * + * @see edoors_spin_require_particle + */ +#define edoors_iota_require_particle(_iota) edoors_spin_require_particle((Edoors_Spin*)(_iota)->spin) + +/** + * @brief Release a particle. + * + * @see edoors_spin_release_particle + */ +#define edoors_iota_release_particle(_iota,_particle) edoors_spin_release_particle((Edoors_Spin*)(_iota)->spin,_particle) + +/** + * @} + */ + +#endif // __EDOORS_IOTA_H__ diff --git a/src/include/eiotas_link.h b/src/include/edoors_link.h index 2d10300..e0dc5fd 100644 --- a/src/include/eiotas_link.h +++ b/src/include/edoors_link.h @@ -1,4 +1,4 @@ -/* EIOTAS +/* EDOORS * Copyright (C) 2012 Jérémy Zurcher * * This library is free software; you can redistribute it and/or @@ -16,26 +16,26 @@ * if not, see <http://www.gnu.org/licenses/>. */ -#ifndef __EIOTAS_LINK_H__ -#define __EIOTAS_LINK_H__ +#ifndef __EDOORS_LINK_H__ +#define __EDOORS_LINK_H__ /** - * @typedef Eiotas_Link - * Type for a Link between @ref Eiotas_Iota. + * @typedef Edoors_Link + * Type for a Link between @ref Edoors_Iota. */ -typedef struct _Eiotas_Link Eiotas_Link; +typedef struct _Edoors_Link Edoors_Link; /** - * @struct _Eiotas_Link - * Struct for a Link between @ref Eiotas_Iota. + * @struct _Edoors_Link + * Struct for a Link between @ref Edoors_Iota. */ -struct _Eiotas_Link { +struct _Edoors_Link { }; /** - * @defgroup Eiotas_Link Eiotas_Link + * @defgroup Edoors_Link Edoors_Link * - * A Eiota_Link allows to apply a destination list to a @ref Eiotas_Particle with no defined destination. + * A Edoors_Link allows to apply a destination list to a @ref Edoors_Particle with no defined destination. * * @{ */ @@ -43,12 +43,12 @@ struct _Eiotas_Link { /** * @brief Free allocated resources. * - * @param link The @ref Eiotas_Link to free. + * @param link The @ref Edoors_Link to free. */ -void eiotas_link_free(Eiotas_Link *link); +void edoors_link_free(Edoors_Link *link); /** * @} */ -#endif // __EIOTAS_LINK_H__ +#endif // __EDOORS_LINK_H__ diff --git a/src/include/eiotas_main.h b/src/include/edoors_main.h index 75ac6fe..01fe818 100644 --- a/src/include/eiotas_main.h +++ b/src/include/edoors_main.h @@ -1,4 +1,4 @@ -/* EIOTAS +/* EDOORS * Copyright (C) 2012 Jérémy Zurcher * * This library is free software; you can redistribute it and/or @@ -16,71 +16,71 @@ * if not, see <http://www.gnu.org/licenses/>. */ -#ifndef __EIOTAS_MAIN_H__ -#define __EIOTAS_MAIN_H__ +#ifndef __EDOORS_MAIN_H__ +#define __EDOORS_MAIN_H__ #include <eina_types.h> /** - * @typedef Eiotas_Version - * Type for the version of Eiotas. + * @typedef Edoors_Version + * Type for the version of Edoors. */ -typedef struct _Eiotas_Version Eiotas_Version; +typedef struct _Edoors_Version Edoors_Version; /** - * @struct _Eiotas_Version - * Struct version of Eiotas. + * @struct _Edoors_Version + * Struct version of Edoors. */ -struct _Eiotas_Version +struct _Edoors_Version { int major; /**< Major component of the version */ int minor; /**< Minor component of the version */ int micro; /**< Micro component of the version */ }; -EAPI extern Eiotas_Version *eiotas_version; +EAPI extern Edoors_Version *edoors_version; -EAPI extern int _eiotas_log_dom; +EAPI extern int _edoors_log_dom; /** - * @defgroup Eiotas_Main Eiotas + * @defgroup Edoors_Main Edoors * * @{ */ /** - * @brief Initialize the Eiotas library. + * @brief Initialize the Edoors library. * * @return 1 or greater on success, 0 on error. * - * This function sets up all the eiotas modules. It returns 0 on + * This function sets up all the edoors modules. It returns 0 on * failure (that is, when one of the module fails to initialize), * otherwise it returns the number of times it has already been * called. * - * When Eiotas is not used anymore, call eiotas_shutdown() to shut down - * the Eiotaslibrary. + * When Edoors is not used anymore, call edoors_shutdown() to shut down + * the Edoorslibrary. */ -EAPI int eiotas_init(); +EAPI int edoors_init(); /** - * @brief Shut down the Eiotas library. + * @brief Shut down the Edoors library. * * @return 0 when all the modules are completely shut down, 1 or * greater otherwise. * - * This function shuts down the Eiotas library. It returns 0 when it has - * been called the same number of times than eiotas_init(). In that case - * it shut down all the Eiotas modules. + * This function shuts down the Edoors library. It returns 0 when it has + * been called the same number of times than edoors_init(). In that case + * it shut down all the Edoors modules. * * Once this function succeeds (that is, @c 0 is returned), you must - * not call any of the Eiotas function anymore. You must call - * eiotas_init() again to use the Eiotas functions again. + * not call any of the Edoors function anymore. You must call + * edoors_init() again to use the Edoors functions again. */ -EAPI int eiotas_shutdown(); +EAPI int edoors_shutdown(); /** * @} */ -#endif // __EIOTAS_MAIN_H__ +#endif // __EDOORS_MAIN_H__ diff --git a/src/include/eiotas_particle.h b/src/include/edoors_particle.h index ca8cc8e..0aebd14 100644 --- a/src/include/eiotas_particle.h +++ b/src/include/edoors_particle.h @@ -1,4 +1,4 @@ -/* EIOTAS +/* EDOORS * Copyright (C) 2012 Jérémy Zurcher * * This library is free software; you can redistribute it and/or @@ -16,8 +16,8 @@ * if not, see <http://www.gnu.org/licenses/>. */ -#ifndef __EIOTAS_PARTICLE_H__ -#define __EIOTAS_PARTICLE_H__ +#ifndef __EDOORS_PARTICLE_H__ +#define __EDOORS_PARTICLE_H__ #include <time.h> #include <eina_hash.h> @@ -25,23 +25,23 @@ #include <eina_inlist.h> #include <eina_stringshare.h> -#include "eiotas_iota.h" +#include "edoors_iota.h" /** - * @typedef Eiotas_Particle + * @typedef Edoors_Particle * Type for a Particle, holding data and spinning from Iotas to Iotas. */ -typedef struct _Eiotas_Particle Eiotas_Particle; +typedef struct _Edoors_Particle Edoors_Particle; /** - * @struct _Eiotas_Particle + * @struct _Edoors_Particle * Struct for a Particle, holding data and spinning from Iotas to Iotas. */ -struct _Eiotas_Particle { +struct _Edoors_Particle { EINA_INLIST; /**< the Eina_Inlist info */ time_t ts; /**< creation time */ - Eiotas_Iota *src; /**< where it's born */ - Eiotas_Iota *dst; /**< current destination */ + Edoors_Iota *src; /**< where it's born */ + Edoors_Iota *dst; /**< current destination */ Eina_Array *dsts; /**< array of destinatinon strings */ unsigned int cur_dst; /**< current destination index */ Eina_Stringshare *cur_action; /**< action part of the current destination */ @@ -54,9 +54,9 @@ struct _Eiotas_Particle { }; /** - * @defgroup Eiotas_Particle Eiotas_Particle + * @defgroup Edoors_Particle Edoors_Particle * - * The central part of Eiotas. The Particle holds, the data, the destination list. + * The central part of Edoors. The Particle holds, the data, the destination list. * * @{ */ @@ -64,138 +64,138 @@ struct _Eiotas_Particle { /** * @brief Free allocated resources. * - * @param particle The @ref Eiotas_Particle to free. + * @param particle The @ref Edoors_Particle to free. * - * This function will free all the merged @ref Eiotas_Particle + * This function will free all the merged @ref Edoors_Particle */ -void eiotas_particle_free(Eiotas_Particle *particle); +void edoors_particle_free(Edoors_Particle *particle); /** * @brief Allocate the resources. * - * @return the new allocated @ref Eiotas_Particle @c NULL on failure + * @return the new allocated @ref Edoors_Particle @c NULL on failure */ -Eiotas_Particle* eiotas_particle_alloc(); +Edoors_Particle* edoors_particle_alloc(); /** - * @brief Reset the @ref Eiotas_Particle so that it can be required later. + * @brief Reset the @ref Edoors_Particle so that it can be required later. * - * @param particle The @ref Eiotas_Particle to reset + * @param particle The @ref Edoors_Particle to reset */ -EAPI void eiotas_particle_reset(Eiotas_Particle *particle); +EAPI void edoors_particle_reset(Edoors_Particle *particle); /** * @brief Set @c src and @c ts timestamp. * - * @param particle The @ref Eiotas_Particle to init - * @param iota The @ref Eiotas_Iota wich will be set as @c src + * @param particle The @ref Edoors_Particle to init + * @param iota The @ref Edoors_Iota wich will be set as @c src */ -EAPI void eiotas_particle_init(Eiotas_Particle *particle, Eiotas_Iota *iota); +EAPI void edoors_particle_init(Edoors_Particle *particle, Edoors_Iota *iota); /** - * @brief Merge a @ref Eiotas_Particle into the other. + * @brief Merge a @ref Edoors_Particle into the other. * - * @param particle The @ref Eiotas_Particle to hold @p p - * @param p The @ref Eiotas_Particle to be merged into @p particle + * @param particle The @ref Edoors_Particle to hold @p p + * @param p The @ref Edoors_Particle to be merged into @p particle */ -EAPI void eiotas_particle_merge(Eiotas_Particle *particle, const Eiotas_Particle *p); +EAPI void edoors_particle_merge(Edoors_Particle *particle, const Edoors_Particle *p); /** * @brief Check if a current destination is defined * - * @param particle The @ref Eiotas_Particle to check + * @param particle The @ref Edoors_Particle to check * * @return EINA_TRUE if a current destination is defined, EINA_FALSE otherwise. */ -EAPI Eina_Bool eiotas_particle_has_dst(Eiotas_Particle *particle); +EAPI Eina_Bool edoors_particle_has_dst(Edoors_Particle *particle); /** * @brief Point to the next destination * - * @param particle The @ref Eiotas_Particle to mofify + * @param particle The @ref Edoors_Particle to mofify * * @return EINA_TRUE if next destination is defined, EINA_FALSE otherwise. */ -EAPI Eina_Bool eiotas_particle_next_dst(Eiotas_Particle *particle); +EAPI Eina_Bool edoors_particle_next_dst(Edoors_Particle *particle); /** * @brief Split current destination in room ; door ; action Eina_Stringshare * - * @param particle The @ref Eiotas_Particle to split current destination + * @param particle The @ref Edoors_Particle to split current destination * */ -EAPI void eiotas_particle_split_dst(Eiotas_Particle *particle); +EAPI void edoors_particle_split_dst(Edoors_Particle *particle); /** * @brief Add a destination and set it as current * - * @param particle The @ref Eiotas_Particle to add destination to + * @param particle The @ref Edoors_Particle to add destination to * @param destination The destination to add and set as current */ -EAPI void eiotas_particle_destination_set(Eiotas_Particle *particle, const char *destination); +EAPI void edoors_particle_destination_set(Edoors_Particle *particle, const char *destination); /** - * @brief Add destinations to the @ref Eiotas_Particle + * @brief Add destinations to the @ref Edoors_Particle * - * @param particle The @ref Eiotas_Particle to add destinations to + * @param particle The @ref Edoors_Particle to add destinations to * @param destinations A comma separated list of destination "/room0/room1/.../doorx?action" * - * This function will append each destination found to the destination list of the @ref Eiotas_Particle. + * This function will append each destination found to the destination list of the @ref Edoors_Particle. */ -EAPI void eiotas_particle_destinations_add(Eiotas_Particle *particle, const char *destinations); +EAPI void edoors_particle_destinations_add(Edoors_Particle *particle, const char *destinations); /** * @brief Set the link fields * - * @param particle The @ref Eiotas_Particle to set the link fields to + * @param particle The @ref Edoors_Particle to set the link fields to * @param link_fields A comma separated list of fields name * */ -EAPI void eiotas_particle_link_fields_set(Eiotas_Particle *particle, const char *link_fields); +EAPI void edoors_particle_link_fields_set(Edoors_Particle *particle, const char *link_fields); /** * @brief Restore the data associated to a given key * - * @param particle The @ref Eiotas_Particle to restore data from + * @param particle The @ref Edoors_Particle to restore data from * @param key The Eina_Hash key * * @return The data stored on success, NULL otherwise. */ -EAPI const char* eiotas_particle_data_get(Eiotas_Particle *particle, const char *key); +EAPI const char* edoors_particle_data_get(Edoors_Particle *particle, const char *key); /** - * @brief Store a key:value data couple into the Eiotas_Particle + * @brief Store a key:value data couple into the Edoors_Particle * - * @param particle The @ref Eiotas_Particle to store data into + * @param particle The @ref Edoors_Particle to store data into * @param key The Eina_Hash key * @param value The value to store * * @return EINA_FALSE if an error occurred, EINA_TRUE otherwise. */ -EAPI Eina_Bool eiotas_particle_data_set(Eiotas_Particle *particle, const char *key, const char *value); +EAPI Eina_Bool edoors_particle_data_set(Edoors_Particle *particle, const char *key, const char *value); /** * @brief Delete the data associated to a given key * - * @param particle The @ref Eiotas_Particle to delete data from + * @param particle The @ref Edoors_Particle to delete data from * @param key The Eina_Hash key * * @return EINA_FALSE if an error occurred, EINA_TRUE otherwise. */ -EAPI Eina_Bool eiotas_particle_data_del(Eiotas_Particle *particle, const char *key); +EAPI Eina_Bool edoors_particle_data_del(Edoors_Particle *particle, const char *key); /** - * @brief Check if two @ref Eiotas_Particle have the same link_value + * @brief Check if two @ref Edoors_Particle have the same link_value * - * @param particle The @ref Eiotas_Particle to compare with - * @param p The @ref Eiotas_Particle to compare with + * @param particle The @ref Edoors_Particle to compare with + * @param p The @ref Edoors_Particle to compare with * * @return EINA_TRUE if the link value is the same, EINA_FALSE otherwise. */ -EAPI Eina_Bool eiotas_particle_match(Eiotas_Particle *particle, const Eiotas_Particle *p); +EAPI Eina_Bool edoors_particle_match(Edoors_Particle *particle, const Edoors_Particle *p); /** * @} */ -#endif // __EIOTAS_PARTICLE_H__ +#endif // __EDOORS_PARTICLE_H__ diff --git a/src/include/eiotas_room.h b/src/include/edoors_room.h index 53b035a..2ccb4d7 100644 --- a/src/include/eiotas_room.h +++ b/src/include/edoors_room.h @@ -1,4 +1,4 @@ -/* EIOTAS +/* EDOORS * Copyright (C) 2012 Jérémy Zurcher * * This library is free software; you can redistribute it and/or @@ -16,33 +16,33 @@ * if not, see <http://www.gnu.org/licenses/>. */ -#ifndef __EIOTAS_ROOM_H__ -#define __EIOTAS_ROOM_H__ +#ifndef __EDOORS_ROOM_H__ +#define __EDOORS_ROOM_H__ -#include "eiotas_iota.h" +#include "edoors_iota.h" #include <eina_hash.h> /** - * @typedef Eiotas_Room - * Type for a Room, which holds other child @ref Eiotas_Iota. + * @typedef Edoors_Room + * Type for a Room, which holds other child @ref Edoors_Iota. */ -typedef struct _Eiotas_Room Eiotas_Room; +typedef struct _Edoors_Room Edoors_Room; /** - * @struct _Eiotas_Room - * Struct for a Room, which holds other child @ref Eiotas_Iota. + * @struct _Edoors_Room + * Struct for a Room, which holds other child @ref Edoors_Iota. */ -struct _Eiotas_Room { - Eiotas_Iota iota; /**< @ref Eiotas_Iota structural info */ +struct _Edoors_Room { + Edoors_Iota iota; /**< @ref Edoors_Iota structural info */ Eina_Hash *links; /**< TODO */ - Eina_Hash *children; /**< stringshared values optimized hash table holding @ref Eiotas_Iota */ + Eina_Hash *children; /**< stringshared values optimized hash table holding @ref Edoors_Iota */ }; /** - * @defgroup Eiotas_Room Eiotas_Room + * @defgroup Edoors_Room Edoors_Room * - * A Eiota_Room may hold children @ref Eiotas_Room or @ref Eiotas_Door (@ref Eiotas_Board). + * A Edoors_Room may hold children @ref Edoors_Room or @ref Edoors_Door (@ref Edoors_Board). * * @{ */ @@ -50,26 +50,26 @@ struct _Eiotas_Room { /** * @brief Free allocated resources. * - * @param room The @ref Eiotas_Room to free. + * @param room The @ref Edoors_Room to free. * - * This function will free all it's child @ref Eiotas_Iota. + * This function will free all it's child @ref Edoors_Iota. */ -void eiotas_room_free(Eiotas_Room *room); +void edoors_room_free(Edoors_Room *room); /** * @brief Print iota information using EINA_LOG_DBG. * - * @param name The name of this @ref Eiotas_Iota. - * @param parent The direct hierarchical parent @ref Eiotas_Room. + * @param name The name of this @ref Edoors_Iota. + * @param parent The direct hierarchical parent @ref Edoors_Room. * - * @return the new @ref Eiotas_Room, @c NULL on failure + * @return the new @ref Edoors_Room, @c NULL on failure * - * This function will register the new room as a child of it's parent @ref Eiotas_Room. + * This function will register the new room as a child of it's parent @ref Edoors_Room. */ -EAPI Eiotas_Room* eiotas_room_add(const char* name, const Eiotas_Room *parent); +EAPI Edoors_Room* edoors_room_add(const char* name, const Edoors_Room *parent); /** * @} */ -#endif // __EIOTAS_ROOM_H__ +#endif // __EDOORS_ROOM_H__ diff --git a/src/include/edoors_spin.h b/src/include/edoors_spin.h new file mode 100644 index 0000000..92c0744 --- /dev/null +++ b/src/include/edoors_spin.h @@ -0,0 +1,129 @@ +/* EDOORS + * Copyright (C) 2012 Jérémy Zurcher + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __EDOORS_SPIN_H__ +#define __EDOORS_SPIN_H__ + +#include "edoors_room.h" +#include "edoors_iota.h" +#include "edoors_particle.h" + +#include <eina_inlist.h> +#include <eina_array.h> + +/** + * @typedef Edoors_Spin + * Type for a Spin, the top level Room which holds @ref Edoors_Particle fifos and free @ref Edoors_Particle. + */ +typedef struct _Edoors_Spin Edoors_Spin; + +/** + * @struct _Edoors_Spin + * Struct for a Spin, the top level Room which holds @ref Edoors_Particle fifos and free @ref Edoors_Particle. + */ +struct _Edoors_Spin { + Edoors_Room room; /**< higher level Room */ + Eina_Array *free_particles; /**< lifo of free to reuse @ref Edoors_Particle TODO support different particle types, use an Eina_Hash */ + Eina_Inlist *app_fifo; /**< fifo of application priority particles */ + Eina_Inlist *sys_fifo; /**< fifo of system priority particles */ +}; + +/** + * @defgroup Edoors_Spin Edoors_Spin + * + * A Edoors_Spin is the top level object. It holds @ref Edoors_Particle free list, + * @ref Edoors_Particle system and application fifos. + * + * @{ + */ + +/** + * @brief Free allocated resources. + * + * @param spin The @ref Edoors_Spin to free. + * + * This function will free all it's child Iotas, + * all the @ref Edoors_Particle holded in app_fifo, sys_fifo and free_particles. + */ +EAPI void edoors_spin_free(Edoors_Spin *spin); + +/** + * @brief Allocate the resources. + * + * @param name The name of this spin. + * @param step The count of pointers to add when increasing the fifo size. + * + * @return the new allocated @ref Edoors_Spin @c NULL on failure + * + * @see eina_array_new(). + */ +EAPI Edoors_Spin* edoors_spin_add(const char* name, unsigned int step); + +/** + * @brief Require a @ref Edoors_Particle from the free list. + * + * @param spin The @ref Edoors_Spin to require a @ref Edoors_Particle from. + * + * @return a ready to use @ref Edoors_Particle + * + * This function will allocate and initialize a new @ref Edoors_Particle if there is none in the free list. + */ +EAPI Edoors_Particle* edoors_spin_require_particle(Edoors_Spin *spin); + +/** + * @brief Release a particle. + * + * @param spin The @ref Edoors_Spin to restore the particle to. + * @param particle The @ref Edoors_Particle to be restored. + * + * This function calls edoors_particle_reset() before giving back the @ref Edoors_Particle. + * Each @ref Edoors_Particle merged in the first one are also released. + * + * @see edoors_particle_reset(). + */ +EAPI void edoors_spin_release_particle(Edoors_Spin *spin, Edoors_Particle *particle); + +/** + * @brief Append the @ref Edoors_Particle to the app or sys fifo. + * + * @param spin The @ref Edoors_Spin to post the particle to. + * @param particle The @ref Edoors_Particle to be sent. + * @param system Post to the system fifo us true, otherwise to the application fifo. + * + */ +EAPI void edoors_spin_send_particle(Edoors_Spin *spin, const Edoors_Particle *particle, Eina_Bool system); + +/** + * @brief Require a @ref Edoors_Particle from the free list. + * + * @see edoors_spin_require_particle + */ +#define edoors_require_particle(_iota) edoors_spin_require_particle((Edoors_Spin*)((Edoors_Iota*)(_iota))->spin) + +/** + * @brief Release a particle. + * + * @see edoors_spin_release_particle + */ +#define edoors_release_particle(_iota,_particle) edoors_spin_release_particle((Edoors_Spin*)((Edoors_Iota*)(_iota))->spin,_particle) + +/** + * @} + */ + +#endif // __EDOORS_SPIN_H__ diff --git a/src/include/edoors_userbits.h b/src/include/edoors_userbits.h new file mode 100644 index 0000000..55eb81b --- /dev/null +++ b/src/include/edoors_userbits.h @@ -0,0 +1,90 @@ +/* EDOORS + * Copyright (C) 2012 Jérémy Zurcher + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __EDOORS_USERBITS_H__ +#define __EDOORS_USERBITS_H__ + +#include "edoors_iota.h" +#include "edoors_particle.h" + +/** + * @typedef Edoors_User_Bits + * Type for a @ref Edoors_User_Bits. + */ +typedef struct _Edoors_User_Bits Edoors_User_Bits; + +/** + * @typedef Edoors_User_Data + * Struct for user allocated data attached to a @ref Edoors_Door or a @ref Edoors_Board + */ +typedef void Edoors_User_Data; + +/** + * @typedef Edoors_User_Data + * Type for function called on resources free + * + * @see edoors_door_free() + * @see edoors_board_free() + */ +typedef void (*Edoors_User_Data_Free) (Edoors_User_Data*); + +/** + * @typedef Edoors_Receive_Particle + * Type for function called on @ref Edoors_Particle receive + */ +typedef void (*Edoors_Receive_Particle) (Edoors_Iota *iota, Edoors_Particle *particle, Edoors_User_Data *data); + +/** + * @typedef Edoors_Init + * Type for function called on systsem init + */ +typedef void (*Edoors_Init) (Edoors_Iota *iota, Edoors_User_Data *data); + +/** + * @typedef Edoors_Shutdown + * Type for function called on system shutdown + */ +typedef void (*Edoors_Shutdown) (Edoors_Iota *iota, Edoors_User_Data *data); + +/** + * @typedef Edoors_Suspend + * Type for function called on system suspend + */ +typedef void (*Edoors_Suspend) (Edoors_Iota *iota, Edoors_User_Data *data); + +/** + * @typedef Edoors_Resume + * Type for function called on system resume + */ +typedef void (*Edoors_Resume) (Edoors_Iota *iota, Edoors_User_Data *data); + +/** + * @struct _Edoors_User_Bits + * Struct for a Edoors_User_Bits. + */ +struct _Edoors_User_Bits { + Edoors_User_Data *data; /**< user data */ + Edoors_User_Data_Free free_fct; /**< to free user data */ + Edoors_Receive_Particle recv_fct; /**< to receive and process a @ref Edoors_Particle */ + Edoors_Init init_fct; /**< to initialize user data on system init */ + Edoors_Shutdown shutdown_fct; /**< to finalize user data on system shutdown */ + Edoors_Suspend suspend_fct; /**< to serialize user data on system shutdown */ + Edoors_Resume resume_fct; /**< to deserialize data on system resume */ +}; + +#endif // __EDOORS_USERBITS_H__ diff --git a/src/include/eiotas_iota.h b/src/include/eiotas_iota.h deleted file mode 100644 index 36ce1cc..0000000 --- a/src/include/eiotas_iota.h +++ /dev/null @@ -1,96 +0,0 @@ -/* EIOTAS - * Copyright (C) 2012 Jérémy Zurcher - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; - * if not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __EIOTAS_IOTA_H__ -#define __EIOTAS_IOTA_H__ - -#include <eina_stringshare.h> - -/** - * @enum _Eiotas_Type - * List of available Eiotas_Iota - */ -typedef enum _Eiotas_Type -{ - EIOTAS_TYPE_SPIN=0, - EIOTAS_TYPE_ROOM, - EIOTAS_TYPE_DOOR, - EIOTAS_TYPE_BOARD, - EIOTAS_TYPE_COUNT -} Eiotas_Type; - -/** - * @typedef Eiotas_Iota - * Type for structural and hierachical info - */ -typedef struct _Eiotas_Iota Eiotas_Iota; - -/** - * @struct _Eiotas_Iota - * Struct for structural and hierachical info. - */ -struct _Eiotas_Iota { - Eiotas_Type type; /**< type of the iota */ - Eiotas_Iota *spin; /**< top level iota which is a @ref Eiotas_Spin */ - Eiotas_Iota *parent; /**< direct parent in the hierarchy */ - Eina_Stringshare *name; /**< iota's name */ - Eina_Stringshare *path; /**< full path to this @ref Eiotas_Iota */ -}; - -/** - * @defgroup Eiotas_Iota Eiotas_Iota - * - * This is the structural info stored in each @ref Eiotas_Room, @ref Eiotas_Door, @ref Eiotas_Board - * - * @{ - */ - -/** - * @brief Print iota information using EINA_LOG_DBG. - * - * @param iota The @ref Eiotas_Iota to show. - */ -EAPI void eiotas_iota_show(Eiotas_Iota *iota); - -/** - * @brief Free allocated resources. - * - * @param iota The @ref Eiotas_Iota to free. - * - */ -void eiotas_iota_free(Eiotas_Iota *iota); - -/** - * @brief Require a @ref Eiotas_Particle from the free list. - * - * @see eiotas_spin_require_particle - */ -#define eiotas_iota_require_particle(_iota) eiotas_spin_require_particle((Eiotas_Spin*)(_iota)->spin) - -/** - * @brief Release a particle. - * - * @see eiotas_spin_release_particle - */ -#define eiotas_iota_release_particle(_iota,_particle) eiotas_spin_release_particle((Eiotas_Spin*)(_iota)->spin,_particle) - -/** - * @} - */ - -#endif // __EIOTAS_IOTA_H__ diff --git a/src/include/eiotas_spin.h b/src/include/eiotas_spin.h deleted file mode 100644 index fbe5440..0000000 --- a/src/include/eiotas_spin.h +++ /dev/null @@ -1,129 +0,0 @@ -/* EIOTAS - * Copyright (C) 2012 Jérémy Zurcher - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; - * if not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __EIOTAS_SPIN_H__ -#define __EIOTAS_SPIN_H__ - -#include "eiotas_room.h" -#include "eiotas_iota.h" -#include "eiotas_particle.h" - -#include <eina_inlist.h> -#include <eina_array.h> - -/** - * @typedef Eiotas_Spin - * Type for a Spin, the top level Room which holds @ref Eiotas_Particle fifos and free @ref Eiotas_Particle. - */ -typedef struct _Eiotas_Spin Eiotas_Spin; - -/** - * @struct _Eiotas_Spin - * Struct for a Spin, the top level Room which holds @ref Eiotas_Particle fifos and free @ref Eiotas_Particle. - */ -struct _Eiotas_Spin { - Eiotas_Room room; /**< higher level Room */ - Eina_Array *free_particles; /**< lifo of free to reuse @ref Eiotas_Particle TODO support different particle types, use an Eina_Hash */ - Eina_Inlist *app_fifo; /**< fifo of application priority particles */ - Eina_Inlist *sys_fifo; /**< fifo of system priority particles */ -}; - -/** - * @defgroup Eiotas_Spin Eiotas_Spin - * - * A Eiota_Spin is the top level object. It holds @ref Eiotas_Particle free list, - * @ref Eiotas_Particle system and application fifos. - * - * @{ - */ - -/** - * @brief Free allocated resources. - * - * @param spin The @ref Eiotas_Spin to free. - * - * This function will free all it's child Iotas, - * all the @ref Eiotas_Particle holded in app_fifo, sys_fifo and free_particles. - */ -EAPI void eiotas_spin_free(Eiotas_Spin *spin); - -/** - * @brief Allocate the resources. - * - * @param name The name of this spin. - * @param step The count of pointers to add when increasing the fifo size. - * - * @return the new allocated @ref Eiotas_Spin @c NULL on failure - * - * @see eina_array_new(). - */ -EAPI Eiotas_Spin* eiotas_spin_add(const char* name, unsigned int step); - -/** - * @brief Require a @ref Eiotas_Particle from the free list. - * - * @param spin The @ref Eiotas_Spin to require a @ref Eiotas_Particle from. - * - * @return a ready to use @ref Eiotas_Particle - * - * This function will allocate and initialize a new @ref Eiotas_Particle if there is none in the free list. - */ -EAPI Eiotas_Particle* eiotas_spin_require_particle(Eiotas_Spin *spin); - -/** - * @brief Release a particle. - * - * @param spin The @ref Eiotas_Spin to restore the particle to. - * @param particle The @ref Eiotas_Particle to be restored. - * - * This function calls eiotas_particle_reset() before giving back the @ref Eiotas_Particle. - * Each @ref Eiotas_Particle merged in the first one are also released. - * - * @see eiotas_particle_reset(). - */ -EAPI void eiotas_spin_release_particle(Eiotas_Spin *spin, Eiotas_Particle *particle); - -/** - * @brief Append the @ref Eiotas_Particle to the app or sys fifo. - * - * @param spin The @ref Eiotas_Spin to post the particle to. - * @param particle The @ref Eiotas_Particle to be sent. - * @param system Post to the system fifo us true, otherwise to the application fifo. - * - */ -EAPI void eiotas_spin_send_particle(Eiotas_Spin *spin, const Eiotas_Particle *particle, Eina_Bool system); - -/** - * @brief Require a @ref Eiotas_Particle from the free list. - * - * @see eiotas_spin_require_particle - */ -#define eiotas_require_particle(_iota) eiotas_spin_require_particle((Eiotas_Spin*)((Eiotas_Iota*)(_iota))->spin) - -/** - * @brief Release a particle. - * - * @see eiotas_spin_release_particle - */ -#define eiotas_release_particle(_iota,_particle) eiotas_spin_release_particle((Eiotas_Spin*)((Eiotas_Iota*)(_iota))->spin,_particle) - -/** - * @} - */ - -#endif // __EIOTAS_SPIN_H__ diff --git a/src/include/eiotas_userbits.h b/src/include/eiotas_userbits.h deleted file mode 100644 index b48c7c2..0000000 --- a/src/include/eiotas_userbits.h +++ /dev/null @@ -1,90 +0,0 @@ -/* EIOTAS - * Copyright (C) 2012 Jérémy Zurcher - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; - * if not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __EIOTAS_USERBITS_H__ -#define __EIOTAS_USERBITS_H__ - -#include "eiotas_iota.h" -#include "eiotas_particle.h" - -/** - * @typedef Eiotas_User_Bits - * Type for a @ref Eiotas_User_Bits. - */ -typedef struct _Eiotas_User_Bits Eiotas_User_Bits; - -/** - * @typedef Eiotas_User_Data - * Struct for user allocated data attached to a @ref Eiotas_Door or a @ref Eiotas_Board - */ -typedef void Eiotas_User_Data; - -/** - * @typedef Eiotas_User_Data - * Type for function called on resources free - * - * @see eiotas_door_free() - * @see eiotas_board_free() - */ -typedef void (*Eiotas_User_Data_Free) (Eiotas_User_Data*); - -/** - * @typedef Eiotas_Receive_Particle - * Type for function called on @ref Eiotas_Particle receive - */ -typedef void (*Eiotas_Receive_Particle) (Eiotas_Iota *iota, Eiotas_Particle *particle, Eiotas_User_Data *data); - -/** - * @typedef Eiotas_Init - * Type for function called on systsem init - */ -typedef void (*Eiotas_Init) (Eiotas_Iota *iota, Eiotas_User_Data *data); - -/** - * @typedef Eiotas_Shutdown - * Type for function called on system shutdown - */ -typedef void (*Eiotas_Shutdown) (Eiotas_Iota *iota, Eiotas_User_Data *data); - -/** - * @typedef Eiotas_Suspend - * Type for function called on system suspend - */ -typedef void (*Eiotas_Suspend) (Eiotas_Iota *iota, Eiotas_User_Data *data); - -/** - * @typedef Eiotas_Resume - * Type for function called on system resume - */ -typedef void (*Eiotas_Resume) (Eiotas_Iota *iota, Eiotas_User_Data *data); - -/** - * @struct _Eiotas_User_Bits - * Struct for a Eiotas_User_Bits. - */ -struct _Eiotas_User_Bits { - Eiotas_User_Data *data; /**< user data */ - Eiotas_User_Data_Free free_fct; /**< to free user data */ - Eiotas_Receive_Particle recv_fct; /**< to receive and process a @ref Eiotas_Particle */ - Eiotas_Init init_fct; /**< to initialize user data on system init */ - Eiotas_Shutdown shutdown_fct; /**< to finalize user data on system shutdown */ - Eiotas_Suspend suspend_fct; /**< to serialize user data on system shutdown */ - Eiotas_Resume resume_fct; /**< to deserialize data on system resume */ -}; - -#endif // __EIOTAS_USERBITS_H__ |