Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > 67e32647b06c0323bf90c6b54a6438d1 > files > 359

rpm-apidocs-4.4.2.3-34.el5.x86_64.rpm

<!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>rpm: lua/lfunc.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</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>Globals</span></a></li>
  </ul></div>
<h1>lua/lfunc.c</h1><a href="lfunc_8c.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">** $Id: lfunc.c,v 1.1 2004/03/16 21:58:30 niemeyer Exp $</span>
<a name="l00003"></a>00003 <span class="comment">** Auxiliary functions to manipulate prototypes and closures</span>
<a name="l00004"></a>00004 <span class="comment">** See Copyright Notice in lua.h</span>
<a name="l00005"></a>00005 <span class="comment">*/</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00009"></a>00009 
<a name="l00010"></a><a class="code" href="lfunc_8c.html#8ee1ddf17394c8befb4092208004036c">00010</a> <span class="preprocessor">#define lfunc_c</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="preprocessor">#include "lua.h"</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include "<a class="code" href="lfunc_8h.html">lfunc.h</a>"</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include "<a class="code" href="lgc_8h.html">lgc.h</a>"</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include "<a class="code" href="lmem_8h.html">lmem.h</a>"</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include "<a class="code" href="lobject_8h.html">lobject.h</a>"</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="lstate_8h.html">lstate.h</a>"</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 
<a name="l00021"></a><a class="code" href="lfunc_8c.html#e0283669f47da8432046d0a24c1db93e">00021</a> <span class="preprocessor">#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \</span>
<a name="l00022"></a>00022 <span class="preprocessor">                         cast(int, sizeof(TObject)*((n)-1)))</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a><a class="code" href="lfunc_8c.html#b5551e284145e5258a8032a97806cfe1">00024</a> <span class="preprocessor">#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \</span>
<a name="l00025"></a>00025 <span class="preprocessor">                         cast(int, sizeof(TObject *)*((n)-1)))</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 
<a name="l00029"></a><a class="code" href="lfunc_8h.html#2e07a74d62105e16e2fc09a846148a46">00029</a> <a class="code" href="unionClosure.html">Closure</a> *<a class="code" href="lfunc_8c.html#2e07a74d62105e16e2fc09a846148a46">luaF_newCclosure</a> (<a class="code" href="structlua__State.html">lua_State</a> *L, <span class="keywordtype">int</span> nelems) {
<a name="l00030"></a>00030   <a class="code" href="unionClosure.html">Closure</a> *c = <a class="code" href="llimits_8h.html#f17d62ec9e237a7644de6b9b34a48a34">cast</a>(<a class="code" href="unionClosure.html">Closure</a> *, <a class="code" href="lmem_8h.html#352102a0627666bfc7f22209c1a7027d">luaM_malloc</a>(L, <a class="code" href="lfunc_8c.html#e0283669f47da8432046d0a24c1db93e">sizeCclosure</a>(nelems)));
<a name="l00031"></a>00031   <a class="code" href="lgc_8c.html#8ceb43f94e1513c18f99e7d2ee6f944e">luaC_link</a>(L, <a class="code" href="lstate_8h.html#b45b06e8618aa4a7bf53171933f30d57">valtogco</a>(c), LUA_TFUNCTION);
<a name="l00032"></a>00032   c-&gt;<a class="code" href="unionClosure.html#ce9dac5a62b61db682ef0cd86b3b44b1">c</a>.<a class="code" href="structCClosure.html#26248a7c18155d17793bf4a35d6d52a0">isC</a> = 1;
<a name="l00033"></a>00033   c-&gt;<a class="code" href="unionClosure.html#ce9dac5a62b61db682ef0cd86b3b44b1">c</a>.<a class="code" href="structCClosure.html#8c910f71349190d0661a422d41b95e82">nupvalues</a> = <a class="code" href="llimits_8h.html#f17d62ec9e237a7644de6b9b34a48a34">cast</a>(<a class="code" href="llimits_8h.html#e1fe9ac10d9803bd1d7bdf30b18bad68">lu_byte</a>, nelems);
<a name="l00034"></a>00034   <span class="keywordflow">return</span> c;
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 
<a name="l00038"></a><a class="code" href="lfunc_8h.html#9af60c298fd42bc8bbea474ee5aa89ce">00038</a> <a class="code" href="unionClosure.html">Closure</a> *<a class="code" href="lfunc_8c.html#9af60c298fd42bc8bbea474ee5aa89ce">luaF_newLclosure</a> (<a class="code" href="structlua__State.html">lua_State</a> *L, <span class="keywordtype">int</span> nelems, <a class="code" href="structlua__TObject.html">TObject</a> *e) {
<a name="l00039"></a>00039   <a class="code" href="unionClosure.html">Closure</a> *c = <a class="code" href="llimits_8h.html#f17d62ec9e237a7644de6b9b34a48a34">cast</a>(<a class="code" href="unionClosure.html">Closure</a> *, <a class="code" href="lmem_8h.html#352102a0627666bfc7f22209c1a7027d">luaM_malloc</a>(L, <a class="code" href="lfunc_8c.html#b5551e284145e5258a8032a97806cfe1">sizeLclosure</a>(nelems)));
<a name="l00040"></a>00040   <a class="code" href="lgc_8c.html#8ceb43f94e1513c18f99e7d2ee6f944e">luaC_link</a>(L, <a class="code" href="lstate_8h.html#b45b06e8618aa4a7bf53171933f30d57">valtogco</a>(c), LUA_TFUNCTION);
<a name="l00041"></a>00041   c-&gt;<a class="code" href="unionClosure.html#8c338ec7dc76078cbee5887857de713c">l</a>.<a class="code" href="structLClosure.html#3e44f9f064e1e6ed596e893682e3ce51">isC</a> = 0;
<a name="l00042"></a>00042   c-&gt;<a class="code" href="unionClosure.html#8c338ec7dc76078cbee5887857de713c">l</a>.<a class="code" href="structLClosure.html#64f4853f6bad93920ccb1158c0da87e7">g</a> = *e;
<a name="l00043"></a>00043   c-&gt;<a class="code" href="unionClosure.html#8c338ec7dc76078cbee5887857de713c">l</a>.<a class="code" href="structLClosure.html#05732375a30757a8faa6c889e1823696">nupvalues</a> = <a class="code" href="llimits_8h.html#f17d62ec9e237a7644de6b9b34a48a34">cast</a>(<a class="code" href="llimits_8h.html#e1fe9ac10d9803bd1d7bdf30b18bad68">lu_byte</a>, nelems);
<a name="l00044"></a>00044   <span class="keywordflow">return</span> c;
<a name="l00045"></a>00045 }
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 
<a name="l00048"></a><a class="code" href="lfunc_8h.html#20f971bc630264489ebc4deea02be13a">00048</a> <a class="code" href="structUpVal.html">UpVal</a> *<a class="code" href="lfunc_8c.html#20f971bc630264489ebc4deea02be13a">luaF_findupval</a> (<a class="code" href="structlua__State.html">lua_State</a> *L, <a class="code" href="structlua__TObject.html">StkId</a> level) {
<a name="l00049"></a>00049   <a class="code" href="unionGCObject.html">GCObject</a> **pp = &amp;L-&gt;<a class="code" href="structlua__State.html#9055a00dd8a0fd55fd2df6554b8a2d58">openupval</a>;
<a name="l00050"></a>00050   <a class="code" href="structUpVal.html">UpVal</a> *p;
<a name="l00051"></a>00051   <a class="code" href="structUpVal.html">UpVal</a> *v;
<a name="l00052"></a>00052   <span class="keywordflow">while</span> ((p = <a class="code" href="lstate_8h.html#290c99068a6004c9553cb9dab9026a68">ngcotouv</a>(*pp)) != NULL &amp;&amp; p-&gt;<a class="code" href="structUpVal.html#c8b2cd011ef64f1929cbafdd5bf96adc">v</a> &gt;= level) {
<a name="l00053"></a>00053     <span class="keywordflow">if</span> (p-&gt;<a class="code" href="structUpVal.html#c8b2cd011ef64f1929cbafdd5bf96adc">v</a> == level) <span class="keywordflow">return</span> p;
<a name="l00054"></a>00054     pp = &amp;p-&gt;<a class="code" href="structUpVal.html#076624ae22f6618dccc8588be4016d85">next</a>;
<a name="l00055"></a>00055   }
<a name="l00056"></a>00056   v = <a class="code" href="lmem_8h.html#e72bd363be924fa9a67be67de0802ad7">luaM_new</a>(L, <a class="code" href="structUpVal.html">UpVal</a>);  <span class="comment">/* not found: create a new one */</span>
<a name="l00057"></a>00057   v-&gt;<a class="code" href="structUpVal.html#c5644323dcf034541299ba28c9489d84">tt</a> = <a class="code" href="lobject_8h.html#3175b6b959953f781a14a9291d9e22b6">LUA_TUPVAL</a>;
<a name="l00058"></a>00058   v-&gt;<a class="code" href="structUpVal.html#7ad97d7f92e2f5053d532f11dd85e229">marked</a> = 1;  <span class="comment">/* open upvalues should not be collected */</span>
<a name="l00059"></a>00059   v-&gt;<a class="code" href="structUpVal.html#c8b2cd011ef64f1929cbafdd5bf96adc">v</a> = level;  <span class="comment">/* current value lives in the stack */</span>
<a name="l00060"></a>00060   v-&gt;<a class="code" href="structUpVal.html#076624ae22f6618dccc8588be4016d85">next</a> = *pp;  <span class="comment">/* chain it in the proper position */</span>
<a name="l00061"></a>00061   *pp = <a class="code" href="lstate_8h.html#b45b06e8618aa4a7bf53171933f30d57">valtogco</a>(v);
<a name="l00062"></a>00062   <span class="keywordflow">return</span> v;
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 
<a name="l00066"></a><a class="code" href="lfunc_8h.html#b50c76a12250379a898290f481de4ab6">00066</a> <span class="keywordtype">void</span> <a class="code" href="lfunc_8c.html#b50c76a12250379a898290f481de4ab6">luaF_close</a> (<a class="code" href="structlua__State.html">lua_State</a> *L, <a class="code" href="structlua__TObject.html">StkId</a> level) {
<a name="l00067"></a>00067   <a class="code" href="structUpVal.html">UpVal</a> *p;
<a name="l00068"></a>00068   <span class="keywordflow">while</span> ((p = <a class="code" href="lstate_8h.html#290c99068a6004c9553cb9dab9026a68">ngcotouv</a>(L-&gt;<a class="code" href="structlua__State.html#9055a00dd8a0fd55fd2df6554b8a2d58">openupval</a>)) != NULL &amp;&amp; p-&gt;<a class="code" href="structUpVal.html#c8b2cd011ef64f1929cbafdd5bf96adc">v</a> &gt;= level) {
<a name="l00069"></a>00069     <a class="code" href="lobject_8h.html#3c26115de0803ac1a3f51221bb9486e3">setobj</a>(&amp;p-&gt;<a class="code" href="structUpVal.html#d1cb3905dee06e42bef08fbb4b516d48">value</a>, p-&gt;<a class="code" href="structUpVal.html#c8b2cd011ef64f1929cbafdd5bf96adc">v</a>);  <span class="comment">/* save current value (write barrier) */</span>
<a name="l00070"></a>00070     p-&gt;<a class="code" href="structUpVal.html#c8b2cd011ef64f1929cbafdd5bf96adc">v</a> = &amp;p-&gt;<a class="code" href="structUpVal.html#d1cb3905dee06e42bef08fbb4b516d48">value</a>;  <span class="comment">/* now current value lives here */</span>
<a name="l00071"></a>00071     L-&gt;<a class="code" href="structlua__State.html#9055a00dd8a0fd55fd2df6554b8a2d58">openupval</a> = p-&gt;<a class="code" href="structUpVal.html#076624ae22f6618dccc8588be4016d85">next</a>;  <span class="comment">/* remove from `open' list */</span>
<a name="l00072"></a>00072     <a class="code" href="lgc_8c.html#8ceb43f94e1513c18f99e7d2ee6f944e">luaC_link</a>(L, <a class="code" href="lstate_8h.html#b45b06e8618aa4a7bf53171933f30d57">valtogco</a>(p), <a class="code" href="lobject_8h.html#3175b6b959953f781a14a9291d9e22b6">LUA_TUPVAL</a>);
<a name="l00073"></a>00073   }
<a name="l00074"></a>00074 }
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 
<a name="l00077"></a><a class="code" href="lfunc_8h.html#4ffd9d8ef515a7f785d007de7ceb9e4f">00077</a> <a class="code" href="structProto.html">Proto</a> *<a class="code" href="lfunc_8c.html#4ffd9d8ef515a7f785d007de7ceb9e4f">luaF_newproto</a> (<a class="code" href="structlua__State.html">lua_State</a> *L) {
<a name="l00078"></a>00078   <a class="code" href="structProto.html">Proto</a> *f = <a class="code" href="lmem_8h.html#e72bd363be924fa9a67be67de0802ad7">luaM_new</a>(L, <a class="code" href="structProto.html">Proto</a>);
<a name="l00079"></a>00079   <a class="code" href="lgc_8c.html#8ceb43f94e1513c18f99e7d2ee6f944e">luaC_link</a>(L, <a class="code" href="lstate_8h.html#b45b06e8618aa4a7bf53171933f30d57">valtogco</a>(f), <a class="code" href="lobject_8h.html#a2a683d9e42dac5846eefa108297cbf0">LUA_TPROTO</a>);
<a name="l00080"></a>00080   f-&gt;<a class="code" href="structProto.html#f379e777efa031186320f7e90c14f8c9">k</a> = NULL;
<a name="l00081"></a>00081   f-&gt;<a class="code" href="structProto.html#5bd719e0486168f6ecd4b01bf41a7444">sizek</a> = 0;
<a name="l00082"></a>00082   f-&gt;<a class="code" href="structProto.html#54dc8e2e8973007794fa0ab0e4a71461">p</a> = NULL;
<a name="l00083"></a>00083   f-&gt;<a class="code" href="structProto.html#73ddad1a18b7c46be46ec32aa2a08632">sizep</a> = 0;
<a name="l00084"></a>00084   f-&gt;<a class="code" href="structProto.html#53b66e4e4ac4b612a41b67a0ace9b6a5">code</a> = NULL;
<a name="l00085"></a>00085   f-&gt;<a class="code" href="structProto.html#43e4d3849b5859112d93bdc2534a7cc0">sizecode</a> = 0;
<a name="l00086"></a>00086   f-&gt;<a class="code" href="structProto.html#65303ae1d815313f3358a578113fcc6e">sizelineinfo</a> = 0;
<a name="l00087"></a>00087   f-&gt;<a class="code" href="structProto.html#6ecec897497ba7d94df6ef69289ef5c0">sizeupvalues</a> = 0;
<a name="l00088"></a>00088   f-&gt;<a class="code" href="structProto.html#e20e9996154a89085ac03eaaf8f23d32">nups</a> = 0;
<a name="l00089"></a>00089   f-&gt;<a class="code" href="structProto.html#bebc63aea579a1b630efc04d2bf9c4b7">upvalues</a> = NULL;
<a name="l00090"></a>00090   f-&gt;<a class="code" href="structProto.html#3f106f177af6c68ffd8b042713266b98">numparams</a> = 0;
<a name="l00091"></a>00091   f-&gt;<a class="code" href="structProto.html#82302f2e9040b681d5b34c1239dcd673">is_vararg</a> = 0;
<a name="l00092"></a>00092   f-&gt;<a class="code" href="structProto.html#9c9ed4e9d996233f75cdf56b912e4803">maxstacksize</a> = 0;
<a name="l00093"></a>00093   f-&gt;<a class="code" href="structProto.html#7b35e79a276933f7e71edceec5b4593d">lineinfo</a> = NULL;
<a name="l00094"></a>00094   f-&gt;<a class="code" href="structProto.html#c2ab37e941e8866687f44f7b2f4b95a9">sizelocvars</a> = 0;
<a name="l00095"></a>00095   f-&gt;<a class="code" href="structProto.html#24fd00345a3dad92baf371a9c96ba140">locvars</a> = NULL;
<a name="l00096"></a>00096   f-&gt;<a class="code" href="structProto.html#03213e8977769a6c465e3f47028f0de0">lineDefined</a> = 0;
<a name="l00097"></a>00097   f-&gt;<a class="code" href="structProto.html#92b6ec319e7aa1ee8b8ff7807353ad96">source</a> = NULL;
<a name="l00098"></a>00098   <span class="keywordflow">return</span> f;
<a name="l00099"></a>00099 }
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 
<a name="l00102"></a><a class="code" href="lfunc_8h.html#117c26fb473f6165ee84d70d49a741b7">00102</a> <span class="keywordtype">void</span> <a class="code" href="lfunc_8c.html#117c26fb473f6165ee84d70d49a741b7">luaF_freeproto</a> (<a class="code" href="structlua__State.html">lua_State</a> *L, <a class="code" href="structProto.html">Proto</a> *f) {
<a name="l00103"></a>00103   <a class="code" href="lmem_8h.html#0e7e8302eb92be56c1043f086deed39a">luaM_freearray</a>(L, f-&gt;<a class="code" href="structProto.html#53b66e4e4ac4b612a41b67a0ace9b6a5">code</a>, f-&gt;<a class="code" href="structProto.html#43e4d3849b5859112d93bdc2534a7cc0">sizecode</a>, <a class="code" href="llimits_8h.html#f6c47c68c1e6b0387c915031e0e681e3">Instruction</a>);
<a name="l00104"></a>00104   <a class="code" href="lmem_8h.html#0e7e8302eb92be56c1043f086deed39a">luaM_freearray</a>(L, f-&gt;<a class="code" href="structProto.html#54dc8e2e8973007794fa0ab0e4a71461">p</a>, f-&gt;<a class="code" href="structProto.html#73ddad1a18b7c46be46ec32aa2a08632">sizep</a>, <a class="code" href="structProto.html">Proto</a> *);
<a name="l00105"></a>00105   <a class="code" href="lmem_8h.html#0e7e8302eb92be56c1043f086deed39a">luaM_freearray</a>(L, f-&gt;<a class="code" href="structProto.html#f379e777efa031186320f7e90c14f8c9">k</a>, f-&gt;<a class="code" href="structProto.html#5bd719e0486168f6ecd4b01bf41a7444">sizek</a>, <a class="code" href="structlua__TObject.html">TObject</a>);
<a name="l00106"></a>00106   <a class="code" href="lmem_8h.html#0e7e8302eb92be56c1043f086deed39a">luaM_freearray</a>(L, f-&gt;<a class="code" href="structProto.html#7b35e79a276933f7e71edceec5b4593d">lineinfo</a>, f-&gt;<a class="code" href="structProto.html#65303ae1d815313f3358a578113fcc6e">sizelineinfo</a>, <span class="keywordtype">int</span>);
<a name="l00107"></a>00107   <a class="code" href="lmem_8h.html#0e7e8302eb92be56c1043f086deed39a">luaM_freearray</a>(L, f-&gt;<a class="code" href="structProto.html#24fd00345a3dad92baf371a9c96ba140">locvars</a>, f-&gt;<a class="code" href="structProto.html#c2ab37e941e8866687f44f7b2f4b95a9">sizelocvars</a>, <span class="keyword">struct</span> <a class="code" href="structLocVar.html">LocVar</a>);
<a name="l00108"></a>00108   <a class="code" href="lmem_8h.html#0e7e8302eb92be56c1043f086deed39a">luaM_freearray</a>(L, f-&gt;<a class="code" href="structProto.html#bebc63aea579a1b630efc04d2bf9c4b7">upvalues</a>, f-&gt;<a class="code" href="structProto.html#6ecec897497ba7d94df6ef69289ef5c0">sizeupvalues</a>, <a class="code" href="unionTString.html">TString</a> *);
<a name="l00109"></a>00109   <a class="code" href="lmem_8h.html#950211b6f3cdd2a18ea3e2ad59412897">luaM_freelem</a>(L, f);
<a name="l00110"></a>00110 }
<a name="l00111"></a>00111 
<a name="l00112"></a>00112 
<a name="l00113"></a><a class="code" href="lfunc_8h.html#63b9905e2b6f52f6368a8f8019605c99">00113</a> <span class="keywordtype">void</span> <a class="code" href="lfunc_8c.html#63b9905e2b6f52f6368a8f8019605c99">luaF_freeclosure</a> (<a class="code" href="structlua__State.html">lua_State</a> *L, <a class="code" href="unionClosure.html">Closure</a> *c) {
<a name="l00114"></a>00114   <span class="keywordtype">int</span> size = (c-&gt;<a class="code" href="unionClosure.html#ce9dac5a62b61db682ef0cd86b3b44b1">c</a>.<a class="code" href="structCClosure.html#26248a7c18155d17793bf4a35d6d52a0">isC</a>) ? <a class="code" href="lfunc_8c.html#e0283669f47da8432046d0a24c1db93e">sizeCclosure</a>(c-&gt;<a class="code" href="unionClosure.html#ce9dac5a62b61db682ef0cd86b3b44b1">c</a>.<a class="code" href="structCClosure.html#8c910f71349190d0661a422d41b95e82">nupvalues</a>) :
<a name="l00115"></a>00115                           <a class="code" href="lfunc_8c.html#b5551e284145e5258a8032a97806cfe1">sizeLclosure</a>(c-&gt;<a class="code" href="unionClosure.html#8c338ec7dc76078cbee5887857de713c">l</a>.<a class="code" href="structLClosure.html#05732375a30757a8faa6c889e1823696">nupvalues</a>);
<a name="l00116"></a>00116   <a class="code" href="lmem_8h.html#45b2229e655e385fd650f882298b2c42">luaM_free</a>(L, c, size);
<a name="l00117"></a>00117 }
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 
<a name="l00120"></a>00120 <span class="comment">/*</span>
<a name="l00121"></a>00121 <span class="comment">** Look for n-th local variable at line `line' in function `func'.</span>
<a name="l00122"></a>00122 <span class="comment">** Returns NULL if not found.</span>
<a name="l00123"></a>00123 <span class="comment">*/</span>
<a name="l00124"></a><a class="code" href="lfunc_8h.html#e9ef9d673c542695dbbb649ec5742d3f">00124</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="lfunc_8c.html#aa3cd5bc3901e7edf1ac428151cdfe8c">luaF_getlocalname</a> (<span class="keyword">const</span> <a class="code" href="structProto.html">Proto</a> *f, <span class="keywordtype">int</span> local_number, <span class="keywordtype">int</span> pc) {
<a name="l00125"></a>00125   <span class="keywordtype">int</span> i;
<a name="l00126"></a>00126   <span class="keywordflow">for</span> (i = 0; i&lt;f-&gt;<a class="code" href="structProto.html#c2ab37e941e8866687f44f7b2f4b95a9">sizelocvars</a> &amp;&amp; f-&gt;<a class="code" href="structProto.html#24fd00345a3dad92baf371a9c96ba140">locvars</a>[i].<a class="code" href="structLocVar.html#c5a8bf5a59430eea070db5b1a97d8b88">startpc</a> &lt;= pc; i++) {
<a name="l00127"></a>00127     <span class="keywordflow">if</span> (pc &lt; f-&gt;locvars[i].endpc) {  <span class="comment">/* is variable active? */</span>
<a name="l00128"></a>00128       local_number--;
<a name="l00129"></a>00129       <span class="keywordflow">if</span> (local_number == 0)
<a name="l00130"></a>00130         <span class="keywordflow">return</span> <a class="code" href="lobject_8h.html#cb05d3ab238923581a9c629b8e11a6ac">getstr</a>(f-&gt;<a class="code" href="structProto.html#24fd00345a3dad92baf371a9c96ba140">locvars</a>[i].<a class="code" href="structLocVar.html#cf62684d78349320b90b4acfa3b6d22a">varname</a>);
<a name="l00131"></a>00131     }
<a name="l00132"></a>00132   }
<a name="l00133"></a>00133   <span class="keywordflow">return</span> NULL;  <span class="comment">/* not found */</span>
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135 
</pre></div><hr size="1"><address style="align: right;"><small>Generated on 1 Oct 2013 for rpm by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>