bool platformInitialize() override
    {
        if (!eina_init())
            return false;

        if (!ecore_init()) {
            // Could not init ecore.
            eina_shutdown();
            return false;
        }

#ifdef HAVE_ECORE_X
        XSetExtensionErrorHandler(dummyExtensionErrorHandler);

        if (!ecore_x_init(0)) {
            // Could not init ecore_x.
            // PlatformScreenEfl and systemBeep() functions
            // depend on ecore_x functionality.
            ecore_shutdown();
            eina_shutdown();
            return false;
        }
#endif

        if (!ecore_evas_init()) {
#ifdef HAVE_ECORE_X
            ecore_x_shutdown();
#endif
            ecore_shutdown();
            eina_shutdown();
            return false;
        }

        if (!edje_init()) {
            ecore_evas_shutdown();
#ifdef HAVE_ECORE_X
            ecore_x_shutdown();
#endif
            ecore_shutdown();
            eina_shutdown();
            return false;
        }

        if (!ecore_main_loop_glib_integrate())
            return false;

        SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment();
        return true;
    }
Beispiel #2
0
/**
 * Initialize libraries
 */
int
elicit_libs_init(void)
{
  BrInitError error;

  if (!br_init(&error) && error != BR_INIT_ERROR_DISABLED)
    fprintf(stderr, "[Elicit] Failed to initialize binreloc (error code: %d)\nFalling back to hardcoded paths.", error);

  if (!eina_init())
  {
    fprintf(stderr, "[Elicit] Failed to initialize eina.\n");
    return 0;
  }
  if (!ecore_init())
  {
    fprintf(stderr, "[Elicit] Failed to initialize ecore.\n");
    eina_shutdown();
    return 0;
  }
  if (!ecore_evas_init() ||
      !ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_XLIB))
  {
    fprintf(stderr, "[Elicit] Failed to initialize ecore_evas.\n");
    fprintf(stderr, "[Elicit] Make sure you have the evas software X11 engine installed.\n");
    eina_shutdown();
    ecore_shutdown();
    return 0;
  }
  if (!ecore_file_init())
  {
    fprintf(stderr, "[Elicit] Failed to initialize ecore_file.\n");
    eina_shutdown();
    ecore_shutdown();
    ecore_evas_shutdown();
    return 0;
  }
  if (!edje_init())
  {
    fprintf(stderr, "[Elicit] Failed to initialize edje.\n");
    eina_shutdown();
    ecore_shutdown();
    ecore_evas_shutdown();
    ecore_file_shutdown();
    return 0;
  }

  return 1;
}
Beispiel #3
0
/**
 * Set up connections, signal handlers, sockets etc.
 * @return 1 or greater on success, 0 otherwise
 *
 * This function sets up all singal handlers and the basic event loop. If it
 * succeeds, 1 will be returned, otherwise 0 will be returned.
 *
 * @code
 * #include <Ecore.h>
 *
 * int main(int argc, char **argv)
 * {
 *   if (!ecore_init())
 *   {
 *     printf("ERROR: Cannot init Ecore!\n");
 *     return -1;
 *   }
 *   ecore_main_loop_begin();
 *   ecore_shutdown();
 * }
 * @endcode
 */
EAPI int ecore_init(void)
{
	if (++_ecore_init_count != 1)
		return _ecore_init_count;

#ifdef HAVE_LOCALE_H
	setlocale(LC_CTYPE, "");
#endif
	/*
	   if (strcmp(nl_langinfo(CODESET), "UTF-8"))
	   {
	   WRN("Not a utf8 locale!");
	   }
	 */
#ifdef HAVE_EVIL
	if (!evil_init())
		return --_ecore_init_count;
#endif
	if (!eina_init())
		goto shutdown_evil;
	_ecore_log_dom =
	    eina_log_domain_register("Ecore", ECORE_DEFAULT_LOG_COLOR);
	if (_ecore_log_dom < 0) {
		EINA_LOG_ERR("Ecore was unable to create a log domain.");
		goto shutdown_log_dom;
	}
	if (getenv("ECORE_FPS_DEBUG"))
		_ecore_fps_debug = 1;
	if (_ecore_fps_debug)
		_ecore_fps_debug_init();
	_ecore_main_loop_init();
	_ecore_signal_init();
	_ecore_exe_init();
	_ecore_thread_init();
	_ecore_glib_init();
	_ecore_job_init();
	_ecore_time_init();

#if HAVE_MALLINFO
	if (getenv("ECORE_MEM_STAT")) {
		_ecore_memory_pid = getpid();
		ecore_animator_add(_ecore_memory_statistic, NULL);
	}
#endif

#if defined(GLIB_INTEGRATION_ALWAYS)
	if (_ecore_glib_always_integrate)
		ecore_main_loop_glib_integrate();
#endif

	return _ecore_init_count;

      shutdown_log_dom:
	eina_shutdown();
      shutdown_evil:
#ifdef HAVE_EVIL
	evil_shutdown();
#endif
	return --_ecore_init_count;
}
Beispiel #4
0
END_TEST

