예제 #1
0
//FIXME on sinks should replace old connection!
Con *filter_connect_real(Filter *source, int out, Filter *sink, int in)
{
  Con *con = malloc(sizeof(Con));
  
  con->source = eina_array_data_get(source->out, out);
  con->sink = eina_array_data_get(sink->in, in);
  
  if (!source->node->con_trees_out)
    source->node->con_trees_out = eina_array_new(1);
  
  if (!sink->node->con_trees_in)
    sink->node->con_trees_in = eina_array_new(1);
  
  if (ea_count(source->node->con_trees_out)) {
    printf("WARNING: have con_trees_out\n");
    while (ea_count(source->node->con_trees_out))
      ea_pop(source->node->con_trees_out);
  }
  if (ea_count(sink->node->con_trees_in)) {
    printf("WARNING: have con_trees_in\n");
    while (ea_count(sink->node->con_trees_in))
      ea_pop(sink->node->con_trees_in);
  }
  
  eina_array_push(source->node->con_trees_out, con);
  eina_array_push(sink->node->con_trees_in, con);
  
  filter_hash_invalidate(source);
  
  return con;
}
예제 #2
0
파일: eio_sentry.c 프로젝트: tasn/efl
static void
_initialize_handlers(Eio_Sentry_Data *pd)
{
   Ecore_Event_Handler *h;
   EINA_SAFETY_ON_NULL_RETURN(pd);
   pd->handlers = eina_array_new(11);

   h = ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, _handle_event, pd);
   eina_array_push(pd->handlers, h);
   h = ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, _handle_event, pd);
   eina_array_push(pd->handlers, h);
   h = ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, _handle_event, pd);
   eina_array_push(pd->handlers, h);
   h = ecore_event_handler_add(EIO_MONITOR_FILE_CLOSED, _handle_event, pd);
   eina_array_push(pd->handlers, h);

   h = ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, _handle_event, pd);
   eina_array_push(pd->handlers, h);
   h = ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, _handle_event, pd);
   eina_array_push(pd->handlers, h);
   h = ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, _handle_event, pd);
   eina_array_push(pd->handlers, h);
   h = ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CLOSED, _handle_event, pd);
   eina_array_push(pd->handlers, h);

   h = ecore_event_handler_add(EIO_MONITOR_SELF_RENAME, _handle_event, pd);
   eina_array_push(pd->handlers, h);
   h = ecore_event_handler_add(EIO_MONITOR_SELF_DELETED, _handle_event, pd);
   eina_array_push(pd->handlers, h);
   h = ecore_event_handler_add(EIO_MONITOR_ERROR, _handle_event, pd);
   eina_array_push(pd->handlers, h);
}
예제 #3
0
/*
 * This function creates a color table for an rtf file. It returns 1 upon 
 * success and 0 in case of failure.
 */
int
ertf_color_table(FILE *fp)
{
  int c;

  DBG("Inside color table handler.");

  // create an eina array
  color_table = eina_array_new(7);
  if (!color_table)
  {
    // In case of success, the eina array module shall be shut down by ertf
    // clean up functions when the app is closed.
    return 0;
  }

  // ready to parse the color table now
  while ((c=fgetc(fp)) != EOF)
  {
    switch (c)
    {
      Ertf_Color *node;

    case ';':// indicates default color
      node = (Ertf_Color *)malloc(sizeof(Ertf_Color));
      if (!node)
      {
	ERR("short of memory while allocating color node");
	return 0;
      }
      node->r = _ertf_default_color_r;
      node->g = _ertf_default_color_g;
      node->b = _ertf_default_color_b;
      eina_array_push(color_table, node);
      break;

    case '\\':
      ungetc(c, fp);
      if (_ertf_color_add(fp))
	continue;
      else
	INFO("Ill-formed rtf");
      break;

    case '}':// end of color table
      // generate markup strings for all colors
      _ertf_color_generate_markup();
      return 1;

    default:
      if (c == '\n' || c == '\r')
	_line++;
      DBG("skipping control character `%c'", c);      
    }
  }

  ERR("End of file reached in color table");
  return 0;
}
예제 #4
0
/*
 * Constructor for the Eupnp_HTTP_Request structure
 *
 * Receives pointers to starting points and lengths of the method, uri
 * and http version attributes and constructs the object. Also initializes the
 * headers array. For dealing with headers, refer to the
 * eupnp_http_request_header_* functions.
 *
 * @param method starting point of the method
 * @param method_len method length
 * @param uri starting point of the uri
 * @param uri_len uri length
 * @param httpver starting point of the http version
 * @param httpver_len http version length
 *
 * @return Eupnp_HTTP_Request instance
 */
Eupnp_HTTP_Request *
eupnp_http_request_new(const char *method, int method_len, const char *uri, int uri_len, const char *httpver, int httpver_len)
{
   Eupnp_HTTP_Request *h;
   h = calloc(1, sizeof(Eupnp_HTTP_Request));

   if (!h)
     {
	eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
	ERROR("Could not create HTTP message.\n");
	return NULL;
     }

   h->headers = eina_array_new(10);

   if (!h->headers)
     {
	ERROR("Could not allocate memory for HTTP headers table.\n");
	free(h);
	return NULL;
     }

   h->method = eina_stringshare_add_length(method, method_len);

   if (!h->method)
     {
	ERROR("Could not stringshare HTTP request method.\n");
	eina_array_free(h->headers);
	free(h);
	return NULL;
     }

   h->http_version = eina_stringshare_add_length(httpver, httpver_len);

   if (!h->http_version)
     {
	ERROR("Could not stringshare HTTP request version.\n");
	eina_array_free(h->headers);
	eina_stringshare_del(h->method);
	free(h);
	return NULL;
     }

   h->uri = eina_stringshare_add_length(uri, uri_len);

   if (!h->uri)
     {
	ERROR("Could not stringshare HTTP request URI.\n");
	eina_array_free(h->headers);
	eina_stringshare_del(h->method);
	eina_stringshare_del(h->http_version);
	free(h);
	return NULL;
     }

   return h;
}
예제 #5
0
//FIXME on sinks should replace old connection!
Con *filter_connect(Filter *source, int out, Filter *sink, int in)
{
  Con *con = malloc(sizeof(Con));
  
  //no composition yet
  assert(in == 0);
  assert(out == 0);
  
  assert(source->in);
  assert(sink->out);
  
  lime_config_reset(sink);
  lime_config_reset(source);
  
  con->source = eina_array_data_get(source->out, out);
  con->sink = eina_array_data_get(sink->in, in);
  
  if (!source->node_orig->con_trees_out)
    source->node_orig->con_trees_out = eina_array_new(1);
  
  if (!sink->node_orig->con_trees_in)
    sink->node_orig->con_trees_in = eina_array_new(1);
  
  if (!ea_count(source->node_orig->con_trees_out))
    eina_array_push(source->node_orig->con_trees_out, con);
  else {
    while (ea_count(source->node_orig->con_trees_out))
      con_del(ea_pop(source->node_orig->con_trees_out));
    eina_array_push(source->node_orig->con_trees_out, con);
  }
  
  if (!ea_count(sink->node_orig->con_trees_in))
    eina_array_push(sink->node_orig->con_trees_in, con);
  else {
    while (ea_count(sink->node_orig->con_trees_in))
      con_del(ea_pop(sink->node_orig->con_trees_in));
    eina_array_push(sink->node_orig->con_trees_in, con);
  }
  
  filter_hash_invalidate(source);
  
  return con;
}
예제 #6
0
//Positionen und Größer immer bezogen auf scale
//FIXME check if area is already cached!
Render_State *render_state_new(Rect *area, Filter *f)
{
  Render_State *state = calloc(sizeof(Render_State), 1);  
  Tile *tile;
  
  if (area) {
    tile = tile_new(area, tile_hash_calc(f, area), f, NULL, 1);
  }
  else
    tile = NULL;
  
  Render_Node *node =  render_node_new(f, tile, state, 1); 
  
  node->need = 1000;

  state->currstate = eina_array_new(64);
  state->ready = eina_array_new(64);
  
  eina_array_push(state->currstate, node);
  
  return state;
}
예제 #7
0
END_TEST

START_TEST(eina_binshare_collision)
{
   Eina_Array *ea;
   char buffer[50];
   int i;

   srand(time(NULL));

   eina_init();

   ea = eina_array_new(256);
   fail_if(!ea);

   for (i = 0; i < 10000; ++i)
     {
        eina_convert_itoa(rand(), buffer);
        eina_array_push(ea,
                        (void *)eina_binshare_add_length(buffer, strlen(buffer)));
        if (rand() > RAND_MAX / 2)
          {
             const char *r = eina_binshare_add_length(buffer, strlen(buffer));
             fail_if(r == NULL);
          }
     }

   for (i = 0; i < 10000; ++i)
     {
        const char *r;

        eina_convert_itoa(60000 - i, buffer);
        eina_array_push(ea,
                        (void *)eina_binshare_add_length(buffer, strlen(buffer)));
        r = eina_binshare_add_length(buffer, strlen(buffer));
        fail_if(r == NULL);
        r = eina_binshare_add_length(buffer, strlen(buffer));
        fail_if(r == NULL);
     }

   for (i = 0; i < 200; ++i)
      eina_binshare_del(eina_array_data_get(ea, i));

   for (i = 0; i < 1000; ++i)
      eina_binshare_del(eina_array_pop(ea));

   eina_shutdown();

   eina_array_free(ea);
}
예제 #8
0
파일: eet_loader.c 프로젝트: Limsik/e17
Eina_Bool
eet_loader_init(void)
{
   if (!elixir_loader_register(&eet_loader))
     return EINA_FALSE;

   eina_init();
   eet_init();

   stack = eina_array_new(4);
   cache = eina_hash_string_superfast_new(EINA_FREE_CB(_elixir_eet_filename_free));

   return EINA_TRUE;
}
예제 #9
0
static void
eina_bench_lookup_evas(int request)
{
   Evas_Hash *hash = NULL;
   Eina_Array *array = NULL;
   int *tmp_val;
   Eina_Array_Iterator it;
   unsigned int i;
   unsigned int j;

   array = eina_array_new(10000);

   for (i = 0; i < (unsigned int)request; ++i)
     {
        char tmp_key[10];

        tmp_val = malloc(sizeof (int));

        if (!tmp_val)
           continue;

        eina_convert_itoa(i, tmp_key);
        *tmp_val = i;

        hash = evas_hash_add(hash, tmp_key, tmp_val);

        eina_array_push(array, tmp_val);
     }

   srand(time(NULL));

   for (j = 0; j < 200; ++j)
      for (i = 0; i < (unsigned int)request; ++i)
        {
           char tmp_key[10];

           eina_convert_itoa(rand() % request, tmp_key);

           tmp_val = evas_hash_find(hash, tmp_key);
        }

   evas_hash_free(hash);

   EINA_ARRAY_ITER_NEXT(array, i, tmp_val, it)
     free(tmp_val);

   eina_array_free(array);
}
예제 #10
0
/*
 * Constructor for the Eupnp_HTTP_Response structure
 *
 * Receives pointers to starting points and lengths of the http version, status
 * code and http version attributes and constructs the object. Also initializes
 * the headers array. For dealing with headers, refer to the
 * eupnp_http_response_header_* functions.
 *
 * @param httpver starting point of the http version
 * @param httpver_len http version length
 * @param status_code starting point of the status code
 * @param status_len status length
 * @param reason_phrase starting point of the reason phrase
 * @param reason_phrase_len reason phrase length
 *
 * @return Eupnp_HTTP_Response instance
 */
Eupnp_HTTP_Response *
eupnp_http_response_new(const char *httpver, int httpver_len, const char *status_code, int status_code_len, const char *reason_phrase, int reason_phrase_len)
{
   Eupnp_HTTP_Response *r;
   r = calloc(1, sizeof(Eupnp_HTTP_Response));

   if (!r)
     {
	eina_error_set(EINA_ERROR_OUT_OF_MEMORY);
	ERROR("Could not create HTTP response.\n");
	return NULL;
     }

   r->headers = eina_array_new(10);

   if (!r->headers)
     {
	ERROR("Could not allocate memory for HTTP headers.\n");
	free(r);
	return NULL;
     }

   r->http_version = eina_stringshare_add_length(httpver, httpver_len);

   if (!r->http_version)
     {
	ERROR("Could not stringshare http response version.\n");
	eina_array_free(r->headers);
	free(r);
	return NULL;
     }

   r->status_code = strtol(status_code, NULL, 10);
   r->reason_phrase = eina_stringshare_add_length(reason_phrase,
						    reason_phrase_len);

   if (!r->reason_phrase)
     {
	ERROR("Could not stringshare http response phrase.\n");
	eina_array_free(r->headers);
	eina_stringshare_del(r->http_version);
	free(r);
	return NULL;
     }

   return r;
}
예제 #11
0
EAPI Eina_Array *eina_module_arch_list_get(Eina_Array *array,
                                           const char *path,
                                           const char *arch)
{
   Dir_List_Get_Cb_Data list_get_cb_data;

   if ((!path) || (!arch))
      return array;

   list_get_cb_data.array = array ? array : eina_array_new(4);
   list_get_cb_data.cb = NULL;
   list_get_cb_data.data = (void *)arch;

   eina_file_dir_list(path, 0, &_dir_arch_list_cb, &list_get_cb_data);

   return list_get_cb_data.array;
}
예제 #12
0
/* this will alloc an Evas_Module struct for each module
 * it finds on the paths */
