[Scilab-Dev] Re: [Scilab-loc] Double value and single value in gui.pot
Yung-Jang Lee
yjlee123 at gmail.com
Tue May 27 18:50:26 CEST 2008
Wait ,
You have defined MATRIX_OF_DOUBLE_DATATYPE and MATRIX_OF_COMPLEX_DATATYPE in
stackTypeVariable.h which are used for calling F77 code,
----------------------------------------------------------------
#define MATRIX_OF_DOUBLE_DATATYPE "d"
#define MATRIX_OF_COMPLEX_DATATYPE "z"
#define MATRIX_OF_INTEGER_DATATYPE "i"
#define MATRIX_OF_RATIONAL_DATATYPE "r"
----------------------------------------------------------------
and then define sci_matrix , sci_poly .. in stack-c.h which are used for
scilab internal,
----------------------------------------------------------
typedef enum {
sci_matrix = 1 ,
sci_poly = 2 ,
sci_boolean = 4 ,
..
--------------------------------------------------------
And then I find statement in function overloadtype which is called by
getrhsvar, here all numeric type (double,integer,rational and complex)
are maped to sci_matrix
-------------------------------------------------
case 'd' : case 'i' : case 'r' : case 'z' : /* numeric */
ityp=sci_matrix;
-------------------------------------------------------------
Finally, in mexlib.c you use DOUBLEMATRIX to represent sci_matrix.
----------------------------------------------------
#define DOUBLEMATRIX sci_matrix
------------------------------------------------------
So DOUBLEMATRIX becomes union of {DOUBLE MATRIX,COMPLEX MATRIX, INTEGER
MATRIX...}
.
I think DOUBLEMATRIX defined in mexlib.c cause confusion and the second row
in table of 'data type nameing' in ScilabWiki page,
http://wiki.scilab.org/Localization_in_English_-_Standard_messages
should be changed to
constant : sci_matrix : -->a generic numeric type or
union of MATRIX_OF_DOUBLE_DATATYPE,
MATRIX_OF_COMPLEX_DATATYPE,
MATRIX_OF_INTEGER_DATATYPE
MATRIX_OF_RATIONAL_DATATYPE
, sci_matrix is not just MATRIX_OF_DOUBLE_DATATYPE.
I think change MATRIX_OF_DOUBLE_DATATYPE to MATRIX_OF_REAL_OR_COMPLEX
>
> _DATATYPE will cause trouble, because MATRIX_OF_DOUBLE_DATATYPE is used
> heavily in calling F77 code.
sci_matrix may has a generic name 'MATRIX_OF_NUMERIC_DATATYPE' and let
MATRIX_OF_DOUBLE_DATATYPE to a represent (double precision ) real matrix
just like its role in F77 code.
YungLee
2008/5/27 Sylvestre Ledru <sylvestre.ledru at inria.fr>:
> Hmmm, after a quick look with Vincent C. (who is also on this mailing
> list), we realize that, yes, 'MATRIX_OF_DOUBLE_DATATYPE' is badly
> choose name in the source. It is causing confusion in the code.
> We are going to rename it to something like
> MATRIX_OF_REAL_OR_COMPLEX_DATATYPE
> Any comments on this?
>
> > To avoid mistake, use 'a real' if it really need a real, 'real
> > matrix' if we need a real matrix or 'real or complex matrix' if we
> > need a generic data.
> Yep, we are reading all messages (you can imagine how sexy it is) and
> changing thme.
>
> Sylvestre
>
> PS: I c/c the dev mailing list since it is border-line.
>
> Le mardi 27 mai 2008 à 20:08 +0800, Yung-Jang Lee a écrit :
> > If we ever trace the code, (for example GUI\sci_gateway\c
> > \sci_delmenu.c)
> >
> >
> ------------------------------------------------------------------------------------------------------
> > // Unset a Menu a Scilab Graphic Window
> > if (VarType(1) != sci_matrix)
> > {
> > Scierror(999, _("%s: Wrong type for first input argument:
> > Double value expected.\n"),fname);
> > return FALSE;
> > }
> > GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &nbRow, &nbCol,
> > &stkAdr);
> >
> ------------------------------------------------------------------------------------------------------
> > 'Double value' always maps to 'MATRIX_OF_DOUBLE_DATATYPE' which means
> > 'real or complex matrix' in Scilab. (Memory representation of
> > variables or
> > http://wiki.scilab.org/Localization_in_English_-_Standard_messages
> > ).
> >
> > But if we follow the gui context then 'Double value' seems to mean 'a
> > real' (I don't expect to read any complex value in GUI applications).
> >
> > The use of 'Double value' causes trouble in interpretation of the
> > meaning, especially if coupled with the use of 'Single value' which
> > means 1x1 matrix.
> >
> > To avoid mistake, use 'a real' if it really need a real, 'real
> > matrix' if we need a real matrix or 'real or complex matrix' if we
> > need a generic data.
> >
> >
> > YungLee
> >
> > 2008/5/27 Shiqi Yu <shiqi.yu at gmail.com>:
> > I think they are all means a double float point real
> > scalar(1x1 matrix), but we can't replace them with 'real or
> > complex matrix'.
> > First, if we use 'matrix', users will input a MxN (M,N>1)
> > matrix.
> > Second, I think they must be real and can't be complex.
> >
> >
> > 2008/5/27 Yung-Jang Lee <yjlee123 at gmail.com>:
> >
> >
> > Hi all,
> >
> > In gui.pot , I found following different messages
> >
> > 'A double value expected',
> > 'A double expected',
> > 'Scalar value expected',
> > 'A value expected',
> > 'Single value expected'
> >
> > and they all means 'A real or complex'.
> >
> > I module gui, 'double value' means 'real or complex
> > matrix', 'single value' means '1x1 matrix' and 'A..'
> > also means '1x1 matrix' . Follow this way, we have
> >
> > 'A double vaule' == 'Single value' == 'A value'.
> >
> > I think this induce unnecessary mistake. It is better
> > to replace 'double value' to 'real or complex matrix'
> > or just 'matrix' in gui module.
> >
> > YungLee
> >
> >
> >
> >
> > --
> > Shiqi Yu
> > Shenzhen Institute of Advanced Technology,
> > Chinese Academy of Sciences.
> > Homepage: http://yushiqi.cn
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20080528/17bf73cd/attachment.htm>
More information about the dev
mailing list