START_TEST(eina_binshare_small)
{
   char buf[4];
   int i;

   eina_init();

   for (i = 1; i < 3; i++)
     {
        const char *t0, *t1;
        int j;

        for (j = 0; j < i; j++)
          {
             char c;
             for (c = 'a'; c <= 'z'; c++)
                buf[j] = c;
          }
        buf[i] = '\0';
        t0 = eina_binshare_add_length(buf, i);
        t1 = eina_binshare_add_length(buf, i);

        fail_if(t0 == NULL);
        fail_if(t1 == NULL);
        fail_if(t0 != t1);
        fail_if(memcmp(t0, buf, i) != 0);

        eina_binshare_del(t0);
        eina_binshare_del(t1);
     }
   eina_shutdown();
}
Beispiel #5
0
int
escarg_init(void)
{
   if (++_escarg_init_count != 1)
     return _escarg_init_count;

   if (!eina_init())
     {
       fprintf(stderr, "Escarg can not initialize Eina\n");
       return --_escarg_init_count;
     }

   _escarg_log_dom_global = eina_log_domain_register("escarg", EINA_COLOR_RED);
   if (_escarg_log_dom_global < 0)
     {
        EINA_LOG_ERR("Escarg can not create a general log domain.");
        goto shutdown_eina;
     }


   DBG("Successfully started");
   return _escarg_init_count;

shutdown_eina:
   eina_shutdown();
   return --_escarg_init_count;
}
Beispiel #6
0
END_TEST

START_TEST(eina_hash_extended)
{
   Eina_Hash *hash = NULL;
   int i;

        fail_if(eina_init() != 2);

   hash = eina_hash_string_djb2_new(NULL);
        fail_if(hash == NULL);

        fail_if(eina_hash_direct_add(hash, "42", "42") != EINA_TRUE);

   for (i = 43; i < 3043; ++i)
     {
        char *tmp = malloc(10);
        fail_if(!tmp);
        eina_convert_itoa(i, tmp);
        fail_if(eina_hash_direct_add(hash, tmp, tmp) != EINA_TRUE);
     }

        fail_if(eina_hash_find(hash, "42") == NULL);

        eina_hash_free(hash);

   fail_if(eina_shutdown() != 1);
}
END_TEST

START_TEST(binbuf_manage_simple)
{
   Eina_Binbuf *buf;
   const char *_cbuf = "12\0 456 78\0 abcthis is some more random junk here!";
   const unsigned char *cbuf = (const unsigned char *) _cbuf;
   size_t size = sizeof(cbuf) - 1; /* We don't care about the real NULL */
   unsigned char *alloc_buf = malloc(size);
   memcpy(alloc_buf, cbuf, size);

   eina_init();

   buf = eina_binbuf_manage_new_length(alloc_buf, size);
   fail_if(!buf);

   fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
   fail_if(size != eina_binbuf_length_get(buf));
   eina_binbuf_append_length(buf, cbuf, size);
   fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
   fail_if(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));
   fail_if(2 * size != eina_binbuf_length_get(buf));

   eina_binbuf_free(buf);

   eina_shutdown();
}
Beispiel #8
0
EAPI int
estate_init(void)
{
   if (++_init_count == 1)
     {
        if (EINA_UNLIKELY(!eina_init()))
          {
             EINA_LOG_CRIT("Failed to init Eina");
             return --_init_count;
          }
        _estate_log_dom = eina_log_domain_register("estate", EINA_COLOR_WHITE);
        if (EINA_UNLIKELY(_estate_log_dom < 0))
          {
             EINA_LOG_CRIT("Failed to create log domain");
             eina_shutdown();
             return --_init_count;
          }
#if 0
        ESTATE_EVENT_ENTERER = ecore_event_type_new();
        ESTATE_EVENT_EXITER = ecore_event_type_new();
        ESTATE_EVENT_TRANSITION = ecore_event_type_new();
#endif
     }
   return _init_count;
}
Beispiel #9
0
END_TEST

