some missing features
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11962 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3e1b900946
commit
57c3d28aaf
4 changed files with 467 additions and 21 deletions
6
Examples/scilab/variables/example.h
Normal file
6
Examples/scilab/variables/example.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* File: example.h */
|
||||
|
||||
typedef struct {
|
||||
int x,y;
|
||||
} Point;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ fvar_set (3.14159);
|
|||
dvar_set (2.1828);
|
||||
strvar_set("Hello World");
|
||||
|
||||
iptrvar= new_int(37);
|
||||
//iptrvar= new_int(37);
|
||||
ptptr = new_Point(37,42);
|
||||
name_set ("Bill");
|
||||
// Now print out the values of the variables
|
||||
|
|
@ -36,7 +36,7 @@ printf("dvar = %f\n", dvar_get());
|
|||
printf("cvar = %s\n", cvar_get());
|
||||
printf("strvar = %s\n", strvar_get());
|
||||
|
||||
iptrvar
|
||||
//iptrvar
|
||||
printf("name = %s\n", name_get());
|
||||
printf("ptptr = %s\n", Point_print(ptptr));
|
||||
printf("\nVariables (values printed from C)\n");
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -60,6 +60,7 @@ or you can use the %apply directive :
|
|||
unsigned long *INPUT (int *piAddrVar, int iRows, int iCols, unsigned long temp),
|
||||
float *INPUT (int *piAddrVar, int iRows, int iCols, float temp),
|
||||
double *INPUT (int *piAddrVar, int iRows, int iCols, double temp) {
|
||||
int iType;
|
||||
double *_piData;
|
||||
int typearg;
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, $argnum, &piAddrVar);
|
||||
|
|
@ -68,11 +69,19 @@ or you can use the %apply directive :
|
|||
return 0;
|
||||
}
|
||||
|
||||
sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
|
||||
if (sciErr.iErr || iType != sci_matrix) {
|
||||
Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), fname, $argnum);
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, &iRows, &iCols, &_piData);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
if (sciErr.iErr || iRows * iCols != 1) {
|
||||
Scierror(999, _("%s: Wrong size for input argument #%d: A real expected.\n"), fname, $argnum);
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
temp = ($*1_ltype)*_piData;
|
||||
$1 = &temp;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue