Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 4fccfe23f6486142b4197d1daac0cf21 > files > 70

Falcon-doc-0.9.6.6-2.fc15.noarch.rpm

<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>Function set "Variable parameters support" - Function set "Variable parameters support"</title>
   <link href="faldoc.css" rel="stylesheet" type="text/css"/>
   <link href="tabs.css" rel="stylesheet" type="text/css"/>
</head>
<body class="faldoc_body">
<div class="navitop">
   <div class="tabs">
      <ul>
         <li><a href="./index.html"><span>Main</span></a></li>
         <li><a href="./pages.html"><span>Related pages</span></a></li>
         <li><a href="./groups.html"><span>Groups</span></a></li>
         <li><a href="./funset.html"><span>Function sets</span></a></li>
         <li><a href="./classes.html"><span>Classes</span></a></li>
         <li><a href="./objects.html"><span>Objects</span></a></li>
         <li><a href="./functions.html"><span>All functions</span></a></li>
         <li><a href="./globals.html"><span>Globals</span></a></li>
         
      </ul>
   </div>
</div>
<hr/>

<h1 class="faldoc_title">Function set "Variable parameters support"</h1>

<p class="faldoc_brief">Functions giving informations on variable parameters. </p>



   <p class="faldoc_brief"><a href="#more">more...</a></p>
   <h2 class="faldoc_title">Summary</h2>
   <table class="faldoc_list">
   
      
         <tr><td><a href="#argd">argd()</a></td><td>Returns a dictionary containing all the parameters passed to the current function. </td></tr>
      
         <tr><td><a href="#argv">argv()</a></td><td>Returns all the parameters of the current function as a vector. </td></tr>
      
         <tr><td><a href="#paramCount">paramCount()</a></td><td>Returns number of parameter that have been passed to the current function or method. </td></tr>
      
         <tr><td><a href="#paramIsRef">paramIsRef()</a></td><td>Checks whether the nth parameter has been passed by reference or not. </td></tr>
      
         <tr><td><a href="#paramSet">paramSet()</a></td><td>Changes the nth paramter if it has been passed by reference. </td></tr>
      
         <tr><td><a href="#parameter">parameter()</a></td><td>Gets the Nth parameter </td></tr>
      
         <tr><td><a href="#passvp">passvp()</a></td><td>Returns all the undeclared parameters, or passes them to a callable item </td></tr>
      
   
   </table>







<a name="more"><h2 class="faldoc_title">Detailed description</h2></a>


<table class="faldoc_function">


</table>
<br/>
<p class="item_brief">Functions giving informations on variable parameters. </p>
<p class="faldoc_text">Falcon supports variable parameter calling; a function or method may access the items that have been used in the parameter call by counting them and accessing them one by one. </p>
<p class="faldoc_text">Parameter passed by reference may be modified with the appropriate function. </p>
<p class="faldoc_text">This functions may be used whether the calling function provides a list of formal parameters or not. The first formal parameter will be treated as the variable parameter number zero, and the parameter count may be the same as, more than or less than the number of formal parameters. So, part of the parameters may be accessible via parameter names, and the others may be accessed with the functions in this group. </p>




   <h2 class="faldoc_title">Members</h2>
   
      <h3 class="faldoc_funcname"><a name="argd">argd()</a></h3>
      <p class="item_brief">Returns a dictionary containing all the parameters passed to the current function. </p>
      <p class="faldoc_funcdecl">argd</p>
      
      <p class="faldoc_text"><p class="faldoc_text">The dictionary contains the parameter names associated with the value passed by the caller. Parameters received beyond the officially declared ones aren't returned in this dictionary. </p>
<p class="faldoc_text">If the function doesn't declare any parameter, returns nil. </p>
</p>
   
      <h3 class="faldoc_funcname"><a name="argv">argv()</a></h3>
      <p class="item_brief">Returns all the parameters of the current function as a vector. </p>
      <p class="faldoc_funcdecl">argv</p>
      
      <p class="faldoc_text"><p class="faldoc_text">If the current function doesn't receive any parameter, it returns nil.   </p>
</p>
   
      <h3 class="faldoc_funcname"><a name="paramCount">paramCount()</a></h3>
      <p class="item_brief">Returns number of parameter that have been passed to the current function or method. </p>
      <p class="faldoc_funcdecl">paramCount</p>
      
         <table class="faldoc_function">
         
         
         <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc">The parameter count. </td></tr>
         
         </table>
      
      <p class="faldoc_text"><p class="faldoc_text">The return value is the minimum value between the formal parameters declared for the current function and the number of actual parameters the caller passed. Formal parameters which are declared in the function header, but for which the caller didn't provide actual parameters, are filled with nil. </p>
</p>
   
      <h3 class="faldoc_funcname"><a name="paramIsRef">paramIsRef()</a></h3>
      <p class="item_brief">Checks whether the nth parameter has been passed by reference or not. </p>
      <p class="faldoc_funcdecl">paramIsRef( number )</p>
      
         <table class="faldoc_function">
         <tr><td class="faldoc_param">number</td><td class="faldoc_paramdesc">The paramter that must be checked (zero based) </td></tr>
         
         <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc">true if the parameter has been passed by reference, false otherwise. </td></tr>
         
            <tr><td class="faldoc_raise">Raises:</td><td class="faldoc_raisedesc">
            <table class="faldoc_raise">
            <tr><td class="faldoc_raiseitem"><a href="./class_AccessError.html">AccessError</a></td><td class="faldoc_raisedesc"> if <b>number</b> is out of range. </td></tr>
            </table>
            </td></tr>
         
         </table>
      
      <p class="faldoc_text"><p class="faldoc_text">Both assigning a value to a certain parameter and using the paramSet() function will change locally the value of the parameter, but this value won't be reflected in the actual parameter that was used to call the function, unless the parameter was explicitly passed by reference. In some contexts, it may be useful to know if this is the case. </p>