void
evas_module_init(void)
{
   int i;

   evas_module_paths_init();

   evas_modules[EVAS_MODULE_TYPE_ENGINE] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL);
   evas_modules[EVAS_MODULE_TYPE_IMAGE_LOADER] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL);
   evas_modules[EVAS_MODULE_TYPE_IMAGE_SAVER] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL);
   evas_modules[EVAS_MODULE_TYPE_OBJECT] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL);

   evas_engines = eina_array_new(4);

   for (i = 0; evas_static_module[i].init; ++i)
     evas_static_module[i].init();
}
예제 #13
0
Eina_Array *
wkb_ibus_properties_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   struct wkb_ibus_property *property = NULL;
   Eina_Array *properties = NULL;
   Eldbus_Message_Iter *iter_props, *props, *prop;

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}av)", &iter_props);
   if (!eldbus_message_iter_arguments_get(iter_props, "sa{sv}av", &ignore.text,
                                          &ignore.dict, &props))
     {
        ERR("Error deserializing IBusPropList");
        goto end;
     }

   if (!props)
     {
        INF("PropList has no property");
        goto end;
     }

   while (eldbus_message_iter_get_and_next(props, 'v', &prop))
     {
        if (!(property = wkb_ibus_property_from_message_iter(prop)))
          {
             wkb_ibus_properties_free(properties);
             properties = NULL;
             goto end;
          }

        if (!properties)
           properties = eina_array_new(10);

        DBG("Appending new property %p", property);
        eina_array_push(properties, property);
     }

end:
   return properties;
}
예제 #14
0
static Eina_Array *
_wkb_ibus_attr_list_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   Eldbus_Message_Iter *iter_array, *iter_attr;
   struct wkb_ibus_attr *attr = NULL;
   Eina_Array *attr_list = NULL;

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}av)", &iter_attr);
   if (!eldbus_message_iter_arguments_get(iter_attr, "sa{sv}av", &ignore.text,
                                          &ignore.dict, &iter_array))
     {
        ERR("Error deserializing IBusAttrList");
        goto end;
     }

   if (!iter_array)
     {
        INF("AttrList has no attribute");
        goto end;
     }

   while (eldbus_message_iter_get_and_next(iter_array, 'v', &iter_attr))
     {
        if (!(attr = wkb_ibus_attr_from_message_iter(iter_attr)))
          {
             _free_eina_array(attr_list, (_free_func) free);
             attr_list = NULL;
             goto end;
          }

        if (!attr_list)
            attr_list = eina_array_new(10);

        DBG("Appending new attribute: %p", attr);
        eina_array_push(attr_list, attr);
     }

end:
   return attr_list;
}
예제 #15
0
END_TEST

START_TEST(eina_rbtree_remove)
{
   Eina_Rbtree_Int *root = NULL;
   Eina_Rbtree_Int *item;
   Eina_Array *ea;
   Eina_Array_Iterator it;
   unsigned int i;

   eina_init();

   ea = eina_array_new(11);
   fail_if(!ea);

   srand(time(NULL));

   for (i = 0; i < 500; ++i)
     {
        item = _eina_rbtree_int_new(rand());
        eina_array_push(ea, item);
        root = (Eina_Rbtree_Int *)eina_rbtree_inline_insert(
              &root->node,
              &item->node,
              EINA_RBTREE_CMP_NODE_CB(
                 eina_rbtree_int_cmp),
              NULL);
     }

   _eina_rbtree_black_height(&root->node,
                             EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));

   EINA_ARRAY_ITER_NEXT(ea, i, item, it)
     {
        root = (Eina_Rbtree_Int *)eina_rbtree_inline_remove(
              &root->node,
              &item->node,
              EINA_RBTREE_CMP_NODE_CB(
                 eina_rbtree_int_cmp),
              NULL);
        _eina_rbtree_black_height(&root->node,
                                  EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));
     }
예제 #16
0
/**
 * @brief Get a list of modules found on the directory path.
 *
 * @param array The array that stores the list of the modules.
 * @param path The directory's path to search for modules.
 * @param recursive Iterate recursively on the path.
 * @param cb Callback function to call on each module.
 * @param data Data passed to the callback function.
 *
 * This function adds to @p array the list of modules found in
 * @p path. If @p recursive is #EINA_TRUE, then recursive search is
 * done. The callback @p cb is called on each module found, and @p data
 * is passed to @p cb. If @p path is @c NULL, the function returns
 * immediately @p array. If the returned value of @p cb is 0, the
 * module will not be added to the list, otherwise it will be added.
 * @p array can be @c NULL. In that case, it is created with 4
 * elements. @p cb can be @c NULL.
 */
