summaryrefslogtreecommitdiffstats
path: root/scilab/modules/integer
diff options
context:
space:
mode:
Diffstat (limited to 'scilab/modules/integer')
-rw-r--r--scilab/modules/integer/Makefile.in2
-rw-r--r--scilab/modules/integer/macros/%i_d_s.sci21
-rw-r--r--scilab/modules/integer/macros/%s_d_i.sci21
-rw-r--r--scilab/modules/integer/macros/mgeti.sci63
4 files changed, 44 insertions, 63 deletions
diff --git a/scilab/modules/integer/Makefile.in b/scilab/modules/integer/Makefile.in
index 98c4526..229542e 100644
--- a/scilab/modules/integer/Makefile.in
+++ b/scilab/modules/integer/Makefile.in
@@ -499,9 +499,11 @@ NMEDIT = @NMEDIT@
499OBJDUMP = @OBJDUMP@ 499OBJDUMP = @OBJDUMP@
500OBJEXT = @OBJEXT@ 500OBJEXT = @OBJEXT@
501OCAMLC = @OCAMLC@ 501OCAMLC = @OCAMLC@
502OCAMLCFLAGS = @OCAMLCFLAGS@
502OCAMLDEP = @OCAMLDEP@ 503OCAMLDEP = @OCAMLDEP@
503OCAMLLEX = @OCAMLLEX@ 504OCAMLLEX = @OCAMLLEX@
504OCAMLOPT = @OCAMLOPT@ 505OCAMLOPT = @OCAMLOPT@
506OCAMLOPTFLAGS = @OCAMLOPTFLAGS@
505OCAMLYACC = @OCAMLYACC@ 507OCAMLYACC = @OCAMLYACC@
506OPENMPI_CC = @OPENMPI_CC@ 508OPENMPI_CC = @OPENMPI_CC@
507OPENMPI_CFLAGS = @OPENMPI_CFLAGS@ 509OPENMPI_CFLAGS = @OPENMPI_CFLAGS@
diff --git a/scilab/modules/integer/macros/%i_d_s.sci b/scilab/modules/integer/macros/%i_d_s.sci
new file mode 100644
index 0000000..f2c1901
--- /dev/null
+++ b/scilab/modules/integer/macros/%i_d_s.sci
@@ -0,0 +1,21 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) INRIA -
3// Copyright (C) 2013 - Samuel GOUGEON : http://bugzilla.scilab.org/13000
4
5// Copyright (C) 2012 - 2016 - Scilab Enterprises
6//
7// This file is hereby licensed under the terms of the GNU GPL v2.0,
8// pursuant to article 5.3.4 of the CeCILL v.2.1.
9// This file was originally licensed under the terms of the CeCILL v2.1,
10// and continues to be available under such terms.
11// For more information, see the COPYING file which you should have received
12// along with this program.
13
14// used to manage int ./ eye()
15function r = %i_d_s(a,b)
16 if b==[] then
17 r = []
18 else
19 r = a./iconvert(b,inttype(a))
20 end
21endfunction \ No newline at end of file
diff --git a/scilab/modules/integer/macros/%s_d_i.sci b/scilab/modules/integer/macros/%s_d_i.sci
new file mode 100644
index 0000000..12ad73b
--- /dev/null
+++ b/scilab/modules/integer/macros/%s_d_i.sci
@@ -0,0 +1,21 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) INRIA -
3// Copyright (C) 2013 - Samuel GOUGEON : http://bugzilla.scilab.org/13000
4//
5// Copyright (C) 2012 - 2016 - Scilab Enterprises
6//
7// This file is hereby licensed under the terms of the GNU GPL v2.0,
8// pursuant to article 5.3.4 of the CeCILL v.2.1.
9// This file was originally licensed under the terms of the CeCILL v2.1,
10// and continues to be available under such terms.
11// For more information, see the COPYING file which you should have received
12// along with this program.
13
14// used to manage eye() ./ int
15function r = %s_d_i(a,b)
16 if a==[] then
17 r = []
18 else
19 r = iconvert(a,inttype(b))./b
20 end
21endfunction \ No newline at end of file
diff --git a/scilab/modules/integer/macros/mgeti.sci b/scilab/modules/integer/macros/mgeti.sci
deleted file mode 100644
index 7f49f86..0000000
--- a/scilab/modules/integer/macros/mgeti.sci
+++ /dev/null
@@ -1,63 +0,0 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) 2013 - Scilab Enterprises - Cedric Delamarre
3//
4// Copyright (C) 2012 - 2016 - Scilab Enterprises
5//
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.
12
13function x = mgeti(varargin)
14
15 rhs=argn(2);
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));
18 end
19
20 if rhs == 1 then
21 typeToConvert = 4;
22 else
23 type = varargin(2);
24
25 if typeof(type) <> "string" then
26 error(msprintf(_("%s: Wrong type for argument #%d: string expected.\n"), "mgeti", 2));
27 end
28
29 if size(type, '*') <> 1 then
30 error(msprintf(_("%s: Wrong size for argument #%d: A single string expected.\n"), "mgeti", 2));
31 end
32
33 typeToConvert = 0;
34 len = length(type);
35 partPos = 1;
36
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));
39 end
40
41 // unsigne
42 if part(type, partPos) == 'u'
43 typeToConvert = 10;
44 partPos = 2;
45 end
46
47 // type to convert
48 select part(type, partPos)
49 case 'l'
50 typeToConvert = typeToConvert + 8;
51 case 'i'
52 typeToConvert = typeToConvert + 4;
53 case 's'
54 typeToConvert = typeToConvert + 2;
55 case 'c'
56 typeToConvert = typeToConvert + 1;
57 else
58 error(msprintf(_("%s: Incorrect integer type: %s .\n"), "mgeti", part(type, partPos)));
59 end
60 end
61
62 x = iconvert(mget(varargin(:)), typeToConvert);
63endfunction