/* eina_binbuf_manage_new_length and eina_binbuf_manage_read_only_new_length
 * are deprecated */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
START_TEST(binbuf_manage_simple)
{
   Eina_Binbuf *buf;
   const char *_cbuf = "12\0 456 78\0 abcthis is some more random junk here!";
   const unsigned char *cbuf = (const unsigned char *) _cbuf;
   size_t size = sizeof(cbuf) - 1; /* We don't care about the real NULL */
   unsigned char *alloc_buf = malloc(size);
   memcpy(alloc_buf, cbuf, size);

   eina_init();

   buf = eina_binbuf_manage_new_length(alloc_buf, size);
   fail_if(!buf);

   fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
   fail_if(size != eina_binbuf_length_get(buf));
   eina_binbuf_append_length(buf, cbuf, size);
   fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
   fail_if(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));
   fail_if(2 * size != eina_binbuf_length_get(buf));

   eina_binbuf_free(buf);

   eina_shutdown();
}
Beispiel #10
0
int
main(int argc, char **argv)
{
   Eina_List *list = NULL;
   Eina_List *l;
   void *list_data;

   eina_init();

   list = eina_list_append(list, eina_stringshare_add("calvin"));
   list = eina_list_append(list, eina_stringshare_add("Leoben"));
   list = eina_list_append(list, eina_stringshare_add("D'Anna"));
   list = eina_list_append(list, eina_stringshare_add("Simon"));
   list = eina_list_append(list, eina_stringshare_add("Doral"));
   list = eina_list_append(list, eina_stringshare_add("Six"));
   list = eina_list_append(list, eina_stringshare_add("Sharon"));

   for(l = list; l; l = eina_list_next(l))
     printf("%s\n", (char*)l->data);

   for(l = eina_list_last(list); l; l = eina_list_prev(l))
      printf("%s\n", (char*)eina_list_data_get(l));

   EINA_LIST_FREE(list, list_data)
     eina_stringshare_del(list_data);

   eina_shutdown();

   return 0;
}
Beispiel #11
0
EAPI int
efreet_shutdown(void)
{
   if (_efreet_init_count <= 0)
     {
        EINA_LOG_ERR("Init count not greater than 0 in shutdown.");
        return 0;
     }
   if (--_efreet_init_count != 0)
     return _efreet_init_count;

   efreet_util_shutdown();
   efreet_menu_shutdown();
   efreet_desktop_shutdown();
   efreet_ini_shutdown();
   efreet_icon_shutdown();
   efreet_xml_shutdown();
   efreet_cache_shutdown();
   efreet_base_shutdown();

   IF_RELEASE(efreet_lang);
   IF_RELEASE(efreet_lang_country);
   IF_RELEASE(efreet_lang_modifier);
   IF_RELEASE(efreet_language);
   efreet_parsed_locale = 0;  /* reset this in case they init efreet again */

   ecore_file_shutdown();
   ecore_shutdown();
   eet_shutdown();
   eina_shutdown();

   return _efreet_init_count;
}
Beispiel #12
0
END_TEST

#ifdef HAVE_ICONV
START_TEST(str_convert)
{
   char *utf8 = "\xc3\xa9\xc3\xa1\xc3\xba\xc3\xad\xc3\xa8\xc3\xa0\xc3\xb9\xc3\xac\xc3\xab\xc3\xa4\xc3\xbc\xc3\xaf";
   char *utf16 = "\xe9\x0\xe1\x0\xfa\x0\xed\x0\xe8\x0\xe0\x0\xf9\x0\xec\x0\xeb\x0\xe4\x0\xfc\x0\xef\x0";
   char *ret;
   size_t ret_sz;
   int i;

   eina_init();

   ret = eina_str_convert("UTF-8", "UTF-16LE", utf8);
        fail_if(ret == NULL);
        for( i=0; i<24; i++)
          fail_if(ret[i] != utf16[i]);

   free(ret);

   ret = eina_str_convert_len("UTF-8", "UTF-16LE", utf8, 24, &ret_sz);
        fail_if(ret == NULL);
        fail_if(ret_sz != 24);
        for( i=0; i<24; i++)
          fail_if(ret[i] != utf16[i]);
   free(ret);

   eina_shutdown();
}
Beispiel #13
0
END_TEST

