#include <string.h>#include "stack-c.h"#include <setjmp.h>Include dependency graph for intex17c.c:

Go to the source code of this file.
Data Structures | |
| struct | FTAB |
Defines | |
| #define | ARGS_ex17c double,double, double * |
Typedefs | |
| typedef void(*) | voidf () |
| typedef int funcex | __PARAMS ((ARGS_ex17c)) |
Functions | |
| int f1c | __PARAMS ((ARGS_ex17c)) |
| int ex17c | __PARAMS ((double *, integer, double *, integer, double *, funcex)) |
| int | intex17c (char *fname) |
| static int | sciex17c (double x, double y, double *z) |
Variables | |
| FTAB | FTab_ex17c [] |
| static jmp_buf | ex17cenv |
| static int | sci_f |
| static int | lhs_f |
| static int | rhs_f |
| static funcex | Argex17c |
| #define ARGS_ex17c double,double, double * |
Definition at line 16 of file intex17c.c.
| typedef int funcex __PARAMS((ARGS_ex17c)) |
Definition at line 18 of file intex17c.c.
| typedef void(*) voidf() |
Definition at line 5 of file intex17c.c.
| int f1c __PARAMS | ( | (ARGS_ex17c) | ) |
| int intex17c | ( | char * | fname | ) |
Definition at line 52 of file intex17c.c.
References CheckLhs, CheckRhs, CreateVar, FTab_ex17c, GetFuncPtr(), GetRhsVar, LhsVar, sciex17c(), and stk.
00054 { 00055 int returned_from_longjump ; 00056 int m_X,n_X,l_X,m_Y,n_Y,l_Y,m_Z,n_Z,l_Z; 00057 static int minlhs=1, minrhs=3, maxlhs=1, maxrhs=3; 00058 00059 /* Check rhs and lhs */ 00060 CheckRhs(minrhs,maxrhs) ; 00061 CheckLhs(minlhs,maxlhs) ; 00062 00063 /* Variable #1 (X = real vector) */ 00064 GetRhsVar(1, "d", &m_X, &n_X, &l_X); 00065 00066 /* Variable #2 (Y = real vector) */ 00067 GetRhsVar(2, "d", &m_Y, &n_Y, &l_Y); 00068 00069 /* Variable #3 (f = "argument function") */ 00070 /* ex17c(X,Y,f) 00071 * if f is a string we search for f in Tables and on succes 00072 * Argex17c will be the function to be called 00073 * if f is a macro then sciex17c will be called (see its definition bellow) 00074 * returned arguments are sci_f, lhs_f, rhs_f 00075 * function position in the stack sci_f required lhs and rhs in lhs_f, rhs_f 00076 * (we do not use lhs_f and rhs_f in this example) 00077 */ 00078 00079 Argex17c = (funcex) GetFuncPtr("ex17c", 3, FTab_ex17c, (voidf) sciex17c, &sci_f, &lhs_f, &rhs_f); 00080 if ( Argex17c == (funcex) 0 ) return 0; 00081 00082 m_Z= m_X*n_X; n_Z= m_Y*n_Y; 00083 00084 /* Creating the output variable Z (#4) , real matrix variable with m_Z rows and n_Z columns */ 00085 00086 CreateVar(4, "d", &m_Z, &n_Z, &l_Z); 00087 00088 /* If an error occurs while Z is calculated ... */ 00089 00090 if (( returned_from_longjump = setjmp(ex17cenv)) != 0 ) 00091 { 00092 Scierror(999,"%s: Internal error \r\n",fname); 00093 return 0; 00094 } 00095 00096 /* Now matrix Z is populated i.e. appropriate values are 00097 * assigned to stk(l_Z)[0] ( = Z(1,1) ), stk(l_Z)[1] ( = Z(2,1) ), ... 00098 */ 00099 00100 ex17c(stk(l_X), m_X*n_X, stk(l_Y), m_Y*n_Y, stk(l_Z), Argex17c); 00101 00102 /* Variable #4 is returned to Scilab */ 00103 LhsVar(1) = 4; 00104 return 0; 00105 }
Here is the call graph for this function:

| static int sciex17c | ( | double | x, | |
| double | y, | |||
| double * | z | |||
| ) | [static] |
Definition at line 112 of file intex17c.c.
References CreateVar, lhs, PExecSciFunction, rhs, and stk.
Referenced by intex17c().
00114 { 00115 static int lhs=1,rhs=2; 00116 int scilab_i,scilab_j, un=1; 00117 /* Inputs (x(i),y(j)) at positions (5,6) */ 00118 CreateVar(5, "d", &un, &un, &scilab_i); 00119 stk(scilab_i)[0] = x; 00120 00121 CreateVar(6, "d", &un, &un, &scilab_j); 00122 stk(scilab_j)[0] = y; 00123 00124 /* executes the Scilab function (f) pointed to by sci_f. 00125 * we provide a rhs=2 and expect lhs = 1 00126 */ 00127 PExecSciFunction(5, &sci_f, &lhs, &rhs, "ArgFex", ex17cenv); 00128 /* One output at position of first input (5) */ 00129 *z = *stk(scilab_i); 00130 return 0; 00131 }
Here is the caller graph for this function:

funcex Argex17c [static] |
Definition at line 46 of file intex17c.c.
jmp_buf ex17cenv [static] |
Definition at line 33 of file intex17c.c.
Definition at line 39 of file intex17c.c.
Definition at line 39 of file intex17c.c.
Definition at line 39 of file intex17c.c.
1.5.1