some html fixes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10985 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-12-17 01:33:00 +00:00
commit 5f016fd495
3 changed files with 5 additions and 27 deletions

View file

@ -431,7 +431,7 @@ Please refer to this section for details, but for convenience, the C# usage for
<p> <p>
For the <tt>%array_functions</tt> example, the equivalent usage would be: For the <tt>%array_functions</tt> example, the equivalent usage would be:
<p> </p>
<div class="code"> <div class="code">
<pre> <pre>
@ -445,7 +445,7 @@ example.delete_doubleArray(a); // Destroy array
<p> <p>
and for the <tt>%array_class</tt> example, the equivalent usage would be: and for the <tt>%array_class</tt> example, the equivalent usage would be:
<p> </p>
<div class="code"> <div class="code">
<pre> <pre>
@ -485,18 +485,17 @@ on MSDN.
<p> <p>
The P/Invoke default marshalling is supported by the <tt>arrays_csharp.i</tt> library via the INPUT, OUTPUT and INOUT typemaps. The P/Invoke default marshalling is supported by the <tt>arrays_csharp.i</tt> library via the INPUT, OUTPUT and INOUT typemaps.
Let's look at some example usage. Consider the following C function: Let's look at some example usage. Consider the following C function:
</p>
<div class="code"> <div class="code">
<pre> <pre>
void myArrayCopy(int *sourceArray, int *targetArray, int nitems); void myArrayCopy(int *sourceArray, int *targetArray, int nitems);
</pre> </pre>
</div> </div>
</p>
<p> <p>
We can now instruct SWIG to use the default marshalling typemaps by We can now instruct SWIG to use the default marshalling typemaps by
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
%include "arrays_csharp.i" %include "arrays_csharp.i"
@ -505,13 +504,11 @@ We can now instruct SWIG to use the default marshalling typemaps by
%apply int OUTPUT[] {int *targetArray} %apply int OUTPUT[] {int *targetArray}
</pre> </pre>
</div> </div>
</p>
<p> <p>
As a result, we get the following method in the module class: As a result, we get the following method in the module class:
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
public static void myArrayCopy(int[] sourceArray, int[] targetArray, int nitems) { public static void myArrayCopy(int[] sourceArray, int[] targetArray, int nitems) {
@ -519,7 +516,6 @@ public static void myArrayCopy(int[] sourceArray, int[] targetArray, int nitems)
} }
</pre> </pre>
</div> </div>
</p>
<p> <p>
If we look beneath the surface at the corresponding intermediary class code, we see If we look beneath the surface at the corresponding intermediary class code, we see
@ -528,7 +524,6 @@ that SWIG has generated code that uses attributes
marshalling for the arrays: marshalling for the arrays:
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
[DllImport("example", EntryPoint="CSharp_myArrayCopy")] [DllImport("example", EntryPoint="CSharp_myArrayCopy")]
@ -536,7 +531,6 @@ public static extern void myArrayCopy([In, MarshalAs(UnmanagedType.LPArray)]int[
[Out, MarshalAs(UnmanagedType.LPArray)]int[] jarg2, int jarg3); [Out, MarshalAs(UnmanagedType.LPArray)]int[] jarg2, int jarg3);
</pre> </pre>
</div> </div>
</p>
<p> <p>
As an example of passing an inout array (i.e. the target function will both read from and As an example of passing an inout array (i.e. the target function will both read from and
@ -544,19 +538,16 @@ write to the array), consider this C function that swaps a given number of eleme
in the given arrays: in the given arrays:
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
void myArraySwap(int *array1, int *array2, int nitems); void myArraySwap(int *array1, int *array2, int nitems);
</pre> </pre>
</div> </div>
</p>
<p> <p>
Now, we can instruct SWIG to wrap this by Now, we can instruct SWIG to wrap this by
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
%include "arrays_csharp.i" %include "arrays_csharp.i"
@ -565,13 +556,11 @@ Now, we can instruct SWIG to wrap this by
%apply int INOUT[] {int *array2} %apply int INOUT[] {int *array2}
</pre> </pre>
</div> </div>
</p>
<p> <p>
This results in the module class method This results in the module class method
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
public static void myArraySwap(int[] array1, int[] array2, int nitems) { public static void myArraySwap(int[] array1, int[] array2, int nitems) {
@ -579,13 +568,11 @@ This results in the module class method
} }
</pre> </pre>
</div> </div>
</p>
<p> <p>
and intermediate class method and intermediate class method
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
[DllImport("example", EntryPoint="CSharp_myArraySwap")] [DllImport("example", EntryPoint="CSharp_myArraySwap")]
@ -593,7 +580,6 @@ and intermediate class method
[In, Out, MarshalAs(UnmanagedType.LPArray)]int[] jarg2, int jarg3); [In, Out, MarshalAs(UnmanagedType.LPArray)]int[] jarg2, int jarg3);
</pre> </pre>
</div> </div>
</p>
<H3><a name="CSharp_arrays_pinning"></a>17.3.3 Managed arrays using pinning</H3> <H3><a name="CSharp_arrays_pinning"></a>17.3.3 Managed arrays using pinning</H3>
@ -629,19 +615,16 @@ void myArrayCopy(int *sourceArray, int *targetArray, int nitems);
We now need to declare the module class method unsafe, as we are using pointers: We now need to declare the module class method unsafe, as we are using pointers:
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
%csmethodmodifiers myArrayCopy "public unsafe"; %csmethodmodifiers myArrayCopy "public unsafe";
</pre> </pre>
</div> </div>
</p>
<p> <p>
Apply the appropriate typemaps to the array parameters: Apply the appropriate typemaps to the array parameters:
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
%include "arrays_csharp.i" %include "arrays_csharp.i"
@ -650,7 +633,6 @@ Apply the appropriate typemaps to the array parameters:
%apply int FIXED[] {int *targetArray} %apply int FIXED[] {int *targetArray}
</pre> </pre>
</div> </div>
</p>
<p> <p>
Notice that there is no need for separate in, out or inout typemaps as is the Notice that there is no need for separate in, out or inout typemaps as is the
@ -661,7 +643,6 @@ case when using P/Invoke default marshalling.
As a result, we get the following method in the module class: As a result, we get the following method in the module class:
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
public unsafe static void myArrayCopy(int[] sourceArray, int[] targetArray, int nitems) { public unsafe static void myArrayCopy(int[] sourceArray, int[] targetArray, int nitems) {
@ -675,7 +656,6 @@ As a result, we get the following method in the module class:
} }
</pre> </pre>
</div> </div>
</p>
<p> <p>
On the method signature level the only difference to the version using P/Invoke default On the method signature level the only difference to the version using P/Invoke default
@ -687,14 +667,12 @@ Also the intermediate class method looks a little different from the default mar
example - the method is expecting an IntPtr as the parameter type. example - the method is expecting an IntPtr as the parameter type.
</p> </p>
<p>
<div class="code"> <div class="code">
<pre> <pre>
[DllImport("example", EntryPoint="CSharp_myArrayCopy")] [DllImport("example", EntryPoint="CSharp_myArrayCopy")]
public static extern void myArrayCopy(IntPtr jarg1, IntPtr jarg2, int jarg3); public static extern void myArrayCopy(IntPtr jarg1, IntPtr jarg2, int jarg3);
</pre> </pre>
</div> </div>
</p>

View file

@ -2858,7 +2858,7 @@ and therefore there is no possibility of premature garbage collection. In practi
<p> <p>
The premature garbage collection prevention parameter for proxy classes is generated by default whenever proxy classes are passed by value, reference or with a pointer. The premature garbage collection prevention parameter for proxy classes is generated by default whenever proxy classes are passed by value, reference or with a pointer.
The implementation for this extra parameter generation requires the "jtype" typemap to contain <tt>long</tt> and the "jstype" typemap to contain the name of a proxy class. The implementation for this extra parameter generation requires the "jtype" typemap to contain <tt>long</tt> and the "jstype" typemap to contain the name of a proxy class.
<p> </p>
<p> <p>
The additional parameter does impose a slight performance overhead and the parameter generation can be suppressed globally with the <tt>-nopgcpp</tt> commandline option. The additional parameter does impose a slight performance overhead and the parameter generation can be suppressed globally with the <tt>-nopgcpp</tt> commandline option.

View file

@ -132,7 +132,7 @@ in <tt>base_module.i</tt> as well as the <tt>%import</tt> in <tt>derived_module.
Another issue Another issue
to beware of is that multiple dependent wrappers should not be linked/loaded to beware of is that multiple dependent wrappers should not be linked/loaded
in parallel from multiple threads as SWIG provides no locking - for more on that in parallel from multiple threads as SWIG provides no locking - for more on that
issue, read on.</p> issue, read on.
</p> </p>
<H2><a name="Modules_nn2"></a>15.2 The SWIG runtime code</H2> <H2><a name="Modules_nn2"></a>15.2 The SWIG runtime code</H2>