START_TEST(str_join_len)
{
   char dst[9];
   size_t ret;
   size_t ds = (sizeof(dst) / sizeof(char));

   eina_init();

   dst[0] = '\0';

   ret = eina_str_join_len(dst, ds, '#', "ab", 2, "cde", 3);
        fail_if(ret != 6);
        fail_if(strcmp(dst, "ab#cde") != 0);

   ret = eina_str_join_len(dst, ds, '#', "abcdefghi", 9, "cde", 3);
        fail_if(ret != 13);
        fail_if(strcmp(dst, "abcdefgh") != 0);

   ret = eina_str_join_len(dst, ds, '#', "abcdefgh", 8, "cde", 3);
        fail_if(ret != 12);
        fail_if(strcmp(dst, "abcdefgh") != 0);

   ret = eina_str_join_len(dst, ds, '#', "abcd", 4, "efgh", 4);
        fail_if(ret != 9);
        fail_if(strcmp(dst, "abcd#efg") != 0);

   eina_shutdown();
}
int main(int argc, char **argv)
{
    Eina_Strbuf *buf;

    eina_init();

    buf = eina_strbuf_new();

    eina_strbuf_append_length(buf, "buffe", 5);
    eina_strbuf_append_char(buf, 'r');
    printf("%s\n", eina_strbuf_string_get(buf));

    eina_strbuf_insert_escaped(buf, "my ", 0);
    printf("%s\n", eina_strbuf_string_get(buf));
    eina_strbuf_reset(buf);

    eina_strbuf_append_escaped(buf, "my buffer");
    printf("%s\n", eina_strbuf_string_get(buf));
    eina_strbuf_reset(buf);

    eina_strbuf_append_printf(buf, "%s%c", "buffe", 'r');
    eina_strbuf_insert_printf(buf, " %s: %d", 6, "length", eina_strbuf_length_get(buf));
    printf("%s\n", eina_strbuf_string_get(buf));

    eina_strbuf_remove(buf, 0, 7);
    printf("%s\n", eina_strbuf_string_get(buf));

    eina_strbuf_replace_all(buf, "length", "size");
    printf("%s\n", eina_strbuf_string_get(buf));

    eina_strbuf_free(buf);
    eina_shutdown();

    return 0;
}
END_TEST

START_TEST(binbuf_remove)
{
   Eina_Binbuf *buf;
   const unsigned char cbuf[] = "12\0 456 78\0 abcthis is some more random junk here!";
   size_t size = sizeof(cbuf) - 1; /* We don't care about the real NULL */

   eina_init();

   buf = eina_binbuf_new();
   fail_if(!buf);

   eina_binbuf_append_length(buf, cbuf, size);
   fail_if(size != eina_binbuf_length_get(buf));
   eina_binbuf_remove(buf, 0, 4);
   fail_if(size - 4 != eina_binbuf_length_get(buf));
   eina_binbuf_remove(buf, 8, 1000);
   fail_if(8 != eina_binbuf_length_get(buf));
   eina_binbuf_remove(buf, 7, eina_binbuf_length_get(buf));
   fail_if(7 != eina_binbuf_length_get(buf));
   eina_binbuf_remove(buf, 2, 4);
   fail_if(5 != eina_binbuf_length_get(buf));
   eina_binbuf_remove(buf, 4, 1);
   fail_if(5 != eina_binbuf_length_get(buf));
   eina_binbuf_remove(buf, 0, eina_binbuf_length_get(buf));
   fail_if(0 != eina_binbuf_length_get(buf));

   eina_binbuf_free(buf);

   eina_shutdown();
}
END_TEST

