本文整理汇总了C++中eina_init函数的典型用法代码示例。如果您正苦于以下问题:C++ eina_init函数的具体用法?C++ eina_init怎么用?C++ eina_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eina_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lime_init
int lime_init(void)
{
inits++;
if (inits > 1)
return 0;
if (inits < 1)
return -1;
if (pthread_mutex_init(&global_lock, NULL))
abort();
eina_init();
static const float GAMMA = 2.2;
int result;
int i;
for (i = 0; i < 256; i++) {
result = (int)(pow(i/255.0, GAMMA)*65535.0 + 0.5);
lime_g2l[i] = (unsigned short)result;
}
for (i = 0; i < 65536; i++) {
result = (int)(pow(i/65535.0, 1/GAMMA)*255.0 + 0.5);
lime_l2g[i] = (unsigned char)result;
}
lime_filters_init();
return 0;
}
示例2: START_TEST
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();
}
示例3: main
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;
}
示例4: main
int main(int argc, char **argv)
{
Eina_Value vtv, vtz;
struct timeval tv;
struct timezone tz;
char *s;
eina_init();
eina_value_setup(&vtv, EINA_VALUE_TYPE_TIMEVAL);
eina_value_setup(&vtz, &TZ_TYPE);
gettimeofday(&tv, &tz);
eina_value_set(&vtv, tv);
eina_value_set(&vtz, tz);
s = eina_value_to_string(&vtv);
printf("time: %s\n", s);
free(s);
s = eina_value_to_string(&vtz);
printf("timezone: %s\n", s);
free(s);
eina_value_flush(&vtz);
eina_value_flush(&vtv);
}
示例5: estate_init
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;
}
示例6: main
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();
}
示例7: main
int
main(void)
{
Eina_List *fonts;
Font_Entry *fe;
Msg_Index_List *msg = NULL;
int size;
eina_init();
_evas_cserve2_debug_log_dom = eina_log_domain_register
("evas_cserve2_debug", EINA_COLOR_BLUE);
if (!_server_connect())
{
ERR("Could not connect to server.");
return -1;
}
while (!msg)
msg = _server_read(&size);
_shared_index_print(msg, size);
_debug_msg_send();
fonts = _debug_msg_read();
EINA_LIST_FREE(fonts, fe)
{
_font_entry_print(fe);
_font_entry_free(fe);
}
示例8: main
int
main(void)
{
FILE *file;
long size;
eina_init();
//1. Open XML File
file = fopen("exia.xml", "rb");
if (!file) return 0;
fseek(file, 0, SEEK_END);
size = ftell(file);
fseek(file, 0, SEEK_SET);
//2. Read XML File
char *buffer = malloc(size);
if (!buffer)
{
fclose(file);
return 0;
}
fread(buffer, 1, size, file);
//3. Start Parsing XML
eina_simple_xml_parse(buffer, size, EINA_FALSE, _xml_tag_parse_cb, NULL);
fclose(file);
free(buffer);
return 0;
}
示例9: main
int
main(void)
{
double done;
eina_init();
ecore_init();
ecore_con_init();
eina_log_domain_level_set("ecore_con", EINA_LOG_LEVEL_ERR);
eina_log_domain_level_set("eina", EINA_LOG_LEVEL_ERR);
counter = eina_counter_new("client");
eina_counter_start(counter);
done = ecore_time_get();
ecore_job_add(_spawn, NULL);
/* set event handler for server connect */
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_add, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_del, NULL);
/* start client */
ecore_main_loop_begin();
eina_counter_stop(counter, 1);
printf("\nTime elapsed for %i connections: %f seconds\n%s", NUM_CLIENTS, ecore_time_get() - done, eina_counter_dump(counter));
return 0;
}
示例10: main
int
main(void)
{
Eina_List *btl = NULL, *l;
char buf[4096];
Bt *bt;
int cols[6] = { 0 }, len, i;
eina_init();
while (fgets(buf, sizeof(buf) - 1, stdin))
{
btl = bt_append(btl, buf);
}
EINA_LIST_FOREACH(btl, l, bt)
{
len = strlen(bt->bin_dir);
if (len > cols[0]) cols[0] = len;
len = strlen(bt->bin_name);
if (len > cols[1]) cols[1] = len;
len = strlen(bt->file_dir);
if (len > cols[2]) cols[2] = len;
len = strlen(bt->file_name);
if (len > cols[3]) cols[3] = len;
snprintf(buf, sizeof(buf), "%i", bt->line);
len = strlen(buf);
if (len > cols[4]) cols[4] = len;
len = strlen(bt->func_name);
if (len > cols[5]) cols[5] = len;
}
示例11: main
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;
}
示例12: ecore_init
/**
* 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;
}
示例13: main
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;
}
示例14: START_TEST
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();
}
示例15: START_TEST
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();
}