luaforwindows/files/docs/wxlua/doxygen/html/wxldebug_8h_source.html

263 lines
34 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"/>
<title>wxLua: /mnt/share/devel/lua/wxLua/modules/wxluadebug/include/wxldebug.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="dirs.html"><span>Directories</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="dir_15d5a205ad383328522db6a6be296af1.html">modules</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_cf470daeabd5035b695eccd689e0edbd.html">wxluadebug</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_7cfce83e8155d1168953975fd16ca4b2.html">include</a>
</div>
</div>
<div class="contents">
<h1>wxldebug.h</h1><a href="wxldebug_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/////////////////////////////////////////////////////////////////////////////</span>
<a name="l00002"></a>00002 <span class="comment"></span><span class="comment">// Purpose: Lua and wxLua debugging code</span>
<a name="l00003"></a>00003 <span class="comment">// Author: J. Winwood, John Labenski</span>
<a name="l00004"></a>00004 <span class="comment">// Created: June 2003</span>
<a name="l00005"></a>00005 <span class="comment">// Copyright: (c) 2002 Lomtick Software. All rights reserved.</span>
<a name="l00006"></a>00006 <span class="comment">// Licence: wxWidgets licence</span><span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment">/////////////////////////////////////////////////////////////////////////////</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef WX_LUA_DEBUG_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define WX_LUA_DEBUG_H</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;wx/dynarray.h&quot;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;wx/treectrl.h&quot;</span> <span class="comment">// for wxTreeItemData</span>
<a name="l00014"></a>00014
<a name="l00015"></a>00015 <span class="preprocessor">#include &quot;<a class="code" href="wxluadebugdefs_8h.html">wxluadebug/include/wxluadebugdefs.h</a>&quot;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;<a class="code" href="wxlstate_8h.html">wxlua/include/wxlstate.h</a>&quot;</span>
<a name="l00017"></a>00017
<a name="l00018"></a><a class="code" href="wxldebug_8h.html#a1fdd8670657fe9588ba3e185a3ecc69a">00018</a> <span class="keyword">class </span><a class="code" href="wxluadebugdefs_8h.html#a26bb867eefeede0ae330a79109b67d2b">WXDLLIMPEXP_WXLUADEBUG</a> <a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a>;
<a name="l00019"></a>00019
<a name="l00020"></a>00020 <span class="comment">// ----------------------------------------------------------------------------</span>
<a name="l00021"></a>00021 <span class="comment">// wxLuaDebugItem - A class to store an item from Lua for wxLuaDebugData</span>
<a name="l00022"></a>00022 <span class="comment">//</span>
<a name="l00023"></a>00023 <span class="comment">// It is typically used to store table[key] = value pair info. However it may</span>
<a name="l00024"></a>00024 <span class="comment">// be used to store stack information as well.</span>
<a name="l00025"></a>00025 <span class="comment">// ----------------------------------------------------------------------------</span>
<a name="l00026"></a>00026
<a name="l00027"></a><a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235">00027</a> <span class="keyword">enum</span> <a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235">wxLuaDebugItem_Type</a>
<a name="l00028"></a>00028 {
<a name="l00029"></a><a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235a330ef4e338bb589ad6ff6e0249772afa">00029</a> <a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235a330ef4e338bb589ad6ff6e0249772afa">WXLUA_DEBUGITEM_LOCALS</a> = 0x0100, <span class="comment">// This wxLuaDebugItem is the parent for local variables</span>
<a name="l00030"></a>00030
<a name="l00031"></a><a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235a332a89e739e060de6e00d7372a7c30fa">00031</a> <a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235a332a89e739e060de6e00d7372a7c30fa">WXLUA_DEBUGITEM_EXPANDED</a> = 0x0200, <span class="comment">// for wxLuaStackDialog</span>
<a name="l00032"></a>00032
<a name="l00033"></a><a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235ab7413bafa0963e0ab72c04eafad0aa51">00033</a> <a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235ab7413bafa0963e0ab72c04eafad0aa51">WXLUA_DEBUGITEM_IS_REFED</a> = 0x1000, <span class="comment">// This item was created with a new</span>
<a name="l00034"></a>00034 <span class="comment">// wxluaR_ref() rather than using an existing one.</span>
<a name="l00035"></a><a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235af057a953936ac6e00eca4983984a2eab">00035</a> <a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235af057a953936ac6e00eca4983984a2eab">WXLUA_DEBUGITEM_KEY_REF</a> = 0x2000, <span class="comment">// The ref is for the key</span>
<a name="l00036"></a><a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235ae399f7991ab5e948074483d0c65cc821">00036</a> <a class="code" href="wxldebug_8h.html#aa2fd8aa5a2d95cde0ea0be4691857235ae399f7991ab5e948074483d0c65cc821">WXLUA_DEBUGITEM_VALUE_REF</a> = 0x4000, <span class="comment">// The ref is for the value</span>
<a name="l00037"></a>00037 };
<a name="l00038"></a>00038
<a name="l00039"></a><a class="code" href="classwxLuaDebugItem.html">00039</a> <span class="keyword">class </span><a class="code" href="wxluadebugdefs_8h.html#a26bb867eefeede0ae330a79109b67d2b">WXDLLIMPEXP_WXLUADEBUG</a> <a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a>
<a name="l00040"></a>00040 {
<a name="l00041"></a>00041 <span class="keyword">public</span>:
<a name="l00042"></a>00042 <a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a>(<span class="keyword">const</span> <a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a> &amp;debugDataItem);
<a name="l00043"></a>00043 <a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a>(<span class="keyword">const</span> wxString &amp;itemKey, <span class="keywordtype">int</span> itemKeyType,
<a name="l00044"></a>00044 <span class="keyword">const</span> wxString &amp;itemValue, <span class="keywordtype">int</span> itemValueType,
<a name="l00045"></a>00045 <span class="keyword">const</span> wxString &amp;itemSource,
<a name="l00046"></a>00046 <span class="keywordtype">int</span> lua_ref, <span class="keywordtype">int</span> idx = 0, <span class="keywordtype">int</span> flag = 0);
<a name="l00047"></a>00047
<a name="l00048"></a>00048 <span class="comment">// The key has the typical meaning of the key in a Lua table</span>
<a name="l00049"></a><a class="code" href="classwxLuaDebugItem.html#acf6c2cb085a8b18027176f008ed784af">00049</a> wxString <a class="code" href="classwxLuaDebugItem.html#acf6c2cb085a8b18027176f008ed784af">GetKey</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_itemKey; }
<a name="l00050"></a><a class="code" href="classwxLuaDebugItem.html#a5ec02bf5985694b4e062bf0d0d1e08fe">00050</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaDebugItem.html#a5ec02bf5985694b4e062bf0d0d1e08fe">GetKeyType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_itemKeyType; }
<a name="l00051"></a><a class="code" href="classwxLuaDebugItem.html#ac5fb0efc9824c1a232b740a5cd62524a">00051</a> wxString <a class="code" href="classwxLuaDebugItem.html#ac5fb0efc9824c1a232b740a5cd62524a">GetKeyTypeString</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="wxlstate_8h.html#a6621fa5a456448acfd515112aa7b23e1">wxluaT_typename</a>(NULL, m_itemKeyType); }
<a name="l00052"></a>00052
<a name="l00053"></a>00053 <span class="comment">// The value has the typical meaning of the value for the key in a Lua table</span>
<a name="l00054"></a><a class="code" href="classwxLuaDebugItem.html#a9bc1790bf51d4ba1d137294803bb8938">00054</a> wxString <a class="code" href="classwxLuaDebugItem.html#a9bc1790bf51d4ba1d137294803bb8938">GetValue</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_itemValue; }
<a name="l00055"></a><a class="code" href="classwxLuaDebugItem.html#a280783082f348e6b1afd1e1a1035b67f">00055</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaDebugItem.html#a280783082f348e6b1afd1e1a1035b67f">GetValueType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_itemValueType; }
<a name="l00056"></a><a class="code" href="classwxLuaDebugItem.html#a1b2ce08fecf3b88cb032d6f0d99a7b29">00056</a> wxString <a class="code" href="classwxLuaDebugItem.html#a1b2ce08fecf3b88cb032d6f0d99a7b29">GetValueTypeString</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="wxlstate_8h.html#a6621fa5a456448acfd515112aa7b23e1">wxluaT_typename</a>(NULL, m_itemValueType); }
<a name="l00057"></a>00057
<a name="l00058"></a>00058 <span class="comment">// The lua_Debug.source value when enumerating the stack or a stack item</span>
<a name="l00059"></a><a class="code" href="classwxLuaDebugItem.html#a30193c00b3c2b3135c9e953079b0b947">00059</a> wxString <a class="code" href="classwxLuaDebugItem.html#a30193c00b3c2b3135c9e953079b0b947">GetSource</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_itemSource; }
<a name="l00060"></a>00060
<a name="l00061"></a><a class="code" href="classwxLuaDebugItem.html#a2317b5a660aa8f04c7d99ba01cf430ba">00061</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaDebugItem.html#a2317b5a660aa8f04c7d99ba01cf430ba">GetRef</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_lua_ref; } <span class="comment">// wxluaR_ref() reference</span>
<a name="l00062"></a><a class="code" href="classwxLuaDebugItem.html#a99c57bc1c8f6f41e4a9d0d2b67fb2537">00062</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaDebugItem.html#a99c57bc1c8f6f41e4a9d0d2b67fb2537">GetIndex</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_index; } <span class="comment">// stack index or table level index</span>
<a name="l00063"></a><a class="code" href="classwxLuaDebugItem.html#a1996eb7c79d9e724aff33539cdc8f984">00063</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaDebugItem.html#a1996eb7c79d9e724aff33539cdc8f984">GetFlag</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_flag; } <span class="comment">// see wxLuaDebugItem_Type</span>
<a name="l00064"></a><a class="code" href="classwxLuaDebugItem.html#a5b2be6fc04e248b2f5de4e0c535f8812">00064</a> <span class="keywordtype">bool</span> <a class="code" href="classwxLuaDebugItem.html#a5b2be6fc04e248b2f5de4e0c535f8812">GetFlagBit</a>(<span class="keywordtype">int</span> mask)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="wxldefs_8h.html#a94d4432b789ed04ce0ed6845cb97c1c6">WXLUA_HASBIT</a>(m_flag, mask); }
<a name="l00065"></a>00065
<a name="l00066"></a>00066 <span class="comment">// If GetFlagBit(WXLUA_DEBUGITEM_KEY_REFED) try to convert GetKey() to a number</span>
<a name="l00067"></a>00067 <span class="comment">// else if GetFlagBit(WXLUA_DEBUGITEM_VALUE_REFED) try to convert GetValue() to a number</span>
<a name="l00068"></a>00068 <span class="comment">// Asserts if neither or both of the bits are set.</span>
<a name="l00069"></a>00069 <span class="keywordtype">bool</span> GetRefPtr(<span class="keywordtype">long</span>&amp; ptr) <span class="keyword">const</span>;
<a name="l00070"></a>00070
<a name="l00071"></a><a class="code" href="classwxLuaDebugItem.html#abe91ae7ef9405c6354f2ee934624eaa6">00071</a> <span class="keywordtype">void</span> <a class="code" href="classwxLuaDebugItem.html#abe91ae7ef9405c6354f2ee934624eaa6">SetFlag</a>(<span class="keywordtype">int</span> flag) { m_flag = flag; }
<a name="l00072"></a><a class="code" href="classwxLuaDebugItem.html#a0e40d661c8b6253bbdef000a3e9ccd2d">00072</a> <span class="keywordtype">void</span> <a class="code" href="classwxLuaDebugItem.html#a0e40d661c8b6253bbdef000a3e9ccd2d">SetFlagBit</a>(<span class="keywordtype">int</span> bit, <span class="keywordtype">bool</span> <span class="keyword">set</span>) { m_flag = <a class="code" href="wxldefs_8h.html#a1712957fa7ad1a61ec844cbfcc92a768">WXLUA_SETBIT</a>(m_flag, bit, <span class="keyword">set</span>); }
<a name="l00073"></a><a class="code" href="classwxLuaDebugItem.html#aea1679d94b976c56abee89161c973c19">00073</a> <span class="keywordtype">void</span> <a class="code" href="classwxLuaDebugItem.html#aea1679d94b976c56abee89161c973c19">SetRef</a>(<span class="keywordtype">int</span> lua_ref) { m_lua_ref = lua_ref; } <span class="comment">// only if you&#39;ve wxluaR_unref()ed it</span>
<a name="l00074"></a>00074
<a name="l00075"></a>00075 <span class="comment">// Get a human readable string for debugging</span>
<a name="l00076"></a><a class="code" href="classwxLuaDebugItem.html#ad6b7d84fa0fccc6531e4e36cd3ca0719">00076</a> wxString ToString()<span class="keyword"> const</span>
<a name="l00077"></a>00077 <span class="keyword"> </span>{
<a name="l00078"></a>00078 <span class="keywordflow">return</span> wxString::Format(wxT(<span class="stringliteral">&quot;Key: &#39;%s&#39; KeyType: %d &#39;%s&#39; Value: &#39;%s&#39; ValueType: %d &#39;%s&#39; Ref: %d Idx: %d Flag: %x HasSrc: %d&quot;</span>),
<a name="l00079"></a>00079 m_itemKey.c_str(), m_itemKeyType, GetKeyTypeString().c_str(),
<a name="l00080"></a>00080 m_itemValue.c_str(), m_itemValueType, GetValueTypeString().c_str(),
<a name="l00081"></a>00081 m_lua_ref, m_index, m_flag, (int)!m_itemSource.IsEmpty());
<a name="l00082"></a>00082 }
<a name="l00083"></a>00083
<a name="l00084"></a>00084 <span class="comment">// implementation</span>
<a name="l00085"></a>00085
<a name="l00086"></a><a class="code" href="classwxLuaDebugItem.html#a5b00ecb7e87e690af18d4a57ee1b75b6">00086</a> wxString m_itemKey;
<a name="l00087"></a><a class="code" href="classwxLuaDebugItem.html#a724720b3a10a534f5ad49227a3e0a2bb">00087</a> <span class="keywordtype">int</span> m_itemKeyType;
<a name="l00088"></a><a class="code" href="classwxLuaDebugItem.html#a6539ecb63415742bef43c23f6794fd36">00088</a> wxString m_itemValue;
<a name="l00089"></a><a class="code" href="classwxLuaDebugItem.html#a3ff51275409202d3f64c37dc4051f866">00089</a> <span class="keywordtype">int</span> m_itemValueType;
<a name="l00090"></a><a class="code" href="classwxLuaDebugItem.html#a604f51ba7ebbf33a52eeaa95fa8b9877">00090</a> wxString m_itemSource;
<a name="l00091"></a><a class="code" href="classwxLuaDebugItem.html#aa47b3efa0690d1a7b5d6f35a930b3071">00091</a> <span class="keywordtype">int</span> m_lua_ref;
<a name="l00092"></a><a class="code" href="classwxLuaDebugItem.html#a38f89d39397ef9c23eaa5c31e8394e1d">00092</a> <span class="keywordtype">int</span> m_index;
<a name="l00093"></a><a class="code" href="classwxLuaDebugItem.html#a9e65bc1c5d16d03a5b35568d78e73db0">00093</a> <span class="keywordtype">int</span> m_flag;
<a name="l00094"></a>00094 };
<a name="l00095"></a>00095
<a name="l00096"></a>00096 <span class="preprocessor">#if defined(WXMAKINGDLL_WXLUADEBUG) || defined(WXUSINGDLL)</span>
<a name="l00097"></a>00097 <span class="preprocessor"></span> WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(<a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a> *, wxLuaDebugItemArray, <a class="code" href="wxluadebugdefs_8h.html#a26bb867eefeede0ae330a79109b67d2b">WXDLLIMPEXP_WXLUADEBUG</a>);
<a name="l00098"></a>00098 <span class="preprocessor">#else</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span> <a class="code" href="wxldebug_8h.html#a2f003f714095d500855615735945ded7">WX_DEFINE_SORTED_ARRAY</a>(<a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a> *, wxLuaDebugItemArray);
<a name="l00100"></a>00100 <span class="preprocessor">#endif</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span>
<a name="l00102"></a>00102 <span class="comment">// ----------------------------------------------------------------------------</span>
<a name="l00103"></a>00103 <span class="comment">// wxLuaDebugData - a wxObject ref counted container for a wxLuaDebugItemArray</span>
<a name="l00104"></a>00104 <span class="comment">// The destructor deletes the array items.</span>
<a name="l00105"></a>00105 <span class="comment">// ----------------------------------------------------------------------------</span>
<a name="l00106"></a>00106
<a name="l00107"></a>00107 <span class="comment">// an invalid wxLuaDebugData for comparison (like wxNullBitmap)</span>
<a name="l00108"></a>00108 <span class="keyword">extern</span> <a class="code" href="wxluadebugdefs_8h.html#ad56a87c879b099c85ccfc7f1676fc705">WXDLLIMPEXP_DATA_WXLUADEBUG</a>(<a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a>) <a class="code" href="wxldebug_8cpp.html#a25502c55f5eb032e2ddeec59f550ccd3">wxNullLuaDebugData</a>;
<a name="l00109"></a>00109
<a name="l00110"></a><a class="code" href="classwxLuaDebugData.html">00110</a> class <a class="code" href="wxluadebugdefs_8h.html#a26bb867eefeede0ae330a79109b67d2b">WXDLLIMPEXP_WXLUADEBUG</a> <a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a> : public wxObject
<a name="l00111"></a>00111 {
<a name="l00112"></a>00112 <span class="keyword">public</span>:
<a name="l00113"></a>00113 <a class="code" href="wxldebug_8h.html#a1fdd8670657fe9588ba3e185a3ecc69a">wxLuaDebugData</a>(<span class="keywordtype">bool</span> create);
<a name="l00114"></a><a class="code" href="classwxLuaDebugData.html#a729da05b8ed0a7c9251c169700f9c73f">00114</a> <a class="code" href="classwxLuaDebugData.html#a729da05b8ed0a7c9251c169700f9c73f">wxLuaDebugData</a>(<span class="keyword">const</span> <a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a> &amp;debugData) { Ref(debugData); }
<a name="l00115"></a>00115
<a name="l00116"></a><a class="code" href="classwxLuaDebugData.html#af0338609f2d37bbd84d607ba59c3b48c">00116</a> <span class="keyword">virtual</span> <a class="code" href="classwxLuaDebugData.html#af0338609f2d37bbd84d607ba59c3b48c">~wxLuaDebugData</a>() {} <span class="comment">// make gcc happy even though it&#39;s not used</span>
<a name="l00117"></a>00117
<a name="l00118"></a>00118 <span class="comment">// Has this been created with its ref data?</span>
<a name="l00119"></a><a class="code" href="classwxLuaDebugData.html#afea7de29d09f7c74b5fc32ae8064f75f">00119</a> <span class="keywordtype">bool</span> <a class="code" href="classwxLuaDebugData.html#afea7de29d09f7c74b5fc32ae8064f75f">Ok</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (m_refData != NULL); }
<a name="l00120"></a>00120
<a name="l00121"></a>00121 <span class="comment">// Get the data array, please use safe array access functions if possible</span>
<a name="l00122"></a>00122 wxLuaDebugItemArray* GetArray();
<a name="l00123"></a>00123 <span class="keyword">const</span> wxLuaDebugItemArray* GetArray() <span class="keyword">const</span>;
<a name="l00124"></a>00124
<a name="l00125"></a>00125 <span class="comment">// wxArray functions mapped to the internal array w/ error checking</span>
<a name="l00126"></a>00126 <span class="comment">// The wxLuaDebugItem items added must be created with &#39;new&#39; and</span>
<a name="l00127"></a>00127 <span class="comment">// will be deleted when this class is destroyed.</span>
<a name="l00128"></a>00128 <span class="keywordtype">size_t</span> GetCount() <span class="keyword">const</span>;
<a name="l00129"></a>00129 <a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a>* Item(<span class="keywordtype">size_t</span> index) <span class="keyword">const</span>;
<a name="l00130"></a>00130 <span class="keywordtype">void</span> Add(<a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a>* item);
<a name="l00131"></a>00131
<a name="l00132"></a>00132 <span class="comment">//-------------------------------------------------------------------------</span>
<a name="l00133"></a>00133
<a name="l00134"></a>00134 <span class="comment">// fill this with the stack entries for the wxLuaState</span>
<a name="l00135"></a>00135 <span class="comment">// returns the number of stack entries added</span>
<a name="l00136"></a>00136 <span class="keywordtype">int</span> EnumerateStack(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>&amp; wxlState);
<a name="l00137"></a>00137 <span class="comment">// fill this with the locals from a particular stack frame, if an item on the stack is a</span>
<a name="l00138"></a>00138 <span class="comment">// table then add a reference to it in the references array</span>
<a name="l00139"></a>00139 <span class="keywordtype">int</span> EnumerateStackEntry(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>&amp; wxlState, <span class="keywordtype">int</span> stack_frame, wxArrayInt&amp; references);
<a name="l00140"></a>00140 <span class="comment">// fill this with the name and value of items in a table at the given reference,</span>
<a name="l00141"></a>00141 <span class="comment">// if the table has a sub table then add a reference to it to the references array</span>
<a name="l00142"></a>00142 <span class="keywordtype">int</span> EnumerateTable(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>&amp; wxlState, <span class="keywordtype">int</span> nRef, <span class="keywordtype">int</span> nEntry, wxArrayInt&amp; references);
<a name="l00143"></a>00143
<a name="l00144"></a>00144 <span class="comment">//-------------------------------------------------------------------------</span>
<a name="l00145"></a>00145 <span class="comment">// These functions are static to allow them to be used in other places to</span>
<a name="l00146"></a>00146 <span class="comment">// give a consistent feel to the display of Lua values.</span>
<a name="l00147"></a>00147
<a name="l00148"></a>00148 <span class="comment">// Get information about the item at the &#39;stack_idx&#39;. Returns the lua_type(L, stack_idx),</span>
<a name="l00149"></a>00149 <span class="comment">// fills &#39;wxl_type&#39; with the WXLUA_TXXX type and &#39;value&#39; with a human readable value.</span>
<a name="l00150"></a>00150 <span class="keyword">static</span> <span class="keywordtype">int</span> GetTypeValue(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>&amp; wxlState, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span>* wxl_type, wxString&amp; value);
<a name="l00151"></a>00151 <span class="comment">// Get a wxString description about the table at the stack_idx in the Lua stack</span>
<a name="l00152"></a>00152 <span class="keyword">static</span> wxString GetTableInfo(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>&amp; wxlState, <span class="keywordtype">int</span> stack_idx);
<a name="l00153"></a>00153 <span class="comment">// Get a wxString description about user data at the stack_idx in the Lua stack</span>
<a name="l00154"></a>00154 <span class="comment">// if full then try to look up the name of the user data from the bindings</span>
<a name="l00155"></a>00155 <span class="keyword">static</span> wxString GetUserDataInfo(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>&amp; wxlState, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">bool</span> full_userdata);
<a name="l00156"></a>00156
<a name="l00157"></a>00157 <span class="comment">//-------------------------------------------------------------------------</span>
<a name="l00158"></a>00158
<a name="l00159"></a>00159 <span class="comment">// Make a full copy of the array and return it.</span>
<a name="l00160"></a>00160 <a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a> Copy() <span class="keyword">const</span>;
<a name="l00161"></a>00161
<a name="l00162"></a>00162 <span class="comment">// Ref this table if it hasn&#39;t been refed already, returns ref # or LUA_NOREF if not refed</span>
<a name="l00163"></a>00163 <span class="keywordtype">int</span> RefTable(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span>* flag_type, <span class="keywordtype">int</span> extra_flag, wxArrayInt&amp; references);
<a name="l00164"></a>00164
<a name="l00165"></a>00165 <span class="comment">// Sorting function for the wxLuaDebugItemArray, sorts by name</span>
<a name="l00166"></a>00166 <span class="keyword">static</span> <span class="keywordtype">int</span> SortFunction(<a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a> *elem1, <a class="code" href="classwxLuaDebugItem.html">wxLuaDebugItem</a> *elem2 );
<a name="l00167"></a>00167
<a name="l00168"></a>00168 <span class="comment">// operators</span>
<a name="l00169"></a><a class="code" href="classwxLuaDebugData.html#a4245fc1481367b5a63eae25208fecf43">00169</a> <span class="keywordtype">bool</span> operator == (<span class="keyword">const</span> <a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a>&amp; debugData)<span class="keyword"> const</span>
<a name="l00170"></a>00170 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_refData == debugData.m_refData; }
<a name="l00171"></a><a class="code" href="classwxLuaDebugData.html#a9f7f2221da0cb2fd98dd25a3d47485a3">00171</a> <span class="keywordtype">bool</span> operator != (<span class="keyword">const</span> <a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a>&amp; debugData)<span class="keyword"> const</span>
<a name="l00172"></a>00172 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_refData != debugData.m_refData; }
<a name="l00173"></a>00173
<a name="l00174"></a><a class="code" href="classwxLuaDebugData.html#a293016d7c6ccc038e03b01648ad834b6">00174</a> <a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a>&amp; operator = (<span class="keyword">const</span> <a class="code" href="classwxLuaDebugData.html">wxLuaDebugData</a>&amp; debugData)
<a name="l00175"></a>00175 {
<a name="l00176"></a>00176 <span class="keywordflow">if</span> ( (*<span class="keyword">this</span>) != debugData )
<a name="l00177"></a>00177 Ref(debugData);
<a name="l00178"></a>00178 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00179"></a>00179 }
<a name="l00180"></a>00180 };
<a name="l00181"></a>00181
<a name="l00182"></a>00182 <span class="comment">// ----------------------------------------------------------------------------</span>
<a name="l00183"></a>00183 <span class="comment">// wxLuaCheckStack - Dump the contents of the lua_State for debugging</span>
<a name="l00184"></a>00184 <span class="comment">// ----------------------------------------------------------------------------</span>
<a name="l00185"></a>00185
<a name="l00186"></a><a class="code" href="classwxLuaCheckStack.html">00186</a> <span class="keyword">class </span><a class="code" href="wxluadebugdefs_8h.html#a26bb867eefeede0ae330a79109b67d2b">WXDLLIMPEXP_WXLUADEBUG</a> <a class="code" href="classwxLuaCheckStack.html">wxLuaCheckStack</a>
<a name="l00187"></a>00187 {
<a name="l00188"></a>00188 <span class="keyword">public</span>:
<a name="l00189"></a>00189 <span class="comment">// Create a instance, remembers lua_gettop(), &#39;msg&#39; can be used to add</span>
<a name="l00190"></a>00190 <span class="comment">// information about where or why this was created.</span>
<a name="l00191"></a>00191 <span class="comment">// If &#39;print_to_console&#39; then all functions below that return a string will also</span>
<a name="l00192"></a>00192 <span class="comment">// print to the console as well.</span>
<a name="l00193"></a>00193 <a class="code" href="classwxLuaCheckStack.html">wxLuaCheckStack</a>(lua_State* L, <span class="keyword">const</span> wxString &amp;msg = wxEmptyString, <span class="keywordtype">bool</span> print_to_console = <span class="keyword">true</span>);
<a name="l00194"></a>00194 <span class="comment">// Prints out the starting top and ending top if &#39;print_to_console&#39; in constructor</span>
<a name="l00195"></a>00195 ~<a class="code" href="classwxLuaCheckStack.html">wxLuaCheckStack</a>();
<a name="l00196"></a>00196
<a name="l00197"></a>00197 <span class="comment">// Returns a string comparing the starting and current lua_gettop() with additional msg</span>
<a name="l00198"></a>00198 wxString TestStack(<span class="keyword">const</span> wxString &amp;msg = wxEmptyString);
<a name="l00199"></a>00199
<a name="l00200"></a>00200 <span class="comment">// Returns a string of the current items on the stack with their types.</span>
<a name="l00201"></a>00201 wxString DumpStack(<span class="keyword">const</span> wxString&amp; msg = wxEmptyString);
<a name="l00202"></a>00202
<a name="l00203"></a>00203 <span class="comment">// Returns a string of all of the global variables and subtables with additional msg.</span>
<a name="l00204"></a>00204 wxString DumpGlobals(<span class="keyword">const</span> wxString&amp; msg = wxEmptyString);
<a name="l00205"></a>00205 <span class="comment">// Dump the table and its subtables from the globals index with additional msg.</span>
<a name="l00206"></a>00206 <span class="comment">// The name may be of the form &quot;table1.subtable2.subtable3...&quot;</span>
<a name="l00207"></a>00207 wxString DumpTable(<span class="keyword">const</span> wxString&amp; tableName, <span class="keyword">const</span> wxString&amp; msg = wxEmptyString);
<a name="l00208"></a>00208 <span class="comment">// Dump the table and its subtables at the stack_idx with additional msg.</span>
<a name="l00209"></a>00209 wxString DumpTable(<span class="keywordtype">int</span> stack_idx, <span class="keyword">const</span> wxString&amp; msg = wxEmptyString);
<a name="l00210"></a>00210
<a name="l00211"></a>00211 <span class="comment">// Dump the contents of the table at the stack_idx to a string. &#39;tablename&#39; and &#39;msg&#39; are</span>
<a name="l00212"></a>00212 <span class="comment">// for informational messages, &#39;tableArray&#39; is used to avoid recursion and should be empty</span>
<a name="l00213"></a>00213 <span class="comment">// for the initial call, and &#39;indent&#39; is used to track indentation level for each subtable.</span>
<a name="l00214"></a>00214 wxString DumpTable(<span class="keywordtype">int</span> stack_idx, <span class="keyword">const</span> wxString&amp; tablename, <span class="keyword">const</span> wxString&amp; msg, wxSortedArrayString&amp; tableArray, <span class="keywordtype">int</span> indent);
<a name="l00215"></a>00215
<a name="l00216"></a>00216 <span class="comment">// Print a message to the console if &#39;print_to_console&#39; in constructor.</span>
<a name="l00217"></a>00217 <span class="keywordtype">void</span> OutputMsg(<span class="keyword">const</span> wxString&amp; msg) <span class="keyword">const</span>;
<a name="l00218"></a>00218
<a name="l00219"></a>00219 <span class="comment">// implementation</span>
<a name="l00220"></a>00220
<a name="l00221"></a><a class="code" href="classwxLuaCheckStack.html#ab7664101ceb417bc348be64ff4e0f36e">00221</a> lua_State* m_luaState;
<a name="l00222"></a><a class="code" href="classwxLuaCheckStack.html#a4df6d7bc293ab54ce349805f5fc6eff2">00222</a> wxString m_msg;
<a name="l00223"></a><a class="code" href="classwxLuaCheckStack.html#aba4ac87e55ef4d0897506e190ac1f445">00223</a> <span class="keywordtype">int</span> m_top;
<a name="l00224"></a><a class="code" href="classwxLuaCheckStack.html#a45ca29a49e79a1b1e4422fa301c61709">00224</a> <span class="keywordtype">bool</span> m_print_to_console;
<a name="l00225"></a>00225 };
<a name="l00226"></a>00226
<a name="l00227"></a>00227 <span class="preprocessor">#endif // WX_LUA_DEBUG_H</span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Tue Jul 13 10:30:39 2010 for wxLua by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>