Update doc.

This commit is contained in:
Patrick Pelissier committed 2017-05-21 21:11:19 +02:00
1 parent 077f5b04a6
commit 1fc3645c35
1 file changed
+71 -1
+71 -1
View File
@@ -2092,8 +2092,78 @@ Example:
NOTE: The user code can not perform a return or a goto outside the {}
otherwise the clear code of the object won't be called .
#### Memory functions
##### type *M\_MEMORY\_ALLOC (type)
Return a pointer to a new allocated object of type 'type'.
The object is not initialized.
In case of allocation error, it returns NULL.
The default function is the malloc function.
It can be overriden before including the header m-core.h
##### void M\_MEMORY\_DEL (type *ptr)
Delete the cleared object pointed by the pointer 'ptr'.
The pointer was previously allocated by the macro M\_MEMORY\_ALLOC.
'ptr' can not be NULL.
The default function is the free function.
It can be overriden before including the header m-core.h
##### type *M\_MEMORY\_REALLOC (type, ptr, number)
Return a pointer to an array of 'number' objects of type 'type'.
The objects are not initialized, nor the state of previous objects changed.
'ptr' is either NULL, or pointer returned from a previous call
of M\_MEMORY\_REALLOC.
In case of allocation error, it returns NULL.
The default function is the realloc function.
It can be overriden before including the header m-core.h
##### void M\_MEMORY\_FREE (type *ptr)
Delete the cleared object pointed by the pointer 'ptr'.
The pointer was previously allocated by the macro M\_MEMORY\_REALLOC.
'ptr' can not be NULL.
The default function is the free function.
It can be overriden before including the header m-core.h
A pointer allocated by M\_MEMORY\_ALLOC can not be freed by this function.
##### void M\_MEMORY\_FULL (size_t size)
This macro is called when a memory exception error shall be raised.
It can be overriden before including the header m-core.h
The default is to abort the execution.
The macro can :
* abort the execution,
* throw an exception (In this case, the state of the object is unchanged),
* set a global error variable and return.
NOTE: The last case is not 100% supported.
##### void M\_INIT\_FAILURE (void)
This macro is called when an initialization error shall be raised.
It can be overriden before including the header m-core.h
The default is to abort the execution.
The macro can :
* abort the execution,
* throw an exception (In this case, the state of the object is unchanged),
* set a global error variable and return.
NOTE: The last case is not 100% supported.
##### void M\_ASSERT\_INIT\_FAILURE(expression)
This macro is called when an assertion in an initialization context
is called.
If the expression is false, the execution is aborted.
The assertion is kept in release programs.
It can be overriden before including the header m-core.h
The default is to abort the execution.
TODO: Document the API.
### M-MUTEX