EAPI Eina_Array *eina_module_list_get(Eina_Array * array,
				      const char *path,
				      Eina_Bool recursive,
				      Eina_Module_Cb cb, void *data)
{
	Dir_List_Get_Cb_Data list_get_cb_data;
	Dir_List_Cb_Data list_cb_data;

	if (!path)
		return array;

	list_get_cb_data.array = array ? array : eina_array_new(4);
	list_get_cb_data.cb = cb;
	list_get_cb_data.data = data;

	list_cb_data.cb = &_dir_list_get_cb;
	list_cb_data.data = &list_get_cb_data;

	eina_file_dir_list(path, recursive, &_dir_list_cb, &list_cb_data);

	return list_get_cb_data.array;
}
예제 #17
0
Filter *filter_new(Filter_Core *fc)
{
  Filter *filter = calloc(sizeof(Filter), 1);
  
  filter->fc = fc;
  filter->in = eina_array_new(2);
  filter->out = eina_array_new(2);
  filter->tune = eina_array_new(2);
  filter->settings = eina_array_new(2);
  filter->core = eina_array_new(2);
  filter->node = fg_node_new(filter);
  filter->node_orig = fg_node_new(filter);
  filter->data = eina_array_new(4);
  filter->metas = eina_array_new(8);
  
  filter->tile_width = DEFAULT_TILE_SIZE;
  filter->tile_height = DEFAULT_TILE_SIZE;
  
  pthread_mutex_init(&filter->lock, NULL);
    
  return filter;
}
예제 #18
0
static Eina_Bool
_etui_epub_ncx_parse_cb(void *data, Eina_Simple_XML_Type type, const char *content, unsigned offset EINA_UNUSED, unsigned length)
{
    Etui_Provider_Data *pd;

    pd = (Etui_Provider_Data *)data;

    if ((type == EINA_SIMPLE_XML_OPEN) || (type == EINA_SIMPLE_XML_OPEN_EMPTY))
    {
        if (strncmp("ncx", content, strlen("ncx")) == 0)
        {
            if (pd->ncx.has_ncx)
            {
                return EINA_FALSE;
            }
            pd->ncx.has_ncx = 1;
        }
        else if (strncmp("meta", content, strlen("meta")) == 0)
        {
            const char *tags;

            tags = eina_simple_xml_tag_attributes_find(content,
                                                       length);

            eina_simple_xml_attributes_parse(tags, length - (tags - content),
                                             _etui_epub_ncx_meta_attr_parse_cb, pd);
        }
        else if (strncmp("docTitle", content, strlen("docTitle")) == 0)
        {
            if (!pd->ncx.has_ncx || pd->ncx.has_title)
            {
                return EINA_FALSE;
            }
            pd->ncx.has_title = 1;
        }
        else if (strncmp("docAuthor", content, strlen("docAuthor")) == 0)
        {
            if (!pd->ncx.has_ncx || pd->ncx.has_author)
            {
                return EINA_FALSE;
            }
            pd->ncx.has_author = 1;
        }
        else if (strncmp("text", content, strlen("text")) == 0)
        {
            if (pd->ncx.has_title)
                pd->ncx.has_title_text = 1;
            if (pd->ncx.has_author)
                pd->ncx.has_author_text = 1;
            if (pd->ncx.has_navpoint)
                pd->ncx.has_navpoint_text = 1;
        }
        else if (strncmp("navMap", content, strlen("navMap")) == 0)
        {
            int i;

            for (i = 0; i < 2; i++)
            {
                if (!strcmp(pd->ncx.meta_items[i].name, "dtb:uid"))
                    pd->ncx.uid = pd->ncx.meta_items[i].content;
                if (!strcmp(pd->ncx.meta_items[i].name, "dtb:depth"))
                {
                    pd->ncx.depth = atoi(pd->ncx.meta_items[i].content);
                    free(pd->ncx.meta_items[i].content);
                    pd->ncx.meta_item_to_free = 1 - i;
                }
                free(pd->ncx.meta_items[i].name);
            }
            /* FIXME: use an eina_array instead */
            if (pd->ncx.depth == 0)
                pd->ncx.depth = 10;
            pd->ncx.stack = (Etui_Epub_Ncx_Toc_Item **)calloc(pd->ncx.depth, sizeof(Etui_Epub_Ncx_Toc_Item *));
        }
        else if (strncmp("navPoint", content, strlen("navPoint")) == 0)
        {
            pd->ncx.current_depth++;
            pd->ncx.stack[pd->ncx.current_depth] = (Etui_Epub_Ncx_Toc_Item *)calloc(1, sizeof(Etui_Epub_Ncx_Toc_Item));
            if (pd->ncx.current_depth > 0)
            {
                if (pd->ncx.stack[pd->ncx.current_depth - 1]->child == NULL)
                    pd->ncx.stack[pd->ncx.current_depth - 1]->child = eina_array_new(4);
            }
            pd->ncx.has_navpoint = 1;
        }
        else if (strncmp("content", content, strlen("content")) == 0)
        {
            const char *tags;

            tags = eina_simple_xml_tag_attributes_find(content,
                                                       length);

            eina_simple_xml_attributes_parse(tags, length - (tags - content),
                                             _etui_epub_ncx_content_attr_parse_cb, pd);
        }
    }
    else if (type == EINA_SIMPLE_XML_DATA)
    {
        if (pd->ncx.has_title_text)
        {
            pd->ncx.title = (char *)malloc(length + 1);
            if (pd->ncx.title)
            {
                memcpy(pd->ncx.title, content, length);
                pd->ncx.title[length] = '\0';
            }
        }
        else if (pd->ncx.has_author_text)
        {
            pd->ncx.author = (char *)malloc(length + 1);
            if (pd->ncx.author)
            {
                memcpy(pd->ncx.author, content, length);
                pd->ncx.author[length] = '\0';
            }
        }
        else if (pd->ncx.has_navpoint_text)
        {
            if (pd->ncx.stack[pd->ncx.current_depth])
            {
                char *label;

                label = (char *)malloc(length + 1);
                if (label)
                {
                    memcpy(label, content, length);
                    label[length] = '\0';
                    pd->ncx.stack[pd->ncx.current_depth]->label = label;
                }
            }
        }
    }
    else if (type == EINA_SIMPLE_XML_CLOSE)
    {
        if (strncmp("docTitle", content, strlen("docTitle")) == 0)
        {
            pd->ncx.has_title = 0;
        }
        else if (strncmp("docAuthor", content, strlen("docAuthor")) == 0)
        {
            pd->ncx.has_author = 0;
        }
        else if (strncmp("navPoint", content, strlen("navPoint")) == 0)
        {
            pd->ncx.has_navpoint = 0;
            if (pd->ncx.stack[pd->ncx.current_depth])
            {
                if (pd->ncx.current_depth == 0)
                    eina_array_push(&pd->doc.toc, pd->ncx.stack[pd->ncx.current_depth]);
                else
                    eina_array_push(pd->ncx.stack[pd->ncx.current_depth - 1]->child, pd->ncx.stack[pd->ncx.current_depth]);
            }
            pd->ncx.current_depth--;
        }
        else if (strncmp("navMap", content, strlen("navMap")) == 0)
        {
            free(pd->ncx.stack);
            pd->ncx.stack = NULL;
        }
        else if (strncmp("text", content, strlen("text")) == 0)
        {
            if (pd->ncx.has_title)
                pd->ncx.has_title_text = 0;
            if (pd->ncx.has_author)
                pd->ncx.has_author_text = 0;
            if (pd->ncx.has_navpoint)
                pd->ncx.has_navpoint_text = 0;
        }
    }

    return EINA_TRUE;
}
예제 #19
0
//return 0 on success
Render_Node *render_state_getjob( Render_State *state)
{
  int i;
  Rect area;
  Tilehash hash;
  Render_Node *node;
  Tile *tile;
  Render_Node *jobnode;
  int found;
  struct timespec t_start;
  struct timespec t_stop;
  
  if (ea_count(state->ready))
    return ea_pop(state->ready);
  
  if (!ea_count(state->currstate)) {
    
    if (state->pending) {
      
      if (!ea_count(state->ready)) {
        clock_gettime(CLOCK_MONOTONIC,&t_start);
        lime_unlock();
        while(state->pending && !ea_count(state->ready)) {
          usleep(1000);
          lime_lock();
          lime_unlock();
        }
        lime_lock();
        
        clock_gettime(CLOCK_MONOTONIC,&t_stop);
        printf("we were blocked!\n");
        global_stat_thread_blocked += t_stop.tv_sec - t_start.tv_sec
        +  (t_stop.tv_nsec - t_start.tv_nsec)*1.0/1000000000.0;
      }
      
      assert(ea_count(state->ready));
      
      return ea_pop(state->ready);
    }

    return NULL;
  }

  node = ea_data(state->currstate, ea_count(state->currstate)-1);
    
  while (node) {
    if (!end_of_iteration(node)) {
      area.corner.x = node->pos.x;
      area.corner.y = node->pos.y;
      area.corner.scale = node->pos.scale;
      area.width = node->tw;
      area.height = node->th;
      
      hash = tile_hash_calc(filter_get_input_filter(node->f, node->channel), &area);
         
      if ((tile = cache_tile_get(&hash))) {
	
	cache_stats_update(tile, 1, 0, 0, 0);
	  
	assert(node->mode);
	  
	//check if we're alredy waiting for this tile on another channel
	found = 0;
	if (tile->want)
	  for(i=0;i<ea_count(tile->want);i++)
	    if (node == ea_data(tile->want, i)) {
	      found = 1;
	      break;
	  }
	  
	  if (found) {
	    //do nothing, we just continue
	    
	  }
	  else if (!tile->channels) {
	    //tile is not yet rendered, push ref
	    
	    if (!tile->want)
	      tile->want = eina_array_new(4);

	    node->need++;
	    ea_push(tile->want, node);
	  }
	  else {
	    if (node->mode == MODE_CLOBBER) {
	      //TODO attention: we assume channels are always processed in the same order
	      clobbertile_add(ea_data(node->inputs, node->channel), ea_data(tile->channels, node->channel));
	      assert(ea_count(node->inputs) > node->channel);
	    }
	    else if (node->mode == MODE_ITER) {
	      node->f->mode_iter->worker(node->f, ea_data(tile->channels, node->channel), node->channel, NULL, NULL, 0);
	    }
	    else
	      abort();
	  }
	  
	incnode(node);
      }
      //this node does not need any input tiles
      else if (!ea_count(node->f_source_curr->node->con_ch_in)) {
	jobnode = render_node_new(node->f_source_curr, tile_new(&area, hash, node->f_source_curr, node->f, node->depth), state, node->depth+1);
	assert(jobnode->f->fixme_outcount);
	cache_tile_add(jobnode->tile);
	cache_stats_update(jobnode->tile, 0, 1, 0, 0);

	//don't incnode so parent node will recheck for this tile
	//the parent will propably be added to tile->need
	return jobnode;
      }
      //node needs input tiles
      else {
	tile = tile_new(&area, hash, node->f_source_curr, node->f, node->depth);
	cache_stats_update(tile, 0, 1, 0, 0);
	if (node->f->fixme_outcount);
	  cache_tile_add(tile);
        
	jobnode = render_node_new(node->f_source_curr, tile, state, node->depth+1);
        
        tile->want = eina_array_new(4);
        node->need++;
        ea_push(tile->want, node);
        //FIXME this incnode would cause problems with tiffsave!
        //incnode(node);
        
        node = jobnode;
        
	//don't incnode so parent node will recheck for this tile
	//the parent will propably be added to tile->need
	
	ea_push(state->currstate, node);
	//to lock it in the currstate array
	node->need += 1000;
      }
    }
    else {
      //all inputs have been processed
      //this doesn't mean that all inputs are available
      jobnode = node;
      
      node = ea_pop(state->currstate);
      node->need -= 1000;
      
      assert(node == jobnode);

      if (jobnode->need) {
	//what happens with jobnode?
	//why this code??
	if (ea_count(state->currstate))
	  node = ea_data(state->currstate, ea_count(state->currstate)-1);
	else
	  node = NULL;
	state->pending++;
      }
      else
	return jobnode;
    }
  }
  
  if (ea_count(state->ready))
    return ea_pop(state->ready);
    
  if (state->pending) {
    lime_unlock();
    while(state->pending && !ea_count(state->ready)) {
      usleep(1000);
      lime_lock();
      lime_unlock();
    }

    lime_lock();
    
    assert(ea_count(state->ready));

    return ea_pop(state->ready);
  } 
  
  return NULL;
}
예제 #20
0
void filter_render_tile(Render_Node *job, int thread_id)
{
  int i;
  struct timespec t_start;
  struct timespec t_stop;
  Eina_Array *channels;
  
  assert(job->f->mode_buffer);
  assert(job->f->mode_buffer->worker != NULL);
  assert(!job->tile->channels);
  assert(job->tile->refs);
  assert(job->mode != MODE_ITER);
  
  if (job->f->fixme_outcount) {
    channels = eina_array_new(4);
  
    for(i=0;i<job->f->fixme_outcount;i++)
      ea_push(channels, tiledata_new(&job->tile->area, 1, job->tile));
  }
  else
    channels = 0;

  if (channels)
    assert(cache_tile_get(&job->tile->hash) != NULL);
  
  if (job->f->prepare && job->f->prepared_hash != job->f->hash.hash) {
    job->f->prepare(job->f);
    job->f->prepared_hash = job->f->hash.hash;
  }
  
  if (job->f->mode_buffer->threadsafe)
    lime_unlock();
  
  if (job->f->mode_buffer->threadsafe)
    filter_fill_thread_data(job->f, thread_id);
  /*else {
   *     if (!job->f->lock) {
   * job->f->lock = calloc(sizeof(pthread_mutex_t),1);
   * pthread_mutex_init(job->f->lock, NULL);
   }
   pthread_mutex_lock(job->f->lock);
   }*/
  
  clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t_start);
  
  if (job->f->mode_buffer->threadsafe)
    job->f->mode_buffer->worker(job->f, job->inputs, channels, &job->tile->area, thread_id);
  else
    job->f->mode_buffer->worker(job->f, job->inputs, channels, &job->tile->area, 0);
    
  
  clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t_stop);
  
  //if (!job->f->mode_buffer->threadsafe)
  //  pthread_mutex_unlock(job->f->lock);
  
  if (job->f->mode_buffer->threadsafe)
    lime_lock();
  
  job->tile->time = t_stop.tv_sec*1000000000 - t_start.tv_sec*1000000000
  +  t_stop.tv_nsec - t_start.tv_nsec;
  
  job->tile->channels = channels;
  cache_stats_update(job->tile, 0, 0, job->tile->time, 0);
  
  //printf("render add %p filter %s\n", job->tile, job->f->fc->shortname);
  //???
  //if (job->f->fixme_outcount)
  //  cache_tile_channelmem_add(job->tile);
}
예제 #21
0
//f_source: source-filter by channel
Render_Node *render_node_new(Filter *f, Tile *tile, Render_State *state, int depth)
{
  int i;
  Rect inputs_area;
  Render_Node *node = calloc(sizeof(Render_Node), 1);
  Rect *area;
  
  if (tile)
    area = &tile->area;
  else
    area = NULL;
  
  node->state = state;
  node->depth = depth;

  if (f->node->con_ch_in && ea_count(f->node->con_ch_in))
      node->f_source = eina_array_new(4);
  
  for(i=0;i<ea_count(f->node->con_ch_in);i++)
    ea_push(node->f_source,  filter_get_input_filter(f, i));

  
  node->f = f;
  node->tile = tile;
  
  node->inputs = eina_array_new(4);
  
  if (node->f_source && f->mode_iter) {
    node->mode = MODE_ITER;
    
    node->iter = f->mode_iter->iter_new(f, area, node->f_source, &node->pos, &node->channel);
    
    node->f_source_curr = ea_data(node->f_source, node->channel);
        
    node->tw = tw_get(node->f_source_curr, node->area.corner.scale);
    node->th = th_get(node->f_source_curr, node->area.corner.scale);
  }
  else if (node->f_source && f->mode_buffer) {
    node->mode = MODE_CLOBBER;
    
    node->channel = 0;

    assert(area);
    
    filter_calc_valid_req_area(f, area, &node->area);
    
    node->f_source_curr = ea_data(node->f_source, node->channel);
        
    node->tw = tw_get(node->f_source_curr, node->area.corner.scale);
    node->th = th_get(node->f_source_curr, node->area.corner.scale);
    
    assert(f->node->con_ch_in && ea_count(f->node->con_ch_in));
  
    if (node->area.corner.x >= 0)
      node->pos.x = (node->area.corner.x/node->tw)*node->tw;
    else
      node->pos.x = ((node->area.corner.x-node->tw+1)/node->tw)*node->tw;
    if (node->area.corner.y >= 0)
      node->pos.y = (node->area.corner.y/node->th)*node->th;
    else
      node->pos.y = ((node->area.corner.y-node->th+1)/node->th)*node->th;
    node->pos.scale = node->area.corner.scale;

    //this is the input provided to filtes, so it will always be as large as actually requested by the filter
    filter_calc_req_area(f, area, &inputs_area);
    
    for(i=0;i<ea_count(f->node->con_ch_in);i++)
      ea_push(node->inputs, tiledata_new(&inputs_area, 1, NULL));
  }
  else
    node->mode = MODE_INPUT;

  
  return node;
}
예제 #22
0
char *
_nedje_text_escape(const char *text)
{
   Eina_Strbuf *txt;
   char *ret;
   const char *text_end;
   size_t text_len;
   Eina_Array *arr;
   const char *cur_tag = NULL;

   if (!text) return NULL;

   txt = eina_strbuf_new();
   text_len = strlen(text);
   arr = eina_array_new(3);

   text_end = text + text_len;
   while (text < text_end)
     {
        int advance;

        if ((text[0] == '<') && text[1])
          {
             const char *tag, *popped;
             Eina_Bool closing = EINA_FALSE;

             if (text[1] == '/') //closing tag
               {
                  closing = EINA_TRUE;
                  tag = _get_tag(text + 2);
               }
             else
               tag = _get_tag(text + 1);
             if (closing)
               {
                  if (cur_tag && (tag != cur_tag))
                    {
                       /* tag mismatch: autoclose all failure tags
                        * not technically required by the spec,
                        * but it makes me feel better about myself
                        */
                       do
                         {
                            popped = eina_array_pop(arr);
                            if (eina_array_count(arr))
                              cur_tag = eina_array_data_get(arr, eina_array_count(arr) - 1);
                            else
                              cur_tag = NULL;
                            eina_strbuf_append_printf(txt, "</%c>", popped[1]);
                         } while (cur_tag && (popped != tag));
                       advance = 4;
                    }
                  else if (cur_tag)
                    {
                       /* tag match: just pop */
                       popped = eina_array_pop(arr);
                       if (eina_array_count(arr))
                         cur_tag = eina_array_data_get(arr, eina_array_count(arr) - 1);
                       else
                         cur_tag = NULL;
                       eina_strbuf_append_printf(txt, "</%c>", popped[1]);
                       advance = 4;
                    }
                  else
                    {
                       /* no current tag: escape */
                       advance = _text_escape(txt, text);
                    }
               }
             else
               {
                  if (tag)
                    {
                       cur_tag = tag;
                       eina_array_push(arr, tag);
                       eina_strbuf_append_printf(txt, "<%c>", tag[1]);
                       advance = 3;
                    }
                  else
                    advance = _text_escape(txt, text);
               }
          }
        else if (text[0] == '&')
          {
             const char *s;

             s = strchr(text, ';');
             if (s)
               s = evas_textblock_escape_string_range_get(text, s + 1);
             if (s)
               {
                  eina_strbuf_append_char(txt, text[0]);
                  advance = 1;
               }
             else
               advance = _text_escape(txt, text);
          }
        else
          advance = _text_escape(txt, text);

        text += advance;
     }

   eina_array_free(arr);
   ret = eina_strbuf_string_steal(txt);
   eina_strbuf_free(txt);
   return ret;
}
예제 #23
0
struct wkb_ibus_lookup_table *
wkb_ibus_lookup_table_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   struct wkb_ibus_lookup_table *table = calloc(1, sizeof(*table));
   struct wkb_ibus_text *text = NULL;
   Eldbus_Message_Iter *iter_table, *candidates, *labels, *t;

   EINA_SAFETY_ON_NULL_RETURN_VAL(table, NULL);

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}uubbiavav)", &iter_table);
   if (!eldbus_message_iter_arguments_get(iter_table, "sa{sv}uubbiavav",
                                          &ignore.text, &ignore.dict,
                                          &table->page_size, &table->cursor_pos,
                                          &table->cursor_visible, &table->round,
                                          &table->orientation, &candidates,
                                          &labels))
     {
        ERR("Error deserializing IBusLookupTable");
        free(table);
        table = NULL;
        goto end;
     }

   DBG("Lookup table:");
   DBG("\tPage size.......: '%d'", table->page_size);
   DBG("\tCursor position.: '%d'", table->cursor_pos);
   DBG("\tCursor visible..: '%d'", table->cursor_visible);
   DBG("\tRound...........: '%d'", table->round);
   DBG("\tOrientation.....: '%d'", table->orientation);
   DBG("\tCandidates......: '%p'", candidates);
   DBG("\tLabels..........: '%p'", labels);

   if (!candidates)
     {
        INF("Lookup table has no candidates");
        goto labels;
     }

   while (eldbus_message_iter_get_and_next(candidates, 'v', &t))
     {
        if (!(text = wkb_ibus_text_from_message_iter(t)))
          {
             wkb_ibus_lookup_table_free(table);
             table = NULL;
             goto end;
          }

        if (!table->candidates)
           table->candidates = eina_array_new(10);

        DBG("Appending new candidate %s", text->text);
        eina_array_push(table->candidates, text);
     }

