summaryrefslogtreecommitdiffstats
path: root/scilab/modules/call_scilab
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre.ledru@scilab.org>2010-03-28 10:58:54 +0200
committerSylvestre Ledru <sylvestre.ledru@scilab.org>2010-03-28 10:58:54 +0200
commit2649149c5c28bd8698bba553984db2b8631edd75 (patch)
treea1cb056d1edd34535eebc5a989bc1a6a69a47c66 /scilab/modules/call_scilab
parent8af90aa402aadbcb63d54279b58263e812a176c7 (diff)
downloadscilab-2649149c5c28bd8698bba553984db2b8631edd75.zip
scilab-2649149c5c28bd8698bba553984db2b8631edd75.tar.gz
Show how to use the error into call_scilab examples and documentation
Diffstat (limited to 'scilab/modules/call_scilab')
-rw-r--r--scilab/modules/call_scilab/examples/basicExamples/readwriteboolean.c43
-rw-r--r--scilab/modules/call_scilab/examples/basicExamples/readwritecomplexmatrix.c66
-rw-r--r--scilab/modules/call_scilab/examples/basicExamples/readwritematrix.c44
-rw-r--r--scilab/modules/call_scilab/examples/basicExamples/readwritestring.c61
-rw-r--r--scilab/modules/call_scilab/help/en_US/BooleanManagement.xml24
-rw-r--r--scilab/modules/call_scilab/help/en_US/ComplexManagement.xml19
-rw-r--r--scilab/modules/call_scilab/help/en_US/DoubleManagement.xml24
-rw-r--r--scilab/modules/call_scilab/help/en_US/StringManagement.xml29
8 files changed, 258 insertions, 52 deletions
diff --git a/scilab/modules/call_scilab/examples/basicExamples/readwriteboolean.c b/scilab/modules/call_scilab/examples/basicExamples/readwriteboolean.c
index 186bba3..ce8c7e0 100644
--- a/scilab/modules/call_scilab/examples/basicExamples/readwriteboolean.c
+++ b/scilab/modules/call_scilab/examples/basicExamples/readwriteboolean.c
@@ -41,11 +41,17 @@ int main(void)
41 /* NOTE that it is an array of int and not an array of double */ 41 /* NOTE that it is an array of int and not an array of double */
42 int rowA=1, colA=4; /* Size of the matrix */ 42 int rowA=1, colA=4; /* Size of the matrix */
43 char variableName[]="A"; 43 char variableName[]="A";
44 SciErr sciErr;
44 45
45 /* 46 /*
46 Write it into Scilab's memory 47 Write it into Scilab's memory
47 */ 48 */
48 createNamedMatrixOfBoolean(pvApiCtx, variableName, rowA, colA, A); 49 sciErr = createNamedMatrixOfBoolean(pvApiCtx, variableName, rowA, colA, A);
50 if(sciErr.iErr)
51 {
52 printError(&sciErr, 0);
53 }
54
49 /* 55 /*
50 * Prior to Scilab 5.2: 56 * Prior to Scilab 5.2:
51 * C2F(cwritebmat)(variableName, &rowA, &colA, A,strlen(variableName)); 57 * C2F(cwritebmat)(variableName, &rowA, &colA, A,strlen(variableName));
@@ -65,9 +71,15 @@ int main(void)
65 int B[]={0,0,0,0,1,0,0,1}; /* Declare the matrix */ 71 int B[]={0,0,0,0,1,0,0,1}; /* Declare the matrix */
66 int rowB=2, colB=4; /* Size of the matrix */ 72 int rowB=2, colB=4; /* Size of the matrix */
67 char variableNameB[] = "B"; 73 char variableNameB[] = "B";
74 SciErr sciErr;
68 75
69 /* Write it into Scilab's memory */ 76 /* Write it into Scilab's memory */
70 createNamedMatrixOfBoolean(pvApiCtx, variableNameB, rowB, colB, B); 77 sciErr = createNamedMatrixOfBoolean(pvApiCtx, variableNameB, rowB, colB, B);
78 if(sciErr.iErr)
79 {
80 printError(&sciErr, 0);
81 }
82
71 /* 83 /*
72 * Prior to Scilab 5.2: 84 * Prior to Scilab 5.2:
73 * C2F(cwritebmat)(variableNameB, &rowB, &colB, B, strlen(variableNameB)); 85 * C2F(cwritebmat)(variableNameB, &rowB, &colB, B, strlen(variableNameB));
@@ -88,9 +100,15 @@ int main(void)
88 int *matrixOfBoolean = NULL; /* Int instead of double */ 100 int *matrixOfBoolean = NULL; /* Int instead of double */
89 101
90 char variableToBeRetrieved[] = "A"; 102 char variableToBeRetrieved[] = "A";
91 103 SciErr sciErr;
104
92 /* First, retrieve the size of the matrix */ 105 /* First, retrieve the size of the matrix */
93 readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, NULL); 106 sciErr = readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, NULL);
107 if(sciErr.iErr)
108 {
109 printError(&sciErr, 0);
110 }
111
94 /* 112 /*
95 * Prior to Scilab 5.2: 113 * Prior to Scilab 5.2:
96 * C2F(cmatbptr)(variableToBeRetrieved, &rowA_, &colA_, &lp, strlen(variableToBeRetrieved)); 114 * C2F(cmatbptr)(variableToBeRetrieved, &rowA_, &colA_, &lp, strlen(variableToBeRetrieved));
@@ -100,7 +118,12 @@ int main(void)
100 matrixOfBoolean=(int*)malloc((rowA_*colA_)*sizeof(int)); 118 matrixOfBoolean=(int*)malloc((rowA_*colA_)*sizeof(int));
101 119
102 /* Load the matrix */ 120 /* Load the matrix */
103 readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, matrixOfBoolean); 121 sciErr = readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, matrixOfBoolean);
122 if(sciErr.iErr)
123 {
124 printError(&sciErr, 0);
125 }
126
104 /* 127 /*
105 * Prior to Scilab 5.2: 128 * Prior to Scilab 5.2:
106 * C2F(creadbmat)(variableToBeRetrieved,&rowA_,&colA_,matrixOfBoolean,strlen(variableToBeRetrieved) ); 129 * C2F(creadbmat)(variableToBeRetrieved,&rowA_,&colA_,matrixOfBoolean,strlen(variableToBeRetrieved) );
@@ -127,9 +150,10 @@ int main(void)
127 int *matrixOfBooleanB = NULL; /* Int instead of double */ 150 int *matrixOfBooleanB = NULL; /* Int instead of double */
128 151
129 char variableToBeRetrievedB[] = "B"; 152 char variableToBeRetrievedB[] = "B";
153 SciErr sciErr;
130 154
131 /* First, retrieve the size of the matrix */ 155 /* First, retrieve the size of the matrix */
132 readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL); 156 sciErr = readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL);
133 /* 157 /*
134 * Prior to Scilab 5.2: 158 * Prior to Scilab 5.2:
135 * C2F(cmatbptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB)); 159 * C2F(cmatbptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB));
@@ -139,8 +163,13 @@ int main(void)
139 matrixOfBooleanB=(int*)malloc((rowB_*colB_)*sizeof(int)); 163 matrixOfBooleanB=(int*)malloc((rowB_*colB_)*sizeof(int));
140 164
141 /* Load the matrix */ 165 /* Load the matrix */
142 readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfBooleanB); 166 sciErr = readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfBooleanB);
167 if(sciErr.iErr)
168 {
169 printError(&sciErr, 0);
170 }
143 171
172
144 /* 173 /*
145 * Prior to Scilab 5.2: 174 * Prior to Scilab 5.2:
146 * C2F(creadbmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfBooleanB,strlen(variableToBeRetrievedB) ); 175 * C2F(creadbmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfBooleanB,strlen(variableToBeRetrievedB) );
diff --git a/scilab/modules/call_scilab/examples/basicExamples/readwritecomplexmatrix.c b/scilab/modules/call_scilab/examples/basicExamples/readwritecomplexmatrix.c
index e4bd045..94ae152 100644
--- a/scilab/modules/call_scilab/examples/basicExamples/readwritecomplexmatrix.c
+++ b/scilab/modules/call_scilab/examples/basicExamples/readwritecomplexmatrix.c
@@ -44,14 +44,19 @@ int main(void)
44 * (note that colA = sizeof(A)/2 44 * (note that colA = sizeof(A)/2
45 */ 45 */
46 char variableName[]="A"; 46 char variableName[]="A";
47 SciErr sciErr;
47 48
48/* Write it into Scilab's memory */ 49 /* Write it into Scilab's memory */
49 createNamedComplexMatrixOfDouble(pvApiCtx,variableName,rowA,colA, A, A_img); 50 sciErr = createNamedComplexMatrixOfDouble(pvApiCtx,variableName,rowA,colA, A, A_img);
51 if(sciErr.iErr)
52 {
53 printError(&sciErr, 0);
54 }
50 55
51/* 56 /*
52 * Prior to Scilab 5.2: 57 * Prior to Scilab 5.2:
53 * C2F(cwritecmat)(variableName, &rowA, &colA, A,strlen(variableName)); 58 * C2F(cwritecmat)(variableName, &rowA, &colA, A,strlen(variableName));
54 */ 59 */
55 printf("Display from Scilab of A:\n"); 60 printf("Display from Scilab of A:\n");
56 SendScilabJob("disp(A);"); /* Display A */ 61 SendScilabJob("disp(A);"); /* Display A */
57 } 62 }
@@ -73,8 +78,14 @@ int main(void)
73 78
74 int rowB=2, colB=4; /* Size of the matrix */ 79 int rowB=2, colB=4; /* Size of the matrix */
75 char variableNameB[] = "B"; 80 char variableNameB[] = "B";
76/* Write it into Scilab's memory */ 81 SciErr sciErr;
77 createNamedComplexMatrixOfDouble(pvApiCtx,variableNameB, rowB, colB, B, B_img); 82
83 /* Write it into Scilab's memory */
84 sciErr = createNamedComplexMatrixOfDouble(pvApiCtx,variableNameB, rowB, colB, B, B_img);
85 if(sciErr.iErr)
86 {
87 printError(&sciErr, 0);
88 }
78 89
79/* 90/*
80 * Prior to Scilab 5.2: 91 * Prior to Scilab 5.2:
@@ -96,9 +107,14 @@ int main(void)
96 double *matrixOfComplex_img = NULL; 107 double *matrixOfComplex_img = NULL;
97 108
98 char variableToBeRetrieved[] = "A"; 109 char variableToBeRetrieved[] = "A";
110 SciErr sciErr;
99 111
100 /* First, retrieve the size of the matrix */ 112 /* First, retrieve the size of the matrix */
101 readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, NULL, NULL); 113 sciErr = readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, NULL, NULL);
114 if(sciErr.iErr)
115 {
116 printError(&sciErr, 0);
117 }
102 118
103/* 119/*
104 * Prior to Scilab 5.2: 120 * Prior to Scilab 5.2:
@@ -110,7 +126,12 @@ int main(void)
110 matrixOfComplex_img = (double*)malloc((rowA_*colA_*2)*sizeof(double)); 126 matrixOfComplex_img = (double*)malloc((rowA_*colA_*2)*sizeof(double));
111 127
112 /* Load the matrix */ 128 /* Load the matrix */
113 readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, matrixOfComplex, matrixOfComplex_img); 129 sciErr = readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, matrixOfComplex, matrixOfComplex_img);
130 if(sciErr.iErr)
131 {
132 printError(&sciErr, 0);
133 }
134
114 135
115/* 136/*
116 * Prior to Scilab 5.2: 137 * Prior to Scilab 5.2:
@@ -148,10 +169,15 @@ int main(void)
148 double *matrixOfComplexB = NULL; 169 double *matrixOfComplexB = NULL;
149 double *matrixOfComplexB_img = NULL; 170 double *matrixOfComplexB_img = NULL;
150 char variableToBeRetrievedB[] = "B"; 171 char variableToBeRetrievedB[] = "B";
151 172 SciErr sciErr;
152 /* First, retrieve the size of the matrix */ 173 /* First, retrieve the size of the matrix */
153 174
154 readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL, NULL); 175 sciErr = readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL, NULL);
176 if(sciErr.iErr)
177 {
178 printError(&sciErr, 0);
179 }
180
155/* 181/*
156 * Prior to Scilab 5.2: 182 * Prior to Scilab 5.2:
157 * C2F(cmatcptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB)); 183 * C2F(cmatcptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB));
@@ -162,13 +188,17 @@ int main(void)
162 matrixOfComplexB_img = (double*)malloc((rowB_*colB_)*sizeof(double)); 188 matrixOfComplexB_img = (double*)malloc((rowB_*colB_)*sizeof(double));
163 189
164 /* Load the matrix */ 190 /* Load the matrix */
165 readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfComplexB, matrixOfComplexB_img); 191 sciErr = readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfComplexB, matrixOfComplexB_img);
166 192 if(sciErr.iErr)
167/* 193 {
168 * Prior to Scilab 5.2: 194 printError(&sciErr, 0);
169 * C2F(creadcmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfComplexB,strlen(variableToBeRetrievedB) ); 195 }
170 */
171 196
197 /*
198 * Prior to Scilab 5.2:
199 * C2F(creadcmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfComplexB,strlen(variableToBeRetrievedB) );
200 */
201
172 printf("\n"); 202 printf("\n");
173 printf("Display from B raw - real part (size: %d, %d):\n",rowB_, colB_); 203 printf("Display from B raw - real part (size: %d, %d):\n",rowB_, colB_);
174 for(i=0; i < rowB_*colB_; i++) /* *2 is because complex part is store 204 for(i=0; i < rowB_*colB_; i++) /* *2 is because complex part is store
diff --git a/scilab/modules/call_scilab/examples/basicExamples/readwritematrix.c b/scilab/modules/call_scilab/examples/basicExamples/readwritematrix.c
index 48e550e..04cbec3 100644
--- a/scilab/modules/call_scilab/examples/basicExamples/readwritematrix.c
+++ b/scilab/modules/call_scilab/examples/basicExamples/readwritematrix.c
@@ -39,11 +39,17 @@ int main(void)
39 double A[] = {1,3,3,2}; /* Declare the matrix */ 39 double A[] = {1,3,3,2}; /* Declare the matrix */
40 int rowA = 1, colA = 4; /* Size of the matrix */ 40 int rowA = 1, colA = 4; /* Size of the matrix */
41 char variableName[] = "A"; 41 char variableName[] = "A";
42 SciErr sciErr;
42 43
43 /* 44 /*
44 * Write it into Scilab's memory 45 * Write it into Scilab's memory
45 */ 46 */
46 createNamedMatrixOfDouble(pvApiCtx,variableName,rowA,colA, A); 47 sciErr = createNamedMatrixOfDouble(pvApiCtx,variableName,rowA,colA, A);
48 if(sciErr.iErr)
49 {
50 printError(&sciErr, 0);
51 }
52
47 /* 53 /*
48 * Prior to Scilab 5.2: 54 * Prior to Scilab 5.2:
49 * C2F(cwritemat)(variableName, &rowA, &colA, A,strlen(variableName)); 55 * C2F(cwritemat)(variableName, &rowA, &colA, A,strlen(variableName));
@@ -63,11 +69,17 @@ int main(void)
63 double B[] = {1,3,4,9,2,8,3,2}; /* Declare the matrix */ 69 double B[] = {1,3,4,9,2,8,3,2}; /* Declare the matrix */
64 int rowB = 2, colB = 4; /* Size of the matrix */ 70 int rowB = 2, colB = 4; /* Size of the matrix */
65 char variableNameB[] = "B"; 71 char variableNameB[] = "B";
72 SciErr sciErr;
66 73
67 /* 74 /*
68 * Write it into Scilab's memory 75 * Write it into Scilab's memory
69 */ 76 */
70 createNamedMatrixOfDouble(pvApiCtx,variableNameB,rowB,colB, B); 77 createNamedMatrixOfDouble(pvApiCtx,variableNameB,rowB,colB, B);
78 if(sciErr.iErr)
79 {
80 printError(&sciErr, 0);
81 }
82
71 /* 83 /*
72 * Prior to Scilab 5.2: 84 * Prior to Scilab 5.2:
73 * C2F(cwritemat)(variableNameB, &rowB, &colB, B, strlen(variableNameB)); 85 * C2F(cwritemat)(variableNameB, &rowB, &colB, B, strlen(variableNameB));
@@ -87,9 +99,15 @@ int main(void)
87 double *matrixOfDouble = NULL; 99 double *matrixOfDouble = NULL;
88 100
89 char variableToBeRetrieved[]="A"; 101 char variableToBeRetrieved[]="A";
102 SciErr sciErr;
90 103
91 /* First, retrieve the size of the matrix */ 104 /* First, retrieve the size of the matrix */
92 readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, NULL); 105 sciErr = readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, NULL);
106 if(sciErr.iErr)
107 {
108 printError(&sciErr, 0);
109 }
110
93 /* 111 /*
94 * Prior to Scilab 5.2: 112 * Prior to Scilab 5.2:
95 * C2F(cmatptr)(variableToBeRetrieved, &rowA_, &colA_, &lp, strlen(variableToBeRetrieved)); 113 * C2F(cmatptr)(variableToBeRetrieved, &rowA_, &colA_, &lp, strlen(variableToBeRetrieved));
@@ -100,7 +118,12 @@ int main(void)
100 matrixOfDouble=(double*)malloc((rowA_*colA_)*sizeof(double)); 118 matrixOfDouble=(double*)malloc((rowA_*colA_)*sizeof(double));
101 119
102 /* Load the matrix */ 120 /* Load the matrix */
103 readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, matrixOfDouble); 121 sciErr = readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrieved, &rowA_, &colA_, matrixOfDouble);
122 if(sciErr.iErr)
123 {
124 printError(&sciErr, 0);
125 }
126
104 /* 127 /*
105 * Prior to Scilab 5.2: 128 * Prior to Scilab 5.2:
106 * C2F(creadmat)(variableToBeRetrieved,&rowA_,&colA_,matrixOfDouble,strlen(variableToBeRetrieved) ); 129 * C2F(creadmat)(variableToBeRetrieved,&rowA_,&colA_,matrixOfDouble,strlen(variableToBeRetrieved) );
@@ -128,9 +151,15 @@ int main(void)
128 int i = 0, j = 0; 151 int i = 0, j = 0;
129 152
130 char variableToBeRetrievedB[] = "B"; 153 char variableToBeRetrievedB[] = "B";
154 SciErr sciErr;
131 155
132 /* First, retrieve the size of the matrix */ 156 /* First, retrieve the size of the matrix */
133 readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL); 157 sciErr = readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL);
158 if(sciErr.iErr)
159 {
160 printError(&sciErr, 0);
161 }
162
134 /* 163 /*
135 * Prior to Scilab 5.2: 164 * Prior to Scilab 5.2:
136 * C2F(cmatptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB)); 165 * C2F(cmatptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB));
@@ -141,7 +170,12 @@ int main(void)
141 matrixOfDoubleB = (double*)malloc((rowB_*colB_)*sizeof(double)); 170 matrixOfDoubleB = (double*)malloc((rowB_*colB_)*sizeof(double));
142 171
143 /* Load the matrix */ 172 /* Load the matrix */
144 readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfDoubleB); 173 sciErr = readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfDoubleB);
174 if(sciErr.iErr)
175 {
176 printError(&sciErr, 0);
177 }
178
145 /* 179 /*
146 * Prior to Scilab 5.2: 180 * Prior to Scilab 5.2:
147 * C2F(creadmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfDoubleB,strlen(variableToBeRetrievedB) ); 181 * C2F(creadmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfDoubleB,strlen(variableToBeRetrievedB) );
diff --git a/scilab/modules/call_scilab/examples/basicExamples/readwritestring.c b/scilab/modules/call_scilab/examples/basicExamples/readwritestring.c
index 929bae9..58dec52 100644
--- a/scilab/modules/call_scilab/examples/basicExamples/readwritestring.c
+++ b/scilab/modules/call_scilab/examples/basicExamples/readwritestring.c
@@ -40,9 +40,15 @@ int main(void)
40 myMatrixOfString[0]="my Message"; 40 myMatrixOfString[0]="my Message";
41 myMatrixOfString[1]="on two lines"; 41 myMatrixOfString[1]="on two lines";
42 char variableName[] = "A"; 42 char variableName[] = "A";
43 SciErr sciErr;
43 44
44 /* Write it into Scilab's memory */ 45 /* Write it into Scilab's memory */
45 createNamedMatrixOfString(pvApiCtx, variableName, row, col, myMatrixOfString); 46 sciErr = createNamedMatrixOfString(pvApiCtx, variableName, row, col, myMatrixOfString);
47 if(sciErr.iErr)
48 {
49 printError(&sciErr, 0);
50 }
51
46 /* 52 /*
47 * Prior to Scilab 5.2 53 * Prior to Scilab 5.2
48 * C2F(cwritechain)(variableName, &sizeOfMyString , myString, strlen(variableName), sizeOfMyString); 54 * C2F(cwritechain)(variableName, &sizeOfMyString , myString, strlen(variableName), sizeOfMyString);
@@ -64,12 +70,19 @@ int main(void)
64 int row = 2, col = 2; /* Size of the matrix */ 70 int row = 2, col = 2; /* Size of the matrix */
65 /* Declare the string */ 71 /* Declare the string */
66 char **myMatrixOfStringB = (char**)malloc(sizeof(char*) * row * col); 72 char **myMatrixOfStringB = (char**)malloc(sizeof(char*) * row * col);
73 SciErr sciErr;
74
67 myMatrixOfStringB[0]="My"; 75 myMatrixOfStringB[0]="My";
68 myMatrixOfStringB[1]="String"; 76 myMatrixOfStringB[1]="String";
69 myMatrixOfStringB[2]="Great"; 77 myMatrixOfStringB[2]="Great";
70 myMatrixOfStringB[3]=";)"; 78 myMatrixOfStringB[3]=";)";
71 char variableNameB[] = "B"; 79 char variableNameB[] = "B";
72 createNamedMatrixOfString(pvApiCtx, variableNameB, row, col, myMatrixOfStringB); 80 sciErr = createNamedMatrixOfString(pvApiCtx, variableNameB, row, col, myMatrixOfStringB);
81 if(sciErr.iErr)
82 {
83 printError(&sciErr, 0);
84 }
85
73 86
74 printf("\n"); 87 printf("\n");
75 printf("Display from Scilab of B:\n"); 88 printf("Display from Scilab of B:\n");
@@ -87,19 +100,35 @@ int main(void)
87 int* piAddr = NULL; 100 int* piAddr = NULL;
88 int* piLen = NULL; 101 int* piLen = NULL;
89 char** pstData = NULL; 102 char** pstData = NULL;
103 SciErr sciErr;
90 104
91 //fisrt call to retrieve dimensions 105 //fisrt call to retrieve dimensions
92 readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved,&iRows, &iCols, NULL, NULL); 106 sciErr = readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved,&iRows, &iCols, NULL, NULL);
107 if(sciErr.iErr)
108 {
109 printError(&sciErr, 0);
110 }
111
93 piLen = (int*)malloc(sizeof(int) * iRows * iCols); 112 piLen = (int*)malloc(sizeof(int) * iRows * iCols);
94 //second call to retrieve length of each string 113 //second call to retrieve length of each string
95 readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved, &iRows, &iCols, piLen, NULL); 114 sciErr = readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved, &iRows, &iCols, piLen, NULL);
115 if(sciErr.iErr)
116 {
117 printError(&sciErr, 0);
118 }
119
96 pstData = (char**)malloc(sizeof(char*) * iRows * iCols); 120 pstData = (char**)malloc(sizeof(char*) * iRows * iCols);
97 for(i = 0 ; i < iRows * iCols ; i++) 121 for(i = 0 ; i < iRows * iCols ; i++)
98 { 122 {
99 pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination 123 pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination
100 } 124 }
101 //third call to retrieve data 125 //third call to retrieve data
102 readNamedMatrixOfString(pvApiCtx, variableToBeRetrieved, &iRows, &iCols, piLen, pstData); 126 sciErr = readNamedMatrixOfString(pvApiCtx, variableToBeRetrieved, &iRows, &iCols, piLen, pstData);
127 if(sciErr.iErr)
128 {
129 printError(&sciErr, 0);
130 }
131
103 132
104 printf("\n"); 133 printf("\n");
105 printf("Load and display of A:\n"); 134 printf("Load and display of A:\n");
@@ -133,19 +162,35 @@ int main(void)
133 int* piAddr = NULL; 162 int* piAddr = NULL;
134 int* piLen = NULL; 163 int* piLen = NULL;
135 char** pstData = NULL; 164 char** pstData = NULL;
165 SciErr sciErr;
136 166
137 //fisrt call to retrieve dimensions 167 //fisrt call to retrieve dimensions
138 readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved,&iRows, &iCols, NULL, NULL); 168 sciErr = readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved,&iRows, &iCols, NULL, NULL);
169 if(sciErr.iErr)
170 {
171 printError(&sciErr, 0);
172 }
173
139 piLen = (int*)malloc(sizeof(int) * iRows * iCols); 174 piLen = (int*)malloc(sizeof(int) * iRows * iCols);
140 //second call to retrieve length of each string 175 //second call to retrieve length of each string
141 readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved, &iRows, &iCols, piLen, NULL); 176 sciErr = readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved, &iRows, &iCols, piLen, NULL);
177 if(sciErr.iErr)
178 {
179 printError(&sciErr, 0);
180 }
181
142 pstData = (char**)malloc(sizeof(char*) * iRows * iCols); 182 pstData = (char**)malloc(sizeof(char*) * iRows * iCols);
143 for(i = 0 ; i < iRows * iCols ; i++) 183 for(i = 0 ; i < iRows * iCols ; i++)
144 { 184 {
145 pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination 185 pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination
146 } 186 }
147 //third call to retrieve data 187 //third call to retrieve data
148 readNamedMatrixOfString(pvApiCtx, variableToBeRetrieved, &iRows, &iCols, piLen, pstData); 188 sciErr = readNamedMatrixOfString(pvApiCtx, variableToBeRetrieved, &iRows, &iCols, piLen, pstData);
189 if(sciErr.iErr)
190 {
191 printError(&sciErr, 0);
192 }
193
149 194
150 printf("\n"); 195 printf("\n");
151 printf("Load and display of B:\n"); 196 printf("Load and display of B:\n");
diff --git a/scilab/modules/call_scilab/help/en_US/BooleanManagement.xml b/scilab/modules/call_scilab/help/en_US/BooleanManagement.xml
index fdfd7fe..49048ef 100644
--- a/scilab/modules/call_scilab/help/en_US/BooleanManagement.xml
+++ b/scilab/modules/call_scilab/help/en_US/BooleanManagement.xml
@@ -55,9 +55,15 @@
55int B[]={0,0,0,0,1,0,0,1}; /* Declare the matrix */ 55int B[]={0,0,0,0,1,0,0,1}; /* Declare the matrix */
56int rowB=2, colB=4; /* Size of the matrix */ 56int rowB=2, colB=4; /* Size of the matrix */
57char variableNameB[] = "B"; 57char variableNameB[] = "B";
58SciErr sciErr;
58 59
59/* Write it into Scilab's memory */ 60/* Write it into Scilab's memory */
60createNamedMatrixOfBoolean(pvApiCtx, variableNameB, rowB, colB, B); 61sciErr = createNamedMatrixOfBoolean(pvApiCtx, variableNameB, rowB, colB, B);
62if(sciErr.iErr)
63{
64 printError(&sciErr, 0);
65}
66
61/* 67/*
62 * Prior to Scilab 5.2: 68 * Prior to Scilab 5.2:
63 * C2F(cwritebmat)(variableNameB, &rowB, &colB, B, strlen(variableNameB)); 69 * C2F(cwritebmat)(variableNameB, &rowB, &colB, B, strlen(variableNameB));
@@ -74,9 +80,14 @@ int i = 0, j = 0;
74int *matrixOfBooleanB = NULL; /* Int instead of double */ 80int *matrixOfBooleanB = NULL; /* Int instead of double */
75 81
76char variableToBeRetrievedB[] = "B"; 82char variableToBeRetrievedB[] = "B";
77 83SciErr sciErr;
78/* First, retrieve the size of the matrix */ 84/* First, retrieve the size of the matrix */
79readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL); 85sciErr = readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL);
86if(sciErr.iErr)
87{
88 printError(&sciErr, 0);
89}
90
80/* 91/*
81 * Prior to Scilab 5.2: 92 * Prior to Scilab 5.2:
82 * C2F(cmatbptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB)); 93 * C2F(cmatbptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB));
@@ -86,7 +97,12 @@ readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL)
86matrixOfBooleanB=(int*)malloc((rowB_*colB_)*sizeof(int)); 97matrixOfBooleanB=(int*)malloc((rowB_*colB_)*sizeof(int));
87 98
88/* Load the matrix */ 99/* Load the matrix */
89readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfBooleanB); 100sciErr = readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfBooleanB);
101if(sciErr.iErr)
102{
103 printError(&sciErr, 0);
104}
105
90/* 106/*
91 * Prior to Scilab 5.2: 107 * Prior to Scilab 5.2:
92 * C2F(creadbmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfBooleanB,strlen(variableToBeRetrievedB) ); 108 * C2F(creadbmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfBooleanB,strlen(variableToBeRetrievedB) );
diff --git a/scilab/modules/call_scilab/help/en_US/ComplexManagement.xml b/scilab/modules/call_scilab/help/en_US/ComplexManagement.xml
index 25126c9..7974c7e 100644
--- a/scilab/modules/call_scilab/help/en_US/ComplexManagement.xml
+++ b/scilab/modules/call_scilab/help/en_US/ComplexManagement.xml
@@ -64,9 +64,14 @@ double B_img[]={1,0.233,-1,-0.2,0.5,42,-23,123}; /* Declare the matrix */
64 64
65int rowB=2, colB=4; /* Size of the matrix */ 65int rowB=2, colB=4; /* Size of the matrix */
66char variableNameB[] = "B"; 66char variableNameB[] = "B";
67SciErr sciErr;
67 68
68/* Write it into Scilab's memory */ 69/* Write it into Scilab's memory */
69createNamedComplexMatrixOfDouble(pvApiCtx,variableNameB,rowB,colB, B, B_img); 70sciErr = createNamedComplexMatrixOfDouble(pvApiCtx,variableNameB,rowB,colB, B, B_img);
71if(sciErr.iErr)
72{
73 printError(&sciErr, 0);
74}
70 75
71/* 76/*
72 * Prior to Scilab 5.2: 77 * Prior to Scilab 5.2:
@@ -84,9 +89,14 @@ int i = 0,j = 0;
84double *matrixOfComplexB = NULL; 89double *matrixOfComplexB = NULL;
85double *matrixOfComplexB_img = NULL; 90double *matrixOfComplexB_img = NULL;
86char variableToBeRetrievedB[] = "B"; 91char variableToBeRetrievedB[] = "B";
92SciErr sciErr;
87 93
88/* First, retrieve the size of the matrix */ 94/* First, retrieve the size of the matrix */
89readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL, NULL); 95readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL, NULL);
96if(sciErr.iErr)
97{
98 printError(&sciErr, 0);
99}
90 100
91/* 101/*
92 * Prior to Scilab 5.2: 102 * Prior to Scilab 5.2:
@@ -98,7 +108,12 @@ matrixOfComplexB = (double*)malloc((rowB_*colB_)*sizeof(double));
98matrixOfComplexB_img = (double*)malloc((rowB_*colB_)*sizeof(double)); 108matrixOfComplexB_img = (double*)malloc((rowB_*colB_)*sizeof(double));
99 109
100/* Load the matrix */ 110/* Load the matrix */
101readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfComplexB, matrixOfComplexB_img); 111sciErr = readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfComplexB, matrixOfComplexB_img);
112if(sciErr.iErr)
113{
114 printError(&sciErr, 0);
115}
116
102 117
103/* 118/*
104 * Prior to Scilab 5.2: 119 * Prior to Scilab 5.2:
diff --git a/scilab/modules/call_scilab/help/en_US/DoubleManagement.xml b/scilab/modules/call_scilab/help/en_US/DoubleManagement.xml
index 4437cf0..b96e81a 100644
--- a/scilab/modules/call_scilab/help/en_US/DoubleManagement.xml
+++ b/scilab/modules/call_scilab/help/en_US/DoubleManagement.xml
@@ -58,11 +58,17 @@
58double B[] = {1,3,4,9,2,8,3,2}; /* Declare the matrix */ 58double B[] = {1,3,4,9,2,8,3,2}; /* Declare the matrix */
59int rowB = 2, colB = 4; /* Size of the matrix */ 59int rowB = 2, colB = 4; /* Size of the matrix */
60char variableNameB[] = "B"; 60char variableNameB[] = "B";
61SciErr sciErr;
61 62
62/* 63/*
63 * Write it into Scilab's memory 64 * Write it into Scilab's memory
64 */ 65 */
65createNamedMatrixOfDouble(pvApiCtx,variableNameB,rowB,colB, B); /* pvApiCtx is a global variable */ 66sciErr = createNamedMatrixOfDouble(pvApiCtx,variableNameB,rowB,colB, B); /* pvApiCtx is a global variable */
67if(sciErr.iErr)
68{
69 printError(&sciErr, 0);
70}
71
66/* 72/*
67 * Prior to Scilab 5.2: 73 * Prior to Scilab 5.2:
68 * C2F(cwritemat)(variableNameB, &rowB, &colB, B, strlen(variableNameB)); 74 * C2F(cwritemat)(variableNameB, &rowB, &colB, B, strlen(variableNameB));
@@ -79,10 +85,15 @@ int rowB_ = 0, colB_ = 0, lp_ = 0;
79double *matrixOfDoubleB = NULL; 85double *matrixOfDoubleB = NULL;
80int i = 0, j = 0; 86int i = 0, j = 0;
81char variableToBeRetrievedB[] = "B"; 87char variableToBeRetrievedB[] = "B";
82 88SciErr sciErr;
83 89
84/* First, retrieve the size of the matrix */ 90/* First, retrieve the size of the matrix */
85readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL); 91sciErr = readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL);
92if(sciErr.iErr)
93{
94 printError(&sciErr, 0);
95}
96
86/* 97/*
87 * Prior to Scilab 5.2: 98 * Prior to Scilab 5.2:
88 * C2F(cmatptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB)); 99 * C2F(cmatptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB));
@@ -93,7 +104,12 @@ readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL);
93matrixOfDoubleB = (double*)malloc((rowB_*colB_)*sizeof(double)); 104matrixOfDoubleB = (double*)malloc((rowB_*colB_)*sizeof(double));
94 105
95/* Load the matrix */ 106/* Load the matrix */
96readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfDoubleB); 107sciErr = readNamedMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfDoubleB);
108if(sciErr.iErr)
109{
110 printError(&sciErr, 0);
111}
112
97/* 113/*
98 * Prior to Scilab 5.2: 114 * Prior to Scilab 5.2:
99 * C2F(creadmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfDoubleB,strlen(variableToBeRetrievedB) ); 115 * C2F(creadmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfDoubleB,strlen(variableToBeRetrievedB) );
diff --git a/scilab/modules/call_scilab/help/en_US/StringManagement.xml b/scilab/modules/call_scilab/help/en_US/StringManagement.xml
index fa00614..499cb55 100644
--- a/scilab/modules/call_scilab/help/en_US/StringManagement.xml
+++ b/scilab/modules/call_scilab/help/en_US/StringManagement.xml
@@ -54,9 +54,15 @@ int row = 1, col = 1; /* Size of the matrix */
54char **myMatrixOfString = (char**)malloc(sizeof(char*) * row * col); 54char **myMatrixOfString = (char**)malloc(sizeof(char*) * row * col);
55myMatrixOfString[0]="my Message"; 55myMatrixOfString[0]="my Message";
56char variableName[] = "A"; 56char variableName[] = "A";
57SciErr sciErr;
57 58
58/* Write it into Scilab's memory */ 59/* Write it into Scilab's memory */
59createNamedMatrixOfString(pvApiCtx, variableName, row, col, myMatrixOfString); 60sciErr = createNamedMatrixOfString(pvApiCtx, variableName, row, col, myMatrixOfString);
61if(sciErr.iErr)
62{
63 printError(&sciErr, 0);
64}
65
60/* 66/*
61 * Prior to Scilab 5.2 67 * Prior to Scilab 5.2
62 * C2F(cwritechain)(variableName, &sizeOfMyString , myString, strlen(variableName), sizeOfMyString); 68 * C2F(cwritechain)(variableName, &sizeOfMyString , myString, strlen(variableName), sizeOfMyString);
@@ -78,19 +84,34 @@ int i,j;
78int* piAddr = NULL; 84int* piAddr = NULL;
79int* piLen = NULL; 85int* piLen = NULL;
80char** pstData = NULL; 86char** pstData = NULL;
87SciErr sciErr;
81 88
82//fisrt call to retrieve dimensions 89//fisrt call to retrieve dimensions
83readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved,&iRows, &iCols, NULL, NULL); 90sciErr = readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved,&iRows, &iCols, NULL, NULL);
91if(sciErr.iErr)
92{
93 printError(&sciErr, 0);
94}
95
84piLen = (int*)malloc(sizeof(int) * iRows * iCols); 96piLen = (int*)malloc(sizeof(int) * iRows * iCols);
85//second call to retrieve length of each string 97//second call to retrieve length of each string
86readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved, &iRows, &iCols, piLen, NULL); 98sciErr = readNamedMatrixOfString(pvApiCtx,variableToBeRetrieved, &iRows, &iCols, piLen, NULL);
99if(sciErr.iErr)
100{
101 printError(&sciErr, 0);
102}
103
87pstData = (char**)malloc(sizeof(char*) * iRows * iCols); 104pstData = (char**)malloc(sizeof(char*) * iRows * iCols);
88for(i = 0 ; i < iRows * iCols ; i++) 105for(i = 0 ; i < iRows * iCols ; i++)
89 { 106 {
90 pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination 107 pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination
91 } 108 }
92//third call to retrieve data 109//third call to retrieve data
93readNamedMatrixOfString(pvApiCtx, variableToBeRetrieved, &iRows, &iCols, piLen, pstData); 110sciErr = readNamedMatrixOfString(pvApiCtx, variableToBeRetrieved, &iRows, &iCols, piLen, pstData);
111if(sciErr.iErr)
112{
113 printError(&sciErr, 0);
114}
94 115
95printf("\n"); 116printf("\n");
96printf("Load and display of A:\n"); 117printf("Load and display of A:\n");