Revert rev 11187 "Merged with recent changes from trunk."
This reverts commit c595e4d90ebfd63eb55430c735bb121cf690bd59. Conflicts: Source/Modules/c.cxx From: William S Fulton <wsf@fultondesigns.co.uk> git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@13033 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
34a628c7c7
commit
d6b81eb831
703 changed files with 9266 additions and 21128 deletions
|
|
@ -1,20 +0,0 @@
|
|||
TOP = ../..
|
||||
SWIG = $(TOP)/../preinst-swig
|
||||
SRCS = example.c
|
||||
TARGET = example
|
||||
INTERFACE = example.i
|
||||
SWIGOPT =
|
||||
CSHARPSRCS = *.cs
|
||||
CSHARPFLAGS= -nologo -unsafe -out:runme.exe
|
||||
|
||||
all:: csharp
|
||||
|
||||
csharp::
|
||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
|
||||
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
|
||||
|
||||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile csharp_clean
|
||||
|
||||
check: all
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/* File : example.c */
|
||||
|
||||
#include "example.h"
|
||||
|
||||
/* copy the contents of the first array to the second */
|
||||
void myArrayCopy( int* sourceArray, int* targetArray, int nitems ) {
|
||||
int i;
|
||||
for ( i = 0; i < nitems; i++ ) {
|
||||
targetArray[ i ] = sourceArray[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
/* swap the contents of the two arrays */
|
||||
void myArraySwap( int* array1, int* array2, int nitems ) {
|
||||
int i, temp;
|
||||
for ( i = 0; i < nitems; i++ ) {
|
||||
temp = array1[ i ];
|
||||
array1[ i ] = array2[ i ];
|
||||
array2[ i ] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
void myArrayCopy( int *sourceArray, int* targetArray, int nitems );
|
||||
void myArraySwap( int* array1, int* array2, int nitems );
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
%include "arrays_csharp.i"
|
||||
|
||||
%apply int INPUT[] { int* sourceArray }
|
||||
%apply int OUTPUT[] { int* targetArray }
|
||||
|
||||
%apply int INOUT[] { int* array1 }
|
||||
%apply int INOUT[] { int* array2 }
|
||||
|
||||
%include "example.h"
|
||||
|
||||
%clear int* sourceArray;
|
||||
%clear int* targetArray;
|
||||
|
||||
%clear int* array1;
|
||||
%clear int* array2;
|
||||
|
||||
|
||||
// Below replicates the above array handling but this time using the pinned (fixed) array typemaps
|
||||
%csmethodmodifiers "public unsafe";
|
||||
|
||||
%apply int FIXED[] { int* sourceArray }
|
||||
%apply int FIXED[] { int* targetArray }
|
||||
|
||||
%inline %{
|
||||
void myArrayCopyUsingFixedArrays( int *sourceArray, int* targetArray, int nitems ) {
|
||||
myArrayCopy(sourceArray, targetArray, nitems);
|
||||
}
|
||||
%}
|
||||
|
||||
%apply int FIXED[] { int* array1 }
|
||||
%apply int FIXED[] { int* array2 }
|
||||
|
||||
%inline %{
|
||||
void myArraySwapUsingFixedArrays( int* array1, int* array2, int nitems ) {
|
||||
myArraySwap(array1, array2, nitems);
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
using System;
|
||||
|
||||
public class runme
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
int[] source = { 1, 2, 3 };
|
||||
int[] target = new int[ source.Length ];
|
||||
|
||||
example.myArrayCopy( source, target, target.Length );
|
||||
|
||||
Console.WriteLine( "Contents of copy target array using default marshaling" );
|
||||
PrintArray( target );
|
||||
|
||||
target = new int[ source.Length ];
|
||||
|
||||
example.myArrayCopyUsingFixedArrays( source, target, target.Length );
|
||||
Console.WriteLine( "Contents of copy target array using fixed arrays" );
|
||||
PrintArray( target );
|
||||
|
||||
target = new int[] { 4, 5, 6 };
|
||||
example.myArraySwap( source, target, target.Length );
|
||||
Console.WriteLine( "Contents of arrays after swapping using default marshaling" );
|
||||
PrintArray( source );
|
||||
PrintArray( target );
|
||||
|
||||
source = new int[] { 1, 2, 3 };
|
||||
target = new int[] { 4, 5, 6 };
|
||||
|
||||
example.myArraySwapUsingFixedArrays( source, target, target.Length );
|
||||
Console.WriteLine( "Contents of arrays after swapping using fixed arrays" );
|
||||
PrintArray( source );
|
||||
PrintArray( target );
|
||||
}
|
||||
|
||||
static void PrintArray( int[] a )
|
||||
{
|
||||
foreach ( int i in a )
|
||||
Console.Write( "{0} ", i );
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
# see top-level Makefile.in
|
||||
arrays
|
||||
callback
|
||||
class
|
||||
enum
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue