1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2013 - Scilab Enterprises - Cedric Delamarre
4 // Copyright (C) 2012 - 2016 - Scilab Enterprises
6 // This file is hereby licensed under the terms of the GNU GPL v2.0,
7 // pursuant to article 5.3.4 of the CeCILL v.2.1.
8 // This file was originally licensed under the terms of the CeCILL v2.1,
9 // and continues to be available under such terms.
10 // For more information, see the COPYING file which you should have received
11 // along with this program.
13 function x = mgeti(varargin)
16 if rhs == 0 | rhs > 3 then
17 error(msprintf(_("%s: Wrong number of input argument(s): %d to %d expected.\n"), "mgeti", 1, 3));
25 if typeof(type) <> "string" then
26 error(msprintf(_("%s: Wrong type for argument #%d: string expected.\n"), "mgeti", 2));
29 if size(type, '*') <> 1 then
30 error(msprintf(_("%s: Wrong size for argument #%d: A single string expected.\n"), "mgeti", 2));
37 if len == 0 | len > 3 then
38 error(msprintf(_("%s: Wrong size for argument #%d: A single string of size %d to %d expected.\n"), "mgeti", 2, 1, 3));
42 if part(type, partPos) == 'u'
48 select part(type, partPos)
50 typeToConvert = typeToConvert + 8;
52 typeToConvert = typeToConvert + 4;
54 typeToConvert = typeToConvert + 2;
56 typeToConvert = typeToConvert + 1;
58 error(msprintf(_("%s: Incorrect integer type: %s .\n"), "mgeti", part(type, partPos)));
62 x = iconvert(mget(varargin(:)), typeToConvert);