Hi. I finished and pushed to ZHAW Gitorious Repos a new version of
KIARA. This is a minor feature and bugfix release.
* New features/bugfixes:
1. Automatic allocation with malloc and initialization of C-structs.
In previous release all structs required explicit allocators and
deallocators. Here example from the documentation:
KIARA_DECL_STRUCT_WITH_API(LocationList,
KIARA_STRUCT_ARRAY_MEMBER(Location_ptr, locations, KIARA_INT,
num_locations)
,
KIARA_USER_API(AllocateType, LocationList_Allocate)
KIARA_USER_API(DeallocateType, LocationList_Deallocate)
)
LocationList_Allocate allocated list with malloc and initialized it.
LocationList_Deallocate deallocated the list.
Starting with the current release both can be omitted:
KIARA_DECL_STRUCT(LocationList,
KIARA_STRUCT_ARRAY_MEMBER(Location_ptr, locations, KIARA_INT,
num_locations)
)
KIARA compiler will generate default allocator and deallocator which
will call malloc/free. Then compiler will generate constructor and
destructor which will initialize all members of the structure.
Note that currently only array members declared with
KIARA_STRUCT_ARRAY_MEMBER are supported. All other members are not
initialized.
2. Semantic annotation of types.
In order to generate correct code we need to distinguish between
different types. However, in C/C++ primitive types like char* can mean
different things: either pointer to raw data ot pointer to
null-terminated string. It is not possible to distinguish between the
two uses based on the type.
In the current version the type system was extended with annotated
types. Annotated type is an alias for another type and annotates it with
additional semantic. Currently this feature is mostly used internally.
But public API now provides two char* types:
KIARA_CHAR_PTR and KIARA_RAW_CHAR_PTR
KIARA_CHAR_PTR is internally an alias to the representation of char*
with additional information that it is a pointer to the null terminated
string.
KIARA_RAW_CHAR_PTR is just a pointer to char or int8_t and has no
additional semantic.
The difference is the generated code when type is allocated/deallocated
and serialized/deserialized.
3. Fixed bug when registering and printing of recursive types like:
typedef struct IntList {
struct IntList *next;
int data;
} IntList;
There are no changes in installation instructions.
Best,
Dmitri
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy