|
- added interpretation of symbols as booleans: NULL, "", "0", and "false" are interpreted as false and all other symbols as true. So get_bool() and find_bool() etc. all work for Symbols, too now.
Some functions were reactivated because they make sense now:
crl_value_char_array_get_bool
crl_value_symbol_get_bool
crl_value_identifier_get_bool
CRL_DELETE was changed to have a recursion protection against deletion loops. This fixed serious bugs in certain REF_UNREF() invocations that could lead to SIGSEGV.
Unfortunately, this breaks the code for deletion of classes derived from CrlObject whose destructor is public.
FIX: Derive the classes from CrlDeletable instead or use CRL_DELETE_QUALIFIED for deletion.
The free documentation has a search button
The access interface to Structure and sub-types has been totally reworked. However, it should either be compatible or find bugs in your code.
There are a lot of additional functions to improve both efficiency of the library and usability in C (and also in C++, but to a lesser degree).
With this change, several functions have been removed because they fail trivially. If you invoke them in your code, the removal in the interface will identify potential bugs.
Some other functions that succeed trivially have sometimes been re-included (like ValueVector::get()), because when changing types in C++, it would propably be nice to not get errors although the code would work just fine. However, I am thinking about including a #define for exclusion of such functions in order to find trivial invacations in application code.
The following functions that are now absolete have compatibility #defines in order not to break existing code:
- crl_value_box_get_const == crl_value_box_get
The prototypes of the two were wrong in previous versions (wrt. 'const'); the new prototype of crl_value_box_get subsumes both.
The following functions are REMOVED since they always fail (those always returning 'false' or 'NULL', etc., without having any side effect):
crl_value_application_get_item
crl_value_compound_get_item
crl_value_compound_is_special
crl_value_compound_is_special_sym
crl_value_char_array_get_{bool,int,item,signed,unsigned}
crl_value_float_get_{bool,int,signed,unsigned,symbol,string}
crl_value_identifier_get_{bool,int,item,signed,unsigned}
crl_value_integer_get_{item,string,symbol}
crl_value_item_append
crl_value_item_find
crl_value_item_find_{bool,int,signed,string,sym,symbol,unsigned}
crl_value_item_get_{bool,int,signed,string,symbol,unsigned}
crl_value_item_has
crl_value_item_has_{nth,sym}
crl_value_item_is_special
crl_value_item_is_special_{nth,sym}
crl_value_item_next_index
crl_value_item_nth
crl_value_item_nth_{bool,int,signed,string,symbol,unsigned}
crl_value_item_reset
crl_value_item_reset_{nth,sym}
crl_value_item_set
crl_value_item_set_{nth,sym}
crl_value_item_set_once
crl_value_item_set_once_{nth,sym}
crl_value_list_get_item
crl_value_list_is_special
crl_value_list_is_special_sym
crl_value_map_append
crl_value_map_get_item
crl_value_numeric_get_{item,string,symbol}
crl_value_numeric_simple_get_{item,string,symbol}
crl_value_range_get_{bool,int,item,signed,string,symbol,unsigned}
crl_value_signed_get_{item,string,symbol}
crl_value_string_get_{bool,int,item,signed,unsigned}
crl_value_symbol_get_{bool,int,item,signed,unsigned}
crl_value_unsigned_get_{item,string,symbol}
crl_value_vector_get_item
crl_value_vector_is_special
crl_value_vector_is_special_sym
of these, the is_special functions might be reintroduces later if we decide that value_compound, etc, understand the poke() method. For now, since the interface does not exist, they fail.
There is an additional nested type CrlValueMapItemValue. ValueMapValueValue will follow soon.
We did not introduce an additional super type to CrlValueMap and CrlValueMapValueValue since the arbitray map type is already called ValueNested. Since ValueVector, ValueList and ValueMap where sub-types to this ValueNested, it would be totally artificial to have a separate super type for ValueMap and ValueMapValueValue: they are all just implementations of mathematical functions.
Due to the additional CrlValueMapValueValue, additional lookup functions are added to CrlStructure and the corresponding sub-classes that support them:
bool CrlStructure::has (CrlValue *) // has_structure in C CrlValue *CrlStructure::lookup (CrlValue *) bool CrlStructure::set (CrlValue *, CrlValue *) bool CrlStructure::set_once (CrlValue *, CrlValue *) bool CrlStructure::reset (CrlValue *)
is_special() is currently not overloaded for a CrlValue * key, because no special attributes of such kind exist.
Also, the lookup functions with implicit casts are implemented:
lookup (unsigned &, ...) // lookup_unsigned in C lookup (signed &, ...) // lookup_signed in C lookup_bool lookup_int lookup_string lookup_symbol
There is no lookup-function accepting CrlAnyValue as a key: use the specialised lookups has(), nth() and find()/find_sym() instead.
All types but 'Type' are now sub-type to TypeAny, since type constraints increase in descending the class hierarchy.
TypeItem is now TypeCertainItem and TypeAnyItem is TypeItem. This is to reflect the increasing restriction down the Type hierarchy: class names should be longer for additional constraints, too.
TypeInteger (concrete) and ValueInteger (abstract) are new super types of *Unsigned and *Signed.
Class hierarchy refinement by introduction of some intermediate classes: TypeNested, ValueSimple, ValueNested
Class hierarchy change: TypeBox is not TypeSimple. It is neither TypeSimple nor TypeNested, it is a special thingy.
ValueUnsigned, ValueSigned: get() returns true for a differently signed type if the value can be represented. I.e. we have the the following situation now:
signed_t s; unsigned_t u; (new ValueUnsigned(5))->get (u) // -> true (just as before) (new ValueUnsigned(5))->get (s) // -> true (different, was false before) (new ValueUnsigned(~0))->get (s) // -> false (same as before) (new ValueSigned(5))->get (s) // -> true (just as before) (new ValueSigned(5))->get (u) // -> true (different, was false before) (new ValueSigned(-5))->get (u) // -> false (same as before)
The parser now checks types:
New classes: TypeBox, TypeApplication (subtype of TypeTuple)
Type contains a few methods for easy type checking.
DelayedValueItem checks types now
The parser is more picky about the syntax now, especially for ranges. (Thus for correct input, nothing changes. :-))
- ValueString, ValueSymbol: Fixed class hierarchy:
they are now ValueScalar
added additional class ValueCharArray above these two
Same as for ValueString etc.: fixed the class hierarchy to have a layout according to the values.
Made some types concrete. They were abstract before and marked with a FIXME. :-)
added method add().
Of course, this adds some functions in all the subclasses, too.
CRL_REF, CRL_UNREF_LVAL, CRL_REF_UNREF_LVAL can be used in expressions now:
if (CrlValue *x= CRL_REF(a->minimum())) {
...
CRL_UNREF (x);
}Object::_ref(), crl_object__ref() etc. can also be used in expressions now, however, the C function should not be used like that.
Further, this type of functions they may be invoked directly now.
Note that it is still deprecated to invoke the functions directly instead of via a macro. The additional underbar in the name reflects this. However, they may be invoked without problems.
First binary library release for Artist2
| Generated by erwin-cgen | © AbsInt Angewandte Informatik GmbH |