94 lines
4.6 KiB
HTML
94 lines
4.6 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||
|
<meta name="generator" content="Doxygen 1.8.9.1"/>
|
||
|
<title>HTML Tidy: _TidyAllocator Struct Reference</title>
|
||
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="jquery.js"></script>
|
||
|
<script type="text/javascript" src="dynsections.js"></script>
|
||
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||
|
<script type="text/javascript" src="resize.js"></script>
|
||
|
<script type="text/javascript" src="navtreedata.js"></script>
|
||
|
<script type="text/javascript" src="navtree.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(initResizable);
|
||
|
$(window).load(resizeHeight);
|
||
|
</script>
|
||
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||
|
<div id="titlearea">
|
||
|
<table cellspacing="0" cellpadding="0">
|
||
|
<tbody>
|
||
|
<tr style="height: 56px;">
|
||
|
<td style="padding-left: 0.5em;">
|
||
|
<div id="projectname">HTML Tidy
|
||
|
 <span id="projectnumber">4.9.15</span>
|
||
|
</div>
|
||
|
<div id="projectbrief">The HTACG Tidy HTML Project</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- end header part -->
|
||
|
<!-- Generated by Doxygen 1.8.9.1 -->
|
||
|
</div><!-- top -->
|
||
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||
|
<div id="nav-tree">
|
||
|
<div id="nav-tree-contents">
|
||
|
<div id="nav-sync" class="sync"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="splitbar" style="-moz-user-select:none;"
|
||
|
class="ui-resizable-handle">
|
||
|
</div>
|
||
|
</div>
|
||
|
<script type="text/javascript">
|
||
|
$(document).ready(function(){initNavTree('struct__TidyAllocator.html','');});
|
||
|
</script>
|
||
|
<div id="doc-content">
|
||
|
<div class="header">
|
||
|
<div class="summary">
|
||
|
<a href="#pub-attribs">Data Fields</a> </div>
|
||
|
<div class="headertitle">
|
||
|
<div class="title">_TidyAllocator Struct Reference<div class="ingroups"><a class="el" href="group__Memory.html">Memory Allocation</a></div></div> </div>
|
||
|
</div><!--header-->
|
||
|
<div class="contents">
|
||
|
|
||
|
<p><code>#include <<a class="el" href="tidy_8h_source.html">tidy.h</a>></code></p>
|
||
|
<table class="memberdecls">
|
||
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
|
||
|
Data Fields</h2></td></tr>
|
||
|
<tr class="memitem:a2113f1c06a3cfe4cbdf9212a47e6938b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2113f1c06a3cfe4cbdf9212a47e6938b"></a>
|
||
|
const <a class="el" href="group__Memory.html#ga3fe8c5ac7d658618c732565776940ed8">TidyAllocatorVtbl</a> * </td><td class="memItemRight" valign="bottom"><b>vtbl</b></td></tr>
|
||
|
<tr class="separator:a2113f1c06a3cfe4cbdf9212a47e6938b"><td class="memSeparator" colspan="2"> </td></tr>
|
||
|
</table>
|
||
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||
|
<div class="textblock"><p>An allocator. To create your own allocator, do something like the following:</p>
|
||
|
<p>typedef struct _MyAllocator { TidyAllocator base; ...other custom allocator state... } MyAllocator;</p>
|
||
|
<p>void* MyAllocator_alloc(TidyAllocator <em>base, void *block, size_t nBytes) { MyAllocator *self = (MyAllocator)base; ... } (etc)</p>
|
||
|
<p>static const TidyAllocatorVtbl MyAllocatorVtbl = { MyAllocator_alloc, MyAllocator_realloc, MyAllocator_free, MyAllocator_panic };</p>
|
||
|
<p>myAllocator allocator; <a class="el" href="structTidyDoc.html">TidyDoc</a> doc;</p>
|
||
|
<p>allocator.base.vtbl = &MyAllocatorVtbl; ...initialise allocator specific state... doc = tidyCreateWithAllocator(&allocator); ...</p>
|
||
|
<p>Although this looks slightly long winded, the advantage is that to create a custom allocator you simply need to set the vtbl pointer correctly. The vtbl itself can reside in static/global data, and hence does not need to be initialised each time an allocator is created, and furthermore the memory is shared amongst all created allocators. </p>
|
||
|
</div><hr/>The documentation for this struct was generated from the following file:<ul>
|
||
|
<li><a class="el" href="tidy_8h_source.html">tidy.h</a></li>
|
||
|
</ul>
|
||
|
</div><!-- contents -->
|
||
|
</div><!-- doc-content -->
|
||
|
<!-- start footer part -->
|
||
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||
|
<ul>
|
||
|
<li class="navelem"><a class="el" href="struct__TidyAllocator.html">_TidyAllocator</a></li>
|
||
|
<li class="footer">Generated on Fri Feb 13 2015 12:51:21 for HTML Tidy by
|
||
|
<a href="http://www.doxygen.org/index.html">
|
||
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|