Localization in English - Standard messages
Data type naming
Data type in Scilab code (see function typeof) |
Data type in stack-c.h |
Data type in stackTypeVariable.h |
Type name for messages |
1x1 value |
1xn value |
nx1 value |
mxn value |
type() |
constant |
sci_matrix |
MATRIX_OF_DOUBLE_DATATYPE |
Real or complex array /matrix |
A real or complex |
Real or Complex row vector |
Real or Complex column vector |
Real or Complex matrix |
1 |
polynomial |
sci_poly |
MATRIX_OF_POLYNOMIAL_DATATYPE |
Polynomial array/matrix |
A polynom |
Real or complex row vector of polynomials |
Real or complex column vector of polynomials |
Real of complex matrix of polynomials |
2 |
boolean |
sci_boolean |
MATRIX_OF_BOOLEAN_DATATYPE |
Boolean array/matrix |
A |
Boolean row vector |
Boolean column vector |
Boolean matrix |
4 |
sparse |
sci_sparse |
SPARSE_MATRIX_DATATYPE |
Sparse real or complex array /matrix |
??? |
Sparse real or complex row vector |
Sparse real or complex column vector |
Sparse real or complex matrix |
5 |
boolean sparse |
sci_boolean_sparse |
??? |
Boolean sparse array /matrix |
??? |
Sparse boolean row vector |
Sparse boolean coliumn vector |
Sparse boolean matrix |
6 |
Matlab sparse |
sci_matlab_sparse |
??? |
Matlab sparse real or complex array /matrix |
??? |
Matlab Sparse real or complex row vector |
Matlab Sparse real or complex column vector |
Matlab Sparse matrix |
7 |
int(8|16|32|64) |
sci_ints |
MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE |
(8|16|32|64)-bit integerarray /matrix |
A (8|16|32|64)-bit integer |
(8|16|32|64)-bit integer row vector |
(8|16|32|64)-bit integer column vector |
(8|16|32|64)-bit integer matrix |
8 |
uint(8|16|32|64) |
sci_ints |
MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE |
(8|16|32|64)-bit unsigned integerarray /matrix |
A (8|16|32|64)-bit unsigned integer |
(8|16|32|64)-bit unsigned integer row vector |
(8|16|32|64)-bit unsigned integer column vector |
(8|16|32|64)-bit unsigned integer matrix |
8 |
handle |
sci_handles |
GRAPHICAL_HANDLE_DATATYPE |
Graphic handle array |
A graphic handle |
Graphic handle row array |
Graphic handle column array |
Graphic handle 2D array |
9 |
string |
sci_strings |
STRING_DATATYPE/MATRIX_OF_STRING_DATATYPE |
Character string array |
A string |
Row array of strings |
Column array of strings |
2D array of strings |
10 |
function (not-compiled) |
sci_u_function |
-- DOES NOT EXIST -- |
Uncompiled function |
??? |
??? |
??? |
??? |
11 |
function (compiled) |
sci_c_function |
-- DOES NOT EXIST -- |
Function |
??? |
??? |
??? |
??? |
13 |
library |
sci_lib |
-- DOES NOT EXIST -- |
Library?? |
??? |
??? |
??? |
??? |
14 |
list |
sci_list |
LIST_DATATYPE |
List |
1-item list |
N-item list |
N-item list |
-- DOES NOT EXIST -- |
15 |
tlist |
sci_tlist |
TYPED_LIST_DATATYPE |
Typed list |
??? |
??? |
??? |
??? |
16 |
rational |
-- DOES NOT EXIST -- |
-- DOES NOT EXIST -- |
Matrix of rational fractions or transfer function |
A rational fraction or a transfer function (depending on context) |
Row vector of rational fractions or Single output transfer function |
Column vector of rational fractions or Single input transfer function |
Matrix of rational fractions or MIMIO transfer function |
16/r |
state-space |
-- DOES NOT EXIST -- |
-- DOES NOT EXIST -- |
State-space representation |
A SISO state space system |
SIMO state space system |
MiSO state space system |
MiMO state space system |
16/lss |
mlist |
sci_mlist |
MATRIX_ORIENTED_TYPED_LIST_DATATYPE |
M-list |
??? |
??? |
??? |
??? |
17 |
hypermat |
-- DOES NOT EXIST -- |
-- DOES NOT EXIST -- |
N-dimensional array |
??? |
??? |
??? |
??? |
17/hm |
st |
-- DOES NOT EXIST -- |
-- DOES NOT EXIST -- |
Struct |
A 1-by-1 struct |
A 1-by-n struct |
A m-by-1 struct |
A m-by-n struct |
17/st |
ce |
-- DOES NOT EXIST -- |
-- DOES NOT EXIST -- |
Cell array |
A 1-by-1 cell |
A 1-by-n cell array |
A m-by-1 cell array |
A m-by-n cell array |
17/ce |
pointer |
sci_lufact_pointer |
EXTERNAL_DATATYPE |
Pointer on LU factorization |
??? |
??? |
??? |
??? |
??? |
Checking in C code
1 // Check type
2 if (VarType(1)!=sci_matrix)
3 {
4 Scierror(999, "%s: Argument %d: String(s) expected.\n", "myfunction", 1);
5 return FALSE;
6 }
7 GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &nbRow, &nbCol, &stkAdr);
8 // Check size
9 if (nbRow*nbCol!=1)
10 {
11 Scierror(999, "%s: Argument #%d: %d-by-%d matrix expected.\n", "myfunction", 1, 1, 1);
12 return FALSE;
13 }
Checking in Scilab code
General framework
- check the number of input and output arguments
- check content type (if simple): Boolean, Encoded integers, Integers, Decimals, Complexes, Polynomial, Rational, String
- check container type (otherwise): Cell, Structure, List, T-List, M-List
- check container dimensions/sizes/shape: Empty, Scalar, Vector, Row, Column, Matrix, Array, ND-hypermatrix, ND-array, m-by-n Array, s1-by-s2-by..-by-sN Hyper-array
- check encoding: Sparse, Dense, Encoded integers of type ??, Not-complex numbers
- check value: e.g. greater than 9, in the set {1,2,3}, integer value
1 // 0. Check number of arguments
2 [lhs, rhs] = argn();
3 if 2 > rhs | rhs > 6 then
4 msg = _("%s: Wrong number of input arguments: %d to %d expected.\n")
5 error(msprintf(msg, "myfunction", 2, 6));
6 end
7 if lhs>2 then
8 msg = _("%s: Wrong number of output arguments: %d expected.\n")
9 error(msprintf(msg, "myfunction", 1));
10 end
11 // 1. Check container type
12 if typeof(myvariable)<>"st" then
13 msg = _("%s: Argument %d: Structure expected.\n")
14 error(sprintf(msg, "myfunction", 1));
15 end
16 // 2. Check container size
17 if size(myvariable, "*")<>1 then
18 msg = _("%s: Argument #%d: %d-by-%d array expected.\n")
19 error(sprintf(msg, "myfunction" , 1, 1, 1));
20 end
21 // 3. Check content type
22 if isreal(myvariable) then
23 msg = _("%s: Argument #%d: Complex numbers expected.\n")
24 error(sprintf(msg, "myfunction" , 1, 1, 1));
25 end
26 // 4. Check value
27 if or(myvariable<0) then
28 msg = _("%s: Argument #%d: Must be > %d.\n")
29 error(sprintf(msg, "myfunction" , 1, 0));
30 end
Error messages
Argument number checking
Input arguments:
"%s: Wrong number of input arguments.\n" "%s: Wrong number of input arguments: %d expected.\n" "%s: Wrong number of input arguments: %d or %d expected.\n" "%s: Wrong number of input arguments: %d to %d expected.\n" "%s: Wrong number of input arguments: At least %d expected.\n" "%s: Wrong number of input arguments: At most %d expected.\n"
Output arguments:
"%s: Wrong number of output arguments: %d expected.\n" "%s: Wrong number of output arguments: %d to %d expected.\n"
Checking container and content types
The error messages are gathered in 4 or 5 categories that are presented below. Each error message should start with a %s containing the name of the Scilab function, when it is known.
// Wrong content type: "%s: Argument #%d: Boolean(s) expected.\n" "%s: Argument #%d: Encoded integer(s) expected.\n" "%s: Argument #%d: Encoded integer(s) of type (%s) expected.\n" "%s: Argument #%d: Integer(s) expected.\n" // integer-encoded or decimal-encoded "%s: Argument #%d: Decimal integer(s) expected.\n" "%s: Argument #%d: Decimal number(s) expected.\n" "%s: Argument #%d: Decimal or complex number(s) expected.\n" "%s: Argument #%d: Complex number(s) expected.\n" "%s: Argument #%d: Complex numbers not supported.\n" "%s: Argument #%d: Polynomial(s) expected.\n" "%s: Argument #%d: Rational fraction(s) expected.\n" "%s: Argument #%d: Polynomial(s) or rational(s) expected.\n" "%s: Argument #%d: Real polynomial(s) expected.\n" "%s: Argument #%d: Real rational(s) expected.\n" "%s: Argument #%d: Text(s) expected.\n" "%s: Argument #%d: Graphic handle(s) expected.\n" "%s: Argument #%d: Graphic handle(s) of type ""%s"" expected.\n" "%s: Argument #%d: Function expected.\n" "%s: Argument #%d: Transfer function expected.\n" "%s: Argument #%d: Linear state space expected.\n" "%s: Argument #%d: %s expected.\n" "%s: Type %s is not implemented.\n" "Function not defined for given argument type(s),\n Check arguments or define the overloading function %s().\n"
// Wrong container: "%s: Argument #%d: List expected.\n" "%s: Argument #%d: Cell expected.\n" "%s: Argument #%d: Structure expected.\n" "%s: Argument #%d: M-list expected.\n" "%s: Argument #%d: T-list of type %s expected.\n" "%s: Argument #%d: %s expected.\n"
// Wrong encoding: "%s: Argument #%d: Sparse matrix expected.\n" "%s: Argument #%d: Dense matrix expected.\n"
Checking container's dimension and sizes
Dimensions / sizes / shape of the container:
- "array" applies to Cells and Structures
- "Scalar", "Row", "Column" apply to matrices as well as to other arrays (Cells and Structures)
// Wrong dimension / sizes / shape for input argument: "%s: Argument #%d: Empty matrix expected.\n" "%s: Argument #%d: Scalar (1 element) expected.\n" "%s: Argument #%d: Row expected.\n" "%s: Argument #%d: Column expected.\n" "%s: Argument #%d: Vector expected.\n" "%s: Argument #%d: Row with %d elements expected.\n" "%s: Argument #%d: Column with %d elements expected.\n" "%s: Argument #%d: Vector with %d elements expected.\n" "%s: Argument #%d: Matrix expected.\n" "%s: Argument #%d: Square matrix expected.\n" "%s: Argument #%d: %d-by-%d matrix expected.\n" "%s: Argument #%d: Matrix with %d rows expected.\n" "%s: Argument #%d: Matrix with %d columns expected.\n" "%s: Argument #%d: Matrix with %s rows expected.\n" // %s is more general ; it could be used for a range "%s: Argument #%d: Matrix with %s columns expected.\n" // idem "%s: Argument #%d: 2D-array expected.\n" "%s: Argument #%d: Hypermatrix expected.\n" "%s: Argument #%d: %dD hypermatrix expected.\n" "%s: Argument #%d: %dD array expected.\n" "%s: Argument #%d: %d-element list expected.\n" "%s: Argument #%d: List of %d to %d elements expected.\n" "%s: Argument #%d: %s expected.\n" "%s: Implicit size not supported.\n" "%s: Hypermatrix not supported.\n"
Strings
"%s: Argument #%d: string length %s %d characters expected.\n" // %s= '='|'>'|'>='|'<' ...etc
Checking value
Wrong values:
"%s: Argument #%d: Must be in the interval [%s, %s].\n" "%s: Argument #%d: Must be in the interval [%d, %d].\n" "%s: Argument #%d: Must be in the interval %s.\n" "%s: Argument #%d: Must be < %d.\n" "%s: Argument #%d: Must be > %d.\n" "%s: Argument #%d: Must be <= %d.\n" "%s: Argument #%d: Must be >= %d.\n" "%s: Argument #%d: ""%s"" expected .\n" "%s: Argument #%d: Must be in the set {%s}.\n" "%s: Argument #%d: Non-negative integers expected.\n" "%s: Argument #%d: Elements must be in increasing order.\n" "%s: Argument #%d: Elements must be in decreasing order.\n" "%s: Argument #%d: Elements must be in strictly increasing order.\n" "%s: Argument #%d: Elements must be in strictly decreasing order.\n" "%s: Argument #%d: An integer value expected.\n" "%s: Argument #%d: Wrong type of graphic handle: ''%s'' expected.\n" "%s: Argument #%d: Wrong color specification.\n" "%s: Argument #%d: Unknown or unexpected property name ''%s''.\n"
Notice that the error message for intervals is special: any type of interval like [[#,|[#, #]] ] (#, #] [[#,|[#, #) (#, #) (-oo, #]]] [#, oo), etc can be conveniently specified within the same generic message. Bounds formatting and replacement must be performed with msprintf(..)
Inter-Arguments constraints checking
"%s: Arguments #%d and #%d: Incompatible sizes.\n" "%s: Arguments #%d and #%d: Same sizes expected.\n" "%s: Arguments #%d and #%d: Same numbers of columns expected.\n" "%s: Arguments #%d and #%d: Same numbers of rows expected.\n" "%s: Arguments #%d and #%d: Same numbers of elements expected.\n" "%s: Arguments #%d and #%d: Same types expected.\n"
Memory
Not enough memory:
"%s: No more memory.\n" "%s: stack size exceeded (Use stacksize function to increase it).\n" "%s: No more memory %d requested, %d available.\n" "%s: Too small stack %d requested, %d available.\n"
Feature
We don't have the feature but this could be implemented in the future:
"%s: Non implemented feature.\n" "%s: This feature is not implemented: Variable translation of type %s.\n"
File, Directory
"%s: Cannot open file %s.\n" "%s: The file %s does not exist.\n" "%s: Error while copying the file ""%s"" to the directory ""%s"".\n" "%s: The file %s doesn''t exist or is not read accessible.\n" "%s: The file ""%s"" cannot be written.\n" "%s: The file ""%s"" is not well formated at line %d\n" "%s: Cannot close file %s.\n"
Miscellaneous
"%s: Inconsistent addition.\n" "%s: Inconsistent multiplication.\n" "%s: The problem is singular.\n" "%s: Division by 0...\n" "%s: Invalid index.\n" "%s: Incorrect assignment.\n" "%s: Undefined variable %s.\n" "%s: Eye variable undefined in this context.\n" "%s: ""%s"" expected instead of ""%s"".\n" "%s: Argument #%d: Undefined time domain.\n" "%s: Wrong argument #%d.\n"