Format: 1.7 Date: Tue, 22 Apr 2008 13:37:24 +0000 Source: erwin Binary: erwin erwin-doc Architecture: source amd64 all Version: 2.1.79937-1 Distribution: stable Urgency: low Maintainer: Henrik Theiling Changed-By: Henrik Theiling Description: erwin - Data structure template library for C and C++ erwin-doc - Data structure template library for C and C++ (Documentation) Changes: erwin (2.1.79937-1) stable; urgency=low . * Added voidp_hash() in analogy with other TYPE_hash() functions. Unfortunately, a badly named function hash_voidp() existed already, which does not conform with the naming conventions, and we have to keep it know for compatibility. . * Fixed a type-punned pointer problem in an assertion and checked that no other cases of this type exist. But this is really hard to track down when the compiler does not warn... . * Fixed several parser bugs in erwin-cgen. . * Use more GCC __attribute__(()) for better optimisations and warnings. . * The memory allocation interface now supports realloc/recalloc with passing of the old size. This might be needed by some memory managers, especially for recalloc, and Erwin structures know the old size anyway. See defs.h for details about the implementation. (Well, currently recalloc is not used by Erwin structures, but maybe some day it will be used...) . Further, we distinguish atomic and non-atomic arrays, i.e., those that are guaranteed not to contain pointers and all others. . Note: the memory allocation interface was changed incompatibly, because it was wrong and could not be repaired without breaking compatibility. Sorry for that. See defs.h for more details. . * Improved initial_size handling in Maps: the 'initial_size' is now the expected number of elements, not the raw hash size. This is because most people probably would not want to know a good hash size, but do know the number of elements. . * Improved space performance of copy constructors . * Added function Map_expect_size() to realloc to an expected number of elements. . * When the library is compiled for mixed C and C++ usage, the internal memory management is mapped to malloc/free now instead of new/delete. This is because _as_array_detach() must be usable from C code, too, where only free() is available. . Existing code might need adjustment to please tools like valgrind. In some platforms, using delete after malloc() might cause problems, so this is actually an API change. A am sorry for this. But the old implementation was just wrong. . To make this work properly, most memory allocating functions now have a deallocation function (like Map_get_entries + Map_delete_entries). . * The inline assembly on x86_64 and i386 targets was improved. Or better, it was corrected: in some cases, Global_erwin_count_bits would fail to compile. . It was also improved by allowing the compiler more choices of input locations. . * Added Global_ERWIN_IS_POWER2, Global_erwin_is_power2, Global_erwin_next_power2, Global_erwin_next_power2_minus1 . * Vectors on 64 bit machines do not waste memory anymore by using size_t element counters internally by default when the API uses only int anyway. . By this, default (CONSTANT_ZERO) vectors on 64 bit machines are now 16 bytes (8 bytes table pointer + 4 bytes element count + 4 bytes table size), which is nicely aligned. . * Vectors may be switched to size_t element counts, switching both the implementation and the API (option Vector_LARGE_INDEX). This is nice on 64 bit machines if you need vectors with > 2G entries. . The vector size is then 24 bytes (8 + 8 + 8), which might lead to some waste in memory allocation. . Note that the API change is incompatible. Use Vector_cnt_t and Vector_index_t instead of int or ssize_t if you need compilation for both API variants. . * Via the new Vector_SMALL_SIZE option, vectors may be switched to 'short' element counts internally, leaving the API compabibly using 'int'. The normal vector then only has 8 bytes (4 + 2 + 2) instead of a somewhat unaligned 12 bytes (4 + 4 + 4). . * Mainly for machines where an 'int' is 8 bytes, there is a new option Vector_MEDIUM_SIZE that tries to switch the internal element count to some 32 bit type, but leaving the API compatible by using 'int'. . I don not know whether this will often be used, but it was only a few additional lines, so there it is. . * Thanks to ingmar's debugging, vectors now support the LOW_MEM option. (Later we found that another few things were missing, but now I think it does work. Note that LOW_MEM is not well tested, however.) . This makes it possible to have 8 byte vectors (4 + 4) on 32 bits and 16 byte vectors (8 + 8) on 64 bits (thus both perfectly aligned) with the maximally possible number of elements (size_t if necessary). A vector then only consists of a pointer and an element count. The table size is removed and instead inferred from the element count. (A similar effect can be achieved by using Vector_MEDIUM_SIZE on 64 bit machines.) . Note that in some (somewhat strange) cases, runtime behaviour is computationally worse (O(n^2) instead of O(n) for n append/chop operations): a vector of size 2^n-1 will reallocate each time in a sequence of append, chop, append, chop, ... . * Removed some style sheet options in documentation processing when an HTML template is used: the user probably wants to be able to define the colours manually. . * added Map_remove_if (like Map_erase_if, but does not free the elements) . * added Vector_init, Vector_init_with_initial_size, Vector_init_with_zero_and_initial_size and Vector_destroy for non-heap vectors. . * optimised Map_rehash for faster operation with less alloc/free/realloc. . * added Vector_find_ptr and Vector_rfind_ptr . * extended classdef/classundef/newdelete to provide fake reference counting to keep APIs stable . * List_forall_reverse fixed . * reprogrammed the Map_rehash so that the list cells are not de- and reallocated but instead be taken from the old table to the new one. This improves overall memory performance. Further, it makes pointers to map cells stable wrt. rehashin. Currently, the following code is crash-prone: : int &i= v["hello"]; // returns reference to map cell w/ key "hello" : v.set ("anything", 1); // might trigger rehash : i= 5; // SIGSEGV (maybe)! since reference might have changed. . * use __thread or for a thread-safe version of global errno variables if ERWIN_THREAD_SAFE is requested (should work on Win/MSVC, Linux/gcc, Mac OS X). . * added erwin_memmem and erwin_memcmp (if possible, simply the system function). . * Optimised hash functions (faster and better distributing). See map.h for more details, especially for functions to hash memory areas and functions for combining hash values (e.g. for hashing structs). . The new hash functions are collisions free and are fast while still distributing well. . * The new hash functions make the golden ratio in hash_into superfluous, because no additional distribution is necessary. In fact, the old hash_into was not collision free. . It is now replaced by a simpler function that multiplies hash*tablesize and uses the upper bits of the result. I will probably add the golden ratio function under a different name again later, because the implementations were quite sophisticated (and implemented in assembly for several architectures) and might still be useful. . CAUTION: The change of hash_into might affect people who have cast hashval_t to unsigned int (bad thing to do!) and then used hash_into, because on 64 bit machines, the cast erases the upper 32 bits, making hash_into hit slot 0 for small table sizes. If you cannot switch your project to a clean usage of hashval_t, you should instead: . #define Global_SIZEOF_HASHVAL_T 4 . (Replacing Global_ with the library prefix, of course.) This switches the hashval_t to 32 bit width again, making it compatible with casting to unsigned int (on 32 bit machines). . If you use Global_REQUIRE_DETERMINISM, hashval_t is also forced to 32 bits in order to get the same hash results on 32 and 64 bit machines. . * A lot of work was spent on improving 64-bit support, especially x86_64. . * User hash functions are now easier to write well; we added a few macros. See Quick Manual and include/erwin/map.h, erwin_hash_state_t. . * In order to repair a name clash for Global_oType_CMP and Global_oType_PRIORITY_CMP, which were needed in the header file because the macros Vector_DEFAULT_ARG_CMP and Vector_DEFAULT_ARG_PRIORITY_CMP depended on them, the two previously mentioned macros are removed and the corresponding macros replaced by Vector_DEFAULT_ARG. . This means that there are default arguments even if the cmp function is not defined. There is no easy way around this, because there are more complications: the files defaults.h and forwards.h should only be visible to the implementation, but they are needed by many _CMP definitions. This flaw was noticed very late, so some things might have been broken before and users included defaults.h themselves, which is clearly undesirable (nothing really wrong with including them, but the user should not be forced to do so). . Well, forwards.h might be a candidant for inclusion for the header files, too, to make the --include stuff unnecessary for recursive data structures. Later. . * The macro Vector_t_TYPE_INFO_STD_MEMBERS was renamed to Vector_TYPE_INFO_STD_MEMBERS. E.g. for oType=int: . OLD: vector_int_t_TYPE_INFO_STD_MEMBERS NEW: VECTOR_INT_TYPE_INFO_STD_MEMBERS . The same goes for Map and List. . Please edit you files accordingly, although the old value is still recognised and used if #defined, in order to be downward compatible. . * My Lisp utils are needed to run 'make options' (a developer thing; you will not need it), and I did not have any standard place for the few Lisp libraries I wrote, so I included them here. To install the (yet undocumented) Lisp tools, run 'make install-lisp'. You need CLisp to use the Lisp stuff. . * Added function Vector_xchg(a,b) to quickly exchange the contents of two vectors. Probably will add the same for Map and List. Also, a macro ERWIN_XCHG was added. . * Added Map_ensure_steal(). The functionality was only there using poke() otherwise, and Map_ensure_steal() is more efficient and elegant. . We'd also need Map_insert_steal() and Map_set_steal() by analogy now. We'll see. . * erwin-cgen can now generate enum2string() functions for you. The C versions still have a broken name, though. These functions return the char const * representation for each enum value, so you can easily print them. (I never understood why C++ does not provide stuff like this automatically.) Files: d3de601b5f5b563185d9e450caec6ef2 282 devel optional erwin_2.1.79937-1.dsc e4432b2d6a006c9e3142551d3749f512 1021470 devel optional erwin_2.1.79937-1.tar.gz 5bd423e41e0daa9cf7000577b4790eec 614042 devel optional erwin_2.1.79937-1_amd64.deb b0cfd82de559f48ac3398650167bff0c 546144 devel optional erwin-doc_2.1.79937-1_all.deb