Update documentation
This commit is contained in:
1 parent
ce6a7f6cb3
commit
0d641f0d17
1 file changed
+35
-27
@@ -5062,47 +5062,53 @@ otherwise the clear code of the object won't be called .
|
|||||||
However, you can use the break instruction to quit the block.
|
However, you can use the break instruction to quit the block.
|
||||||
|
|
||||||
|
|
||||||
#### Memory functions
|
#### Memory macros
|
||||||
|
|
||||||
|
All these macro can be overridden before including the header m-core.h
|
||||||
|
so that they can be adapted to a particular memory pool.
|
||||||
|
|
||||||
|
|
||||||
##### type *M\_MEMORY\_ALLOC (type)
|
##### type *M\_MEMORY\_ALLOC (type)
|
||||||
|
|
||||||
Return a pointer to a new allocated object of type 'type'.
|
Return a pointer to a new allocated non-initialized object of type 'type'.
|
||||||
The object is not initialized.
|
|
||||||
In case of allocation error, it returns NULL.
|
In case of allocation error, it returns NULL.
|
||||||
The default function is the malloc function.
|
The default used function is the 'malloc' function of the libc.
|
||||||
It can be overridden before including the header m-core.h
|
|
||||||
|
|
||||||
##### void M\_MEMORY\_DEL (type *ptr)
|
##### void M\_MEMORY\_DEL (type *ptr)
|
||||||
|
|
||||||
Delete the cleared object pointed by the pointer 'ptr'.
|
Delete the cleared object pointed by the pointer 'ptr'
|
||||||
The pointer was previously allocated by the macro M\_MEMORY\_ALLOC.
|
that was previously allocated by the macro M\_MEMORY\_ALLOC.
|
||||||
'ptr' can not be NULL.
|
'ptr' can not be NULL.
|
||||||
The default function is the free function.
|
The default used function is the 'free' function of the libc.
|
||||||
It can be overridden before including the header m-core.h
|
|
||||||
|
|
||||||
##### type *M\_MEMORY\_REALLOC (type, ptr, number)
|
##### type *M\_MEMORY\_REALLOC (type, ptr, number)
|
||||||
|
|
||||||
Return a pointer to an array of 'number' objects of type 'type'.
|
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 (in which the array is allocated),
|
||||||
'ptr' is either NULL, or pointer returned from a previous call
|
or a pointer returned from a previous call of M\_MEMORY\_REALLOC
|
||||||
of M\_MEMORY\_REALLOC.
|
(in which case the array is reallocated).
|
||||||
|
The objects are not initialized, nor the state of previous objects changed
|
||||||
|
(in case of reallocation).
|
||||||
|
The address of the previous objects may have moved and the MOVE operator
|
||||||
|
is not used in this case.
|
||||||
In case of allocation error, it returns NULL.
|
In case of allocation error, it returns NULL.
|
||||||
The default function is the realloc function.
|
The default used function is the 'realloc' function of the libc.
|
||||||
It can be overridden before including the header m-core.h
|
|
||||||
|
|
||||||
##### void M\_MEMORY\_FREE (type *ptr)
|
##### void M\_MEMORY\_FREE (type *ptr)
|
||||||
|
|
||||||
Delete the cleared object pointed by the pointer 'ptr'.
|
Delete the cleared object pointed by the pointer 'ptr'.
|
||||||
The pointer was previously allocated by the macro M\_MEMORY\_REALLOC.
|
The pointer was previously allocated by the macro M\_MEMORY\_REALLOC.
|
||||||
'ptr' can not be NULL.
|
'ptr' can not be NULL.
|
||||||
The default function is the free function.
|
The default used function is the 'free' function of the libc.
|
||||||
It can be overridden 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)
|
##### void M\_MEMORY\_FULL (size_t size)
|
||||||
|
|
||||||
This macro is called when a memory error has been detected.
|
This macro is called when a memory error has been detected and shall be raised.
|
||||||
It can be overridden before including the header m-core.h
|
The parameter 'size' is what was tried to be allocated.
|
||||||
The default is to abort the execution.
|
The default is to abort the execution.
|
||||||
The macro can :
|
The macro can :
|
||||||
|
|
||||||
@@ -5111,11 +5117,12 @@ The macro can :
|
|||||||
* set a global error variable and return.
|
* set a global error variable and return.
|
||||||
|
|
||||||
NOTE: The last two cases are not properly fully supported yet.
|
NOTE: The last two cases are not properly fully supported yet.
|
||||||
|
Throwing an exception is not fully supported yet.
|
||||||
|
|
||||||
|
|
||||||
##### void M\_INIT\_FAILURE (void)
|
##### void M\_INIT\_FAILURE (void)
|
||||||
|
|
||||||
This macro is called when an initialization error shall be raised.
|
This macro is called when an initialization error has been detected and shall be raised.
|
||||||
It can be overridden before including the header m-core.h
|
|
||||||
The default is to abort the execution.
|
The default is to abort the execution.
|
||||||
The macro can :
|
The macro can :
|
||||||
|
|
||||||
@@ -5124,14 +5131,15 @@ The macro can :
|
|||||||
* set a global error variable and return.
|
* set a global error variable and return.
|
||||||
|
|
||||||
NOTE: The last case is not currently supported.
|
NOTE: The last case is not currently supported.
|
||||||
|
Throwing an exception is not fully supported yet.
|
||||||
|
|
||||||
|
|
||||||
##### void M\_ASSERT\_INIT\_FAILURE(expression)
|
##### void M\_ASSERT\_INIT\_FAILURE(expression)
|
||||||
|
|
||||||
This macro is called when an assertion in an initialization context
|
This macro is called when an assertion used in an initialization context
|
||||||
is called.
|
is called to check the good creation of an object (like a thread, a mutex).
|
||||||
If the expression is false, the execution is aborted.
|
If the given 'expression' is false, the execution shall be aborted.
|
||||||
The assertion is kept in release programs.
|
The assertion is kept in programs built in release mode.
|
||||||
It can be overridden before including the header m-core.h
|
|
||||||
The default is to abort the execution.
|
The default is to abort the execution.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user