Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
oops, another module was dropped
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 8 Jun 2017 21:42:51 +0000 (23:42 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 8 Jun 2017 21:42:51 +0000 (23:42 +0200)
ChangeLog
include/xbt/lib.h [deleted file]
src/xbt/lib.c [deleted file]
src/xbt/log.c
tools/cmake/DefinePackages.cmake

index 8562356..21cd087 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,20 +17,21 @@ SimGrid (3.16) UNRELEASED
    - Remove attribute 'content_type' of <storage_type>: was never used
    - Make attribute 'model' of <storage_type> optional: for future usage
    - Remove Bconnection model property: was never (in)validated. Replaced by
-      the maximum of the read and write bandwidth as a resource constraint. 
+      the maximum of the read and write bandwidth as a resource constraint.
 
  SimDag
-  - New and Backwards Compatibility break: 
+  - New and Backwards Compatibility break:
     SD_simulate_with_update (double how_long, xbt_dynar_t changed_tasks_dynar)
     When one wants to get the list of tasks whose states have changed during a
-    simulation round, s/he has to allocate and free a dynar and use it as argument 
-    to this function. The former SD_simulate (double how_long) now returns void.
+    simulation round, s/he has to allocate and free a dynar and use it as
+    argument to this function. The former SD_simulate (double how_long)
+    now        returns void.
 
  Virtual Machines
   - Allow multicore VMs, along with the correct sharing computations
 
  MSG
-  - The netzone are now available from the MSG API. 
+  - The netzone are now available from the MSG API.
     The old names still work, but are now deprecated.
 
  SMPI
@@ -44,6 +45,7 @@ SimGrid (3.16) UNRELEASED
   - DROPPED FUNCTION: xbt_str_varsubst()
   - DROPPED MODULE: strbuff. We don't need it anymore.
   - DROPPED MODULE: matrix. We don't need it anymore.
+  - DROPPED MODULE: lib. We don't need it anymore.
 
  -- Release target: June 21 2017   -- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
 
diff --git a/include/xbt/lib.h b/include/xbt/lib.h
deleted file mode 100644 (file)
index 56a9007..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/* xbt/lib.h - api to a generic library                                     */
-
-/* Copyright (c) 2011, 2013-2014. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef XBT_LIB_H
-#define XBT_LIB_H
-
-#include <xbt/dict.h>
-
-SG_BEGIN_DECL()
-
-/** Container for all the objects of a given type
- *
- *  * each item is identified by a string name/identifier;
- *
- *  * the lib itself is a dictionary from the element id to the element;
- *
- *  * the element itself is represented aby the xbt_dictelm_t;
- *
- *  * the element can store any number of associated facets/data structures (corresponding to the different layers of
- *    SimGrid or its extensions) in ((void**)dictelt->content)[level];
- *
- *  * each level is allocated in the lib with `xbt_lib_add_level`.
- *
- *  <pre>
- *  // Define a collection for the foo objects and two associated facets:
- *  typedef xbt_dictelm_t foo_t;
- *  xbt_lib_t foo_lib = xbt_lib_new();
- *  int BAR_FOO_LEVEL  = xbt_lib_add_level(foo_lib, free_bar);
- *  int AUTH_FOO_LEVEL = xbt_lib_add_level(foo_lib, free_auth);
- *
- *  // Store a bar:
- *  bar_t bar = bar_new();
- *  char* id = bar_name(bar);
- *  xbt_lib_set(id, id, BAR_FOO_LEVEL, bar);
- *
- *  // Find the corresponding foo and the facet again:
- *  foo_t foo = xbt_lib_get_elm_or_null(foo_lib, id);
- *  bar_t bar2 = (bar_t) xbt_lib_get_level(foo, BAR_FOO_LEVEL);
- *  assert(bar == bar2);
- *
- *  // Add authentication facet for the previous object:
- *  auth_t auth = auth_new();
- *  xbt_lib_set(foo_lib, id, AUTH_FOO_LEVEL, auth);
- *  </pre>
- */
-struct s_xbt_lib {
-  xbt_dict_t dict;
-  int levels;
-  void_f_pvoid_t *free_f;       /* This is actually a table */
-};
-typedef struct s_xbt_lib  s_xbt_lib_t;
-typedef struct s_xbt_lib* xbt_lib_t;
-
-#define xbt_lib_cursor_t xbt_dict_cursor_t
-
-XBT_PUBLIC(xbt_lib_t) xbt_lib_new(void);
-XBT_PUBLIC(void) xbt_lib_free(xbt_lib_t * lib);
-XBT_PUBLIC(int) xbt_lib_add_level(xbt_lib_t lib, void_f_pvoid_t free_f);
-XBT_PUBLIC(void) xbt_lib_set(xbt_lib_t lib, const char *name, int level, void *obj);
-XBT_PUBLIC(void) xbt_lib_unset(xbt_lib_t lib, const char *key, int level, int invoke_callback);
-XBT_PUBLIC(void *) xbt_lib_get_or_null(xbt_lib_t lib, const char *name, int level);
-XBT_PUBLIC(xbt_dictelm_t) xbt_lib_get_elm_or_null(xbt_lib_t lib, const char *key);
-XBT_PUBLIC(void *) xbt_lib_get_level(xbt_dictelm_t elm, int level);
-XBT_PUBLIC(void) xbt_lib_remove(xbt_lib_t lib, const char *key);
-
-#define xbt_lib_length(lib) xbt_dict_length((lib)->dict)
-
-/** @def xbt_lib_foreach
-    @hideinitializer */
-#define xbt_lib_foreach(lib, cursor, key, data)         \
-  xbt_dict_foreach((lib)->dict, cursor, key, data)
-
-SG_END_DECL()
-
-#endif                          /* _XBT_LIB_H */
diff --git a/src/xbt/lib.c b/src/xbt/lib.c
deleted file mode 100644 (file)
index 068652e..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/* lib - a generic library, variation over dictionary                    */
-
-/* Copyright (c) 2011, 2013-2015. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include <xbt/asserts.h>
-#include <xbt/sysdep.h>
-#include <xbt/log.h>
-#include <xbt/lib.h>
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_lib, xbt, "A dict with keys of type (name, level)");
-
-xbt_lib_t xbt_lib_new(void)
-{
-  xbt_lib_t lib  = xbt_new(s_xbt_lib_t, 1);
-  lib->dict = xbt_dict_new_homogeneous(xbt_free_f);
-  lib->levels = 0;
-  lib->free_f = NULL;
-  return lib;
-}
-
-void xbt_lib_free(xbt_lib_t *plib)
-{
-  xbt_lib_t lib = *plib;
-  if (lib) {
-    xbt_dict_cursor_t cursor;
-    char *key;
-    void **elts;
-    xbt_dict_foreach (lib->dict, cursor, key, elts) {
-      int i;
-      for (i = 0 ; i < lib->levels ; i++)
-        if (elts[i] && lib->free_f[i])
-          lib->free_f[i](elts[i]);
-    }
-    xbt_dict_free(&lib->dict);
-    xbt_free(lib->free_f);
-    xbt_free(lib);
-    *plib = NULL;
-  }
-}
-
-int xbt_lib_add_level(xbt_lib_t lib, void_f_pvoid_t free_f)
-{
-  XBT_DEBUG("xbt_lib_add_level");
-  xbt_assert(xbt_dict_is_empty(lib->dict), "Lib is not empty (size: %u), cannot add a level", xbt_dict_size(lib->dict));
-  lib->free_f = xbt_realloc(lib->free_f, sizeof(void_f_pvoid_t) * (lib->levels + 1));
-  lib->free_f[lib->levels] = free_f;
-  return lib->levels++;
-}
-
-void xbt_lib_set(xbt_lib_t lib, const char *key, int level, void *obj)
-{
-  XBT_DEBUG("xbt_lib_set key '%s:%d' with object %p", key, level, obj);
-  xbt_assert(level >= 0);
-  void **elts = xbt_dict_get_or_null(lib->dict, key);
-  if (!elts) {
-    elts = xbt_new0(void *, lib->levels);
-    xbt_dict_set(lib->dict, key, elts, NULL);
-  }
-  if (elts[level]) {
-    XBT_DEBUG("Replace %p by %p element under key '%s:%d'", elts[level], obj, key, level);
-    if (lib->free_f[level])
-      lib->free_f[level](elts[level]);
-  }
-  elts[level] = obj;
-}
-
-void xbt_lib_unset(xbt_lib_t lib, const char *key, int level, int invoke_callback)
-{
-  xbt_assert(level >= 0);
-  void **elts = xbt_dict_get_or_null(lib->dict, key);
-  if (!elts) {
-     XBT_WARN("no key %s", key);
-     return;
-  }
-
-  void *obj = elts[level];
-  if (!obj) {
-     XBT_WARN("no key %s at level %d", key, level);
-     return;
-  }
-
-  XBT_DEBUG("Remove %p of key %s at level %d", obj, key, level);
-  elts[level] = NULL;
-
-  /* check if there still remains any elements of this key */
-  int empty = 1;
-  for (int i = 0; i < lib->levels && empty; i++) {
-     if (elts[i] != NULL)
-       empty = 0;
-  }
-  if (empty) {
-    /* there is no element at any level, so delete the key */
-    xbt_dict_remove(lib->dict, key);
-  }
-
-  if (invoke_callback && lib->free_f[level])
-    lib->free_f[level](obj);
-}
-
-void *xbt_lib_get_or_null(xbt_lib_t lib, const char *key, int level)
-{
-  xbt_assert(level >= 0);
-  void **elts = xbt_dict_get_or_null(lib->dict, key);
-  return elts ? elts[level] : NULL;
-}
-
-xbt_dictelm_t xbt_lib_get_elm_or_null(xbt_lib_t lib, const char *key)
-{
-  return xbt_dict_get_elm_or_null(lib->dict, key);
-}
-
-void *xbt_lib_get_level(xbt_dictelm_t elm, int level)
-{
-  xbt_assert(level >= 0);
-  void **elts = elm->content;
-  return elts ? elts[level] : NULL;
-}
-
-void xbt_lib_remove(xbt_lib_t lib, const char *key){
-  xbt_dict_remove(lib->dict, key);
-}
index a7379c5..829ba05 100644 (file)
@@ -112,7 +112,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(xbt_exception);
   XBT_LOG_CONNECT(xbt_graph);
   XBT_LOG_CONNECT(xbt_heap);
-  XBT_LOG_CONNECT(xbt_lib);
   XBT_LOG_CONNECT(xbt_mallocator);
   XBT_LOG_CONNECT(xbt_memory_map);
   XBT_LOG_CONNECT(xbt_parmap);
index a2789e3..d070236 100644 (file)
@@ -263,7 +263,6 @@ set(XBT_SRC
   src/xbt/exception.cpp
   src/xbt/graph.c
   src/xbt/heap.c
-  src/xbt/lib.c
   src/xbt/log.c
   src/xbt/mallocator.c
   src/xbt/memory_map.cpp
@@ -713,7 +712,6 @@ set(headers_to_install
   include/xbt/future.hpp
   include/xbt/graph.h
   include/xbt/heap.h
-  include/xbt/lib.h
   include/xbt/Extendable.hpp
   include/xbt/log.h
   include/xbt/log.hpp