📄 group__block__heap__fns.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>MiniGUI V1.6.10 API Reference: Block data heap operations</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.2 --><div class="qindex"><a class="qindex" href="index.htm">Main Page</a> | <a class="qindex" href="modules.htm">Modules</a> | <a class="qindex" href="classes.htm">Alphabetical List</a> | <a class="qindex" href="annotated.htm">Data Structures</a> | <a class="qindex" href="dirs.htm">Directories</a> | <a class="qindex" href="files.htm">File List</a> | <a class="qindex" href="functions.htm">Data Fields</a> | <a class="qindex" href="globals.htm">Globals</a> | <a class="qindex" href="pages.htm">Related Pages</a></div><h1>Block data heap operations<br><small>[<a class="el" href="group__global__fns.htm">Global/general functions</a>]</small></h1><h2>Data Structures</h2><ul><li>struct <a class="el" href="struct__BLOCKHEAP.htm">_BLOCKHEAP</a></ul><h2>Typedefs</h2><ul><li>typedef <a class="el" href="struct__BLOCKHEAP.htm">_BLOCKHEAP</a> <a class="el" href="group__block__heap__fns.htm#ga0">BLOCKHEAP</a><li>typedef <a class="el" href="struct__BLOCKHEAP.htm">BLOCKHEAP</a> * <a class="el" href="group__block__heap__fns.htm#ga1">PBLOCKHEAP</a><dl class="el"><dd class="mdescRight">Data type of the pointer to a BLOCKHEAP. <a href="#ga1"></a><br></dl></ul><h2>Functions</h2><ul><li>MG_EXPORT void <a class="el" href="group__block__heap__fns.htm#ga2">InitBlockDataHeap</a> (<a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> heap, size_t bd_size, size_t heap_size)<dl class="el"><dd class="mdescRight">Initializes a private block data heap. <a href="#ga2"></a><br></dl><li>MG_EXPORT void * <a class="el" href="group__block__heap__fns.htm#ga3">BlockDataAlloc</a> (<a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> heap)<dl class="el"><dd class="mdescRight">Allocates a data block from private heap. <a href="#ga3"></a><br></dl><li>MG_EXPORT void <a class="el" href="group__block__heap__fns.htm#ga4">BlockDataFree</a> (<a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> heap, void *data)<dl class="el"><dd class="mdescRight">Frees an allocated data block. <a href="#ga4"></a><br></dl><li>MG_EXPORT void <a class="el" href="group__block__heap__fns.htm#ga5">DestroyBlockDataHeap</a> (<a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> heap)<dl class="el"><dd class="mdescRight">Destroys a private block data heap. <a href="#ga5"></a><br></dl></ul><hr><a name="_details"></a><h2>Detailed Description</h2>MiniGUI maintains some private block data heaps to allocate data blocks which have fixed size, such as the clipping rectangles in a region. By using the private heap, we can avoiding calling <em>malloc</em> and <em>free</em> function frequently, so will have a slight performance enhancement. <hr><h2>Typedef Documentation</h2><a class="anchor" name="ga0" doxytag="gdi.h::BLOCKHEAP"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">typedef struct <a class="el" href="struct__BLOCKHEAP.htm">_BLOCKHEAP</a> <a class="el" href="struct__BLOCKHEAP.htm">BLOCKHEAP</a> </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>MiniGUI's private block data heap.<p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__block__heap__fns.htm#ga2">InitBlockDataHeap</a>, <a class="el" href="group__block__heap__fns.htm#ga5">DestroyBlockDataHeap</a> </dd></dl> </td> </tr></table><a class="anchor" name="ga1" doxytag="gdi.h::PBLOCKHEAP"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">typedef <a class="el" href="struct__BLOCKHEAP.htm">BLOCKHEAP</a> * <a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> </td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Data type of the pointer to a BLOCKHEAP. <p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__block__heap__fns.htm#ga0">BLOCKHEAP</a> </dd></dl><p>Definition at line <a class="el" href="gdi_8h-source.htm#l00401">401</a> of file <a class="el" href="gdi_8h-source.htm">gdi.h</a>. </td> </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="ga3" doxytag="gdi.h::BlockDataAlloc"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void * BlockDataAlloc </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> </td> <td class="mdname1" valign="top" nowrap> <em>heap</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Allocates a data block from private heap. <p>This function allocates a data block from an initialized block data heap. The allocated block will have the size of <em>heap->bd_size</em>. If there is no free block in the heap, this function will try to allocate the block from the system heap by using <em>malloc(3)</em> function.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>heap</em> </td><td>The pointer to the initialized heap. </td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>Pointer to the allocated data block, NULL on error.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__block__heap__fns.htm#ga2">InitBlockDataHeap</a>, <a class="el" href="group__block__heap__fns.htm#ga4">BlockDataFree</a> </dd></dl> </td> </tr></table><a class="anchor" name="ga4" doxytag="gdi.h::BlockDataFree"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void BlockDataFree </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> </td> <td class="mdname" nowrap> <em>heap</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>void * </td> <td class="mdname" nowrap> <em>data</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Frees an allocated data block. <p>This function frees the specified data block pointed to by <em>data</em> to the heap <em>heap</em>. If the block was allocated by using <em>malloc</em> function, this function will free the element by using <em>free(3)</em> function.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>heap</em> </td><td>The pointer to the heap. </td></tr> <tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>The pointer to the element to be freed.</td></tr> </table></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__block__heap__fns.htm#ga2">InitBlockDataHeap</a>, <a class="el" href="group__block__heap__fns.htm#ga3">BlockDataAlloc</a> </dd></dl> </td> </tr></table><a class="anchor" name="ga5" doxytag="gdi.h::DestroyBlockDataHeap"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void DestroyBlockDataHeap </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> </td> <td class="mdname1" valign="top" nowrap> <em>heap</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Destroys a private block data heap. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>heap</em> </td><td>The pointer to the heap to be destroied.</td></tr> </table></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__block__heap__fns.htm#ga2">InitBlockDataHeap</a>, <a class="el" href="group__block__heap__fns.htm#ga0">BLOCKHEAP</a> </dd></dl> </td> </tr></table><a class="anchor" name="ga2" doxytag="gdi.h::InitBlockDataHeap"></a><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void InitBlockDataHeap </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct__BLOCKHEAP.htm">PBLOCKHEAP</a> </td> <td class="mdname" nowrap> <em>heap</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>size_t </td> <td class="mdname" nowrap> <em>bd_size</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>size_t </td> <td class="mdname" nowrap> <em>heap_size</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Initializes a private block data heap. <p>This function initializes a block data heap pointed to by <em>heap</em>. It will allocate the buffer used by the heap from system heap by using <em>malloc(3)</em>. Initially, the heap has <em>heap_size</em> blocks free, and each is <em>bd_size</em> bytes long.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>heap</em> </td><td>The pointer to the heap structure. </td></tr> <tr><td valign="top"></td><td valign="top"><em>bd_size</em> </td><td>The size of one block in bytes. </td></tr> <tr><td valign="top"></td><td valign="top"><em>heap_size</em> </td><td>The size of the heap in blocks.</td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd><em>heap->heap</em> will contains a valid pointer on success, NULL on error.</dd></dl><dl compact><dt><b>Note:</b></dt><dd>This function does not return anything. You should check the <em>heap</em> field of the <em>heap</em> structure.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__block__heap__fns.htm#ga0">BLOCKHEAP</a> </dd></dl> </td> </tr></table><hr size="1"><address style="align: right;"><small>Generated on Thu Nov 22 15:35:54 2007 for MiniGUI V1.6.10 API Reference by <a href="http://www.doxygen.org/index.html"><img src="http://www.minigui.com/api_ref/1.6.10/doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -