Revert non-scilab changes: Octave modifications
This commit is contained in:
parent
9f08e04428
commit
678058dbc7
4 changed files with 20 additions and 10 deletions
|
|
@ -4,7 +4,7 @@ swigexample
|
|||
|
||||
# Call our gcd() function
|
||||
|
||||
x = -2;
|
||||
x = 42;
|
||||
y = 105;
|
||||
g = swigexample.gcd(x,y);
|
||||
printf("The gcd of %d and %d is %d\n",x,y,g);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/octave
|
||||
# file: runme.m
|
||||
|
||||
swigexample
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ double dvar = 0;
|
|||
char *strvar = 0;
|
||||
const char cstrvar[] = "Goodbye";
|
||||
int *iptrvar = 0;
|
||||
char name[5] = "Dave";
|
||||
char name[256] = "Dave";
|
||||
char path[256] = "/home/beazley";
|
||||
|
||||
|
||||
|
|
@ -53,8 +53,8 @@ void print_vars() {
|
|||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar ? cstrvar : "(null)");
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("name = %c%c%c%c%c\n", name[0],name[1],name[2],name[3],name[4]);
|
||||
printf("ptptr = %p %s\n", ptptr, Point_print( ptptr ) );
|
||||
printf("name = %s\n", name);
|
||||
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
|
||||
printf("pt = (%d, %d)\n", pt.x, pt.y);
|
||||
printf("status = %d\n", status);
|
||||
}
|
||||
|
|
@ -67,10 +67,6 @@ int *new_int(int value) {
|
|||
return ip;
|
||||
}
|
||||
|
||||
int value_int(int *value) {
|
||||
return *value;
|
||||
}
|
||||
|
||||
/* A function to create a point */
|
||||
|
||||
Point *new_Point(int x, int y) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,22 @@
|
|||
// Vectors
|
||||
|
||||
%fragment("StdVectorTraits","header")
|
||||
%fragment("StdVectorTraits","header",fragment="StdSequenceTraits")
|
||||
%{
|
||||
namespace swig {
|
||||
template <class T>
|
||||
struct traits_asptr<std::vector<T> > {
|
||||
static int asptr(const octave_value& obj, std::vector<T> **vec) {
|
||||
return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct traits_from<std::vector<T> > {
|
||||
static octave_value from(const std::vector<T>& vec) {
|
||||
return traits_from_stdseq<std::vector<T> >::from(vec);
|
||||
}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
#define %swig_vector_methods(Type...) %swig_sequence_methods(Type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue