static Eina_Bool _args_init(int argc, char **argv) { e = calloc(1, sizeof(Ewallset)); int arg_index; char *image_file; Ecore_Getopt_Value general_values[] = { ECORE_GETOPT_VALUE_STR(image_file), ECORE_GETOPT_VALUE_BOOL(e->quit_bool), ECORE_GETOPT_VALUE_BOOL(e->quit_bool), ECORE_GETOPT_VALUE_BOOL(e->quit_bool), ECORE_GETOPT_VALUE_BOOL(e->quit_bool), ECORE_GETOPT_VALUE_NONE }; arg_index = ecore_getopt_parse(&general_opts, general_values, argc, argv); if (arg_index <= 1) { printf("Try `ewallset --help' for more information.\n"); e->quit_bool = EINA_TRUE; } e->image_file = eina_stringshare_add(image_file); if (e->quit_bool) exit(0); return EINA_TRUE; }
int main(int argc, char **argv) { char *xml_buf = NULL; DBus_Object *obj = NULL; char *prefix = NULL, *interface = NULL, *output = NULL; Eina_Bool quit_option = EINA_FALSE; int arg_index; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_STR(prefix), ECORE_GETOPT_VALUE_STR(interface), ECORE_GETOPT_VALUE_STR(output), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; eina_init(); arg_index = ecore_getopt_parse(&optdesc, values, argc, argv); if (arg_index == -1) { printf("Error: parsing arguments.\n"); return -1; } if (quit_option) return 0; if (argc <= arg_index) { printf("Error: Missing file name.\n"); return -1; } if (!file_read(argv[arg_index], &xml_buf)) { printf("Error reading file.\n"); goto end; } if (!eina_simple_xml_parse(xml_buf, strlen(xml_buf), EINA_TRUE, parser, &obj)) { printf("Error: could not parse XML\n"); goto end; } source_client_generate(obj, prefix, interface, output); util_h_write(); end: if (obj) object_free(obj); free(xml_buf); eina_shutdown(); return 0; }
int elm_main(int argc, char **argv) { unsigned char exit_option = 0; char *library_path = NULL; enlil_init(); APP_LOG_DOMAIN = eina_log_domain_register("Enki-Slideshow", "\033[34;1m"); //ecore_getopt Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_STR(library_path), ECORE_GETOPT_VALUE_BOOL(exit_option), }; ecore_app_args_set(argc, (const char **) argv); int nonargs = ecore_getopt_parse(&options, values, argc, argv); if (nonargs < 0) return 1; else if (nonargs != argc || !library_path) { fputs("Invalid non-option argument", stderr); ecore_getopt_help(stderr, &options); return 1; } if (exit_option) return 0; // elm_config_finger_size_set(1); // library = enlil_library_new(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); enlil_library_path_set(library, library_path); Enlil_Load *load = enlil_load_new(library, _load_album_done_cb, _load_done_cb, _load_error_cb, library); enlil_load_run(load); // elm_run(); enlil_shutdown(); elm_shutdown(); return 0; }
int main(int argc, char *argv[]) { const char *url; int args = 1; char *engine = NULL; unsigned char quitOption = 0; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_STR(engine), ECORE_GETOPT_VALUE_BOOL(quitOption), ECORE_GETOPT_VALUE_BOOL(quitOption), ECORE_GETOPT_VALUE_BOOL(quitOption), ECORE_GETOPT_VALUE_BOOL(quitOption), ECORE_GETOPT_VALUE_NONE }; if (!ewk_init()) return EXIT_FAILURE; ecore_app_args_set(argc, (const char **) argv); args = ecore_getopt_parse(&options, values, argc, argv); if (args < 0) return quit(EINA_FALSE, "ERROR: could not parse options.\n"); if (quitOption) return quit(EINA_TRUE, NULL); if (args < argc) url = argv[args]; else url = DEFAULT_URL; MiniBrowser *browser = browserCreate(url, engine); if (!browser) return quit(EINA_FALSE, "ERROR: could not create browser.\n"); Ecore_Event_Handler *handle = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, 0); ecore_main_loop_begin(); ecore_event_handler_del(handle); ecore_evas_free(browser->ee); free(browser); return quit(EINA_TRUE, NULL); }
EAPI int elm_main(int argc, char **argv) { Evas_Object *window; Evas_Object *layout; Evas_Object *edje; Evas_Object *grid; Evas_Object *list; char path[PATH_MAX]; Eina_Bool quit_option = EINA_FALSE; int args; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(crazy_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; _log_domain = eina_log_domain_register("Excessive", NULL); if (_log_domain < 0) { EINA_LOG_CRIT("could not create log domain 'Excessive'."); return -1; } args = ecore_getopt_parse(&options, values, argc, argv); if (args < 0) { ERR("could not parse command line options."); return -1; } if (quit_option) return 0; excessive_browse_init(); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_theme_extension_add(NULL, PACKAGE_DATA_DIR "/themes/theme.edj"); elm_theme_overlay_add(NULL, PACKAGE_DATA_DIR "/themes/theme.edj"); elm_need_efreet(); elm_need_ethumb(); window = elm_win_add(NULL, PACKAGE_NAME, ELM_WIN_BASIC); if (!window) { ERR("could'nt create window."); return -1; } /* FIXME: later remember last size */ elm_win_alpha_set(window, 1); evas_object_resize(window, 800, 600); elm_win_title_set(window, PACKAGE_STRING); elm_win_autodel_set(window, 1); layout = elm_layout_add(window); if (!layout) { ERR("couldn't create layout object."); return -1; } evas_object_size_hint_align_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(window, layout); if (!elm_layout_theme_set(layout, "layout", "application", "content")) { ERR("could not load style 'content' from theme"); return -1; } evas_object_show(layout); evas_object_show(window); edje = elm_layout_edje_get(layout); grid = edje_object_part_external_object_get(edje, "grid"); evas_object_data_set(grid, "excessive/layout", layout); evas_object_data_set(layout, "excessive/win", window); evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_gengrid_bounce_set(grid, EINA_FALSE, EINA_TRUE); elm_gengrid_align_set(grid, 0.5, 0.5); elm_gengrid_item_size_set(grid, 128, 128); excessive_browse_load(layout); list = edje_object_part_external_object_get(edje, "shortcut"); excessive_shortcut_init(list, grid); if (argc < args + 1) { getcwd(path, PATH_MAX); excessive_browse_directory(grid, path); } else { excessive_browse_directory(grid, argv[args]); } elm_run(); excessive_shortcut_shutdown(); excessive_browse_shutdown(); return 0; }
int main(int argc, char **argv) { unsigned char exit_option = 0; char *library_path = NULL; enlil_init(); LOG_DOMAIN = eina_log_domain_register("bin_load_sync", "\033[34;1m"); //ecore_getopt Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_BOOL(exit_option), ECORE_GETOPT_VALUE_STR(library_path), ECORE_GETOPT_VALUE_BOOL(exit_option), }; ecore_app_args_set(argc, (const char **)argv); int nonargs = ecore_getopt_parse(&options, values, argc, argv); if (nonargs < 0) return 1; else if (nonargs != argc) { fputs("Invalid non-option argument", stderr); ecore_getopt_help(stderr, &options); return 1; } if(!library_path) { fprintf(stderr, "You must specify the location of your enlil !\n"); return 0; } if(exit_option) return 0; // Enlil_Library *library = enlil_library_new(_monitor_album_new_cb, _monitor_album_delete_cb, _monitor_enlil_delete_cb, _monitor_photo_new_cb, _monitor_photo_delete_cb, _monitor_photo_update_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); enlil_library_path_set(library, library_path); Enlil_Sync *_sync = enlil_sync_new(enlil_library_path_get(library), _sync_album_new_cb, _sync_album_update_cb, _sync_album_disappear_cb, _sync_photo_new_cb, _sync_photo_update_cb, _sync_photo_disappear_cb, _sync_done_cb, _sync_start_cb, _sync_error_cb, library); enlil_library_sync_set(library, _sync); Enlil_Load *load = enlil_load_new(library, _load_album_done_cb, _load_done_cb, _load_error_cb, library); enlil_library_monitor_start(library); t0 = ecore_time_get(); enlil_load_run(load); ecore_main_loop_begin(); enlil_sync_free(&_sync); enlil_library_free(&library); eina_log_domain_unregister(LOG_DOMAIN); enlil_shutdown(); return 0; }
Eina_Bool quit_option = EINA_FALSE; Eina_Bool list_option = EINA_FALSE; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(list_option), ECORE_GETOPT_VALUE_STR(test), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; eina_init(); args = ecore_getopt_parse(&optdesc, values, argc, argv); if (args < 0) { EINA_LOG_CRIT("Could not parse arguments."); goto end; } else if (quit_option) { goto end; } else if (list_option) { fprintf(stdout, "Available tests :\n"); for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) fprintf(stdout, "\t%s\n", tests[i].name); goto end;
int main(int argc, char *argv[]) { Eina_Bool quit_option = EINA_FALSE; char *source = NULL, *header = NULL; int arg_index, ret = 0; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_STR(prefix), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_NONE }; setlocale(LC_NUMERIC, "C"); eina_init(); ecore_init(); ecore_evas_init(); edje_init(); if (argc < 2) { fprintf(stderr, "Missing action. See '--help or -h'.\n"); ret = 1; goto error_log; } _log_dom = eina_log_domain_register("elementary_codegen", EINA_COLOR_YELLOW); if (_log_dom < 0) { EINA_LOG_CRIT("could not register log domain 'elementary_codegen'"); ret = 1; goto error_log; } arg_index = ecore_getopt_parse(&optdesc, values, argc, argv); if (arg_index < 0) { ERR("could not parse arguments."); ret = 1; goto error_getopt; } else if (quit_option) goto error_getopt; else if (arg_index != argc - 4) { fprintf(stderr, "Incorrect number of parameters. Requires " \ "fours arguments, an edje, the group, " \ "the source output (foo.c) and the header(foo.h).\n" \ "See %s --help\n", argv[0]); ret = 1; goto error_getopt; } file = argv[arg_index++]; // check if the file is accessible if (access(file, R_OK) == -1) { ERR("File '%s' not accessible, error %d (%s).\n", file, errno, strerror(errno)); ret = 1; goto error_getopt; } group = argv[arg_index++]; source = argv[arg_index++]; header = argv[arg_index++]; if (!edje_file_group_exists(file, group)) { ERR("The group %s not exists", group); ret = 2; goto error_getopt; } ee = ecore_evas_buffer_new(1, 1); if (!ee) { ERR("could not create ecore_evas_buffer"); ret = 3; goto error_getopt; } if (!_file_descriptors_open(source, header)) { ERR("Could not create the source files, error %d (%s)", errno, strerror(errno)); ret = 4; goto error_getopt; } if (!_headers_write(header)) { ERR("Could not write the header, error %d (%s)", errno, strerror(errno)); ret = 5; goto error_getopt; } if (!_theme_set_write()) WRN("Theme set getter/setter not created. Group name: %s invalid.", group); if (!_parse()) { ERR("Could not parsing the EDJE"); ret = 6; goto error_getopt; } if (!_footer_write(header)) { ERR("Could not write the footer, error %d (%s)", errno, strerror(errno)); ret = 7; goto error_getopt; } if (!_file_descriptors_close()) { ERR("Could not close the source files, error %d (%s)", errno, strerror(errno)); ret = 8; } error_getopt: if (ee) ecore_evas_free(ee); error_log: edje_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); eina_log_domain_unregister(_log_dom); eina_shutdown(); if (ret > 4) { unlink(header); unlink(source); } return ret; }
EAPI_MAIN int elm_main(int argc, char **argv) { int ret = EXIT_FAILURE; int args; int i; Editor *ed; unsigned int ed_count = 0; Eina_Bool quit_opt = EINA_FALSE; Eina_Bool debug = EINA_FALSE; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(debug), ECORE_GETOPT_VALUE_BOOL(quit_opt), ECORE_GETOPT_VALUE_BOOL(quit_opt) }; const Module *mod_ptr; const Module *mod_end = &(_modules[EINA_C_ARRAY_LENGTH(_modules)]); const char *env; unsigned int debug_flags = 0; args = ecore_getopt_parse(&_options, values, argc, argv); if (args < 0) { EINA_LOG_CRIT("Getopt failed"); goto end; } /* Quit option requested? End now, with success */ if (quit_opt) { ret = EXIT_SUCCESS; goto end; } if (debug) debug_flags = ~0U; /* Are we running in tree? */ env = getenv("WAR2EDIT_IN_TREE"); _in_tree = (env) ? !!atoi(env) : EINA_FALSE; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_language_set(""); elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR); elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR); elm_app_compile_data_dir_set(PACKAGE_DATA_DIR); elm_app_info_set(elm_main, "war2edit", "sprites/units/units.eet"); if (EINA_UNLIKELY(!_edje_get(NULL))) { EINA_LOG_CRIT("Failed to get edje theme"); goto end; } for (mod_ptr = _modules; mod_ptr != mod_end; ++mod_ptr) { if (EINA_UNLIKELY(EINA_FALSE == mod_ptr->init())) { EINA_LOG_CRIT("Failed to initialize module \"%s\"", mod_ptr->name); goto modules_shutdown; } } /* Open editors for each specified files */ for (i = args; i < argc; ++i) { /* If an editor fails to open, don't close now */ ed = editor_new(argv[i], debug_flags); if (!ed) ERR("Failed to create editor with file \"%s\"", argv[i]); else ++ed_count; } if (ed_count == 0) { ed = editor_new(NULL, debug_flags); if (EINA_UNLIKELY(!ed)) { CRI("Failed to create editor"); goto modules_shutdown; } } /* === Main loop === */ elm_run(); ret = EXIT_SUCCESS; modules_shutdown: for (--mod_ptr; mod_ptr >= _modules; --mod_ptr) mod_ptr->shutdown(); end: if (_edje_file) { free(_edje_file); _edje_file = NULL; } return ret; }
EAPI_MAIN int elm_main(int argc, char **argv) { char *theme = NULL; int args; unsigned char quit_option = 0; Eina_Rectangle geometry = {0, 0, 0, 0}; Eina_Bool is_fullscreen = 0; Enna *enna; Ecore_Getopt_Value values[] = { ECORE_GETOPT_VALUE_BOOL(is_fullscreen), ECORE_GETOPT_VALUE_PTR_CAST(geometry), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_STR(theme), ECORE_GETOPT_VALUE_NONE }; eina_init(); ecore_app_args_set(argc, (const char **) argv); args = ecore_getopt_parse(&_options, values, argc, argv); if (args < 0) { ERR("Could not parse options !"); return EXIT_FAILURE; } if (quit_option) return EXIT_SUCCESS; if (!enna_init()) goto shutdown; if (!enna_config_init()) goto shutdown_enna; if (theme) enna_config_theme_set(theme); if (!ems_init(enna_config_config_get(), EINA_FALSE)) goto shutdown_config; enna = enna_add(is_fullscreen, geometry); if (!enna) goto shutdown_config; // INF("Start scanner"); // ems_scanner_start(); INF("Start services annoucement"); ems_avahi_start(); ems_run(); ems_shutdown(); enna_config_shutdown(); enna_shutdown(); elm_shutdown(); return EXIT_SUCCESS; shutdown_config: enna_config_shutdown(); shutdown_enna: enna_shutdown(); shutdown: enna_shutdown(); return -1; }