labels:
   if (!labels)
     {
        INF("Lookup table has no labels");
        goto end;
     }

   while (eldbus_message_iter_get_and_next(labels, 'v', &t))
     {
        if (!(text = wkb_ibus_text_from_message_iter(t)))
          {
             wkb_ibus_lookup_table_free(table);
             table = NULL;
             goto end;
          }

        if (!table->labels)
           table->labels = eina_array_new(10);

        DBG("Appending new label %s", text->text);
        eina_array_push(table->labels, text);
     }

end:
   return table;
}
예제 #24
0
/*
 * List depends on:
 *  - state->sort
 *  - state->tags
 *  - state->filter
 *  - dir contents on FS
 */
static Eina_Array *
_fill_files(const madshelf_state_t *state, const char *dir, int *old_pos)
{
    char *old_file = curdir_get(dir);
    if(old_pos) *old_pos = -1;

    Eina_Array *files = eina_array_new(10);

    /* HACK: using global variable to pas state into sort function */
    cur_dir = !strcmp(dir, "/") ? "" : dir;

    Eina_List *ls = ecore_file_ls(dir);
    ls = eina_list_sort(ls, eina_list_count(ls),
                        state->sort == MADSHELF_SORT_NAME ? &_name
                        : (state->sort == MADSHELF_SORT_NAMEREV ? &_namerev
                           : &_daterev));

    /* First select directories */
    for (Eina_List *i = ls; i; i = eina_list_next(i)) {
        const char *file = eina_list_data_get(i);
        char *filename = xasprintf("%s/%s", !strcmp(dir, "/") ? "" : dir, file);

        if (!ecore_file_is_dir(filename)) {
            free(filename);
            continue;
        }

        if (!state->show_hidden && is_hidden(state, filename)) {
            free(filename);
            continue;
        }

        if (old_file && old_pos)
            if (!strcmp(old_file, file))
                *old_pos = eina_array_count_get(files);
        eina_array_push(files, filename);
    }

    /* Then files */
    for (Eina_List *i = ls; i; i = eina_list_next(i)) {
        const char *file = eina_list_data_get(i);
        char *filename = xasprintf("%s/%s", !strcmp(dir, "/") ? "" : dir, file);

        if (ecore_file_is_dir(filename)) {
            free(filename);
            continue;
        }

        if (!state->show_hidden && is_hidden(state, filename)) {
            free(filename);
            continue;
        }

        if (old_file && old_pos)
            if (!strcmp(old_file, file))
                *old_pos = eina_array_count_get(files);
        eina_array_push(files, filename);
    }

    char* s;
    EINA_LIST_FREE(ls, s)
        free(s);

    free(old_file);

    return files;
}
예제 #25
0
static Eina_Value *
azy_value_deserialize_struct_json(cJSON *object)
{
   Eina_Array *st_members, *st_values;
   unsigned int offset = 0, z = 0;
   Eina_Value *value_st = NULL;
   Eina_Value_Struct_Member *members;
   Eina_Value_Struct_Desc *st_desc;
   const char *name;
   cJSON *child;

   st_desc = azy_value_util_struct_desc_new();
   st_members = eina_array_new(1);
   st_values = eina_array_new(1);

   for (child = object->child; child; child = child->next)
     {
        Eina_Value_Struct_Member *m;
        const Eina_Value_Type *type;
        Eina_Value *v;

        type = _azy_value_type_get(child);
        if (!type) goto end;
        name = child->string;
        m = (Eina_Value_Struct_Member*)calloc(1, sizeof(Eina_Value_Struct_Member));
        m->name = eina_stringshare_add(name);
        offset = azy_value_util_type_offset(type, offset);
        m->offset = offset;
        offset += azy_value_util_type_size(type);
        m->type = type;
        eina_array_push(st_members, m);

        v = azy_value_deserialize_json(child);
        if (!v) goto end;
        eina_array_push(st_values, v);
        z++;
     }
   if (!z)
     {
        free(st_desc);
        goto end;
     }

   members = (Eina_Value_Struct_Member*)malloc(eina_array_count(st_members) * sizeof(Eina_Value_Struct_Member));
   for (z = 0; z < eina_array_count(st_members); z++)
     {
        Eina_Value_Struct_Member *m = (Eina_Value_Struct_Member*)eina_array_data_get(st_members, z);
        members[z].name = m->name;
        members[z].offset = m->offset;
        members[z].type = m->type;
        free(m);
     }

   //setup
   st_desc->members = members;
   st_desc->member_count = eina_array_count(st_members);
   st_desc->size = offset;
   value_st = eina_value_struct_new(st_desc);

   //filling with data
   for (z = 0; z < eina_array_count(st_values); z++)
     {
        Eina_Value *v = (Eina_Value*)eina_array_data_get(st_values, z);
        eina_value_struct_value_set(value_st, members[z].name, v);
        eina_value_free(v);
     }

end:
   eina_array_free(st_members);
   eina_array_free(st_values);
   return value_st;
}
예제 #26
0
파일: module.c 프로젝트: GeeXboX/enna
/**
 * @brief Init the module system
 */