START_TEST(eina_rectangle_intersect)
{
   Eina_Rectangle r1, r2, r3, r4, rd;

   fail_if(!eina_init());

   EINA_RECTANGLE_SET(&r1, 10, 10, 50, 50);
   EINA_RECTANGLE_SET(&r2, 20, 20, 20, 20);
   EINA_RECTANGLE_SET(&r3, 0, 0, 10, 10);
   EINA_RECTANGLE_SET(&r4, 30, 30, 50, 50);

   rd = r1;

   fail_if(eina_rectangle_intersection(&rd, &r3));
   fail_if(!eina_rectangle_intersection(&rd, &r2));

   fail_if(rd.x != r2.x
	   || rd.y != r2.y
	   || rd.w != r2.w
	   || rd.h != r2.h);

   rd = r1;

   fail_if(!eina_rectangle_intersection(&rd, &r4));

   fail_if(rd.x != 30
	   || rd.y != 30
	   || rd.w != 30
	   || rd.h != 30);

   eina_shutdown();
}
Beispiel #17
0
EAPI int
eeze_shutdown(void)
{
   if (_eeze_init_count <= 0)
     {
        EINA_LOG_ERR("Init count not greater than 0 in shutdown.");
        return 0;
     }
   if (--_eeze_init_count != 0)
     return _eeze_init_count;

   udev_unref(udev);
#ifdef HAVE_EEZE_MOUNT
   eeze_disk_shutdown();
#endif
   eeze_sensor_shutdown();
   eeze_net_shutdown();
   ecore_shutdown();
   eina_log_domain_unregister(_eeze_udev_log_dom);
   _eeze_udev_log_dom = -1;
   eina_log_domain_unregister(_eeze_net_log_dom);
   _eeze_net_log_dom = -1;
   eina_log_domain_unregister(_eeze_sensor_log_dom);
   _eeze_sensor_log_dom = -1;
   eina_shutdown();
   return _eeze_init_count;
}
Beispiel #18
0
int
ecore_wince_shutdown()
{
    HWND task_bar;

    if (--_ecore_wince_init_count != 0)
        return _ecore_wince_init_count;

    /* force task bar to be shown (in case the application exits */
    /* while being fullscreen) */
    task_bar = FindWindow(L"HHTaskBar", NULL);
    if (task_bar)
    {
        ShowWindow(task_bar, SW_SHOW);
        EnableWindow(task_bar, TRUE);
    }

    if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance))
        ERR("UnregisterClass() failed");

    if (!FreeLibrary(_ecore_wince_instance))
        ERR("FreeLibrary() failed");

    _ecore_wince_instance = NULL;

    ecore_event_shutdown();
    eina_log_domain_unregister(_ecore_wince_log_dom_global);
    _ecore_wince_log_dom_global = -1;
    eina_shutdown();

    return _ecore_wince_init_count;
}
Beispiel #19
0
EAPI int eolian_shutdown(void)
{
   if (_eolian_init_counter <= 0)
     {
        EINA_LOG_ERR("Init count not greater than 0 in shutdown.");
        return 0;
     }
   _eolian_init_counter--;

   if (_eolian_init_counter == 0)
     {
        INF("Shutdown");
        eina_log_timing(_eolian_log_dom,
              EINA_LOG_STATE_START,
              EINA_LOG_STATE_SHUTDOWN);

        eo_lexer_shutdown();
        database_shutdown();
        eina_prefix_free(_eolian_prefix);
        _eolian_prefix = NULL;

        eina_log_domain_unregister(_eolian_log_dom);
        _eolian_log_dom = -1;
        eina_shutdown();
     }

   return _eolian_init_counter;
}
Beispiel #20
0
int
main(int argc, char **argv)
{
   Eina_Benchmark *test;
   unsigned int i;

   if (argc != 2)
      return -1;

   _mempool_init();

   eina_init();

   for (i = 0; etc[i].bench_case; ++i)
     {
        test = eina_benchmark_new(etc[i].bench_case, argv[1]);
        if (!test)
           continue;

        etc[i].build(test);

        eina_benchmark_run(test);

        eina_benchmark_free(test);
     }

   eina_bench_e17();

   eina_shutdown();

   _mempool_shutdown();
   return 0;
}
Beispiel #21
0
/**
 * @return Returns the number of times the init function as been called
 * minus the corresponding init call.
 * @brief Shuts down Efreet if a balanced number of init/shutdown calls have
 * been made
 */