<p class="faldoc_text">If the given parameter number cannot be accessed, a AccessError is raised. </p>
</p>
   
      <h3 class="faldoc_funcname"><a name="paramSet">paramSet()</a></h3>
      <p class="item_brief">Changes the nth paramter if it has been passed by reference. </p>
      <p class="faldoc_funcdecl">paramSet( number, value )</p>
      
         <table class="faldoc_function">
         <tr><td class="faldoc_param">number</td><td class="faldoc_paramdesc">the paramter to be changed (zero based) </td></tr><tr><td class="faldoc_param">value</td><td class="faldoc_paramdesc">the new value for the parameter </td></tr>
         
         
         
            <tr><td class="faldoc_raise">Raises:</td><td class="faldoc_raisedesc">
            <table class="faldoc_raise">
            <tr><td class="faldoc_raiseitem"><a href="./class_AccessError.html">AccessError</a></td><td class="faldoc_raisedesc">if </td></tr>
            </table>
            </td></tr>
         
         </table>
      
      <p class="faldoc_text"><ol>
<li>is out of range. </li>
</ol>
<p class="faldoc_text">The function is equivalent to assigning the value directly to the required parameter; of course, in this way also optional parameter may be accessed. If the required parameter was passed by reference, also the original value in the caller is changed. </p>
<p class="faldoc_text">If the given parameter number cannot be accessed, an AccessError is raised. </p>
</p>
   
      <h3 class="faldoc_funcname"><a name="parameter">parameter()</a></h3>
      <p class="item_brief">Gets the Nth parameter </p>
      <p class="faldoc_funcdecl">parameter( pnum )</p>
      
         <table class="faldoc_function">
         <tr><td class="faldoc_param">pnum</td><td class="faldoc_paramdesc">The ordinal number of the paremeter, zero based </td></tr>
         
         <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc">The nth paramter (zero based) or NIL if the parameter is not given. </td></tr>
         
            <tr><td class="faldoc_raise">Raises:</td><td class="faldoc_raisedesc">
            <table class="faldoc_raise">
            <tr><td class="faldoc_raiseitem"><a href="./class_AccessError.html">AccessError</a></td><td class="faldoc_raisedesc"> if <b>pnum</b> is out of range. </td></tr>
            </table>
            </td></tr>
         
         </table>
      
      <p class="faldoc_text"><p class="faldoc_text">This function returns the required parameter, being the first one passed to the function indicated as 0, the second as 1 and so on. Both formally declared parameters and optional parameters can be accessed this way. </p>
<p class="faldoc_text">If the given parameter number cannot be accessed, a AccessError is raised. </p>
<p class="faldoc_note"><span class="faldoc_notetype">Note:</span>  This function used to be called "paramNumber", and has been renamed in version 0.8.10. The function is still aliased throught the old function name for compatibility reason, but its usage is deprecated. Use <b>parameter</b> instead. </p>
</p>
   
      <h3 class="faldoc_funcname"><a name="passvp">passvp()</a></h3>
      <p class="item_brief">Returns all the undeclared parameters, or passes them to a callable item </p>
      <p class="faldoc_funcdecl">passvp( [citem] )</p>
      
         <table class="faldoc_function">
         
         <tr><td class="faldoc_optparam">citem</td><td class="faldoc_optparamdesc">Callable item on which to pass the parameters. </td></tr>
         <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc">An array containing unnamed parameters, or the return value \b citem. </td></tr>
         
         </table>
      
      <p class="faldoc_text"><p class="faldoc_text">This function returns all the parameters passed to this function but not declared in its prototype (variable parameters) in an array. </p>
<p class="faldoc_text">If the host function doesn't receive any extra parameter, this function returns an empty array. This is useful in case the array is immediately added to a direct call. For example: </p>
<pre class="faldoc_code">
 function receiver( a, b )
   &gt; "A: ", a
   &gt; "B: ", b
   &gt; "Others: ", passvp().describe()
end

receiver( "one", "two", "three", "four" )
</pre>
<p class="faldoc_text"> If <b>citem</b> is specified, the function calls citem passing all the extra parameters to it. For example: </p>
<pre class="faldoc_code">
 function promptPrint( prompt )
   passvp( .[printl prompt] )
end

promptPrint( "The prompt: ", "arg1", " ", "arg2" )
</pre>
</p>
   

<hr/>
<div class="navibottom">
   <center>
      <a href="./index.html">Main</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href="./pages.html">Related pages</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href="./groups.html">Groups</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href="./funset.html">Function sets</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href="./classes.html">Classes</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href="./objects.html">Objects</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href="./functions.html">All functions</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href="./globals.html">Globals</a>
   </center>
</div>
</div>
<div class="faldoc_signature">Made with <a href="http://www.falconpl.org">faldoc 2.2.0</div>
</body>
</html>