int
enna_module_init(void)
{
    Eina_Array_Iterator iterator;
    unsigned int i;
    
#ifdef USE_STATIC_MODULES
    Enna_Module_Api *api;

    /* Populate the array of available plugins statically */
    _plugins_array = eina_array_new(20);
    #ifdef BUILD_ACTIVITY_BOOKSTORE
        eina_array_push(_plugins_array, &enna_mod_activity_bookstore_api);
    #endif
    #ifdef BUILD_ACTIVITY_CONFIGURATION
        eina_array_push(_plugins_array, &enna_mod_activity_configuration_api);
    #endif
    #ifdef BUILD_ACTIVITY_GAMES
        eina_array_push(_plugins_array, &enna_mod_activity_games_api);
    #endif
    #ifdef BUILD_ACTIVITY_MUSIC
        eina_array_push(_plugins_array, &enna_mod_activity_music_api);
    #endif
    #ifdef BUILD_ACTIVITY_PHOTO
        eina_array_push(_plugins_array, &enna_mod_activity_photo_api);
    #endif
    #ifdef BUILD_ACTIVITY_TV
        eina_array_push(_plugins_array, &enna_mod_activity_tv_api);
    #endif
    #ifdef BUILD_ACTIVITY_VIDEO
        eina_array_push(_plugins_array, &enna_mod_activity_video_api);
    #endif
    #ifdef BUILD_ACTIVITY_WEATHER
        eina_array_push(_plugins_array, &enna_mod_activity_weather_api);
    #endif
    #ifdef BUILD_BROWSER_CDDA
        eina_array_push(_plugins_array, &enna_mod_browser_cdda_api);
    #endif
    #ifdef BUILD_BROWSER_DVD
        eina_array_push(_plugins_array, &enna_mod_browser_dvd_api);
    #endif
    #ifdef BUILD_BROWSER_IPOD
        eina_array_push(_plugins_array, &enna_mod_browser_ipod_api);
    #endif
    #ifdef BUILD_BROWSER_SPOTIFY
        eina_array_push(_plugins_array, &enna_mod_browser_spotify_api);
    #endif
    #ifdef BUILD_BROWSER_LOCALFILES
        eina_array_push(_plugins_array, &enna_mod_browser_localfiles_api);
    #endif
    #ifdef BUILD_BROWSER_NETSTREAMS
        eina_array_push(_plugins_array, &enna_mod_browser_netstreams_api);
    #endif
    #ifdef BUILD_BROWSER_PODCASTS
        eina_array_push(_plugins_array, &enna_mod_browser_podcasts_api);
    #endif
    #ifdef BUILD_BROWSER_SHOUTCAST
        eina_array_push(_plugins_array, &enna_mod_browser_shoutcast_api);
    #endif
    #ifdef BUILD_BROWSER_UPNP
        eina_array_push(_plugins_array, &enna_mod_browser_upnp_api);
    #endif
    #ifdef BUILD_BROWSER_VALHALLA
        eina_array_push(_plugins_array, &enna_mod_browser_valhalla_api);
    #endif
    #ifdef BUILD_GADGET_DATE
        eina_array_push(_plugins_array, &enna_mod_gadget_date_api);
    #endif
    #ifdef BUILD_GADGET_DUMMY
        eina_array_push(_plugins_array, &enna_mod_gadget_dummy_api);
    #endif
    #ifdef BUILD_GADGET_WEATHER
        eina_array_push(_plugins_array, &enna_mod_gadget_weather_api);
    #endif
    #ifdef BUILD_INPUT_KBD
        eina_array_push(_plugins_array, &enna_mod_input_kbd_api);
    #endif
    #ifdef BUILD_INPUT_LIRC
        eina_array_push(_plugins_array, &enna_mod_input_lirc_api);
    #endif
    #ifdef BUILD_INPUT_WIIMOTE
        eina_array_push(_plugins_array, &enna_mod_input_wiimote_api);
    #endif
    #ifdef BUILD_VOLUME_HAL
        eina_array_push(_plugins_array, &enna_mod_volume_hal_api);
    #endif
    #ifdef BUILD_VOLUME_MTAB
        eina_array_push(_plugins_array, &enna_mod_volume_mtab_api);
    #endif
    #ifdef BUILD_VOLUME_UDEV
        eina_array_push(_plugins_array, &enna_mod_volume_udev_api);
    #endif

    /* Log the array */
    enna_log(ENNA_MSG_INFO, NULL, "Available Plugins (static):");
    EINA_ARRAY_ITER_NEXT(_plugins_array, i, api, iterator)
        enna_log(ENNA_MSG_INFO, NULL, "\t * %s", api->name);

#else
    Eina_Module *module;

    /* Populate the array of available plugins dinamically */
    _plugins_array = eina_array_new(20);
    _plugins_array = eina_module_list_get(_plugins_array,
                        PACKAGE_LIB_DIR"/enna/modules/", 0, NULL, NULL);
    enna_log(ENNA_MSG_INFO, NULL,
              "Plugin Directory: %s", PACKAGE_LIB_DIR"/enna/modules/");

    /* Log the array */
    enna_log(ENNA_MSG_INFO, NULL, "Available Plugins (dynamic):");
    EINA_ARRAY_ITER_NEXT(_plugins_array, i, module, iterator)
        enna_log(ENNA_MSG_INFO, NULL, "\t * %s", eina_module_file_get(module));
#endif /* USE_STATIC_MODULES */

#if ENABLE_CONFIG_PANEL
    _config_panel = enna_config_panel_register(_("Modules"), "icon/module",
                                  _config_panel_show, _config_panel_hide, NULL);
#endif

    return 0;
}