PageRenderTime 21ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Doc/Devel/parm.html

#
HTML | 102 lines | 73 code | 29 blank | 0 comment | 0 complexity | 9b752fc84028337f15d17385b1013a56 MD5 | raw file
  1<html>
  2<head>
  3<title>SWIG Parameter Handling</title>
  4</head>
  5
  6<body>
  7<center>
  8<h1>SWIG Parameter Handling</h1>
  9
 10<p>
 11David M. Beazley <br>
 12dave-swig@dabeaz.com<br>
 13January 9, 2007<br>
 14
 15</b>
 16</center>
 17
 18<h2>Introduction</h2>
 19
 20This document describes the functions related to management of function parameters and parameter lists in the SWIG core. These functions are declared in <tt>Source/Swig/swigparm.h</tt>.   This API is considered to be stable.
 21
 22<h2>Parameters</h2>
 23
 24The following utility functions are used to create and copy individual parameters.  In their most basic form, a parameter merely contains a type, a name, and an optional default value.
 25
 26<p>
 27<b><tt>Parm *NewParm(SwigType *type, const String_or_char *name)</tt></b>
 28
 29<blockquote>
 30Creates a new parameter object with type <tt>type</tt> and name <tt>name</tt>.  The type is stored in the attribute "type" and the name is stored in the attribute "name".
 31</blockquote>
 32
 33<p>
 34<b><tt>Parm *CopyParm(Parm *p)</tt></b>
 35<blockquote>
 36Copies a parameter object.  All string attributes are copied in the
 37process of making the copy.  However, no complex attributes (lists,
 38hashes, etc.) are copied.
 39</blockquote>
 40
 41<h2>Parameter Lists</h2>
 42
 43<p>
 44<b><tt>ParmList *CopyParmList(ParmList *p)</tt></b>
 45<blockquote>
 46Creates a copy of a parameter list.  A parameter list is merely a linked list of parameters created by NewParm().
 47</blockquote>
 48
 49<p>
 50<b><tt>ParmList *CopyParmListMax(ParmList *p, int count)</tt></b>
 51<blockquote>
 52Copies at most <tt>count</tt> parameters from the parameter list <tt>p</tt>.
 53</blockquote>
 54
 55<p>
 56<b><tt>int ParmList_len(ParmList *p)</tt></b>
 57
 58<blockquote>
 59Returns the total number of parameters in a parameter list.
 60</blockquote>
 61
 62<p>
 63<b><tt>int ParmList_numrequired(ParmList *p)</tt></b>
 64<blockquote>
 65Returns the number of required parameters in a parameter list.   This pertains to invoking a function/method in C/C++.
 66</blockquote>
 67
 68<p>
 69<b><tt>int ParmList_has_defaultargs(ParmList *p)</tt></b>
 70<blockquote>
 71Returns 1 if the parameter list has any default arguments.  Otherwise returns 0.
 72</blockquote>
 73
 74
 75<h2>Code Generation Functions</h2>
 76
 77<p>
 78<b><tt>String *ParmList_str(ParmList *p)</tt></b>
 79<blockquote>
 80Creates a C prototype string of the parameters, but without any default values.
 81</blockquote>
 82
 83<p>
 84<b><tt>String *ParmList_str_defaultargs(ParmList *p)</tt></b>
 85<blockquote>
 86Creates a C prototype string of the parameters and includes the default values (if any).
 87</blockquote>
 88
 89<p>
 90<b><tt>String *ParmList_protostr(ParmList *p)</tt></b>
 91<blockquote>
 92Creates a C prototype string of the parameters. 
 93</blockquote>
 94
 95
 96</body>
 97</html>
 98
 99
100
101
102