EAPI int
efreet_shutdown(void)
{
    if (--_efreet_init_count != 0)
        return _efreet_init_count;

    efreet_util_shutdown();
    efreet_menu_shutdown();
    efreet_desktop_shutdown();
    efreet_ini_shutdown();
    efreet_icon_shutdown();
    efreet_xml_shutdown();
    efreet_cache_shutdown();
    efreet_base_shutdown();
    eina_log_domain_unregister(_efreet_log_domain_global);

    IF_RELEASE(efreet_lang);
    IF_RELEASE(efreet_lang_country);
    IF_RELEASE(efreet_lang_modifier);
    efreet_parsed_locale = 0;  /* reset this in case they init efreet again */

    ecore_file_shutdown();
    ecore_shutdown();
    eet_shutdown();
    eina_shutdown();

    return _efreet_init_count;
}
Beispiel #22
0
END_TEST

START_TEST(eina_inarray_test_reverse)
{
   Eina_Inarray *array;
   int i;

   eina_init();

   array = eina_inarray_new(sizeof(short), 1);
   fail_unless(array != NULL);

   for (i = 0; i < numbers_count; i++)
     {
        short val = i;
        eina_inarray_push(array, &val);
     }
   eina_inarray_reverse(array);

   for (i = 0; i < numbers_count; i++)
     {
        short *member = eina_inarray_nth(array, i);
        fail_unless(*member == (numbers_count - i - 1));
     }

   eina_inarray_free(array);
   eina_shutdown();
}
Beispiel #23
0
static Eina_Bool
_ecore_imf_xim_init(void)
{
   eina_init();

   _ecore_imf_xim_log_dom = eina_log_domain_register("ecore_imf_xim", NULL);
   if (_ecore_imf_xim_log_dom < 0)
     {
        EINA_LOG_ERR("Could not register log domain: ecore_imf_xim");
        return EINA_FALSE;
     }

   DBG(" ");

   if (!ecore_x_init(NULL))
     {
        eina_shutdown();
        return EINA_FALSE;
     }

   ecore_imf_module_register(&xim_info,
                             xim_imf_module_create,
                             xim_imf_module_exit);

   return EINA_TRUE;
}
Beispiel #24
0
END_TEST

START_TEST(eina_bezier_test_length)
{
   Eina_Bezier b;
   double length;

   eina_init();
   eina_bezier_values_set(&b,
                          1, 1,
                          3, 1,
                          5, 1,
                          7, 1);
   length = eina_bezier_length_get(&b);
   fail_if(floor(length) != 6);

   eina_bezier_values_set(&b,
                          1, 1,
                          1, 1,
                          1, 1,
                          1, 1);
   length = eina_bezier_length_get(&b);
   fail_if(length != 0);

   eina_shutdown();
}
Beispiel #25
0
/**
 * Close anything opened by this module
 */
Eina_Bool uninit(DB *db) {
	EINA_SAFETY_ON_NULL_RETURN_VAL(db, EINA_FALSE);
	INF("Uninitializing source 'zrpcdb'");

	if (db->config)
		db_config_free(db->config);

	if (db->e){
		INF("Connection pool teardown for 'zrpcdb'");
		esql_free(db->e);
		INF("Uninitialization of source 'zrpcdb' complete");
	}
	if (--init_count == 0){
		ecore_event_handler_del(zrpc_res);
		zrpc_res = NULL;
		ecore_event_handler_del(zrpc_err);
		zrpc_err = NULL;
	}
	if (type_cbs) eina_hash_free(type_cbs);
	type_cbs = NULL;
	if (db_cbs) eina_hash_free(db_cbs);
	db_cbs = NULL;
	if (db_cb_params) eina_hash_free(db_cb_params);
	db_cb_params = NULL;

	esql_shutdown();
	eina_shutdown();
	return EINA_TRUE;
}
Beispiel #26
0
END_TEST

