Rework the ibar/restart/startup Apps dialog. - Resizable - Lists ALL applications - Can multi-select on the ilists now - Dialog takes up less space.

--- src/modules/conf_applications/e_int_config_apps.c
+++ src/modules/conf_applications/e_int_config_apps.c
@@ -1,69 +1,72 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 #include "e.h"

-/* TODO: This should be modified to handle any other fdo menu editing. */
-
+typedef struct _E_Config_Data
+{
+   const char *title, *icon, *dialog, *filename;
+} E_Config_Data;
+
+struct _E_Config_Dialog_Data
+{
+   E_Config_Data *data;
+   Evas_Object *o_all, *o_sel;
+   Evas_Object *o_add, *o_del;
+   Evas_Object *o_up, *o_down;
+   Ecore_List *apps;
+   char *app, *sel;
+};
+
+/* local protos */
+static E_Config_Dialog *_create_dialog(E_Container *con, E_Config_Data *data);
 static void *_create_data(E_Config_Dialog *cfd);
 static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
 static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
 static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
-static void _fill_categories(E_Config_Dialog_Data *cfdata);
+static Ecore_List *_load_menu(const char *path);
+static Ecore_List *_load_order(const char *path);
 static void _fill_apps(E_Config_Dialog_Data *cfdata);
 static void _fill_list(E_Config_Dialog_Data *cfdata);
-static void _category_cb_selected(void *data);
-static void _apps_cb_selected(void *data);
-static void _list_cb_selected(void *data);
-static void _cb_categories(void *data, void *data2);
+static int _cb_sort_desks(Efreet_Desktop *d1, Efreet_Desktop *d2);
+static void _all_list_cb_change(void *data, Evas_Object *obj);
+static void _sel_list_cb_change(void *data, Evas_Object *obj);
+static void _all_list_cb_selected(void *data);
+static void _sel_list_cb_selected(void *data);
 static void _cb_add(void *data, void *data2);
 static void _cb_del(void *data, void *data2);
 static void _cb_up(void *data, void *data2);
 static void _cb_down(void *data, void *data2);
-static int _cb_desktop_name_sort(Efreet_Desktop *a, Efreet_Desktop *b);
-
 static int _save_menu(E_Config_Dialog_Data *cfdata);
 static int _save_order(E_Config_Dialog_Data *cfdata);
-static Ecore_List *_load_menu(const char *path);
-static Ecore_List *_load_order(const char *path);
-
-typedef struct _E_Config_Once
-{
-   const char *title;
-   const char *icon;
-   const char *dialog;
-   char *filename;
-} E_Config_Once;
-
-static E_Config_Dialog *_create_config_dialog(E_Container *con, E_Config_Once *once);
-
-struct _E_Config_Dialog_Data
-{
-   E_Config_Once *once;
-
-   Evas_Object *o_apps, *o_list;
-   Evas_Object *o_add, *o_del, *o_categories;
-   Evas_Object *o_up, *o_down;
-   Ecore_List *apps;
-   const char *category;
-   int category_n;
-
-   char *fav, *app;
-};

 EAPI E_Config_Dialog *
-e_int_config_apps_add(E_Container *con, const char *params __UNUSED__)
+e_int_config_apps_favs(E_Container *con, const char *params __UNUSED__)
+{
+   E_Config_Data *data;
+   char buf[4096];
+
+   snprintf(buf, sizeof(buf), "%s/.e/e/applications/menu/favorite.menu",
+	    e_user_homedir_get());
+   data = E_NEW(E_Config_Data, 1);
+   data->title = evas_stringshare_add(_("Favorites Menu"));
+   data->dialog = evas_stringshare_add("_config_apps_favs_dialog");
+   data->icon = evas_stringshare_add("enlightenment/favorites");
+   data->filename = evas_stringshare_add(buf);
+
+   return _create_dialog(con, data);
+}
+
+EAPI E_Config_Dialog *
+e_int_config_apps_add(E_Container *con, const char *params __UNUSED__)
 {
    E_Desktop_Edit *ed;
    Efreet_Desktop *de = NULL;
    char path[PATH_MAX];
    const char *desktop_dir;
-
+
    desktop_dir = e_user_desktop_dir_get();
    if (desktop_dir)
      {
 	int i;
-
+
 	for (i = 1; i < 65536; i++)
 	  {
 	     snprintf(path, sizeof(path), "%s/_new_app-%i.desktop",
@@ -85,249 +88,194 @@
      de = efreet_desktop_empty_new(NULL);
    if (!de) return NULL;
    ed = e_desktop_edit(con, de);
-   return (E_Config_Dialog *)ed;
+   if (!ed) return NULL;
+   return ed->cfd;
 }

 EAPI E_Config_Dialog *
-e_int_config_apps_favs(E_Container *con, const char *params __UNUSED__)
-{
-   E_Config_Once *once;
+e_int_config_apps_ibar(E_Container *con, const char *params __UNUSED__)
+{
+   E_Config_Data *data;
    char buf[4096];

-   snprintf(buf, sizeof(buf), "%s/.e/e/applications/menu/favorite.menu",
+   snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/default/.order",
 	    e_user_homedir_get());
-
-   once = E_NEW(E_Config_Once, 1);
-   once->title = _("Favorites Menu");
-   once->dialog = "_config_apps_favs_dialog";
-   once->icon = "enlightenment/favorites";
-   once->filename = strdup(buf);
-   return _create_config_dialog(con, once);
-}
-
-EAPI E_Config_Dialog *
-e_int_config_apps_ibar(E_Container *con, const char *params __UNUSED__)
-{
-   E_Config_Once *once;
-   char buf[4096];
-
-   snprintf(buf, sizeof(buf), "%s/.e/e/applications/bar/default/.order",
-	    e_user_homedir_get());
-
-   once = E_NEW(E_Config_Once, 1);
-   once->title = _("IBar Applications");
-   once->icon = "enlightenment/ibar_applications";
-   once->dialog = "_config_apps_ibar_dialog";
-   once->filename = strdup(buf);
-
-   return _create_config_dialog(con, once);
+   data = E_NEW(E_Config_Data, 1);
+   data->title = evas_stringshare_add(_("IBar Applications"));
+   data->dialog = evas_stringshare_add("_config_apps_ibar_dialog");
+   data->icon = evas_stringshare_add("enlightenment/ibar_applications");
+   data->filename = evas_stringshare_add(buf);
+
+   return _create_dialog(con, data);
 }

 EAPI E_Config_Dialog *
 e_int_config_apps_ibar_other(E_Container *con, const char *path)
 {
-   E_Config_Once *once;
+   E_Config_Data *data;

    if (!path) return NULL;
-   once = E_NEW(E_Config_Once, 1);
-   once->title = _("IBar Applications");
-   once->icon = "enlightenment/ibar_applications";
-   once->dialog = "_config_apps_ibar_dialog";
-   once->filename = strdup(path);
-
-   return _create_config_dialog(con, once);
+   data = E_NEW(E_Config_Data, 1);
+   data->title = evas_stringshare_add(_("IBar Applications"));
+   data->dialog = evas_stringshare_add("_config_apps_ibar_dialog");
+   data->icon = evas_stringshare_add("enlightenment/ibar_applications");
+   data->filename = evas_stringshare_add(path);
+
+   return _create_dialog(con, data);
 }

 EAPI E_Config_Dialog *
 e_int_config_apps_startup(E_Container *con, const char *params __UNUSED__)
 {
-   E_Config_Once *once;
+   E_Config_Data *data;
    char buf[4096];
-
-   snprintf(buf, sizeof(buf), "%s/.e/e/applications/startup/.order",
+
+   snprintf(buf, sizeof(buf), "%s/.e/e/applications/startup/.order",
 	    e_user_homedir_get());
-
-   once = E_NEW(E_Config_Once, 1);
-   once->title = _("Startup Applications");
-   once->icon = "enlightenment/startup_applications";
-   once->dialog = "_config_apps_startup_dialog";
-   once->filename = strdup(buf);
-
-   return _create_config_dialog(con, once);
+   data = E_NEW(E_Config_Data, 1);
+   data->title = evas_stringshare_add(_("Startup Applications"));
+   data->dialog = evas_stringshare_add("_config_apps_startup_dialog");
+   data->icon = evas_stringshare_add("enlightenment/startup_applications");
+   data->filename = evas_stringshare_add(buf);
+
+   return _create_dialog(con, data);
 }

 EAPI E_Config_Dialog *
 e_int_config_apps_restart(E_Container *con, const char *params __UNUSED__)
 {
-   E_Config_Once *once;
+   E_Config_Data *data;
    char buf[4096];
-
-   snprintf(buf, sizeof(buf), "%s/.e/e/applications/restart/.order",
+
+   snprintf(buf, sizeof(buf), "%s/.e/e/applications/restart/.order",
 	    e_user_homedir_get());
-
-   once = E_NEW(E_Config_Once, 1);
-   once->title = _("Restart Applications");
-   once->icon = "enlightenment/restart_applications";
-   once->dialog = "_config_apps_restart_dialog";
-   once->filename = strdup(buf);
-
-   return _create_config_dialog(con, once);
-}
-
+   data = E_NEW(E_Config_Data, 1);
+   data->title = evas_stringshare_add(_("Restart Applications"));
+   data->dialog = evas_stringshare_add("_config_apps_restart_dialog");
+   data->icon = evas_stringshare_add("enlightenment/restart_applications");
+   data->filename = evas_stringshare_add(buf);
+
+   return _create_dialog(con, data);
+}
+
+/* local functions */
 static E_Config_Dialog *
-_create_config_dialog(E_Container *con, E_Config_Once *once)
+_create_dialog(E_Container *con, E_Config_Data *data)
 {
    E_Config_Dialog *cfd;
    E_Config_Dialog_View *v;

-   if (e_config_dialog_find("E", once->dialog)) return NULL;
+   if (e_config_dialog_find("E", data->dialog))
+     {
+	if (data->title) evas_stringshare_del(data->title);
+	if (data->dialog) evas_stringshare_del(data->dialog);
+	if (data->icon) evas_stringshare_del(data->icon);
+	if (data->filename) evas_stringshare_del(data->filename);
+	E_FREE(data);
+	return NULL;
+     }

    v = E_NEW(E_Config_Dialog_View, 1);
    v->create_cfdata = _create_data;
    v->free_cfdata = _free_data;
    v->basic.create_widgets = _basic_create;
    v->basic.apply_cfdata = _basic_apply;
-
-   cfd = e_config_dialog_new(con, once->title, "E", once->dialog,
-			     once->icon, 0, v, once);
+   cfd = e_config_dialog_new(con, data->title, "E", data->dialog,
+			     data->icon, 0, v, data);
+   e_dialog_resizable_set(cfd->dia, 1);
    return cfd;
 }

-/* Private Functions */
 static void *
 _create_data(E_Config_Dialog *cfd)
 {
    E_Config_Dialog_Data *cfdata;
-   E_Config_Once *once;
+   E_Config_Data *data;
    const char *ext;

+   if (!(data = cfd->data)) return NULL;
+   if (!data->filename) return NULL;
+
+   ext = strrchr(data->filename, '.');
+   if (!ext) return NULL;
+
    cfdata = E_NEW(E_Config_Dialog_Data, 1);
-   once = cfd->data;
-   if (!once->filename) return NULL;
-
-   ext = strrchr(once->filename, '.');
-   if (!ext) return NULL;
-
-   cfdata->once = once;
-   if (!strcmp(ext, ".menu"))
-     cfdata->apps = _load_menu(once->filename);
+   cfdata->data = data;
+   if (!strcmp(ext, ".menu"))
+     cfdata->apps = _load_menu(data->filename);
    else if (!strcmp(ext, ".order"))
-     cfdata->apps = _load_order(once->filename);
-
+     cfdata->apps = _load_order(data->filename);
+
    return cfdata;
 }

-static Ecore_List *
-_load_menu(const char *path)
-{
-   Efreet_Menu *menu, *entry;
-   Ecore_List *apps;
-
-   apps = ecore_list_new();
-   ecore_list_free_cb_set(apps, ECORE_FREE_CB(efreet_desktop_free));
-
-   menu = efreet_menu_parse(path);
-   if (!menu) return apps;
-
-   ecore_list_first_goto(menu->entries);
-   while ((entry = ecore_list_next(menu->entries)))
-     {
-	if (entry->type != EFREET_MENU_ENTRY_DESKTOP) continue;
-	efreet_desktop_ref(entry->desktop);
-	ecore_list_append(apps, entry->desktop);
-     }
-   efreet_menu_free(menu);
-   return apps;
-}
-
-static Ecore_List *
-_load_order(const char *path)
-{
-   E_Order *order;
-   Evas_List *l;
-   Ecore_List *apps;
-
-   apps = ecore_list_new();
-   ecore_list_free_cb_set(apps, ECORE_FREE_CB(efreet_desktop_free));
-   order = e_order_new(path);
-   for (l = order->desktops; l; l = l->next)
-     {
-	efreet_desktop_ref(l->data);
-	ecore_list_append(apps, l->data);
-     }
-
-   e_object_del(E_OBJECT(order));
-   return apps;
-}
-
 static void
 _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
 {
-   if (cfdata->once)
-     {
-	E_FREE(cfdata->once->filename);
-	E_FREE(cfdata->once);
-     }
-
+   E_Config_Data *data;
+
+   data = cfdata->data;
+   if (data)
+     {
+	if (data->title) evas_stringshare_del(data->title);
+	if (data->dialog) evas_stringshare_del(data->dialog);
+	if (data->icon) evas_stringshare_del(data->icon);
+	if (data->filename) evas_stringshare_del(data->filename);
+	E_FREE(data);
+     }
+   if (cfdata->app) free(cfdata->app);
+   if (cfdata->sel) free(cfdata->sel);
    if (cfdata->apps) ecore_list_destroy(cfdata->apps);
-   if (cfdata->category) ecore_string_release(cfdata->category);
-   E_FREE(cfdata->app);
-   E_FREE(cfdata->fav);
    E_FREE(cfdata);
 }

 static Evas_Object *
 _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
 {
-   Evas_Object *ot, *of, *ob;
-
-   ot = e_widget_table_add(evas, 0);
-
-   of = e_widget_frametable_add(evas, _("Application Categories"), 0);
-   ob = e_widget_button_add(evas, _("Categories"), "widget/categories",
-			    _cb_categories, cfdata, NULL);
-   cfdata->o_categories = ob;
-   e_widget_disabled_set(ob, 1);
-   e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
-
-   ob = e_widget_ilist_add(evas, 24, 24, &(cfdata->app));
-   cfdata->o_apps = ob;
-   _fill_categories(cfdata);
-   e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 1, 1);
-
-   e_widget_table_object_append(ot, of, 0, 0, 1, 4, 1, 1, 1, 1);
-
-   ob = e_widget_button_add(evas, _("Add"), "widget/add", _cb_add, cfdata, NULL);
-   cfdata->o_add = ob;
-   e_widget_disabled_set(ob, 1);
-   e_widget_table_object_append(ot, ob, 1, 1, 1, 1, 1, 0, 0, 0);
-
-   ob = e_widget_button_add(evas, _("Delete"), "widget/del", _cb_del, cfdata, NULL);
-   cfdata->o_del = ob;
-   e_widget_disabled_set(ob, 1);
-   e_widget_table_object_append(ot, ob, 1, 2, 1, 1, 1, 0, 0, 0);
-
-   of = e_widget_framelist_add(evas, cfdata->once->title, 0);
-   ob = e_widget_ilist_add(evas, 24, 24, &(cfdata->fav));
-   cfdata->o_list = ob;
+   Evas_Object *o, *ot, *ow, *bt;
+
+   o = e_widget_list_add(evas, 0, 1);
+   ot = e_widget_frametable_add(evas, _("All Applications"), 0);
+   ow = e_widget_ilist_add(evas, 24, 24, &(cfdata->app));
+   e_widget_ilist_multi_select_set(ow, 1);
+   e_widget_on_change_hook_set(ow, _all_list_cb_change, cfdata);
+   cfdata->o_all = ow;
+   _fill_apps(cfdata);
+   e_widget_frametable_object_append(ot, ow, 0, 0, 1, 1, 1, 1, 1, 1);
+   ow = e_widget_button_add(evas, _("Add"), "widget/add", _cb_add,
+			    cfdata, NULL);
+   cfdata->o_add = ow;
+   e_widget_disabled_set(ow, 1);
+   e_widget_frametable_object_append(ot, ow, 0, 1, 1, 1, 1, 0, 1, 0);
+   e_widget_list_object_append(o, ot, 1, 1, 0.5);
+
+   ot = e_widget_frametable_add(evas, _("Selected Applications"), 0);
+   ow = e_widget_ilist_add(evas, 24, 24, &(cfdata->sel));
+   e_widget_ilist_multi_select_set(ow, 1);
+   e_widget_on_change_hook_set(ow, _sel_list_cb_change, cfdata);
+   cfdata->o_sel = ow;
    _fill_list(cfdata);
-   e_widget_framelist_object_append(of, ob);
-   e_widget_table_object_append(ot, of, 2, 0, 1, 4, 1, 1, 1, 1);
-
-   ob = e_widget_button_add(evas, _("Up"), "widget/up_arrow",
-			    _cb_up, cfdata, NULL);
-   cfdata->o_up = ob;
-   e_widget_disabled_set(ob, 1);
-   e_widget_table_object_append(ot, ob, 3, 1, 1, 1, 1, 0, 0, 0);
-
-   ob = e_widget_button_add(evas, _("Down"), "widget/down_arrow",
-			    _cb_down, cfdata, NULL);
-   cfdata->o_down = ob;
-   e_widget_disabled_set(ob, 1);
-   e_widget_table_object_append(ot, ob, 3, 2, 1, 1, 1, 0, 0, 0);
-
-   e_dialog_resizable_set(cfd->dia, 1);
-   return ot;
+   e_widget_frametable_object_append(ot, ow, 0, 0, 1, 1, 1, 1, 1, 1);
+   bt = e_widget_table_add(evas, 0);
+   ow = e_widget_button_add(evas, _("Up"), "widget/up_arrow", _cb_up,
+			    cfdata, NULL);
+   cfdata->o_up = ow;
+   e_widget_disabled_set(ow, 1);
+   e_widget_table_object_append(bt, ow, 0, 0, 1, 1, 1, 0, 1, 0);
+   ow = e_widget_button_add(evas, _("Down"), "widget/down_arrow", _cb_down,
+			    cfdata, NULL);
+   cfdata->o_down = ow;
+   e_widget_disabled_set(ow, 1);
+   e_widget_table_object_append(bt, ow, 1, 0, 1, 1, 1, 0, 1, 0);
+   e_widget_frametable_object_append(ot, bt, 0, 1, 1, 1, 1, 0, 1, 0);
+   ow = e_widget_button_add(evas, _("Delete"), "widget/del", _cb_del,
+			    cfdata, NULL);
+   cfdata->o_del = ow;
+   e_widget_disabled_set(ow, 1);
+   e_widget_frametable_object_append(ot, ow, 0, 2, 1, 1, 1, 0, 1, 0);
+   e_widget_list_object_append(o, ot, 1, 1, 0.5);
+
+   return o;
 }

 static int
@@ -335,12 +283,10 @@
 {
    int ret = 0;
    char *ext;
-
-   if (!cfdata->apps || !cfdata->once || !cfdata->once->filename) return 1;
-
-   ext = strrchr(cfdata->once->filename, '.');
+
+   if ((!cfdata->data) || (!cfdata->data->filename)) return 0;
+   ext = strrchr(cfdata->data->filename, '.');
    if (!ext) return 0;
-
    if (!strcmp(ext, ".menu"))
      ret = _save_menu(cfdata);
    else if (!strcmp(ext, ".order"))
@@ -349,375 +295,402 @@
    return ret;
 }

-static int
-_save_menu(E_Config_Dialog_Data *cfdata)
-{
-   Efreet_Menu *menu;
-   Efreet_Desktop *desk;
-   int ret;
-
-   menu = efreet_menu_new();
-   ecore_list_first_goto(cfdata->apps);
-   while ((desk = ecore_list_next(cfdata->apps)))
-     efreet_menu_desktop_insert(menu, desk, -1);
-
-   ret = efreet_menu_save(menu, cfdata->once->filename);
+static Ecore_List *
+_load_menu(const char *path)
+{
+   Efreet_Menu *menu, *entry;
+   Ecore_List *apps = NULL;
+
+   apps = ecore_list_new();
+   ecore_list_free_cb_set(apps, ECORE_FREE_CB(efreet_desktop_free));
+   menu = efreet_menu_parse(path);
+   if (!menu) return apps;
+   ecore_list_first_goto(menu->entries);
+   while ((entry = ecore_list_next(menu->entries)))
+     {
+	if (entry->type != EFREET_MENU_ENTRY_DESKTOP) continue;
+	efreet_desktop_ref(entry->desktop);
+	ecore_list_append(apps, entry->desktop);
+     }
    efreet_menu_free(menu);
-   return ret;
-}
-
-static int
-_save_order(E_Config_Dialog_Data *cfdata)
-{
-   E_Order *order;
-   Efreet_Desktop *desk;
-
-   order = e_order_new(cfdata->once->filename);
-   if (!order) return 0;
-   e_order_clear(order);
-   ecore_list_first_goto(cfdata->apps);
-   while ((desk = ecore_list_next(cfdata->apps)))
-     e_order_append(order, desk);
-
+   if (apps) ecore_list_sort(apps, ECORE_COMPARE_CB(_cb_sort_desks), ECORE_SORT_MIN);
+   return apps;
+}
+
+static Ecore_List *
+_load_order(const char *path)
+{
+   E_Order *order = NULL;
+   Evas_List *l = NULL;
+   Ecore_List *apps = NULL;
+
+   apps = ecore_list_new();
+   ecore_list_free_cb_set(apps, ECORE_FREE_CB(efreet_desktop_free));
+   if (!path) return apps;
+   order = e_order_new(path);
+   if (!order) return apps;
+   for (l = order->desktops; l; l = l->next)
+     {
+	efreet_desktop_ref(l->data);
+	ecore_list_append(apps, l->data);
+     }
+   if (l) evas_list_free(l);
    e_object_del(E_OBJECT(order));
-   return 1;
-}
-
-static void
-_fill_categories(E_Config_Dialog_Data *cfdata)
-{
+   if (apps) ecore_list_sort(apps, ECORE_COMPARE_CB(_cb_sort_desks), ECORE_SORT_MIN);
+   return apps;
+}
+
+static void
+_fill_apps(E_Config_Dialog_Data *cfdata)
+{
+   Ecore_List *desks = NULL, *l = NULL;
+   Efreet_Desktop *desk = NULL;
    Evas *evas;
-   Evas_Coord w;
-   Ecore_List *cats;
-   char *category;
-
-   evas = evas_object_evas_get(cfdata->o_apps);
+   int w;
+
+   l = ecore_list_new();
+   ecore_list_free_cb_set(l, ECORE_FREE_CB(efreet_desktop_free));
+
+   evas = evas_object_evas_get(cfdata->o_all);
+   desks = efreet_util_desktop_name_glob_list("*");
+   ecore_list_sort(desks, ECORE_COMPARE_CB(_cb_sort_desks), ECORE_SORT_MIN);
+   ecore_list_first_goto(desks);
+   while ((desk = ecore_list_next(desks)))
+     {
+	if (!ecore_list_find(l, ECORE_COMPARE_CB(_cb_sort_desks), desk))
+	  {
+	     efreet_desktop_ref(desk);
+	     ecore_list_append(l, desk);
+	  }
+     }
+
+   if (desks) ecore_list_destroy(desks);
+   if (l) ecore_list_sort(l, ECORE_COMPARE_CB(_cb_sort_desks), ECORE_SORT_MIN);
+
    evas_event_freeze(evas);
    edje_freeze();
-   e_widget_ilist_freeze(cfdata->o_apps);
-   e_widget_ilist_clear(cfdata->o_apps);
-
-   cats = efreet_util_desktop_categories_list();
-   ecore_list_sort(cats, ECORE_COMPARE_CB(strcmp), ECORE_SORT_MIN);
-   ecore_list_first_goto(cats);
-   while ((category = ecore_list_next(cats)))
-     e_widget_ilist_append(cfdata->o_apps, NULL, category,
-			   _category_cb_selected, cfdata, category);
-   ecore_list_destroy(cats);
-
-   e_widget_ilist_go(cfdata->o_apps);
-   e_widget_min_size_get(cfdata->o_apps, &w, NULL);
-   e_widget_min_size_set(cfdata->o_apps, w, 200);
-   e_widget_ilist_thaw(cfdata->o_apps);
+   e_widget_ilist_freeze(cfdata->o_all);
+   e_widget_ilist_clear(cfdata->o_all);
+   ecore_list_first_goto(l);
+   while ((desk = ecore_list_next(l)))
+     {
+	Evas_Object *icon = NULL;
+
+	icon = e_util_desktop_icon_add(desk, "24x24", evas);
+	e_widget_ilist_append(cfdata->o_all, icon, desk->name,
+			      _all_list_cb_selected, cfdata, desk->orig_path);
+     }
+   if (l) ecore_list_destroy(l);
+
+   e_widget_ilist_go(cfdata->o_all);
+   e_widget_ilist_thaw(cfdata->o_all);
    edje_thaw();
    evas_event_thaw(evas);
-}
-
-static int
-_cb_desktop_name_sort(Efreet_Desktop *a, Efreet_Desktop *b)
-{
-  return strcmp(a->name, b->name);
-}
-
-static void
-_fill_apps(E_Config_Dialog_Data *cfdata)
-{
+   e_widget_min_size_get(cfdata->o_all, &w, NULL);
+   e_widget_min_size_set(cfdata->o_all, w, 240);
+}
+
+static void
+_fill_list(E_Config_Dialog_Data *cfdata)
+{
+   Efreet_Desktop *desk = NULL;
    Evas *evas;
-   Evas_Coord w;
-
-   Ecore_List *desktops;
-   Efreet_Desktop *desktop;
-
-   if (!cfdata->category) return;
-   evas = evas_object_evas_get(cfdata->o_apps);
+   int w;
+
+   if (!cfdata->apps) return;
+   evas = evas_object_evas_get(cfdata->o_sel);
    evas_event_freeze(evas);
    edje_freeze();
-   e_widget_ilist_freeze(cfdata->o_apps);
-   e_widget_ilist_clear(cfdata->o_apps);
-   e_widget_ilist_header_append(cfdata->o_apps, NULL, cfdata->category);
-
-   desktops = (Ecore_List *)efreet_util_desktop_category_list(cfdata->category);
-   ecore_list_sort(desktops, ECORE_COMPARE_CB(_cb_desktop_name_sort), ECORE_SORT_MIN);
-   ecore_list_first_goto(desktops);
-   while ((desktop = ecore_list_next(desktops)))
-     {
-	Evas_Object *icon;
-
-	icon = e_util_desktop_icon_add(desktop, "24x24", evas);
-	e_widget_ilist_append(cfdata->o_apps, icon, desktop->name,
-			      _apps_cb_selected, cfdata, desktop->orig_path);
-     }
-
-   e_widget_ilist_go(cfdata->o_apps);
-   e_widget_min_size_get(cfdata->o_apps, &w, NULL);
-   e_widget_min_size_set(cfdata->o_apps, w, 200);
-   e_widget_ilist_thaw(cfdata->o_apps);
+   e_widget_ilist_freeze(cfdata->o_sel);
+   e_widget_ilist_clear(cfdata->o_sel);
+   ecore_list_first_goto(cfdata->apps);
+   while ((desk = ecore_list_next(cfdata->apps)))
+     {
+	Evas_Object *icon = NULL;
+
+	icon = e_util_desktop_icon_add(desk, "24x24", evas);
+	e_widget_ilist_append(cfdata->o_sel, icon, desk->name,
+			      _sel_list_cb_selected, cfdata, desk->orig_path);
+     }
+   if (cfdata->apps) ecore_list_destroy(cfdata->apps);
+   cfdata->apps = NULL;
+   e_widget_ilist_go(cfdata->o_sel);
+   e_widget_min_size_get(cfdata->o_sel, &w, NULL);
+   e_widget_min_size_set(cfdata->o_sel, w, 240);
+   e_widget_ilist_thaw(cfdata->o_sel);
    edje_thaw();
    evas_event_thaw(evas);
-}
-
-static void
-_fill_list(E_Config_Dialog_Data *cfdata)
-{
-   Evas *evas;
-   Evas_Coord w;
-   Efreet_Desktop *desktop;
-
-   if ((!cfdata->apps))
-     {
-	e_widget_min_size_set(cfdata->o_list, 200, 200);
-	return;
-     }
-
-   evas = evas_object_evas_get(cfdata->o_list);
-   evas_event_freeze(evas);
-   edje_freeze();
-   e_widget_ilist_freeze(cfdata->o_list);
-
-   ecore_list_first_goto(cfdata->apps);
-   while ((desktop = ecore_list_next(cfdata->apps)))
-     {
-	Evas_Object *icon = NULL;
-
-	icon = e_util_desktop_icon_add(desktop, "24x24", evas);
-	e_widget_ilist_append(cfdata->o_list, icon, desktop->name,
-			      _list_cb_selected, cfdata, desktop->orig_path);
-     }
-
-   e_widget_ilist_go(cfdata->o_list);
-   e_widget_min_size_get(cfdata->o_list, &w, NULL);
-   e_widget_min_size_set(cfdata->o_list, w, 200);
-   e_widget_ilist_thaw(cfdata->o_list);
-   edje_thaw();
-   evas_event_thaw(evas);
-}
-
-static void
-_category_cb_selected(void *data)
-{
-   E_Config_Dialog_Data *cfdata;
-
-   cfdata = data;
-
-   cfdata->category_n = e_widget_ilist_selected_get(cfdata->o_apps);
-   if (cfdata->category) ecore_string_release(cfdata->category);
-   cfdata->category = ecore_string_instance(cfdata->app);
-   _fill_apps(cfdata);
-   e_widget_disabled_set(cfdata->o_categories, 0);
-}
-
-static void
-_apps_cb_selected(void *data)
-{
-   E_Config_Dialog_Data *cfdata;
-
-   cfdata = data;
-   e_widget_disabled_set(cfdata->o_add, 0);
-}
-
-static void
-_list_cb_selected(void *data)
-{
-   E_Config_Dialog_Data *cfdata;
+   e_widget_disabled_set(cfdata->o_del, 1);
+}
+
+static int
+_cb_sort_desks(Efreet_Desktop *d1, Efreet_Desktop *d2)
+{
+   if (!d1->name) return 1;
+   if (!d2->name) return -1;
+   return strcmp(d1->name, d2->name);
+}
+
+static void
+_all_list_cb_change(void *data, Evas_Object *obj)
+{
+   E_Config_Dialog_Data *cfdata = NULL;
+
+   if (!(cfdata = data)) return;
+
+   /* unselect anything in Sel List & disable buttons */
+   e_widget_ilist_unselect(cfdata->o_sel);
+   e_widget_disabled_set(cfdata->o_up, 1);
+   e_widget_disabled_set(cfdata->o_down, 1);
+   e_widget_disabled_set(cfdata->o_del, 1);
+}
+
+static void
+_sel_list_cb_change(void *data, Evas_Object *obj)
+{
+   E_Config_Dialog_Data *cfdata = NULL;
+
+   if (!(cfdata = data)) return;
+
+   /* unselect anything in All List & disable buttons */
+   e_widget_ilist_unselect(cfdata->o_all);
+   e_widget_disabled_set(cfdata->o_add, 1);
+}
+
+static void
+_all_list_cb_selected(void *data)
+{
+   E_Config_Dialog_Data *cfdata = NULL;
+   int sel;
+
+   if (!(cfdata = data)) return;
+   sel = e_widget_ilist_selected_count_get(cfdata->o_all);
+   if (sel == 0)
+     e_widget_disabled_set(cfdata->o_add, 1);
+   else
+     e_widget_disabled_set(cfdata->o_add, 0);
+}
+
+static void
+_sel_list_cb_selected(void *data)
+{
+   E_Config_Dialog_Data *cfdata = NULL;
    int sel, count;
-
-   cfdata = data;
+
+   if (!(cfdata = data)) return;
    e_widget_disabled_set(cfdata->o_del, 0);
-
-   count = e_widget_ilist_count(cfdata->o_list);
-   sel = e_widget_ilist_selected_get(cfdata->o_list);
-   if (sel == 0)
+   sel = e_widget_ilist_selected_get(cfdata->o_sel);
+   count = e_widget_ilist_count(cfdata->o_sel);
+   if (sel == 0)
      e_widget_disabled_set(cfdata->o_up, 1);
    else
      e_widget_disabled_set(cfdata->o_up, 0);
-   if (sel < (count -1))
+   if (sel < (count - 1))
      e_widget_disabled_set(cfdata->o_down, 0);
    else
      e_widget_disabled_set(cfdata->o_down, 1);
 }

 static void
-_cb_categories(void *data, void *data2)
-{
-   E_Config_Dialog_Data *cfdata;
-
-   cfdata = data;
-   e_widget_disabled_set(cfdata->o_categories, 1);
-   if (cfdata->category) ecore_string_release(cfdata->category);
-   cfdata->category = NULL;
-   _fill_categories(cfdata);
-   e_widget_ilist_nth_show(cfdata->o_apps, cfdata->category_n, 1);
-   cfdata->category_n = 0;
-}
-
-static void
 _cb_add(void *data, void *data2)
 {
-   E_Config_Dialog_Data *cfdata;
-   Evas_Object *icon;
-   Efreet_Desktop *desk;
+   E_Config_Dialog_Data *cfdata = NULL;
+   Evas_List *l = NULL;
    Evas *evas;
-   Evas_Coord w;
-
-   cfdata = data;
-   if (!cfdata->apps) return;
-   if (e_widget_ilist_selected_get(cfdata->o_apps) < 0) return;
-   desk = efreet_desktop_get(cfdata->app);
-   if (!desk) return;
-
-   evas = evas_object_evas_get(cfdata->o_list);
+   int w, i;
+
+   if (!(cfdata = data)) return;
+   evas = evas_object_evas_get(cfdata->o_all);
    evas_event_freeze(evas);
    edje_freeze();
-   e_widget_ilist_freeze(cfdata->o_list);
-   icon = e_util_desktop_icon_add(desk, "24x24", evas);
-   e_widget_ilist_append(cfdata->o_list, icon, desk->name,
-			 _list_cb_selected, cfdata, cfdata->app);
-   e_widget_ilist_go(cfdata->o_list);
-   e_widget_min_size_get(cfdata->o_list, &w, NULL);
-   e_widget_min_size_set(cfdata->o_list, w, 200);
-   e_widget_ilist_thaw(cfdata->o_list);
+   e_widget_ilist_freeze(cfdata->o_all);
+
+   for (i = 0, l = e_widget_ilist_items_get(cfdata->o_all); l; l = l->next, i++)
+     {
+	E_Ilist_Item *item = NULL;
+	Efreet_Desktop *desk = NULL;
+	Evas_Object *icon = NULL;
+	const char *lbl;
+
+	if (!(item = l->data)) continue;
+	if (!item->selected) continue;
+	lbl = e_widget_ilist_nth_label_get(cfdata->o_all, i);
+	if (!lbl) continue;
+	desk = efreet_util_desktop_name_find(lbl);
+	if (!desk) continue;
+	icon = e_util_desktop_icon_add(desk, "24x24", evas);
+	e_widget_ilist_append(cfdata->o_sel, icon, desk->name,
+			      _sel_list_cb_selected, cfdata, desk->orig_path);
+     }
+
+   e_widget_ilist_go(cfdata->o_sel);
+   e_widget_min_size_get(cfdata->o_sel, &w, NULL);
+   e_widget_min_size_set(cfdata->o_sel, w, 240);
+   e_widget_ilist_thaw(cfdata->o_sel);
+   e_widget_ilist_unselect(cfdata->o_all);
    edje_thaw();
    evas_event_thaw(evas);
-
-   ecore_list_append(cfdata->apps, desk);
 }

 static void
 _cb_del(void *data, void *data2)
 {
-   E_Config_Dialog_Data *cfdata;
-   Efreet_Desktop *desk;
+   E_Config_Dialog_Data *cfdata = NULL;
+   Evas_List *l = NULL;
    Evas *evas;
-   Evas_Coord w;
-   int num;
-
-   cfdata = data;
-   if (!cfdata->apps) return;
-   num = e_widget_ilist_selected_get(cfdata->o_list);
-   if (num < 0) return;
-
-   evas = evas_object_evas_get(cfdata->o_list);
+   int w;
+
+   if (!(cfdata = data)) return;
+   evas = evas_object_evas_get(cfdata->o_sel);
    evas_event_freeze(evas);
    edje_freeze();
-   e_widget_ilist_freeze(cfdata->o_list);
-   e_widget_ilist_remove_num(cfdata->o_list, num);
-   e_widget_ilist_go(cfdata->o_list);
-   e_widget_min_size_get(cfdata->o_list, &w, NULL);
-   e_widget_min_size_set(cfdata->o_list, w, 200);
-   e_widget_ilist_thaw(cfdata->o_list);
+   e_widget_ilist_freeze(cfdata->o_sel);
+   for (l = e_widget_ilist_items_get(cfdata->o_sel); l; l = l->next)
+     {
+	int i = 0;
+
+	i = e_widget_ilist_selected_get(cfdata->o_sel);
+	if (i == -1) break;
+	e_widget_ilist_remove_num(cfdata->o_sel, i);
+     }
+   e_widget_ilist_unselect(cfdata->o_sel);
+   e_widget_ilist_go(cfdata->o_sel);
+   e_widget_min_size_get(cfdata->o_sel, &w, NULL);
+   e_widget_min_size_set(cfdata->o_sel, w, 240);
+   e_widget_ilist_thaw(cfdata->o_sel);
    edje_thaw();
    evas_event_thaw(evas);
-
-   desk = efreet_desktop_get(cfdata->fav);
-   if (!desk) return;
-   if (ecore_list_goto(cfdata->apps, desk))
-     {
-	Efreet_Desktop *tmp;
-
-	tmp = ecore_list_remove(cfdata->apps);
-	efreet_desktop_free(tmp);
-     }
-   efreet_desktop_free(desk);
 }

 static void
 _cb_up(void *data, void *data2)
 {
-   E_Config_Dialog_Data *cfdata;
-   Efreet_Desktop *desk;
+   E_Config_Dialog_Data *cfdata = NULL;
+   Evas_Object *icon = NULL;
+   Efreet_Desktop *desk = NULL;
    Evas *evas;
-   Evas_Object *icon;
-   Evas_Coord w;
-   int sel, i;
-
-   cfdata = data;
-   if (!cfdata->apps) return;
-
-   sel = e_widget_ilist_selected_get(cfdata->o_list);
-   if (sel < 0) return;
-
-   desk = efreet_desktop_get(cfdata->fav);
-   if (!desk) return;
-
-   evas = evas_object_evas_get(cfdata->o_list);
+   const char *lbl;
+   int sel, w;
+
+   if (!(cfdata = data)) return;
+   if (e_widget_ilist_selected_count_get(cfdata->o_sel) > 1) return;
+   evas = evas_object_evas_get(cfdata->o_sel);
    evas_event_freeze(evas);
    edje_freeze();
-   e_widget_ilist_freeze(cfdata->o_list);
-   e_widget_ilist_remove_num(cfdata->o_list, sel);
-   e_widget_ilist_go(cfdata->o_list);
-
-   icon = e_util_desktop_icon_add(desk, "24x24", evas);
-   e_widget_ilist_prepend_relative(cfdata->o_list, icon, desk->name,
-			 _list_cb_selected, cfdata, cfdata->fav, (sel - 1));
-   e_widget_ilist_selected_set(cfdata->o_list, (sel - 1));
-   e_widget_ilist_go(cfdata->o_list);
-   e_widget_min_size_get(cfdata->o_list, &w, NULL);
-   e_widget_min_size_set(cfdata->o_list, w, 200);
-   e_widget_ilist_thaw(cfdata->o_list);
+   e_widget_ilist_freeze(cfdata->o_sel);
+   sel = e_widget_ilist_selected_get(cfdata->o_sel);
+   lbl = e_widget_ilist_nth_label_get(cfdata->o_sel, sel);
+   if (lbl)
+     {
+	desk = efreet_util_desktop_name_find(lbl);
+	if (desk)
+	  {
+	     e_widget_ilist_remove_num(cfdata->o_sel, sel);
+	     e_widget_ilist_go(cfdata->o_sel);
+	     icon = e_util_desktop_icon_add(desk, "24x24", evas);
+	     e_widget_ilist_prepend_relative(cfdata->o_sel, icon, desk->name,
+					     _sel_list_cb_selected, cfdata,
+					     desk->orig_path, (sel - 1));
+	     e_widget_ilist_selected_set(cfdata->o_sel, (sel - 1));
+	  }
+     }
+   e_widget_ilist_go(cfdata->o_sel);
+   e_widget_min_size_get(cfdata->o_sel, &w, NULL);
+   e_widget_min_size_set(cfdata->o_sel, w, 240);
+   e_widget_ilist_thaw(cfdata->o_sel);
    edje_thaw();
    evas_event_thaw(evas);
-
-   if (ecore_list_goto(cfdata->apps, desk))
-     {
-	Efreet_Desktop *tmp;
-
-	i = ecore_list_index(cfdata->apps);
-	tmp = ecore_list_remove(cfdata->apps);
-	ecore_list_index_goto(cfdata->apps, (i - 1));
-	ecore_list_insert(cfdata->apps, desk);
-	efreet_desktop_free(tmp);
-     }
-   else
-     efreet_desktop_free(desk);
 }

 static void
 _cb_down(void *data, void *data2)
 {
-   E_Config_Dialog_Data *cfdata;
-   Efreet_Desktop *desk;
+   E_Config_Dialog_Data *cfdata = NULL;
+   Evas_Object *icon = NULL;
+   Efreet_Desktop *desk = NULL;
    Evas *evas;
-   Evas_Object *icon;
-   Evas_Coord w;
-   int sel, i;
-
-   cfdata = data;
-   if (!cfdata->apps) return;
-
-   sel = e_widget_ilist_selected_get(cfdata->o_list);
-   if (sel < 0) return;
-
-   desk = efreet_desktop_get(cfdata->fav);
-   if (!desk) return;
-
-   evas = evas_object_evas_get(cfdata->o_list);
+   const char *lbl;
+   int sel, w;
+
+   if (!(cfdata = data)) return;
+   if (e_widget_ilist_selected_count_get(cfdata->o_sel) > 1) return;
+   evas = evas_object_evas_get(cfdata->o_sel);
    evas_event_freeze(evas);
    edje_freeze();
-   e_widget_ilist_freeze(cfdata->o_list);
-   e_widget_ilist_remove_num(cfdata->o_list, sel);
-   e_widget_ilist_go(cfdata->o_list);
-
-   icon = e_util_desktop_icon_add(desk, "24x24", evas);
-   e_widget_ilist_append_relative(cfdata->o_list, icon, desk->name,
-			 _list_cb_selected, cfdata, cfdata->fav, sel);
-   e_widget_ilist_selected_set(cfdata->o_list, (sel + 1));
-   e_widget_ilist_go(cfdata->o_list);
-   e_widget_min_size_get(cfdata->o_list, &w, NULL);
-   e_widget_min_size_set(cfdata->o_list, w, 200);
-   e_widget_ilist_thaw(cfdata->o_list);
+   e_widget_ilist_freeze(cfdata->o_sel);
+   sel = e_widget_ilist_selected_get(cfdata->o_sel);
+   lbl = e_widget_ilist_nth_label_get(cfdata->o_sel, sel);
+   if (lbl)
+     {
+	desk = efreet_util_desktop_name_find(lbl);
+	if (desk)
+	  {
+	     e_widget_ilist_remove_num(cfdata->o_sel, sel);
+	     e_widget_ilist_go(cfdata->o_sel);
+	     icon = e_util_desktop_icon_add(desk, "24x24", evas);
+	     e_widget_ilist_append_relative(cfdata->o_sel, icon, desk->name,
+					     _sel_list_cb_selected, cfdata,
+					     desk->orig_path, sel);
+	     e_widget_ilist_selected_set(cfdata->o_sel, (sel + 1));
+	  }
+     }
+   e_widget_ilist_go(cfdata->o_sel);
+   e_widget_min_size_get(cfdata->o_sel, &w, NULL);
+   e_widget_min_size_set(cfdata->o_sel, w, 240);
+   e_widget_ilist_thaw(cfdata->o_sel);
    edje_thaw();
    evas_event_thaw(evas);
-
-   if (ecore_list_goto(cfdata->apps, desk))
-     {
-	Efreet_Desktop *tmp;
-
-	i = ecore_list_index(cfdata->apps);
-	tmp = ecore_list_remove(cfdata->apps);
-	ecore_list_index_goto(cfdata->apps, (i + 1));
-	ecore_list_insert(cfdata->apps, desk);
-	efreet_desktop_free(tmp);
-     }
-   else
-     efreet_desktop_free(desk);
-}
+}
+
+static int
+_save_menu(E_Config_Dialog_Data *cfdata)
+{
+   Evas_List *l = NULL;
+   Efreet_Menu *menu = NULL;
+   int i, ret;
+
+   menu = efreet_menu_new();
+   for (i = 0, l = e_widget_ilist_items_get(cfdata->o_sel); l; l = l->next, i++)
+     {
+	E_Ilist_Item *item = NULL;
+	Efreet_Desktop *desk = NULL;
+	const char *lbl;
+
+	if (!(item = l->data)) continue;
+	lbl = e_widget_ilist_nth_label_get(cfdata->o_sel, i);
+	if (!lbl) continue;
+	desk = efreet_util_desktop_name_find(lbl);
+	if (!desk) continue;
+	efreet_menu_desktop_insert(menu, desk, -1);
+     }
+   ret = efreet_menu_save(menu, cfdata->data->filename);
+   efreet_menu_free(menu);
+   return ret;
+}
+
+static int
+_save_order(E_Config_Dialog_Data *cfdata)
+{
+   Evas_List *l = NULL;
+   E_Order *order = NULL;
+   int i;
+
+   order = e_order_new(cfdata->data->filename);
+   if (!order) return 0;
+   e_order_clear(order);
+   for (i = 0, l = e_widget_ilist_items_get(cfdata->o_sel); l; l = l->next, i++)
+     {
+	E_Ilist_Item *item = NULL;
+	Efreet_Desktop *desk = NULL;
+	const char *lbl;
+
+	if (!(item = l->data)) continue;
+	lbl = e_widget_ilist_nth_label_get(cfdata->o_sel, i);
+	if (!lbl) continue;
+	desk = efreet_util_desktop_name_find(lbl);
+	if (!desk) continue;
+	e_order_append(order, desk);
+     }
+   e_object_del(E_OBJECT(order));
+   return 1;
+}


Added missing headers to master header

Added missing headers to master header

--- FranticApparatus/FranticApparatus.h
+++ FranticApparatus/FranticApparatus.h
@@ -23,6 +23,14 @@
 //

+
+// Event
+#import "FAEvent.h"
+#import "FAEventHandler.h"
+#import "FAEventDispatcher.h"
+#import "FAAbstractEventDispatcher.h"
+#import "FASynchronousEventDispatcher.h"
+#import "FAAsynchronousEventDispatcher.h"

 // Task
 #import "FATask.h"
@@ -60,5 +68,7 @@

 // Network Events
 #import "FAURLConnectionTaskResultEvent.h"
+#import "FAURLConnectionTaskDataResultEvent.h"
+#import "FAURLConnectionTaskDownloadResultEvent.h"
 #import "FAURLConnectionTaskSendProgressEvent.h"
 #import "FAURLConnectionTaskReceiveProgressEvent.h"


- issue 2119: instead of always including the files, allow an overwrite definition, so that symbols don't class

--- copasi/steadystate/CEigen.h
+++ copasi/steadystate/CEigen.h
@@ -33,22 +33,28 @@
 #include "utilities/CVector.h"
 #include "report/CCopasiContainer.h"

-#ifndef HAVE_APPLE
-#include "lapack/blaswrap.h"
-#include "lapack/lapackwrap.h"
-#else
+#ifdef COPASI_OVERWRITE_LOGICAL_AS_INT
+typedef  C_INT logical;
+#elif COPASI_OVERWRITE_LOGICAL_AS_LONG
+typedef  long logical;
+#else
+# ifndef HAVE_APPLE
+#   include "lapack/blaswrap.h"
+#   include "lapack/lapackwrap.h"
+# else
 // need to include definition directly, so that
 // MacTypes.h is not included which would break
 // the build
-# ifdef HAVE_F2C_H
-#  include <f2c.h>
-# else
-#  include "lapack/f2c.h"
-# endif
-# undef abs
-# undef max
-# undef min
-#endif
+#   ifdef HAVE_F2C_H
+#     include <f2c.h>
+#   else
+#     include "lapack/f2c.h"
+#   endif
+#   undef abs
+#   undef max
+#   undef min
+# endif // HAVE_APPLE
+#endif // COPASI_OVERWRITE_LOGICAL_AS_INT

 class CEigen: public CCopasiContainer
 {


Update rvdbg.h

Update rvdbg.h

--- src/Dispatcher/rvdbg.h
+++ src/Dispatcher/rvdbg.h
@@ -7,20 +7,24 @@
 #include "..\Injector\injector.h"
 #include "..\IATResolution\iatresolve.h"

+#define PAUSE_ALL 0
+#define PAUSE_SINGLE 1
+#define PAUSE_CONTINUE 2
+
+#define IMMEDIATE_EXCEPTION 0
+#define PAGE_EXCEPTION 1
+#define ACCESS_EXCEPTION 2

 static BOOLEAN UseModule;

 static DWORD ExceptionComparator; // If the exception is the address compared
 static DWORD ExceptionCode; // The exception status code
 static DWORD AccessException;
-static DWORD SelectedAddress;
-static BYTE SelectedARegister;

+static BOOLEAN Pause; // {0 = complete pause ; 1 = only the thread being debugged is pause ; 2 = full continue}
 static BOOLEAN Debugger;
-extern BOOLEAN tDSend;

 static BOOLEAN ExceptionMode;
-static BOOLEAN ChunkExecutable;

 static PVOID Decision; // The code to jump to, what we would call the catch block
 static PVOID KiUserRealDispatcher; // the code to the real exception dispatcher
@@ -34,8 +38,14 @@

 static std::vector<PVOID> Swaps;
 static HANDLE Threads[16];
+
 static Dispatcher::PoolSect Sector[128];
 static Dispatcher::PoolSect CurrentPool;
+
+static char CopyModule[MAX_PATH];
+static char MainModule[MAX_PATH];
+
+static BYTE g_Field[128];

 namespace Dbg
 {
@@ -104,12 +114,21 @@
 		xmm7,
 	};

+
+
 	static void HandleSSE();
+	static PVOID CallChainVPA();
 	static PVOID CallChain();
 	static void SetKiUser();
+	static void ResumeSelfThreads();
+	static int WaitOptModule(const char* OriginalModuleName, const char* OptModuleName);
+	void SetModule(BOOLEAN use, const char* OriginalModuleName, const char* ModuleCopyName);
+	char* GetCopyModuleName();

-	int WaitOptModule(const char* OriginalModuleName, const char* OptModuleName);
-	void SetModule(BOOLEAN use);
+	extern BOOLEAN tDSend;
+
+	void SetPauseMode(BOOLEAN PauseMode);
+	BOOLEAN GetPauseMode();

 	void AttachRVDbg();
 	void DetachRVDbg();


ports/gtk-webkit: Protect against null cookies.

--- ports/gtk-webkit/buffer.h
+++ ports/gtk-webkit/buffer.h
@@ -143,7 +143,7 @@

 void buffer_set_uri(GObject *cookie_manager, GAsyncResult *res, gpointer data) {
 	GError *error = NULL;
-	char *cookies_string = NULL;
+	char *cookies_string = "";
 	{
 		GList *cookies = webkit_cookie_manager_get_cookies_finish(
 			(WebKitCookieManager *)cookie_manager, res, &error);
@@ -160,7 +160,9 @@
 			cookies = cookies->next;
 		}
 		scookies = g_slist_reverse(scookies);
-		cookies_string = soup_cookies_to_cookie_header(scookies);
+		if (scookies != NULL) {
+			cookies_string = soup_cookies_to_cookie_header(scookies);
+		}

 		g_slist_free(scookies);
 		g_list_free_full(cookies, (GDestroyNotify)soup_cookie_free);
@@ -201,7 +203,9 @@
 	if (g_strcmp0(mouse_button, "") != 0) {
 		g_free(mouse_button);
 	}
-	g_free(cookies_string);
+	if (g_strcmp0(cookies_string, "") != 0) {
+		g_free(cookies_string);
+	}
 	g_free(is_new_window);
 	g_free(is_known_type);
 	g_free(modifiers);


Remove duplicate #error informing people to run the CreateProjectDirectoryStructure.bat.

--- FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main.c
+++ FreeRTOS/Demo/CORTEX_M0_LPC1114_LPCXpresso/RTOSDemo/Source/main.c
@@ -88,8 +88,6 @@
  *
  *****************************************************************************/

-#error The batch file Demo\CORTEX_M0_LPC1114_LPCXpresso\RTOSDemo\CreateProjectDirectoryStructure.bat must be executed before the first build.  After executing the batch file hit F5 to refrech the Eclipse project, then delete this line.
-
 /* Standard includes. */
 #include "string.h"


zephyr/modusocket: Fix parameter in calls to net_context_get_XXX().

The following simple usocket example throws an error EINVAL on connect

    import usocket
    s = usocket.socket()
    s.connect(usocket.getaddrinfo('www.micropython.org', 80)[0][-1])

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: [Errno 22] EINVAL

Fixing the context parameter in calls of net_context_get_family() and
net_context_get_type(), the connect works fine.

Tested on a nucleo_h743zi board.

--- ports/zephyr/modusocket.c
+++ ports/zephyr/modusocket.c
@@ -79,7 +79,8 @@

     mp_obj_t *addr_items;
     mp_obj_get_array_fixed_n(addr_in, 2, &addr_items);
-    sockaddr_in->sin_family = net_context_get_family((void *)socket->ctx);
+    void *context = zsock_get_context_object(socket->ctx);
+    sockaddr_in->sin_family = net_context_get_family(context);
     RAISE_ERRNO(net_addr_pton(sockaddr_in->sin_family, mp_obj_str_get_str(addr_items[0]), &sockaddr_in->sin_addr));
     sockaddr_in->sin_port = htons(mp_obj_get_int(addr_items[1]));
 }
@@ -119,8 +120,8 @@
     if (self->ctx == -1) {
         mp_printf(print, "<socket NULL>");
     } else {
-        struct net_context *ctx = (void *)self->ctx;
-        mp_printf(print, "<socket %p type=%d>", ctx, net_context_get_type(ctx));
+        void *context = zsock_get_context_object(self->ctx);
+        mp_printf(print, "<socket %p type=%d>", self->ctx, net_context_get_type(context));
     }
 }


error: pathspec 'C/String/FormatNoAccent.c' did not match any file(s) known to git

--- C/String/FormatNoAccent.c
+++ C/String/FormatNoAccent.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#include <string.h>
+
+int main() {
+    char nomes[3][15];
+    strcpy(nomes[0], "palavra");
+    strcpy(nomes[1], "palavraozzz");
+    strcpy(nomes[2], "palavraozao");
+    for (int i = 0; i < 3 ; i++) printf("%-20s\t1\n", nomes[i]);
+}
+
+//https://pt.stackoverflow.com/q/440945/101


add AVX2 dispatch

add AVX2 dispatch

--- numpy/core/src/multiarray/compiled_base.dispatch.c
+++ numpy/core/src/multiarray/compiled_base.dispatch.c
@@ -1,6 +1,6 @@
 /**
  * @targets $maxopt baseline
- * SSE2
+ * SSE2 AVX2
  * VSX VSX2
  * NEON ASIMDDP
  */
@@ -29,8 +29,9 @@
         npyv_u64 zero = npyv_zero_u64();
         /* don't handle non-full 8-byte remainder */
         npy_intp vn_out = n_out - (remain ? 1 : 0);
-        vn_out -= (vn_out & 1);
         const int vstep = npyv_nlanes_u64;
+        vn_out -= (vn_out & (vstep - 1));
+        // Maximum paraller abillity: handle 8 64bits at one time
         npy_uint64 a[4];
         for (index = 0; index < vn_out; index += vstep) {
             unsigned int r;
@@ -43,9 +44,9 @@
             /* note x86 can load unaligned */
             npyv_u64 v;
             if (vstep == 4) {
-                v = npyv_setf_u64(a[3], a[2], a[1], a[0]);
+                v = npyv_set_u64(a[0], a[1], a[2], a[3]);
             } else {
-                v = npyv_setf_u64(a[1], a[0]);
+                v = npyv_set_u64(a[0], a[1]);
             }
             /* false -> 0x00 and true -> 0xFF (there is no cmpneq) */
             v = npyv_cvt_u8_u64(npyv_cmpeq_u8(npyv_cvt_u64_u8(v), npyv_cvt_u64_u8(zero)));


Fixed a bug of row number when updating for the NextTrains window.

--- src/window_next_trains.c
+++ src/window_next_trains.c
@@ -385,7 +385,7 @@
 }

 static uint16_t menu_layer_get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, NextTrains *user_info) {
-    if (section_index == NEXT_TRAINS_SECTION_INFO) {
+    if (section_index == NEXT_TRAINS_SECTION_INFO || user_info->is_updating) {
         return 1;
     } else if (section_index == NEXT_TRAINS_SECTION_TRAINS) {
         return (user_info->next_trains_list_count > 0)?user_info->next_trains_list_count:1;


* typo fix: rename recpt-activated into recpt_activated

pmo-trunk-r1532

--- src/widgets/modest-mail-header-view.c
+++ src/widgets/modest-mail-header-view.c
@@ -523,7 +523,7 @@
 	g_type_class_add_private (object_class, sizeof (ModestMailHeaderViewPriv));

  	signals[RECPT_ACTIVATED_SIGNAL] =
- 		g_signal_new ("recpt-activated",
+ 		g_signal_new ("recpt_activated",
 			      G_TYPE_FROM_CLASS (object_class),
 			      G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
 			      G_STRUCT_OFFSET(ModestMailHeaderViewClass, recpt_activated),


Use folly::atomic_compare_exchange_strong_explicit in futures

Summary: This helps avoid TSAN false positives.

Reviewed By: yfeldblum

Differential Revision: D20787056

fbshipit-source-id: e62537235e3ad876e3ec5266f9c449d0d8340330

--- folly/futures/detail/Core.h
+++ folly/futures/detail/Core.h
@@ -209,8 +209,9 @@
     }
     DCHECK(state == State::EMPTY);
     func_ = std::move(func);
-    if (state_.compare_exchange_strong(
-            state,
+    if (folly::atomic_compare_exchange_strong_explicit(
+            &state_,
+            &state,
             State::HAS_FUNCTION,
             std::memory_order_release,
             std::memory_order_acquire)) {
@@ -240,8 +241,9 @@
     executor_ = std::move(executor);
     auto state = state_.load(std::memory_order_acquire);
     if (state == State::EMPTY &&
-        state_.compare_exchange_strong(
-            state,
+        folly::atomic_compare_exchange_strong_explicit(
+            &state_,
+            &state,
             State::HAS_EXECUTOR,
             std::memory_order_release,
             std::memory_order_acquire)) {
@@ -269,8 +271,9 @@
     }
     auto state = state_.load(std::memory_order_acquire);
     if (state == State::EMPTY &&
-        state_.compare_exchange_strong(
-            state,
+        folly::atomic_compare_exchange_strong_explicit(
+            &state_,
+            &state,
             State::DETACHED,
             std::memory_order_release,
             std::memory_order_acquire)) {


Add rsa_pss signature schemes to SSLCommonOptions

Summary: Required to support RSA certificates in TLS 1.3.

Reviewed By: knekritz

Differential Revision: D28606758

fbshipit-source-id: 0b75eccf207c1327e590675137ce3289956d8771

--- folly/io/async/SSLOptions.h
+++ folly/io/async/SSLOptions.h
@@ -52,10 +52,22 @@
    */
   static constexpr auto sigalgs() {
     return folly::make_array(
+#if FOLLY_OPENSSL_PREREQ(1, 1, 1)
+        "rsa_pss_pss_sha512",
+        "rsa_pss_rsae_sha512",
+#endif // FOLLY_OPENSSL_PREREQ(1, 1, 1)
         "RSA+SHA512",
         "ECDSA+SHA512",
+#if FOLLY_OPENSSL_PREREQ(1, 1, 1)
+        "rsa_pss_pss_sha384",
+        "rsa_pss_rsae_sha384",
+#endif // FOLLY_OPENSSL_PREREQ(1, 1, 1)
         "RSA+SHA384",
         "ECDSA+SHA384",
+#if FOLLY_OPENSSL_PREREQ(1, 1, 1)
+        "rsa_pss_pss_sha256",
+        "rsa_pss_rsae_sha256",
+#endif // FOLLY_OPENSSL_PREREQ(1, 1, 1)
         "RSA+SHA256",
         "ECDSA+SHA256",
         "RSA+SHA1",


minor reformatting

minor reformatting

--- src/glut/glx/glut_event.c
+++ src/glut/glx/glut_event.c
@@ -302,17 +302,16 @@
       return 1;
     }
 #ifndef VMS
-     /* the combination ConectionNumber-select is buggy on VMS. Sometimes it
-      * fails. This part of the code hangs the program on VMS7.2. But even
-      * without it the program seems to run correctly.
-      * Note that this is a bug in the VMS/DECWindows run-time-libraries.
-      * Compaq engeneering does not want or is not able to make a fix.
-      * (last sentence is a quotation from Compaq when I reported the
-      * problem January 2000) */
-     FD_ZERO(&fds);
+    /* the combination ConectionNumber-select is buggy on VMS. Sometimes it
+     * fails. This part of the code hangs the program on VMS7.2. But even
+     * without it the program seems to run correctly.
+     * Note that this is a bug in the VMS/DECWindows run-time-libraries.
+     * Compaq engeneering does not want or is not able to make a fix.
+     * (last sentence is a quotation from Compaq when I reported the
+     * problem January 2000) */
+    FD_ZERO(&fds);
     FD_SET(__glutConnectionFD, &fds);
-    rc = select(__glutConnectionFD + 1, &fds,
-      NULL, NULL, NULL);
+    rc = select(__glutConnectionFD + 1, &fds, NULL, NULL, NULL);
     if (rc < 0) {
       if (errno == EINTR) {
         return 0;


Make GrPipelineInput::setToSolidCoverage set the opaque bit.

Change-Id: I3580a9bf1b40c46ac642157f50e09b1fab40c3d3
Reviewed-on: https://skia-review.googlesource.com/8485
Reviewed-by: Greg Daniel <39df0a804564ccb6cf75f18db79653821f37c1c5@google.com>
Commit-Queue: Brian Salomon <61fabaaf0876044aeedfd8e351e485c028d69e7b@google.com>

--- src/gpu/GrPipelineInput.h
+++ src/gpu/GrPipelineInput.h
@@ -40,7 +40,7 @@

     void setToSolidCoverage() {
         fColor = GrColor_WHITE;
-        fFlags = kColorIsKnown_Flag | kColorIsKnown_Flag;
+        fFlags = kColorIsKnown_Flag | kIsOpaque_Flag;
     }

     void setToScalar(uint8_t alpha) {


Fix math functions

Fix math functions

- Use a uint8_t max function instead of one defined for float.
- Use expf, fabsf, fmaxf instead of their double counterparts.

Former-commit-id: 131cca18eb40761afb58a8507817206a6d9eb02a

--- mlp/mlp_impl.c
+++ mlp/mlp_impl.c
@@ -99,6 +99,8 @@
   return sum / (input.rows * input.cols);
 }

+static uint8_t min(uint8_t a, uint8_t b) { return a < b ? a : b; }
+
 static uint8_t minChar(MatChar input) {
   assert(input.data);
   int q, w;
@@ -106,10 +108,12 @@

   for (q = 0; q < input.rows; q++)
     for (w = 0; w < input.cols; w++)
-      minvalue = fmin(minvalue, input.data[q * input.step + w + input.start]);
+      minvalue = min(minvalue, input.data[q * input.step + w + input.start]);

   return minvalue;
 }
+
+static uint8_t max(uint8_t a, uint8_t b) { return a > b ? a : b; }

 static uint8_t maxChar(MatChar input) {
   assert(input.data);
@@ -118,7 +122,7 @@

   for (q = 0; q < input.rows; q++)
     for (w = 0; w < input.cols; w++)
-      maxvalue = fmax(maxvalue, input.data[q * input.step + w + input.start]);
+      maxvalue = max(maxvalue, input.data[q * input.step + w + input.start]);

   return maxvalue;
 }
@@ -325,7 +329,7 @@
   sampleMax -= sampleMean;
   sampleMin -= sampleMean;

-  sampleMax = fmax(fabs(sampleMin), fabs(sampleMax));
+  sampleMax = fmaxf(fabsf(sampleMin), fabsf(sampleMax));

   if (sampleMax == 0.0)
     sampleMax = 1.0;
@@ -394,9 +398,9 @@
       addFloat(e, -1.0, &xOut);

       SetValueFloat(result, ncy, ncx,
-                    1. / (1. + exp(-dotProduct(wOut, xOut)) - bOut));
+                    1. / (1. + expf(-dotProduct(wOut, xOut)) - bOut));
       SetValueFloat(result, ncy, ncx,
-                    1. / (1. + exp(-dotProduct(wOut, xOut) - bOut)));
+                    1. / (1. + expf(-dotProduct(wOut, xOut) - bOut)));

       freeMatFloat(&e);
       freeMatFloat(&xOut);


mm: frontswap: split out __frontswap_unuse_pages

An attempt at making frontswap_shrink shorter and more readable. This patch
splits out walking through the swap list to find an entry with enough
pages to unuse.

Also, assert that the internal __frontswap_unuse_pages is called under swap
lock, since that part of code was previously directly happen inside the lock.

Signed-off-by: Sasha Levin <611d453c03d02ce713e72b62ff6a901ea7e9cd77@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <da3a51b335cef0eb0e2c329c5ef6bcd6acef687a@oracle.com>

--- mm/frontswap.c
+++ mm/frontswap.c
@@ -230,6 +230,41 @@
 	return totalpages;
 }

+static int __frontswap_unuse_pages(unsigned long total, unsigned long *unused,
+					int *swapid)
+{
+	int ret = -EINVAL;
+	struct swap_info_struct *si = NULL;
+	int si_frontswap_pages;
+	unsigned long total_pages_to_unuse = total;
+	unsigned long pages = 0, pages_to_unuse = 0;
+	int type;
+
+	assert_spin_locked(&swap_lock);
+	for (type = swap_list.head; type >= 0; type = si->next) {
+		si = swap_info[type];
+		si_frontswap_pages = atomic_read(&si->frontswap_pages);
+		if (total_pages_to_unuse < si_frontswap_pages) {
+			pages = pages_to_unuse = total_pages_to_unuse;
+		} else {
+			pages = si_frontswap_pages;
+			pages_to_unuse = 0; /* unuse all */
+		}
+		/* ensure there is enough RAM to fetch pages from frontswap */
+		if (security_vm_enough_memory_mm(current->mm, pages)) {
+			ret = -ENOMEM;
+			continue;
+		}
+		vm_unacct_memory(pages);
+		*unused = pages_to_unuse;
+		*swapid = type;
+		ret = 0;
+		break;
+	}
+
+	return ret;
+}
+
 /*
  * Frontswap, like a true swap device, may unnecessarily retain pages
  * under certain circumstances; "shrink" frontswap is essentially a
@@ -240,11 +275,9 @@
  */
 void frontswap_shrink(unsigned long target_pages)
 {
-	struct swap_info_struct *si = NULL;
-	int si_frontswap_pages;
 	unsigned long total_pages = 0, total_pages_to_unuse;
-	unsigned long pages = 0, pages_to_unuse = 0;
-	int type;
+	unsigned long pages_to_unuse = 0;
+	int type, ret;
 	bool locked = false;

 	/*
@@ -258,22 +291,8 @@
 	if (total_pages <= target_pages)
 		goto out;
 	total_pages_to_unuse = total_pages - target_pages;
-	for (type = swap_list.head; type >= 0; type = si->next) {
-		si = swap_info[type];
-		si_frontswap_pages = atomic_read(&si->frontswap_pages);
-		if (total_pages_to_unuse < si_frontswap_pages) {
-			pages = pages_to_unuse = total_pages_to_unuse;
-		} else {
-			pages = si_frontswap_pages;
-			pages_to_unuse = 0; /* unuse all */
-		}
-		/* ensure there is enough RAM to fetch pages from frontswap */
-		if (security_vm_enough_memory_mm(current->mm, pages))
-			continue;
-		vm_unacct_memory(pages);
-		break;
-	}
-	if (type < 0)
+	ret = __frontswap_unuse_pages(total_pages_to_unuse, &pages_to_unuse, &type);
+	if (ret < 0)
 		goto out;
 	locked = false;
 	spin_unlock(&swap_lock);


Remove unused parameters, to quiet compiler warnings

--- src/hash_test_interface.h
+++ src/hash_test_interface.h
@@ -772,8 +772,8 @@
   bool supports_serialization() const { return true; }

   typedef typename ht::NopointerSerializer NopointerSerializer;
-  template <typename OUTPUT> bool write_metadata(OUTPUT *fp) { return false; }
-  template <typename INPUT> bool read_metadata(INPUT *fp) { return false; }
+  template <typename OUTPUT> bool write_metadata(OUTPUT *) { return false; }
+  template <typename INPUT> bool read_metadata(INPUT *) { return false; }
   template <typename OUTPUT> bool write_nopointer_data(OUTPUT *) {
     return false;
   }
@@ -876,8 +876,8 @@
   bool supports_serialization() const { return true; }

   typedef typename ht::NopointerSerializer NopointerSerializer;
-  template <typename OUTPUT> bool write_metadata(OUTPUT *fp) { return false; }
-  template <typename INPUT> bool read_metadata(INPUT *fp) { return false; }
+  template <typename OUTPUT> bool write_metadata(OUTPUT *) { return false; }
+  template <typename INPUT> bool read_metadata(INPUT *) { return false; }
   template <typename OUTPUT> bool write_nopointer_data(OUTPUT *) {
     return false;
   }
@@ -1003,8 +1003,8 @@
   bool supports_serialization() const { return true; }

   typedef typename ht::NopointerSerializer NopointerSerializer;
-  template <typename OUTPUT> bool write_metadata(OUTPUT *fp) { return false; }
-  template <typename INPUT> bool read_metadata(INPUT *fp) { return false; }
+  template <typename OUTPUT> bool write_metadata(OUTPUT *) { return false; }
+  template <typename INPUT> bool read_metadata(INPUT *) { return false; }
   template <typename OUTPUT> bool write_nopointer_data(OUTPUT *) {
     return false;
   }


Consistent parameter names

Consistent parameter names

--- src/helper/macos/helper.h
+++ src/helper/macos/helper.h
@@ -143,7 +143,7 @@
 class TimerFnRegistry : public FnRegistry<TimerFn, TimerFnRegistry>
 {
 public:
-  static void callback(CFRunLoopTimerRef ref, void *info);
+  static void callback(CFRunLoopTimerRef timer, void *info);

   TimerFnRegistry() = default;


leesuto gradient

leesuto gradient


pixbuf-loader: Don't include rsvg-private.h

--- gdk-pixbuf-loader/io-svg.c
+++ gdk-pixbuf-loader/io-svg.c
@@ -21,11 +21,17 @@
  * Boston, MA 02111-1307, USA.
  */

+#include "config.h"
+
+#include <stdlib.h>
+
 #include <rsvg.h>
-#include <stdlib.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
-#include "rsvg-private.h"
+
 #include "librsvg-features.h"
+
+#define N_(string) (string)
+#define _(string) (string)

 typedef struct {
         RsvgHandle                 *handle;


Don't use stream before it is created

Don't use stream before it is created

--- gdk-pixbuf/io-gdip-utils.c
+++ gdk-pixbuf/io-gdip-utils.c
@@ -353,7 +353,6 @@
   if (!hg)
     return NULL;

-  IStream_SetSize (stream, *(ULARGE_INTEGER *)&size64);
   hr = CreateStreamOnHGlobal (hg, FALSE, (LPSTREAM *)&stream);

   if (!SUCCEEDED (hr)) {
@@ -361,7 +360,9 @@
     GlobalFree (hg);
     return NULL;
   }
-
+
+  IStream_SetSize (stream, *(ULARGE_INTEGER *)&size64);
+
   status = GdipCreateBitmapFromStream (stream, &bitmap);

   if (Ok != status)


RPCServiceSAP.h

RPCServiceSAP.h

error: pathspec 'p3/src/org/cracs/stheno/services/rpc/net/RPCServiceSAP.h' did not match any file(s) known to git

--- p3/src/org/cracs/stheno/services/rpc/net/RPCServiceSAP.h
+++ p3/src/org/cracs/stheno/services/rpc/net/RPCServiceSAP.h
@@ -0,0 +1,45 @@
+/*
+ *  Copyright 2012 Rolando Martins, CRACS & INESC-TEC, DCC/FCUP
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+/*
+ * File:   RPCServiceSAP.h
+ * Author: rmartins
+ *
+ * Created on January 21, 2011, 4:24 PM
+ */
+
+#ifndef RPCSERVICESAP_H
+#define	RPCSERVICESAP_H
+
+#include <euryale/net/endpoint/SAP.h>
+#include <stheno/services/rpc/net/RPCServiceAcceptor.h>
+
+class RPCService;
+class RPCServiceSAP: public SAP<RPCServiceAcceptor> {
+public:
+    RPCServiceSAP(RPCService* discovery);
+    virtual ~RPCServiceSAP();
+
+protected:
+    RPCService* m_discovery;
+    //virtual abstract method impl
+    RPCServiceAcceptor* createAcceptor();
+
+};
+
+
+#endif	/* RPCSERVICESAP_H */
+


IntelFrameworkModulePkg: Modify CpuIoDxe to support new IoLib library

The IO_PROTOCOL supports Fifo types by invoking the Fifo routines in the
new BaseIoLibIntrinsic (IoLib class) library.

Cc: Jeff Fan <7d6fed0251a47076d6e691789131f22f07d057b4@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <6c1ba716601dd19ee463759bfdaf6de1e69b2b21@amd.com>
Signed-off-by: Leo Duran  <de3438c1a4f7b527d4e4fd666d13484b4545c540@amd.com>
Reviewed-by: Liming Gao <6480311aeeb4b006862f6d13ebabddc03f51e507@intel.com>
Reviewed-by: Jordan Justen <a79006884ba9cf5f4f7fcbb92a15b208780d8c97@intel.com>
Reviewed-by: Jeff Fan <7d6fed0251a47076d6e691789131f22f07d057b4@intel.com>

--- IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c
+++ IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIo.c
@@ -2,6 +2,8 @@
   Uses the services of the I/O Library to produce the CPU I/O Protocol

 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.

+Copyright (c) 2017, AMD Incorporated. All rights reserved.

+
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -410,6 +412,31 @@
   InStride = mInStride[Width];
   OutStride = mOutStride[Width];
   OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03);
+
+  //
+  // Fifo operations supported for (mInStride[Width] == 0)
+  //
+  if (InStride == 0) {
+    switch (OperationWidth) {
+    case EfiCpuIoWidthUint8:
+      IoReadFifo8 ((UINTN)Address, Count, Buffer);
+      return EFI_SUCCESS;
+    case EfiCpuIoWidthUint16:
+      IoReadFifo16 ((UINTN)Address, Count, Buffer);
+      return EFI_SUCCESS;
+    case EfiCpuIoWidthUint32:
+      IoReadFifo32 ((UINTN)Address, Count, Buffer);
+      return EFI_SUCCESS;
+    default:
+      //
+      // The CpuIoCheckParameter call above will ensure that this
+      // path is not taken.
+      //
+      ASSERT (FALSE);
+      break;
+    }
+  }
+
   for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
     if (OperationWidth == EfiCpuIoWidthUint8) {
       *Uint8Buffer = IoRead8 ((UINTN)Address);
@@ -492,6 +519,31 @@
   InStride = mInStride[Width];
   OutStride = mOutStride[Width];
   OperationWidth = (EFI_CPU_IO_PROTOCOL_WIDTH) (Width & 0x03);
+
+  //
+  // Fifo operations supported for (mInStride[Width] == 0)
+  //
+  if (InStride == 0) {
+    switch (OperationWidth) {
+    case EfiCpuIoWidthUint8:
+      IoWriteFifo8 ((UINTN)Address, Count, Buffer);
+      return EFI_SUCCESS;
+    case EfiCpuIoWidthUint16:
+      IoWriteFifo16 ((UINTN)Address, Count, Buffer);
+      return EFI_SUCCESS;
+    case EfiCpuIoWidthUint32:
+      IoWriteFifo32 ((UINTN)Address, Count, Buffer);
+      return EFI_SUCCESS;
+    default:
+      //
+      // The CpuIoCheckParameter call above will ensure that this
+      // path is not taken.
+      //
+      ASSERT (FALSE);
+      break;
+    }
+  }
+
   for (Uint8Buffer = (UINT8 *)Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
     if (OperationWidth == EfiCpuIoWidthUint8) {
       IoWrite8 ((UINTN)Address, *Uint8Buffer);


codemem: use symbol name in filename

codemem: use symbol name in filename

--- orc/orccodemem.c
+++ orc/orccodemem.c
@@ -7,12 +7,15 @@

 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 #ifdef HAVE_CODEMEM_MMAP
 #include <sys/mman.h>
 #endif

 #include <orc/orcprogram.h>
 #include <orc/orcdebug.h>
+

 #define SIZE 65536

@@ -21,17 +24,38 @@
 void
 orc_compiler_allocate_codemem (OrcCompiler *compiler)
 {
-  char filename[32] = "/tmp/orcexecXXXXXX";
   int fd;
   int n;

-  fd = mkstemp (filename);
-  if (fd == -1) {
-    /* FIXME oh crap */
-    ORC_COMPILER_ERROR (compiler, "failed to create temp file");
-    return;
+  /* FIXME something combining these two would be ideal */
+#if 1
+  {
+    char filename[32] = "/tmp/orcexecXXXXXX";
+    fd = mkstemp (filename);
+    if (fd == -1) {
+      /* FIXME oh crap */
+      ORC_COMPILER_ERROR (compiler, "failed to create temp file");
+      return;
+    }
+    unlink (filename);
   }
-  unlink (filename);
+#else
+  {
+    char *filename;
+
+    filename = malloc (strlen ("/tmp/orcexec") +
+        strlen (compiler->program->name) + 1);
+    sprintf(filename, "/tmp/orcexec%s", compiler->program->name);
+    fd = open (filename, O_RDWR | O_CREAT, S_IRWXU);
+    if (fd == -1) {
+      /* FIXME oh crap */
+      ORC_COMPILER_ERROR (compiler, "failed to create temp file");
+      return;
+    }
+    unlink (filename);
+    free (filename);
+  }
+#endif

   n = ftruncate (fd, SIZE);


Update Last.fm API keys.

Update Last.fm API keys.

--- ImportedSources/FMEngine/FMEngine.h
+++ ImportedSources/FMEngine/FMEngine.h
@@ -9,8 +9,8 @@
 #import <Foundation/Foundation.h>
 #import "NSString+FMEngine.h"

-#define _LASTFM_API_KEY_ @"2116c8771c6a03bb89c24a0935bea3a4"
-#define _LASTFM_SECRETK_ @"7f363485e3dedbefec78c9087402a75d"
+#define _LASTFM_API_KEY_ @"31fc44bcd6e21954afb404d179a09e9a"
+#define _LASTFM_SECRETK_ @"a146429ed54f25b8bf9d5ca3cc423260"
 #define _LASTFM_BASEURL_ @"http://ws.audioscrobbler.com/2.0/"

 // Comment the next line to use XML


Add missing std::

Add missing std::

--- third_party/css_parser/src/util/utf8/public/unicodetext.h
+++ third_party/css_parser/src/util/utf8/public/unicodetext.h
@@ -389,7 +389,7 @@

 // UnicodeTextRange is a pair of iterators, useful for specifying text
 // segments. If the iterators are ==, the segment is empty.
-typedef pair<UnicodeText::const_iterator,
+typedef std::pair<UnicodeText::const_iterator,
              UnicodeText::const_iterator> UnicodeTextRange;

 inline bool UnicodeTextRangeIsEmpty(const UnicodeTextRange& r) {


comment on how much I really want to lose DEBUG_NEW - in @todo

--- Library/Sources/Stroika/Foundation/Memory/Common.h
+++ Library/Sources/Stroika/Foundation/Memory/Common.h
@@ -14,8 +14,12 @@
 /*
  * TODO:
  *
- *      o   See if Valgrind works well tracking leaks. If so - even on windows - see about just losing DEBUG_NEW code!
- *          (maybe http://code.google.com/p/drmemory/ - or http://www.codersnotes.com/sleepy
+ *      @todo   See if Valgrind works well tracking leaks. If so - even on windows - see about just losing
+ *              DEBUG_NEW code! (maybe http://code.google.com/p/drmemory/
+ *              - or http://www.codersnotes.com/sleepy
+ *
+ *              SERIOUSLY consider losing DEBUG_NEW anyhow - because it really interacts badly with overloaded
+ *              operator new - such as with block allocation.
  */

@@ -50,7 +54,7 @@

-/*
+/**
  * Support for using the MSVC CRT memleak detector. If not available, then DBG_NEW simply expands
  * to 'new' so it can be safely used in places where the global new operator would have been used.
  *      -- LGP 2009-05-25


MdePkg: IORT Specification Rev D updates

Updated IORT structure definitions to conform to the IO Remapping
Table, Platform Design Document, Revision D, March 2018.

The following structures have been updated:
  1. SMMUv3 - fix on proximity node.
  2. PMCG - added page 1 support.
  3. Root complex node - added DMA mask (memory address size limit).

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <7ee5866756d84adbbb7f8117a93f0bf1abd52ae0@arm.com>
Reviewed-by: Evan Lloyd <cdda240a1142086a2861a2bc5509023c0f3b4e11@arm.com>
Reviewed-by: Liming Gao <6480311aeeb4b006862f6d13ebabddc03f51e507@intel.com>

--- MdePkg/Include/IndustryStandard/IoRemappingTable.h
+++ MdePkg/Include/IndustryStandard/IoRemappingTable.h
@@ -1,7 +1,7 @@
 /** @file
-  ACPI IO Remapping Table (IORT) as specified in ARM spec DEN0049C
-
-  http://infocenter.arm.com/help/topic/com.arm.doc.den0049c/DEN0049C_IO_Remapping_Table.pdf
+  ACPI IO Remapping Table (IORT) as specified in ARM spec DEN0049D
+
+  http://infocenter.arm.com/help/topic/com.arm.doc.den0049d/DEN0049D_IO_Remapping_Table.pdf

   Copyright (c) 2017, Linaro Limited. All rights reserved.

   Copyright (c) 2018, ARM Limited. All rights reserved.

@@ -123,6 +123,8 @@

   UINT32                                  AtsAttribute;
   UINT32                                  PciSegmentNumber;
+  UINT8                                   MemoryAddressSize;
+  UINT8                                   Reserved1[3];
 } EFI_ACPI_6_0_IO_REMAPPING_RC_NODE;

 ///
@@ -185,8 +187,7 @@
   UINT32                                  Pri;
   UINT32                                  Gerr;
   UINT32                                  Sync;
-  UINT8                                   ProximityDomain;
-  UINT8                                   Reserved1[3];
+  UINT32                                  ProximityDomain;
   UINT32                                  DeviceIdMappingIndex;
 } EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE;

@@ -199,6 +200,7 @@
   UINT64                                  Base;
   UINT32                                  OverflowInterruptGsiv;
   UINT32                                  NodeReference;
+  UINT64                                  Page1Base;
 //EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE      OverflowInterruptMsiMapping[1];
 } EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE;


looked promising, but crashes

looked promising, but crashes

AXTextMarker, etc. will probably just have to be ignored when it comes up with Safari (others?) but save in case I want to try again

error: pathspec 'axuielement/AXTextMarker.h' did not match any file(s) known to git

--- axuielement/AXTextMarker.h
+++ axuielement/AXTextMarker.h
@@ -0,0 +1,11 @@
+// Culled from WebCore 7601.3.8 at http://www.opensource.apple.com/release/os-x-10112/
+
+extern CFTypeID wkGetAXTextMarkerTypeID();
+extern CFTypeID wkGetAXTextMarkerRangeTypeID();
+// extern CFTypeRef (*wkCreateAXTextMarkerRange)(CFTypeRef start, CFTypeRef end);
+// extern CFTypeRef (*wkCopyAXTextMarkerRangeStart)(CFTypeRef range);
+// extern CFTypeRef (*wkCopyAXTextMarkerRangeEnd)(CFTypeRef range);
+// extern CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len);
+// extern BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
+
+// still no joy... calling these crashes


Create set_kth_bit.c

Create set_kth_bit.c

error: pathspec 'bit_manipulation/set_kth_bit/set_kth_bit.c' did not match any file(s) known to git

--- bit_manipulation/set_kth_bit/set_kth_bit.c
+++ bit_manipulation/set_kth_bit/set_kth_bit.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+
+int set_kth_bit(int num, int k){
+	/* Left shift 1, n times and perform bitwise OR with num */
+	return (1 << k) | num;
+}
+
+int main()
+{
+    int num, k, newNum;
+
+    /* Input number from user */
+    printf("Enter any number: ");
+    scanf("%d", &num);
+
+    /* Input bit position you want to set */
+    printf("Enter nth bit to set: ");
+    scanf("%d", &k);
+
+    newNum =  set_kth_bit(num, k);
+
+    printf("Number before setting %d bit: %d (in decimal)\n", k, num);
+    printf("Number after setting %d bit: %d (in decimal)\n",  k, newNum);
+
+    return 0;
+}


Use libFirm's obst.h instead of obstack.h

[r13503]

--- ir/adt/array.h
+++ ir/adt/array.h
@@ -28,8 +28,8 @@

 #include <assert.h>
 #include <stddef.h>
-#include <obstack.h>
-
+
+#include "obst.h"
 #include "fourcc.h"
 #include "align.h"
 #include "xmalloc.h"
@@ -54,7 +54,7 @@
   ((type *)_new_arr_f ((nelts), sizeof(type) * (nelts)))

 /**
- * Creates a new flxible array with the same number of elements as a
+ * Creates a new flexible array with the same number of elements as a
  * given one.
  *
  * @param type     The element type of the new array.
@@ -346,4 +346,4 @@
 #define _ARR_ELTS_OFFS offsetof (_arr_descr, v.elts)
 #define _ARR_DESCR(elts) ((_arr_descr *)(void *)((char *)(elts) - _ARR_ELTS_OFFS))

-#endif
+#endif /* FIRM_ADT_ARRAY_H */


added initializers for get_block/set_block operations

[r15117]

--- ir/be/benode.c
+++ ir/be/benode.c
@@ -1812,6 +1812,8 @@
 	NULL,
 	NULL,
 	NULL,
+	NULL,
+	NULL,
 	copy_attr,
 	NULL,
 	NULL,


- fixed comment
- construnc an Unknown node instead of Const(<tarval_bad>) if no
  default_initialize_local_variable() callback is available

[r17869]

--- ir/ir/ircons.c
+++ ir/ir/ircons.c
@@ -2087,7 +2087,7 @@
  			   However, this SHOULD NOT HAPPEN, as bad control flow nodes are intercepted
  			   before recurring.
 			 */
-			if (default_initialize_local_variable) {
+			if (default_initialize_local_variable != NULL) {
 				ir_node *rem = get_cur_block();

 				set_cur_block(block);
@@ -2095,7 +2095,7 @@
 				set_cur_block(rem);
 			}
 			else
-				block->attr.block.graph_arr[pos] = new_Const(mode, tarval_bad);
+				block->attr.block.graph_arr[pos] = new_Unknown(mode);
 			/* We don't need to care about exception ops in the start block.
 			   There are none by definition. */
 			return block->attr.block.graph_arr[pos];
@@ -2191,8 +2191,8 @@

 	   1. The block is not mature and we visit it the first time.  We can not
 	      create a proper Phi node, therefore a Phi0, i.e., a Phi without
-	      predecessors is returned.  This node is added to the linked list (field
-	      "link") of the containing block to be completed when this block is
+	      predecessors is returned.  This node is added to the linked list (block
+	      attribute "phis") of the containing block to be completed when this block is
 	      matured. (Completion will add a new Phi and turn the Phi0 into an Id
 	      node.)

@@ -2231,17 +2231,18 @@
 	res = block->attr.block.graph_arr[pos];

 	/* case 2 -- If the value is actually computed, return it. */
-	if (res) { return res; };
+	if (res != NULL)
+		return res;

 	if (block->attr.block.is_matured) { /* case 3 */

 		/* The Phi has the same amount of ins as the corresponding block. */
 		int ins = get_irn_arity(block);
 		ir_node **nin;
-		NEW_ARR_A (ir_node *, nin, ins);
+		NEW_ARR_A(ir_node *, nin, ins);

 		/* Phi merge collects the predecessors and then creates a node. */
-		res = phi_merge (block, pos, mode, nin, ins);
+		res = phi_merge(block, pos, mode, nin, ins);

 	} else {  /* case 1 */
 		/* The block is not mature, we don't know how many in's are needed.  A Phi
@@ -2258,7 +2259,7 @@
 	}

 	/* If we get here, the frontend missed a use-before-definition error */
-	if (!res) {
+	if (res == NULL) {
 		/* Error Message */
 		printf("Error: no value set.  Use of undefined variable.  Initializing to zero.\n");
 		assert(mode->code >= irm_F && mode->code <= irm_P);


python: return dictionary without value in case of no blockjob

6.5.z: https://bugzilla.redhat.com/show_bug.cgi?id=1038815
6.6: https://bugzilla.redhat.com/show_bug.cgi?id=999454
(cherry picked from commit 0f9e67bfad96c4a2e69769d8a5908ee145a86766)

Currently, when there is no blockjob, dom.blockJobInfo('vda')
still reports error because it doesn't distinguish return value 0 from -1.
libvirt.libvirtError: virDomainGetBlockJobInfo() failed

virDomainGetBlockJobInfo() API return value:
 -1 in case of failure, 0 when nothing found, 1 found.

And use PyDict_SetItemString instead of PyDict_SetItem when key is
of string type. PyDict_SetItemString increments key/value reference
count, so call Py_DECREF() for value. For key, we don't need to
do this, because PyDict_SetItemString will handle it internally.

Signed-off-by: Jiri Denemark <62bdf77dc47919a4d59a91822129d14633cfca81@redhat.com>

--- python/libvirt-override.c
+++ python/libvirt-override.c
@@ -4111,33 +4111,57 @@
     unsigned int flags;
     virDomainBlockJobInfo info;
     int c_ret;
-    PyObject *ret;
+    PyObject *type = NULL, *bandwidth = NULL, *cur = NULL, *end = NULL;
+    PyObject *dict;

     if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainGetBlockJobInfo",
                           &pyobj_domain, &path, &flags))
         return NULL;
     domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);

-LIBVIRT_BEGIN_ALLOW_THREADS;
+    if ((dict = PyDict_New()) == NULL)
+        return NULL;
+
+    LIBVIRT_BEGIN_ALLOW_THREADS;
     c_ret = virDomainGetBlockJobInfo(domain, path, &info, flags);
-LIBVIRT_END_ALLOW_THREADS;
-
-    if (c_ret != 1)
-        return VIR_PY_NONE;
-
-    if ((ret = PyDict_New()) == NULL)
-        return VIR_PY_NONE;
-
-    PyDict_SetItem(ret, libvirt_constcharPtrWrap("type"),
-                   libvirt_intWrap(info.type));
-    PyDict_SetItem(ret, libvirt_constcharPtrWrap("bandwidth"),
-                   libvirt_ulongWrap(info.bandwidth));
-    PyDict_SetItem(ret, libvirt_constcharPtrWrap("cur"),
-                   libvirt_ulonglongWrap(info.cur));
-    PyDict_SetItem(ret, libvirt_constcharPtrWrap("end"),
-                   libvirt_ulonglongWrap(info.end));
-
-    return ret;
+    LIBVIRT_END_ALLOW_THREADS;
+
+    if (c_ret == 0) {
+        return dict;
+    } else if (c_ret < 0) {
+        Py_DECREF(dict);
+        return VIR_PY_NONE;
+    }
+
+    if ((type = libvirt_intWrap(info.type)) == NULL ||
+        PyDict_SetItemString(dict, "type", type) < 0)
+        goto error;
+    Py_DECREF(type);
+
+    if ((bandwidth = libvirt_ulongWrap(info.bandwidth)) == NULL ||
+        PyDict_SetItemString(dict, "bandwidth", bandwidth) < 0)
+        goto error;
+    Py_DECREF(bandwidth);
+
+    if ((cur = libvirt_ulonglongWrap(info.cur)) == NULL ||
+        PyDict_SetItemString(dict, "cur", cur) < 0)
+        goto error;
+    Py_DECREF(cur);
+
+    if ((end = libvirt_ulonglongWrap(info.end)) == NULL ||
+        PyDict_SetItemString(dict, "end", end) < 0)
+        goto error;
+    Py_DECREF(end);
+
+    return dict;
+
+error:
+    Py_DECREF(dict);
+    Py_XDECREF(type);
+    Py_XDECREF(bandwidth);
+    Py_XDECREF(cur);
+    Py_XDECREF(end);
+    return NULL;
 }

 static PyObject *


reverting parsing of SVG_Number to parse_svg_length for stop offset attribute

--- src/scenegraph/svg_attributes.c
+++ src/scenegraph/svg_attributes.c
@@ -3197,11 +3197,8 @@
 	case SVG_Coordinate_datatype:
 	case SVG_FontSize_datatype:
 	case SVG_Rotate_datatype:
+    case SVG_Number_datatype:
 		svg_parse_length((SVG_Number*)info->far_ptr, attribute_content, 0);
-		break;
-
-    case SVG_Number_datatype:
-		svg_parse_number(attribute_content, &((SVG_Number*)info->far_ptr)->value, 0);
 		break;

 	case SMIL_AnimateValue_datatype:


Minor beautification

Minor beautification

--- sqlite3_stubs.c
+++ sqlite3_stubs.c
@@ -176,7 +176,7 @@

 /* Conversion from return values */

-static inline int Val_rc(int rc)
+static inline value Val_rc(int rc)
 {
   if (rc >= 0) {
     if (rc <= 26) return Val_int(rc);


added new pinned flag for fragile ops

added new pinned flag for fragile ops

[r4139]

--- ir/ir/ircons.c
+++ ir/ir/ircons.c
@@ -542,7 +542,8 @@

   assert(is_method_type(tp));
   set_Call_type(res, tp);
-  res->attr.call.callee_arr = NULL;
+  res->attr.call.exc.pin_state = op_pin_state_pinned;
+  res->attr.call.callee_arr    = NULL;
   res = optimize_node(res);
   IRN_VRFY_IRG(res, irg);
   return res;
@@ -590,8 +591,9 @@
   in[0] = store;
   in[1] = adr;
   res = new_ir_node(db, irg, block, op_Load, mode_T, 2, in);
-  res->attr.load.load_mode  = mode;
-  res->attr.load.volatility = volatility_non_volatile;
+  res->attr.load.exc.pin_state = op_pin_state_pinned;
+  res->attr.load.load_mode     = mode;
+  res->attr.load.volatility    = volatility_non_volatile;
   res = optimize_node(res);
   IRN_VRFY_IRG(res, irg);
   return res;
@@ -608,7 +610,8 @@
   in[1] = adr;
   in[2] = val;
   res = new_ir_node(db, irg, block, op_Store, mode_T, 3, in);
-  res->attr.store.volatility = volatility_non_volatile;
+  res->attr.store.exc.pin_state = op_pin_state_pinned;
+  res->attr.store.volatility    = volatility_non_volatile;
   res = optimize_node(res);
   IRN_VRFY_IRG(res, irg);
   return res;
@@ -624,8 +627,9 @@
   in[0] = store;
   in[1] = size;
   res = new_ir_node(db, irg, block, op_Alloc, mode_T, 2, in);
-  res->attr.a.where = where;
-  res->attr.a.type  = alloc_type;
+  res->attr.a.exc.pin_state = op_pin_state_pinned;
+  res->attr.a.where         = where;
+  res->attr.a.type          = alloc_type;
   res = optimize_node(res);
   IRN_VRFY_IRG(res, irg);
   return res;
@@ -1613,13 +1617,13 @@
 get_frag_arr (ir_node *n) {
   switch (get_irn_opcode(n)) {
   case iro_Call:
-    return n->attr.call.frag_arr;
+    return n->attr.call.exc.frag_arr;
   case iro_Alloc:
-    return n->attr.a.frag_arr;
+    return n->attr.a.exc.frag_arr;
   case iro_Load:
-    return n->attr.load.frag_arr;
+    return n->attr.load.exc.frag_arr;
   case iro_Store:
-    return n->attr.store.frag_arr;
+    return n->attr.store.exc.frag_arr;
   default:
     return n->attr.except.frag_arr;
   }
@@ -2058,6 +2062,7 @@
   ir_node *res;
   res = new_rd_Quot (db, current_ir_graph, current_ir_graph->current_block,
              memop, op1, op2);
+  res->attr.except.pin_state = op_pin_state_pinned;
 #if PRECISE_EXC_CONTEXT
   allocate_frag_arr(res, op_Quot, &res->attr.except.frag_arr);  /* Could be optimized away. */
 #endif
@@ -2071,6 +2076,7 @@
   ir_node *res;
   res = new_rd_DivMod (db, current_ir_graph, current_ir_graph->current_block,
                memop, op1, op2);
+  res->attr.except.pin_state = op_pin_state_pinned;
 #if PRECISE_EXC_CONTEXT
   allocate_frag_arr(res, op_DivMod, &res->attr.except.frag_arr);  /* Could be optimized away. */
 #endif
@@ -2084,6 +2090,7 @@
   ir_node *res;
   res = new_rd_Div (db, current_ir_graph, current_ir_graph->current_block,
             memop, op1, op2);
+  res->attr.except.pin_state = op_pin_state_pinned;
 #if PRECISE_EXC_CONTEXT
   allocate_frag_arr(res, op_Div, &res->attr.except.frag_arr);  /* Could be optimized away. */
 #endif
@@ -2097,6 +2104,7 @@
   ir_node *res;
   res = new_rd_Mod (db, current_ir_graph, current_ir_graph->current_block,
             memop, op1, op2);
+  res->attr.except.pin_state = op_pin_state_pinned;
 #if PRECISE_EXC_CONTEXT
   allocate_frag_arr(res, op_Mod, &res->attr.except.frag_arr);  /* Could be optimized away. */
 #endif
@@ -2194,7 +2202,7 @@
   res = new_rd_Call (db, current_ir_graph, current_ir_graph->current_block,
              store, callee, arity, in, tp);
 #if PRECISE_EXC_CONTEXT
-  allocate_frag_arr(res, op_Call, &res->attr.call.frag_arr);  /* Could be optimized away. */
+  allocate_frag_arr(res, op_Call, &res->attr.call.exc.frag_arr);  /* Could be optimized away. */
 #endif

   return res;
@@ -2221,7 +2229,7 @@
   res = new_rd_Load (db, current_ir_graph, current_ir_graph->current_block,
              store, addr, mode);
 #if PRECISE_EXC_CONTEXT
-  allocate_frag_arr(res, op_Load, &res->attr.load.frag_arr);  /* Could be optimized away. */
+  allocate_frag_arr(res, op_Load, &res->attr.load.exc.frag_arr);  /* Could be optimized away. */
 #endif

   return res;
@@ -2234,7 +2242,7 @@
   res = new_rd_Store (db, current_ir_graph, current_ir_graph->current_block,
               store, addr, val);
 #if PRECISE_EXC_CONTEXT
-  allocate_frag_arr(res, op_Store, &res->attr.store.frag_arr);  /* Could be optimized away. */
+  allocate_frag_arr(res, op_Store, &res->attr.store.exc.frag_arr);  /* Could be optimized away. */
 #endif

   return res;
@@ -2248,7 +2256,7 @@
   res = new_rd_Alloc (db, current_ir_graph, current_ir_graph->current_block,
               store, size, alloc_type, where);
 #if PRECISE_EXC_CONTEXT
-  allocate_frag_arr(res, op_Alloc, &res->attr.a.frag_arr);  /* Could be optimized away. */
+  allocate_frag_arr(res, op_Alloc, &res->attr.a.exc.frag_arr);  /* Could be optimized away. */
 #endif

   return res;


put another bandaid on the build until i figure out bsnmp headers

--- contrib/bsnmp/snmp_mibII/mibII_route.c
+++ contrib/bsnmp/snmp_mibII/mibII_route.c
@@ -30,7 +30,7 @@
  *
  * Routing table
  */
-#include "support.h"
+/*#include "support.h"*/

 #ifdef HAVE_SYS_TREE_H
 #include <sys/tree.h>


Changed dumping modes from positive to negativ list. This allows unknown
opcodes to be dumped more intelligent.

[r4099]

--- ir/ir/irdump.c
+++ ir/ir/irdump.c
@@ -535,31 +535,26 @@
 dump_node_mode(FILE *F, ir_node *n)
 {
   int bad = 0;
-
-  switch (get_irn_opcode(n)) {
-  case iro_Phi:
-  case iro_Const:
-  case iro_Id:
-  case iro_Proj:
-  case iro_Filter:
-  case iro_Conv:
-  case iro_Tuple:
-  case iro_Add:
-  case iro_Sub:
-  case iro_Mul:
-  case iro_And:
-  case iro_Or:
-  case iro_Eor:
-  case iro_Shl:
-  case iro_Shr:
-  case iro_Abs:
-  case iro_Cmp:
-  case iro_Confirm:
-    fprintf(F, "%s", get_mode_name_ex(get_irn_mode(n), &bad));
-    break;
-  default:
-    ;
-  }
+  opcode iro = get_irn_opcode(n);
+
+  switch (iro) {
+    case iro_SymConst:
+    case iro_Sel:
+    case iro_End:
+    case iro_Return:
+    case iro_Free:
+    case iro_Sync:
+    case iro_Jmp:
+      break;
+    default: {
+      ir_mode *mode = get_irn_mode(n);
+
+      if (mode && mode != mode_BB && mode != mode_ANY && mode != mode_BAD &&
+          (mode != mode_T || iro == iro_Proj))
+        fprintf(F, "%s", get_mode_name_ex(mode, &bad));
+    }
+  }
+
   return bad;
 }


We need to set the no-unreachable-code property instead of confirming it.

--- ir/ir/irgopt.c
+++ ir/ir/irgopt.c
@@ -185,16 +185,15 @@

 	constbits_clear(irg);

-	ir_graph_properties_t confirm_properties = IR_GRAPH_PROPERTY_ONE_RETURN
-	                                           | IR_GRAPH_PROPERTY_MANY_RETURNS
-	                                           | IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES;
+	confirm_irg_properties(irg, IR_GRAPH_PROPERTY_ONE_RETURN
+	                            | IR_GRAPH_PROPERTY_MANY_RETURNS
+	                            | IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES);

 	if (get_opt_algebraic_simplification()) {
 		/* Unreachable code elimination was enabled. */
 		clear_irg_constraints(irg, IR_GRAPH_CONSTRAINT_OPTIMIZE_UNREACHABLE_CODE);
-		confirm_properties |= IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE;
-	}
-	confirm_irg_properties(irg, confirm_properties);
+		add_irg_properties(irg, IR_GRAPH_PROPERTY_NO_UNREACHABLE_CODE);
+	}

 	/* Finally kill BAD and doublets from the keep alives.
 	 * Doing this AFTER edges where deactivated saves cycles */


doxygen comments fixed

doxygen comments fixed

[r2947]

--- ir/ir/irnode.c
+++ ir/ir/irnode.c
@@ -136,7 +136,7 @@
   memcpy(&new_node->attr, &old_node->attr, get_op_attr_size(get_irn_op(old_node)));
 }

-/** getting some parameters from ir_nodes **/
+/*-- getting some parameters from ir_nodes --*/

 int
 is_ir_node (const void *thing) {


BugFix:
  We cannot replace old Phi nodes with current one BEFORE we
  have handled all Phi's in the current block, else we might
  generate wrong references between Phi nodes of a block

clean up is_despensible: uses goto's now, but more readable

[r6578]

--- ir/opt/cfopt.c
+++ ir/opt/cfopt.c
@@ -5,7 +5,7 @@
  * Author:
  * Created:
  * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2004 Universit�t Karlsruhe
+ * Copyright:   (c) 1998-2004 Universitt Karlsruhe
  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */

@@ -24,6 +24,7 @@
 #include "iropt_t.h"
 #include "irgwalk.h"
 #include "irgmod.h"
+#include "irdump.h"
 #include "irvrfy.h"

 #include "array.h"
@@ -239,7 +240,6 @@
  **/
 static int test_whether_dispensable(ir_node *b, int pos) {
   int i, j, n_preds = 1;
-  int dispensable = 1;
   ir_node *cfop = get_Block_cfgpred(b, pos);
   ir_node *pred = get_nodes_block(cfop);

@@ -262,35 +262,45 @@
       n_preds = get_Block_n_cfgpreds(pred);
     } else {
       /* b's pred blocks and pred's pred blocks must be pairwise disjunct.
-         Work preds < pos as if they were already removed. */
+         Handle all pred blocks with preds < pos as if they were already removed. */
       for (i = 0; i < pos; i++) {
-        ir_node *b_pred = get_nodes_block(get_Block_cfgpred(b, i));
+        ir_node *b_pred = get_Block_cfgpred_block(b, i);
         if (get_Block_block_visited(b_pred) + 1
             < get_irg_block_visited(current_ir_graph)) {
           for (j = 0; j < get_Block_n_cfgpreds(b_pred); j++) {
-            ir_node *b_pred_pred = get_nodes_block(get_Block_cfgpred(b_pred, j));
-            if (is_pred_of(b_pred_pred, pred)) dispensable = 0;
+            ir_node *b_pred_pred = get_Block_cfgpred_block(b_pred, j);
+            if (is_pred_of(b_pred_pred, pred))
+              goto non_dispensable;
           }
         } else {
-          if (is_pred_of(b_pred, pred)) dispensable = 0;
+          if (is_pred_of(b_pred, pred))
+            goto non_dispensable;
         }
       }
       for (i = pos +1; i < get_Block_n_cfgpreds(b); i++) {
-        ir_node *b_pred = get_nodes_block(get_Block_cfgpred(b, i));
-        if (is_pred_of(b_pred, pred)) dispensable = 0;
-      }
-      if (!dispensable) {
-        set_Block_block_visited(pred, get_irg_block_visited(current_ir_graph)-1);
-        n_preds = 1;
-      } else {
-        n_preds = get_Block_n_cfgpreds(pred);
-      }
+        ir_node *b_pred = get_Block_cfgpred_block(b, i);
+        if (is_pred_of(b_pred, pred))
+          goto non_dispensable;
+      }
+      /* if we get here, the block is dispensable */
+      n_preds = get_Block_n_cfgpreds(pred);
     }
   }

   return n_preds;
-}
-
+
+non_dispensable:
+  set_Block_block_visited(pred, get_irg_block_visited(current_ir_graph)-1);
+  return 1;
+}
+
+/**
+ * Store to defer the exchanged of Phi nodes.
+ */
+typedef struct _defer_ex_phi {
+  ir_node *phi_pred;    /**< the previous Phi node that will be replaced */
+  ir_node *phi;         /**< the new Phi node that replaces phi_pred */
+} defer_ex_phi;

 /**
  * This method removed Bad cf predecessors from Blocks and Phis, and removes
@@ -302,10 +312,10 @@
  * for all nodes, not regarding whether there is a possibility for optimization.
  *
  * For each predecessor p of a Block b there are three cases:
- *  -#. The predecessor p is a Bad node:  just skip it.  The in array of b shrinks by one.
- *  -#. The predecessor p is empty.  Remove p.  All predecessors of p are now
+ *  -1. The predecessor p is a Bad node:  just skip it.  The in array of b shrinks by one.
+ *  -2. The predecessor p is empty.  Remove p.  All predecessors of p are now
  *      predecessors of b.
- *  -#. The predecessor p is a block containing useful code.  Just keep p as is.
+ *  -3. The predecessor p is a block containing useful code.  Just keep p as is.
  *
  * For Phi nodes f we have to check the conditions at the Block of f.
  * For cases 1 and 3 we proceed as for Blocks.  For case 2 we can have two
@@ -324,7 +334,7 @@
  *       \      /                                      \      /
  *        \    /                                        |    /
  *        pred_b                                        |   /
- *         |   ____                                     |  /
+ *         |   ____                                     |  /  ____
  *         |  |    |                                    |  | |    |
  *         |  |    |       === optimized to ===>        \  | |    |
  *        loop_b   |                                     loop_b   |
@@ -343,6 +353,7 @@
   int i, j, k, n, max_preds, n_preds, p_preds;
   ir_node *pred, *phi;
   ir_node **in;
+  defer_ex_phi *defers;

   /* Count the number of predecessor if this block is merged with pred blocks
      that are empty. */
@@ -351,6 +362,8 @@
     max_preds += test_whether_dispensable(b, i);
   }
   in = xmalloc(max_preds * sizeof(*in));
+
+  defers = NEW_ARR_F(defer_ex_phi, 0);

 /*-
   printf(" working on "); DDMN(b);
@@ -372,7 +385,7 @@
     /* Find the new predecessors for the Phi */
     p_preds = 0;
     for (i = 0, n = get_Block_n_cfgpreds(b); i < n; ++i) {
-      pred = get_nodes_block(get_Block_cfgpred(b, i));
+      pred = get_Block_cfgpred_block(b, i);

       if (is_Bad(get_Block_cfgpred(b, i))) {
         /* case Phi 1: Do nothing */
@@ -402,6 +415,10 @@

            Somehow the removed Phi node can be used legally in loops.
            Therefore we replace the old phi by the new one.
+           This must be done _AFTER_ all Phis are optimized, or
+           it will fail if two Phis use the same pred_Phi.
+
+           FIXME: Is the following true? We ALWAYS replace it by the new one.

            Further we have to remove the old Phi node by replacing it
            by Bad.  Else it will remain in the keep alive array of End
@@ -409,9 +426,21 @@
            replace it by Bad.
         */
         if (get_nodes_block(phi_pred) == pred) {
+          int i;
           /* remove the Phi as it might be kept alive. Further there
              might be other users. */
-          exchange(phi_pred, phi);  /* geht, ist aber doch semantisch falsch! Warum?? */
+          for (i = ARR_LEN(defers) - 1; i >= 0; --i)
+            if (defers[i].phi_pred == phi_pred)
+              break;
+
+          if (i < 0) {
+              /* we have a new replacement */
+            defer_ex_phi elem;
+
+            elem.phi_pred = phi_pred;
+            elem.phi      = phi;
+            ARR_APP1(defer_ex_phi, defers, elem);
+          }
         }
       } else {
         /* case Phi 3: */
@@ -429,6 +458,12 @@

     phi = get_irn_link(phi);
   }
+
+  /* now, exchange all Phis */
+  for (i = ARR_LEN(defers) - 1; i >= 0; --i) {
+    exchange(defers[i].phi_pred, defers[i].phi);
+  }
+  DEL_ARR_F(defers);

   /*- This happens only if merge between loop backedge and single loop entry.
       See special case above. -*/
@@ -519,7 +554,7 @@
            < get_irg_block_visited(current_ir_graph)) {
       /* case 2: It's an empty block and not yet visited. */
       assert(get_Block_n_cfgpreds(b) > 1);
-                        /* Else it should be optimized by equivalent_node. */
+      /* Else it should be optimized by equivalent_node. */
       for (j = 0; j < get_Block_n_cfgpreds(pred); j++) {
         ir_node *pred_block = get_Block_cfgpred(pred, j);


- if all Condb has Cmp predecessors, allow Unknown nodes to produce TOP
- Cmp(a, TOP) produces !=, not TOP (like icc, Clicks work returns ==
  here because they congruent, but it isn't important waht to choose as
  long as it is monotone

[r21186]

--- ir/opt/combo.c
+++ ir/opt/combo.c
@@ -167,7 +167,8 @@
 	pmap            *type2id_map;   /**< The type->id map. */
 	int             end_idx;        /**< -1 for local and 0 for global congruences. */
 	int             lambda_input;   /**< Captured argument for lambda_partition(). */
-	int             modified;       /**< Set, if the graph was modified. */
+	char            nonstd_cond;    /**< Set, if a Condb note has a non-Cmp predecessor. */
+	char            modified;       /**< Set, if the graph was modified. */
 #ifdef DEBUG_libfirm
 	partition_t     *dbg_list;      /**< List of all partitions. */
 #endif
@@ -189,6 +190,9 @@

 /** Next partition number. */
 DEBUG_ONLY(static unsigned part_nr = 0);
+
+/** The tarval returned by Unknown nodes. */
+static tarval *tarval_UNKNOWN;

 /* forward */
 static node_t *identity(node_t *node);
@@ -619,6 +623,11 @@

 	if (is_Phi(irn)) {
 		add_Block_phi(get_nodes_block(irn), irn);
+	} else if (is_Cond(irn)) {
+		/* check if all Cond's have a Cmp predecessor. */
+		if (get_irn_mode(irn) == mode_b && !is_Cmp(skip_Proj(get_Cond_selector(irn))))
+			env->nonstd_cond = 1;
+
 	}
 }  /* create_initial_partitions */

@@ -1588,10 +1597,8 @@
 	 * nodes are inputs to Conds. We check that first.
 	 * This is the way Frontends typically build Firm, but some optimizations
 	 * (cond_eval for instance) might replace them by Phib's...
-	 *
-	 * For now, we compute bottom here.
 	 */
-	node->type.tv = tarval_bottom;
+	node->type.tv = tarval_UNKNOWN;
 }  /* compute_Unknown */

 /**
@@ -1785,7 +1792,11 @@
 	lattice_elem_t b     = r->type;

 	if (a.tv == tarval_top || b.tv == tarval_top) {
-		node->type.tv = tarval_top;
+		/*
+		 * Top is congruent to any other value, we can
+		 * calculate the compare result.
+		 */
+		node->type.tv = tarval_b_true;
 	} else if (is_con(a) && is_con(b)) {
 		/* both nodes are constants, we can probably do something */
 		node->type.tv = tarval_b_true;
@@ -1813,7 +1824,9 @@
 	tarval         *tv;

 	if (a.tv == tarval_top || b.tv == tarval_top) {
-		node->type.tv = tarval_top;
+		/* see above */
+		tv = new_tarval_from_long((pnc & pn_Cmp_Eq) ^ pn_Cmp_Eq, mode_b);
+		goto not_equal;
 	} else if (is_con(a) && is_con(b)) {
 		default_compute(node);
 		node->by_all_const = 1;
@@ -1824,6 +1837,7 @@
 		 * NaN != NaN is defined, so we must check this here.
 		 */
 		tv = new_tarval_from_long(pnc & pn_Cmp_Eq, mode_b);
+not_equal:

 		/* if the node was ONCE evaluated by all constants, but now
 		   this breakes AND we cat by partition a different result, switch to bottom.
@@ -2852,6 +2866,7 @@
 	env.type2id_map    = pmap_create();
 	env.end_idx        = get_opt_global_cse() ? 0 : -1;
 	env.lambda_input   = 0;
+	env.nonstd_cond    = 0;
 	env.modified       = 0;

 	assure_irg_outs(irg);
@@ -2866,6 +2881,8 @@
 	env.initial = new_partition(&env);
 	add_to_worklist(env.initial, &env);
 	irg_walk_graph(irg, init_block_phis, create_initial_partitions, &env);
+
+	tarval_UNKNOWN = env.nonstd_cond ? tarval_bad : tarval_top;

 	/* all nodes on the initial partition have type Top */
 	env.initial->type_is_T_or_C = 1;


slice: don't retry if mmaping was successful and the codec failed

This prevents squash_splice from attempting to fall back to streaming
if the (de)compression fails: the fallback only occurs if mmapping
fails. In the worst case, this meant (de)compression would be attempted
twice for almost the entirety of the input, if the codec failed on data
at the end of the file.

--- squash/splice.c
+++ squash/splice.c
@@ -47,6 +47,8 @@

 #include "internal.h"
 #include "squash/tinycthread/source/tinycthread.h"
+
+#define SQUASH_MMAP_FAILED ((SquashStatus)(-127))

 /**
  * @defgroup Splicing
@@ -95,7 +97,7 @@
 #if !defined(_WIN32)
 static SquashStatus
 squash_splice_map (FILE* fp_in, FILE* fp_out, size_t size, SquashStreamType stream_type, SquashCodec* codec, SquashOptions* options) {
-  SquashStatus res = SQUASH_FAILED;
+  SquashStatus res = SQUASH_MMAP_FAILED;
   SquashMappedFile mapped_in = squash_mapped_file_empty;
   SquashMappedFile mapped_out = squash_mapped_file_empty;

@@ -125,8 +127,10 @@
       squash_npot (mapped_in.size) << 3;

     do {
-      if (!squash_mapped_file_init (&mapped_out, fp_out, max_output_size, true))
+      if (!squash_mapped_file_init (&mapped_out, fp_out, max_output_size, true)) {
+        res = SQUASH_MMAP_FAILED;
         goto cleanup;
+      }

       res = squash_codec_decompress_with_options (codec, &mapped_out.size, mapped_out.data, mapped_in.size, mapped_in.data, options);
       if (res == SQUASH_OK) {
@@ -406,7 +410,7 @@
                             FILE* fp_in,
                             size_t size,
                             SquashOptions* options) {
-  SquashStatus res = SQUASH_FAILED;
+  SquashStatus res = SQUASH_MMAP_FAILED;

   assert (fp_in != NULL);
   assert (fp_out != NULL);
@@ -429,7 +433,7 @@
     }
 #endif

-    if (res != SQUASH_OK)
+    if (res == SQUASH_MMAP_FAILED)
       res = squash_splice_stream (fp_in, fp_out, size, stream_type, codec, options);
   }