START_TEST(eina_bezier_test_angle)
{
   Eina_Bezier b;
   double angle;

   eina_init();
   eina_bezier_values_set(&b,
                          1, 1,
                          3, 1,
                          5, 1,
                          7, 1);
   angle = eina_bezier_angle_at(&b, 0.5);

   fail_if(angle != 0);

   eina_bezier_values_set(&b,
                          1, 2,
                          1, 4,
                          1, 6,
                          1, 8);
   angle = eina_bezier_angle_at(&b, 0.5);
   fail_if(floor(angle) != 90);

   eina_shutdown();
}
Beispiel #27
0
END_TEST

START_TEST(eina_fp_sin)
{
   Eina_F32p32 fc;
   Eina_F32p32 fl;
   Eina_F32p32 step;
   Eina_F32p32 fresult;
   double dc;
   double dresult;
   double delta;

        fail_if(!eina_init());

   fl = eina_f32p32_scale(EINA_F32P32_PI, 4);
   step = eina_f32p32_div(fl, eina_f32p32_int_from(2048));

   for (fc = 0; fc < fl; fc += step)
     {
        fresult = eina_f32p32_sin(fc);
        dc = eina_f32p32_double_to(fc);
        dresult = sin(dc);

        delta = fabs(dresult - eina_f32p32_double_to(fresult));
        fail_if(delta > 0.005);
     }


   eina_shutdown();
}
int
main(int argc, char **argv)
{
   const char* strings[] = {
      "helo", "hera", "starbuck", "kat", "boomer",
      "hotdog", "longshot", "jammer", "crashdown", "hardball",
      "duck", "racetrack", "apolo", "husker", "freaker",
      "skulls", "bulldog", "flat top", "hammerhead", "gonzo"
   };
   char **str, **str2;
   Eina_Inarray *iarr;
   int i;

   eina_init();
   iarr = eina_inarray_new(sizeof(char *), 0);

   for (i = 0; i < 20; i++){
     str = (char **)(&strings[i]);
      eina_inarray_push(iarr, str);
   }

   printf("Inline array of strings:\n");
   EINA_INARRAY_FOREACH(iarr, str2)
     printf("string: %s(pointer: %p)\n", *str2, str2);

   eina_inarray_free(iarr);
   eina_shutdown();
}
Beispiel #29
0
int emqtt_init(void)
{
    if (++_emqtt_init_count != 1)
        return _emqtt_init_count;

    if (!eina_init ())
        return --_emqtt_init_count;

    _emqtt_log_dom_global =
            eina_log_domain_register("emqtt", EMQTT_DEFAULT_LOG_COLOR);
    if (_emqtt_log_dom_global < 0)
    {
        EINA_LOG_ERR("Enna-Server Can not create a general log domain.");
        goto shutdown_eina;
    }
    else
        INF("EMqtt Init");

    if (!ecore_init ())
        goto shutdown_eina;

    return _emqtt_init_count;

shutdown_eina:
    eina_shutdown ();
    return --_emqtt_init_count;
}
Beispiel #30
0
int main(int c, char **v)
{
   int wfd, rfd;
   Slave_Command cmd;
   void *params = NULL;
   Eina_Module *m;
   Eina_Bool quit = EINA_FALSE;

   if (c < 3)
     return 1;

   eina_init();
   pfx =  eina_prefix_new(v[0], main,
                          "EVAS", "evas", "checkme",
                          PACKAGE_BIN_DIR,
                          PACKAGE_LIB_DIR,
                          PACKAGE_DATA_DIR,
                          PACKAGE_DATA_DIR);

   loaders = eina_hash_string_superfast_new(NULL);
   evas_module_init();

   wfd = atoi(v[1]);
   rfd = atoi(v[2]);

   while (!quit)
     {
        if (!command_read(rfd, &cmd, &params))
          {
             error_send(wfd, CSERVE2_INVALID_COMMAND);
             return 1;
          }
        switch (cmd)
          {
           case IMAGE_OPEN:
             handle_image_open(wfd, params);
             break;
           case IMAGE_LOAD:
             handle_image_load(wfd, params);
             break;
           case SLAVE_QUIT:
             quit = EINA_TRUE;
             break;
           default:
             error_send(wfd, CSERVE2_INVALID_COMMAND);
          }
     }

   evas_module_shutdown();
   eina_hash_free(loaders);

   EINA_LIST_FREE(modules, m)
      eina_module_free(m);

   eina_prefix_free(pfx);
   eina_shutdown();

   return 0;
}