* Update the default size of the Scilab stack to 100 M elements (instead of 50M).
See stacksize for more information.
+* save/load functions can now export/import Scilab data to HDF5 format:
+ - Graphic handles can be saved as HDF5 data
+ - 'save' displays a message when using old calling sequence save(filename, a, b, c) and writes data in old Scilab binary format. This format will not be readable by Scilab 6 family.
+ - 'save' writes data to HDF5 format when using new calling sequence save(filename, "a", "b", "c"). This format is Scilab 6 compatible.
+
Scilab Desktop
==============
clear // erase all variables
clearglobal();
+load = %_load;
+
// Set stack size ===================================================
function setStackSize()
defaultstacksize = 10000000;
clear atomsSystemInit;
end
+clear load
+
// Protect variable previously defined ================================
predef("all");
zlib
hdf5
gl2ps
+Eigen
*.lib
Eigen
fh = scf();
plot3d();
-save(TMPDIR + '/foo.scg',fh);
+save(TMPDIR + "/foo.scg", "fh");
close(fh);
// go to TMPDIR with your file explorer
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- INTERACTIVE TEST -->
+// <-- TEST WITH CONSOLE -->
+//
+// <-- Non-regression test for bug 8232 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=8232
+//
+// <-- Short Description -->
+// drag and drop of .scg files (on console) used "xload" and not "load"
+
+fh = scf();
+plot3d();
+save(TMPDIR + '/foo.scg',fh);
+close(fh);
+
+// go to TMPDIR with your file explorer
+// select foo.scg and drag and drop on scilab console
+// check that plot3d was restored
+
+
// <-- Short Description -->
//Variables whose name starts by a $ cannot be retreived in libraries
//create a library of variables
+warning("off");
Dir = TMPDIR + "/bug_6726/";
mkdir(Dir);
function y=$a(x)
// <-- Short Description -->
//Variables whose name starts by a $ cannot be retreived in libraries
+warning("off");
+
//create a library of variables
Dir = TMPDIR + "/bug_6726/";
mkdir(Dir);
mkdir(Dir);
a = 1;
b = 2;
+warning("off");
save(Dir + "a.bin", a);
save(Dir + "b.bin", b);
+warning("on");
mputl(["a";"b"], Dir + "names");
testlib = lib(Dir);
clear a b
mkdir(Dir);
a = 1;
b = 2;
+warning("off");
save(Dir + "a.bin", a);
save(Dir + "b.bin", b);
+warning("on");
mputl(["a";"b"], Dir + "names");
testlib = lib(Dir);
//
// <-- Short Description -->
//
+warning("off");
a = list();
a(2) = 10;
save(TMPDIR+"/test.sav",a);
// <-- Short Description -->
//
+warning("off");
+
a = list();
a(2) = 10;
save(TMPDIR+"/test.sav",a);
t = [t string(i)];
end
t = t';
+warning("off");
save(TMPDIR + filesep() + 'pb.dat',t);
clear t;
load(TMPDIR + filesep() + 'pb.dat');
t = [t string(i)];
end
t = t';
+warning("off");
save(TMPDIR + filesep() + 'pb.dat',t);
clear t;
execstr(nam+'=lib('''+getshortpathname(path1)+''')')
//save it
+ warnMode = warning("query");
+ warning("off");
if execstr('save('''+path1+'lib'''+','+nam+')','errcatch')<>0 then
success = %f;
+ warning(warnMode);
error(msprintf(gettext("%s: %s file cannot be created\n"),"genlib",path+'lib'));
end
+ warning(warnMode);
else
execstr(nam+'=lib('''+path1+''')')
end
if new<>[] then
result = new($:-1:1)';
+ warnMode = warning("query");
+ warning("off");
execstr('save(u,'+strcat(new($:-1:1),',')+')');
+ warning(warnMode);
else
msprintf(gettext("%s: File %s does not contain any function.\n"),"genlib",binfile)
result = %f;
function z = yourplus(x, y), x = x - y,endfunction
A=1:10;
//create the *.bin files in libdir
-libdir=TMPDIR
- libdir =
-
- TMPDIR
+libdir=TMPDIR;
+warning("off");
save(libdir + '/myplus.bin', myplus);
save(libdir + '/yourplus.bin', yourplus);
save(libdir + '/A.bin', A);
A=1:10;
//create the *.bin files in libdir
-libdir=TMPDIR
+libdir=TMPDIR;
+warning("off");
save(libdir + '/myplus.bin', myplus);
save(libdir + '/yourplus.bin', yourplus);
save(libdir + '/A.bin', A);
function z = myplus(x, y), z = x + y,endfunction
function z = yourplus(x, y), x = x - y,endfunction
// =============================================================================
-cd TMPDIR
- ans =
-
- TMPDIR
+cd TMPDIR;
mkdir('bug_6550');
libdir = TMPDIR + '/bug_6550';
+warning("off");
save(libdir + '/myplus.bin', myplus);
save(libdir + '/yourplus.bin', yourplus);
//create the name file
function z = myplus(x, y), z = x + y,endfunction
function z = yourplus(x, y), x = x - y,endfunction
// =============================================================================
-cd TMPDIR
+cd TMPDIR;
mkdir('bug_6550');
libdir = TMPDIR + '/bug_6550';
+warning("off");
save(libdir + '/myplus.bin', myplus);
save(libdir + '/yourplus.bin', yourplus);
//create the name file
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
+warning("off");
cd(TMPDIR);
mkdir('test_lib');
cd('test_lib');
// <-- JVM NOT MANDATORY -->
+warning("off");
+
cd(TMPDIR);
mkdir('test_lib');
cd('test_lib');
function h=%h_copy(h,ax)
- save(TMPDIR+'/ghdlcopy',h)
+ save(TMPDIR+'/ghdlcopy','h')
if argn(2)<2 then
load(TMPDIR+'/ghdlcopy')
else
if is_higher_than([3 0 0 0]) then
if ascii(mget(1,characterFormat,fd))=='t' then // mark_size_unit
- msu='tabulated' ;
+ msu='tabulated' ;
else
- msu='point';
+ msu='point';
end
mark_foreground=mget(1,'il',fd) // mark_foreground
mark_background=mget(1,'il',fd) // mark_background
if preservecur then old=gcf();end
f=scf(num);
end
- save(fil,f)
+ save(fil,"f")
if preservecur then scf(old),end
endfunction
f = gcf();
delete(f);
if execstr("save(TMPDIR+""/bug_2165.tst"");", "errcatch")<>0 then bugmes();quit;end
-WARNING: save_graphichandle: handle no more valid ignored.
f.background = backgroundvariable;
userdatavariable = ["my user_data - entry will not be saved, - but i.e. the backgroundvariable will be saved."];
f.user_data = userdatavariable;
-save(pathconvert(TMPDIR+"/bug_2250.scg",%f), f)
+save(pathconvert(TMPDIR+"/bug_2250.scg",%f), "f")
delete(f)
load(pathconvert(TMPDIR+"/bug_2250.scg",%f))
figureloaded = gcf();
f.user_data = userdatavariable;
-save(pathconvert(TMPDIR+"/bug_2250.scg",%f), f)
+save(pathconvert(TMPDIR+"/bug_2250.scg",%f), "f")
delete(f)
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+// <-- Non-regression test for bug 2250 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=2250
+//
+// <-- Short Description -->
+// I can not save or load user_data of a figure to or from a file
+warning("off");
+f = scf(11);
+plot2d();
+backgroundvariable = 5;
+f.background = backgroundvariable;
+userdatavariable = ["my user_data - entry will not be saved, - but i.e. the backgroundvariable will be saved."];
+f.user_data = userdatavariable;
+save(pathconvert(TMPDIR+"/bug_2250.scg",%f), f)
+delete(f)
+load(pathconvert(TMPDIR+"/bug_2250.scg",%f))
+figureloaded = gcf();
+if figureloaded.background<>backgroundvariable then bugmes();quit;end
+if figureloaded.user_data<>userdatavariable then bugmes();quit;end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+// <-- Non-regression test for bug 2250 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=2250
+//
+// <-- Short Description -->
+// I can not save or load user_data of a figure to or from a file
+
+warning("off");
+
+f = scf(11);
+plot2d();
+
+backgroundvariable = 5;
+f.background = backgroundvariable;
+
+userdatavariable = ["my user_data - entry will not be saved, - but i.e. the backgroundvariable will be saved."];
+
+f.user_data = userdatavariable;
+
+save(pathconvert(TMPDIR+"/bug_2250.scg",%f), f)
+
+delete(f)
+
+load(pathconvert(TMPDIR+"/bug_2250.scg",%f))
+
+figureloaded = gcf();
+
+if figureloaded.background<>backgroundvariable then pause; end
+
+if figureloaded.user_data<>userdatavariable then pause;end
f.auto_resize='off';
f.figure_size = [300 300];
f.viewport = [110 130];
-save('foo.sav',f);
+save('foo.sav',"f");
delete(f)
load('foo.sav')
f = gcf();
f.auto_resize='off';
f.figure_size = [300 300];
f.viewport = [110 130];
-save('foo.sav',f);
+save('foo.sav',"f");
delete(f)
load('foo.sav')
f = gcf();
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008-2008 - Digiteo - Jean-Baptiste Silvy
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+// <-- Non-regression test for bug 3822 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=3822
+//
+// <-- Short Description -->
+// When a figure handle is saved and reloaded the figure_size as well as the viewport properties are not saved nor restored
+//
+warning("off");
+f = gcf();
+f.auto_resize='off';
+f.figure_size = [300 300];
+f.viewport = [110 130];
+save('foo.sav',f);
+delete(f)
+load('foo.sav')
+f = gcf();
+if (f.figure_size <> [300 300]) then bugmes();quit;end
+if (f.viewport <> [110, 130]) then bugmes();quit;end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008-2008 - Digiteo - Jean-Baptiste Silvy
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+// <-- Non-regression test for bug 3822 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=3822
+//
+// <-- Short Description -->
+// When a figure handle is saved and reloaded the figure_size as well as the viewport properties are not saved nor restored
+//
+
+warning("off");
+f = gcf();
+f.auto_resize='off';
+f.figure_size = [300 300];
+f.viewport = [110 130];
+save('foo.sav',f);
+delete(f)
+load('foo.sav')
+f = gcf();
+if (f.figure_size <> [300 300]) then pause; end
+if (f.viewport <> [110, 130]) then pause; end
// into the current one
f13 = scf(13);
plot(1:5);
-save(TMPDIR + "/save.scg", f13);
+save(TMPDIR + "/save.scg", "f13");
f6 = scf(6);
xload(TMPDIR + "/save.scg");
// Check whether the curve's compound object has been loaded
f13 = scf(13);
plot(1:5);
-save(TMPDIR + "/save.scg", f13);
+save(TMPDIR + "/save.scg", "f13");
f6 = scf(6);
xload(TMPDIR + "/save.scg");
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+// <-- Non-regression test for bug 3975 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=3975
+//
+// <-- Short Description -->
+// xload is not able to load the contents of a previously saved figure
+// into the current one
+warning("off");
+f13 = scf(13);
+plot(1:5);
+save(TMPDIR + "/save.scg", f13);
+f6 = scf(6);
+xload(TMPDIR + "/save.scg");
+// Check whether the curve's compound object has been loaded
+if (f6.children(1).children(1) == []) then bugmes();quit;end;
+// Figure 6's curve polyline handle
+pf6 = f6.children(1).children(1).children(1);
+// Figure 13's curve polyline handle
+pf13 = f13.children(1).children(1).children(1);
+if (pf13.type <> pf6.type) then bugmes();quit;end;
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+// <-- Non-regression test for bug 3975 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=3975
+//
+// <-- Short Description -->
+// xload is not able to load the contents of a previously saved figure
+// into the current one
+
+warning("off");
+
+f13 = scf(13);
+plot(1:5);
+
+save(TMPDIR + "/save.scg", f13);
+
+f6 = scf(6);
+xload(TMPDIR + "/save.scg");
+
+// Check whether the curve's compound object has been loaded
+if (f6.children(1).children(1) == []) then pause; end;
+
+// Figure 6's curve polyline handle
+pf6 = f6.children(1).children(1).children(1);
+
+// Figure 13's curve polyline handle
+pf13 = f13.children(1).children(1).children(1);
+
+if (pf13.type <> pf6.type) then pause; end;
+
t=0:0.01:10;
subplot(211),plot2d(t,sin(t))
subplot(212),plot2d(t,sin(3*t))
-save(TMPDIR+'/foo.scg',gcf()) //or xsave
+f = gcf();
+save(TMPDIR+'/foo.scg', "f") //or xsave
clf()
load(TMPDIR+'/foo.scg') //or xload
f = gcf();
t=0:0.01:10;
subplot(211),plot2d(t,sin(t))
subplot(212),plot2d(t,sin(3*t))
-save(TMPDIR+'/foo.scg',gcf()) //or xsave
+f = gcf();
+save(TMPDIR+'/foo.scg',"f") //or xsave
clf()
load(TMPDIR+'/foo.scg') //or xload
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009-2009 - Digiteo - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+// <-- Non-regression test for bug 4082 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4082
+//
+// <-- Short Description -->
+//
+// After save ( xsave ) a figure, the load command ( save/xsave ) modify the name of the figure.
+warning("off");
+t=0:0.01:10;
+subplot(211),plot2d(t,sin(t))
+subplot(212),plot2d(t,sin(3*t))
+f = gcf();
+save(TMPDIR+'/foo.scg', f) //or xsave
+clf()
+load(TMPDIR+'/foo.scg') //or xload
+f = gcf();
+if f.figure_name <> _("Graphic window number %d") then bugmes();quit;end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009-2009 - Digiteo - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+// <-- Non-regression test for bug 4082 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4082
+//
+// <-- Short Description -->
+//
+// After save ( xsave ) a figure, the load command ( save/xsave ) modify the name of the figure.
+warning("off");
+t=0:0.01:10;
+subplot(211),plot2d(t,sin(t))
+subplot(212),plot2d(t,sin(3*t))
+f = gcf();
+save(TMPDIR+'/foo.scg',f) //or xsave
+clf()
+load(TMPDIR+'/foo.scg') //or xload
+
+f = gcf();
+
+if f.figure_name <> _("Graphic window number %d") then pause,end
y = [1:4];
z = cos(x)*cos(y);
grayplot(x,y,z);
-save(TMPDIR + "/save.scg", gcf());
+f = gcf();
+save(TMPDIR + "/save.scg", "f");
close
load(TMPDIR + "/save.scg");
e = gce();
y = [1:4];
z = cos(x)*cos(y);
grayplot(x,y,z);
-save(TMPDIR + "/save.scg", gcf());
+f = gcf();
+save(TMPDIR + "/save.scg", "f");
close
load(TMPDIR + "/save.scg");
e = gce();
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - Digiteo - Jean-Baptiste Silvy
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+// <-- Non-regression test for bug 4236 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4236
+//
+// <-- Short Description -->
+// Complex grayplots are not saved correctly in scilab 5.1
+//
+warning("off");
+x = [1:2]';
+y = [1:4];
+z = cos(x)*cos(y);
+grayplot(x,y,z);
+f = gcf();
+save(TMPDIR + "/save.scg", f);
+close
+load(TMPDIR + "/save.scg");
+e = gce();
+if or(e.data.x <> x) then bugmes();quit;end
+if or(e.data.y <> y') then bugmes();quit;end
+if or(e.data.z <> z) then bugmes();quit;end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - Digiteo - Jean-Baptiste Silvy
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+// <-- Non-regression test for bug 4236 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4236
+//
+// <-- Short Description -->
+// Complex grayplots are not saved correctly in scilab 5.1
+//
+warning("off");
+x = [1:2]';
+y = [1:4];
+z = cos(x)*cos(y);
+grayplot(x,y,z);
+f = gcf();
+save(TMPDIR + "/save.scg", f);
+close
+load(TMPDIR + "/save.scg");
+e = gce();
+if or(e.data.x <> x) then pause; end
+if or(e.data.y <> y') then pause; end
+if or(e.data.z <> z) then pause; end
+
plot3d();
h = gcf();
tmp_file=pathconvert(TMPDIR+'/nonreg_test_bug4811.dat',%f);
-save(tmp_file,h);
+save(tmp_file,"h");
// close the figure
delete(h);
load(tmp_file);
tmp_file=pathconvert(TMPDIR+'/nonreg_test_bug4811.dat',%f);
-save(tmp_file,h);
+save(tmp_file,"h");
// close the figure
delete(h);
load(tmp_file);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - pierre.lando@scilab.org
+//
+//// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+//
+// <-- Non-regression test for bug 4811 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4811
+//
+// <-- Short Description -->
+// for some figures, it is not possible to save and load the handle of the figure.
+warning("off");
+plot3d();
+h = gcf();
+tmp_file=pathconvert(TMPDIR+'/nonreg_test_bug4811.dat',%f);
+save(tmp_file,h);
+// close the figure
+delete(h);
+load(tmp_file);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - pierre.lando@scilab.org
+//
+//// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+//
+// <-- Non-regression test for bug 4811 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4811
+//
+// <-- Short Description -->
+// for some figures, it is not possible to save and load the handle of the figure.
+
+warning("off");
+
+plot3d();
+h = gcf();
+
+tmp_file=pathconvert(TMPDIR+'/nonreg_test_bug4811.dat',%f);
+
+save(tmp_file,h);
+// close the figure
+delete(h);
+load(tmp_file);
+
plot2d();
legend(['a';'b';'c']);
f=gcf();
-save(TMPDIR+'/foo.scg',f);
+save(TMPDIR+'/foo.scg','f');
clf();
load(TMPDIR+'/foo.scg');
if f.children.children(1).type<>'Legend' then bugmes();quit;end
plot2d();
legend(['a';'b';'c']);
f=gcf();
-save(TMPDIR+'/foo.scg',f);
+save(TMPDIR+'/foo.scg','f');
clf();
load(TMPDIR+'/foo.scg');
if f.children.children(1).type<>'Legend' then pause,end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2006-2008 - INRIA - Serge.Steer@inria.fr
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+// <-- Non-regression test for bug 6665 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6665
+//
+// <-- Short Description -->
+//legend (caption) nor properly saved or loaded
+warning("off");
+plot2d();
+legend(['a';'b';'c']);
+f=gcf();
+save(TMPDIR+'/foo.scg',f);
+clf();
+load(TMPDIR+'/foo.scg');
+if f.children.children(1).type<>'Legend' then bugmes();quit;end
+l=f.children.children(1);
+if or(l.text<>['a';'b';'c']) then bugmes();quit;end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2006-2008 - INRIA - Serge.Steer@inria.fr
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+// <-- Non-regression test for bug 6665 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6665
+//
+// <-- Short Description -->
+//legend (caption) nor properly saved or loaded
+warning("off");
+plot2d();
+legend(['a';'b';'c']);
+f=gcf();
+save(TMPDIR+'/foo.scg',f);
+clf();
+load(TMPDIR+'/foo.scg');
+if f.children.children(1).type<>'Legend' then pause,end
+l=f.children.children(1);
+if or(l.text<>['a';'b';'c']) then pause,end
+
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA - Jean-Baptiste SILVY <jean-baptiste.silvy@inria.fr>
+// Copyright (C) 2012 - DIGITEO - Vincent COUVERT
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- TEST WITH GRAPHIC -->
// test to check that save and load are working properly
-plotExportFile = pathconvert(TMPDIR) + "savePlot.scg";
+plotExportFile = pathconvert(TMPDIR) + "savePlot.hdf5";
// check clip properties
clf();
x = 0:10;
e.clip_box = [1, 2, 3, 4];
e.clip_state = "on";
// save the two curves
-save(plotExportFile, gcf());
+f = gcf();
+save(plotExportFile, "f");
// close window
-delete(gcf());
+delete(f);
// reload data
load(plotExportFile);
axes = gca();
e.clip_box = [1, 2, 3, 4];
e.clip_state = "on";
// save the two curves
-save(plotExportFile, gcf());
+f = gcf();
+save(plotExportFile, "f");
// close window
-delete(gcf());
+delete(f);
// reload data
load(plotExportFile);
axes = gca();
e.clip_box = [1, 2, 3, 4];
e.clip_state = "on";
// save the two curves
-save(plotExportFile, gcf());
+f = gcf();
+save(plotExportFile, "f");
// close window
-delete(gcf());
+delete(f);
// reload data
load(plotExportFile);
axes = gca();
e.clip_box = [1, 2, 3, 4];
e.clip_state = "on";
// save the two curves
-save(plotExportFile, gcf());
+f = gcf();
+save(plotExportFile, "f");
// close window
-delete(gcf());
+delete(f);
// reload data
load(plotExportFile);
axes = gca();
surf2 = axes.children(2).children(1);
if (surf2.clip_box <> []) then bugmes();quit;end
if (surf2.clip_state <> "clipgrf") then bugmes();quit;end
+// axis
+clf();
+a = gca();//get the handle of the newly created axes
+a.data_bounds=[-1,-1;10,10];
+drawaxis(x=2:7,y=4,dir='u');
+a1=a.children(1);
+a1.xtics_coord=[1 4 5 8 10];
+a1.tics_color=2;
+a1.labels_font_size=3;
+a1.tics_direction="bottom";
+a1.tics_labels= [" February" "May" "june" "August" "October"];
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// legend
+clf();
+t=linspace(0,%pi,20);
+a=gca();a.data_bounds=[t(1) -1.8;t($) 1.8];
+plot2d(t,[cos(t'),cos(2*t'),cos(3*t')],[-5,2 3]);
+e=gce();
+e1=e.children(1);e1.thickness=2;e1.polyline_style=4;e1.arrow_size_factor = 1/2;
+e.children(2).line_style=4;
+e3=e.children(3);e3.line_mode='on';e3.mark_background=5;
+hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)']);
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// arc
+clf();
+plot2d(0,0,-1,"031"," ",[-1,-1,1,1])
+arcs=[-1.0 0.0 0.5;
+ 1.0 0.0 0.5;
+ 0.5 1.0 0.5;
+ 0.5 0.5 1.0;
+ 0.0 0.0 0.0;
+ 180*64 360*64 90*64];
+xarcs(arcs,[1,2,3])
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// rectangle
+clf();
+plot2d([-100,500],[-50,50],[-1,-1],"022")
+cols=[-34,-33,-32,-20:5:20,32,33,34];
+x=400*(0:14)/14; step=20;
+rects=[x;10*ones(x);step*ones(x);30*ones(x)];
+xrects(rects,cols)
+xnumb(x,15*ones(x),cols)
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+WARNING : The size of the figure may not be as wide as you want.
+// xsegs
+clf();
+x=2*%pi*(0:9)/10;
+xv=[sin(x);9*sin(x)];
+yv=[cos(x);9*cos(x)];
+plot2d([-10,10],[-10,10],[-1,-1],"022")
+xsegs(xv,yv,1:10)
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// champ demo
+clf();
+champ();
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// plot demo
+clf();
+plot();
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// plot2d demo
+clf();
+plot2d();
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// plot3d demo
+clf();
+plot3d();
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// uicontrols demo
+clf();
+exec(SCI + filesep() + "modules/gui/demos/uicontrol_plot3d.dem.sce");
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// uicontrols demo
+clf();
+exec(SCI + filesep() + "modules/gui/demos/uicontrol.dem.sce");
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA - Jean-Baptiste SILVY <jean-baptiste.silvy@inria.fr>
+// Copyright (C) 2012 - DIGITEO - Vincent COUVERT
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- TEST WITH GRAPHIC -->
// test to check that save and load are working properly
-plotExportFile = pathconvert(TMPDIR) + "savePlot.scg";
+plotExportFile = pathconvert(TMPDIR) + "savePlot.hdf5";
// check clip properties
clf();
e.clip_state = "on";
// save the two curves
-save(plotExportFile, gcf());
+f = gcf();
+save(plotExportFile, "f");
// close window
-delete(gcf());
+delete(f);
// reload data
load(plotExportFile);
e.clip_state = "on";
// save the two curves
-save(plotExportFile, gcf());
+f = gcf();
+save(plotExportFile, "f");
// close window
-delete(gcf());
+delete(f);
// reload data
load(plotExportFile);
e.clip_state = "on";
// save the two curves
-save(plotExportFile, gcf());
+f = gcf();
+save(plotExportFile, "f");
// close window
-delete(gcf());
+delete(f);
// reload data
load(plotExportFile);
e.clip_state = "on";
// save the two curves
-save(plotExportFile, gcf());
+f = gcf();
+save(plotExportFile, "f");
// close window
-delete(gcf());
+delete(f);
// reload data
load(plotExportFile);
if (surf2.clip_box <> []) then pause; end
if (surf2.clip_state <> "clipgrf") then pause; end
+// axis
+clf();
+a = gca();//get the handle of the newly created axes
+a.data_bounds=[-1,-1;10,10];
+
+drawaxis(x=2:7,y=4,dir='u');
+a1=a.children(1);
+a1.xtics_coord=[1 4 5 8 10];
+a1.tics_color=2;
+a1.labels_font_size=3;
+a1.tics_direction="bottom";
+a1.tics_labels= [" February" "May" "june" "August" "October"];
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// legend
+clf();
+t=linspace(0,%pi,20);
+a=gca();a.data_bounds=[t(1) -1.8;t($) 1.8];
+
+plot2d(t,[cos(t'),cos(2*t'),cos(3*t')],[-5,2 3]);
+e=gce();
+e1=e.children(1);e1.thickness=2;e1.polyline_style=4;e1.arrow_size_factor = 1/2;
+e.children(2).line_style=4;
+e3=e.children(3);e3.line_mode='on';e3.mark_background=5;
+
+hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)']);
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// arc
+clf();
+plot2d(0,0,-1,"031"," ",[-1,-1,1,1])
+arcs=[-1.0 0.0 0.5;
+ 1.0 0.0 0.5;
+ 0.5 1.0 0.5;
+ 0.5 0.5 1.0;
+ 0.0 0.0 0.0;
+ 180*64 360*64 90*64];
+xarcs(arcs,[1,2,3])
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// rectangle
+clf();
+plot2d([-100,500],[-50,50],[-1,-1],"022")
+cols=[-34,-33,-32,-20:5:20,32,33,34];
+x=400*(0:14)/14; step=20;
+rects=[x;10*ones(x);step*ones(x);30*ones(x)];
+xrects(rects,cols)
+xnumb(x,15*ones(x),cols)
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// xsegs
+clf();
+x=2*%pi*(0:9)/10;
+xv=[sin(x);9*sin(x)];
+yv=[cos(x);9*cos(x)];
+plot2d([-10,10],[-10,10],[-1,-1],"022")
+xsegs(xv,yv,1:10)
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// champ demo
+clf();
+champ();
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// plot demo
+clf();
+plot();
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// plot2d demo
+clf();
+plot2d();
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+// plot3d demo
+clf();
+plot3d();
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// uicontrols demo
+clf();
+exec(SCI + filesep() + "modules/gui/demos/uicontrol_plot3d.dem.sce");
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
+
+// uicontrols demo
+clf();
+exec(SCI + filesep() + "modules/gui/demos/uicontrol.dem.sce");
+// save the curves
+f = gcf();
+save(plotExportFile, "f");
+// close window
+delete(f);
+// reload data
+load(plotExportFile);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Jean-Baptiste SILVY <jean-baptiste.silvy@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+warning("off");
+// test to check that save and load are working properly
+plotExportFile = pathconvert(TMPDIR) + "savePlot.scg";
+// check clip properties
+clf();
+x = 0:10;
+z = sin(x)'*cos(x);
+plot3d(x, x, z);
+e = gce();
+e.clip_state = "clipgrf";
+plot3d(x ,x ,z + 1);
+e = gce();
+e.clip_box = [1, 2, 3, 4];
+e.clip_state = "on";
+// save the two curves
+save(plotExportFile, gcf());
+// close window
+delete(gcf());
+// reload data
+load(plotExportFile);
+axes = gca();
+// check axes properties
+surf1 = axes.children(1);
+if (surf1.clip_box <> [1, 2, 3, 4]) then bugmes();quit;end
+if (surf1.clip_state <> "on") then bugmes();quit;end
+surf2 = axes.children(2);
+if (surf2.clip_box <> []) then bugmes();quit;end
+if (surf2.clip_state <> "clipgrf") then bugmes();quit;end
+// same for grayplot
+clf();
+x = 0:10;
+z = sin(x)'*cos(x);
+grayplot(x, x, z)
+e = gce();
+e.clip_state = "clipgrf";
+grayplot(x, x, z + 1);
+e = gce();
+e.clip_box = [1, 2, 3, 4];
+e.clip_state = "on";
+// save the two curves
+save(plotExportFile, gcf());
+// close window
+delete(gcf());
+// reload data
+load(plotExportFile);
+axes = gca();
+// check axes properties
+surf1 = axes.children(1);
+if (surf1.clip_box <> [1, 2, 3, 4]) then bugmes();quit;end
+if (surf1.clip_state <> "on") then bugmes();quit;end
+surf2 = axes.children(2);
+if (surf2.clip_box <> []) then bugmes();quit;end
+if (surf2.clip_state <> "clipgrf") then bugmes();quit;end
+// same for Matplot
+clf();
+x = 0:10;
+z = sin(x)'*cos(x);
+Matplot(z)
+e = gce();
+e.clip_state = "clipgrf";
+Matplot(z + 1);
+e = gce();
+e.clip_box = [1, 2, 3, 4];
+e.clip_state = "on";
+// save the two curves
+save(plotExportFile, gcf());
+// close window
+delete(gcf());
+// reload data
+load(plotExportFile);
+axes = gca();
+// check axes properties
+surf1 = axes.children(1);
+if (surf1.clip_box <> [1, 2, 3, 4]) then bugmes();quit;end
+if (surf1.clip_state <> "on") then bugmes();quit;end
+surf2 = axes.children(2);
+if (surf2.clip_box <> []) then bugmes();quit;end
+if (surf2.clip_state <> "clipgrf") then bugmes();quit;end
+// same for fec
+clf();
+x = 0:10;
+z = sin(x)'*cos(x);
+Sgrayplot(x, x, z)
+e = gce();
+e = e.children(1);
+e.clip_state = "clipgrf";
+Sgrayplot(x, x, z + 1)
+e = gce();
+e = e.children(1);
+e.clip_box = [1, 2, 3, 4];
+e.clip_state = "on";
+// save the two curves
+save(plotExportFile, gcf());
+// close window
+delete(gcf());
+// reload data
+load(plotExportFile);
+axes = gca();
+// check axes properties
+surf1 = axes.children(1).children(1);
+if (surf1.clip_box <> [1, 2, 3, 4]) then bugmes();quit;end
+if (surf1.clip_state <> "on") then bugmes();quit;end
+surf2 = axes.children(2).children(1);
+if (surf2.clip_box <> []) then bugmes();quit;end
+if (surf2.clip_state <> "clipgrf") then bugmes();quit;end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Jean-Baptiste SILVY <jean-baptiste.silvy@inria.fr>
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+warning("off");
+
+// test to check that save and load are working properly
+plotExportFile = pathconvert(TMPDIR) + "savePlot.scg";
+
+// check clip properties
+clf();
+x = 0:10;
+z = sin(x)'*cos(x);
+plot3d(x, x, z);
+e = gce();
+e.clip_state = "clipgrf";
+plot3d(x ,x ,z + 1);
+e = gce();
+e.clip_box = [1, 2, 3, 4];
+e.clip_state = "on";
+
+// save the two curves
+save(plotExportFile, gcf());
+
+// close window
+delete(gcf());
+
+// reload data
+load(plotExportFile);
+axes = gca();
+
+// check axes properties
+surf1 = axes.children(1);
+if (surf1.clip_box <> [1, 2, 3, 4]) then pause; end
+if (surf1.clip_state <> "on") then pause; end
+surf2 = axes.children(2);
+if (surf2.clip_box <> []) then pause; end
+if (surf2.clip_state <> "clipgrf") then pause; end
+
+// same for grayplot
+clf();
+x = 0:10;
+z = sin(x)'*cos(x);
+grayplot(x, x, z)
+e = gce();
+e.clip_state = "clipgrf";
+grayplot(x, x, z + 1);
+e = gce();
+e.clip_box = [1, 2, 3, 4];
+e.clip_state = "on";
+
+// save the two curves
+save(plotExportFile, gcf());
+
+// close window
+delete(gcf());
+
+// reload data
+load(plotExportFile);
+axes = gca();
+
+// check axes properties
+surf1 = axes.children(1);
+if (surf1.clip_box <> [1, 2, 3, 4]) then pause; end
+if (surf1.clip_state <> "on") then pause; end
+surf2 = axes.children(2);
+if (surf2.clip_box <> []) then pause; end
+if (surf2.clip_state <> "clipgrf") then pause; end
+
+// same for Matplot
+clf();
+x = 0:10;
+z = sin(x)'*cos(x);
+Matplot(z)
+e = gce();
+e.clip_state = "clipgrf";
+Matplot(z + 1);
+e = gce();
+e.clip_box = [1, 2, 3, 4];
+e.clip_state = "on";
+
+// save the two curves
+save(plotExportFile, gcf());
+
+// close window
+delete(gcf());
+
+// reload data
+load(plotExportFile);
+axes = gca();
+
+// check axes properties
+surf1 = axes.children(1);
+if (surf1.clip_box <> [1, 2, 3, 4]) then pause; end
+if (surf1.clip_state <> "on") then pause; end
+surf2 = axes.children(2);
+if (surf2.clip_box <> []) then pause; end
+if (surf2.clip_state <> "clipgrf") then pause; end
+
+
+// same for fec
+clf();
+x = 0:10;
+z = sin(x)'*cos(x);
+Sgrayplot(x, x, z)
+e = gce();
+e = e.children(1);
+e.clip_state = "clipgrf";
+Sgrayplot(x, x, z + 1)
+e = gce();
+e = e.children(1);
+e.clip_box = [1, 2, 3, 4];
+e.clip_state = "on";
+
+// save the two curves
+save(plotExportFile, gcf());
+
+// close window
+delete(gcf());
+
+// reload data
+load(plotExportFile);
+axes = gca();
+
+// check axes properties
+surf1 = axes.children(1).children(1);
+if (surf1.clip_box <> [1, 2, 3, 4]) then pause; end
+if (surf1.clip_state <> "on") then pause; end
+surf2 = axes.children(2).children(1);
+if (surf2.clip_box <> []) then pause; end
+if (surf2.clip_state <> "clipgrf") then pause; end
+
+
//
// <-- Short Description -->
// Scilab 5.0.2 has issues when saving/loading gui (uicontrols,figure...)
+warning("off");
f=figure();
h = uicontrol(f,"style","listbox", ..
"position", [10 10 150 160],..
// <-- Short Description -->
// Scilab 5.0.2 has issues when saving/loading gui (uicontrols,figure...)
+warning("off");
+
f=figure();
h = uicontrol(f,"style","listbox", ..
Parent:
Children: ["uimenu";"uimenu"]
// Before this bug fix, uicontextmenus were not be saved
-save(TMPDIR + filesep() + "bug_4782.tmp", h);
+save(TMPDIR + filesep() + "bug_4782.tmp", "h");
clear h
load(TMPDIR + filesep() + "bug_4782.tmp");
deletefile(TMPDIR + filesep() + "bug_4782.tmp");
h1 = uimenu("Parent", h, "label", "uimenufoo1", "Callback", "disp hello");
h2 = uimenu("Parent", h, "label", "uimenufoo2", "Callback", "disp coucou");
// Before this bug fix, uimenus children were not be saved
-save(TMPDIR + filesep() + "bug_4782.tmp", h);
+save(TMPDIR + filesep() + "bug_4782.tmp", "h");
clear h
load(TMPDIR + filesep() + "bug_4782.tmp");
deletefile(TMPDIR + filesep() + "bug_4782.tmp");
disp(h)
// Before this bug fix, uicontextmenus were not be saved
-save(TMPDIR + filesep() + "bug_4782.tmp", h);
+save(TMPDIR + filesep() + "bug_4782.tmp", "h");
clear h
load(TMPDIR + filesep() + "bug_4782.tmp");
deletefile(TMPDIR + filesep() + "bug_4782.tmp");
h2 = uimenu("Parent", h, "label", "uimenufoo2", "Callback", "disp coucou");
// Before this bug fix, uimenus children were not be saved
-save(TMPDIR + filesep() + "bug_4782.tmp", h);
+save(TMPDIR + filesep() + "bug_4782.tmp", "h");
clear h
load(TMPDIR + filesep() + "bug_4782.tmp");
deletefile(TMPDIR + filesep() + "bug_4782.tmp");
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+//
+// <-- Non-regression test for bug 4782 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4782
+//
+// <-- Short Description -->
+// Can not save/display uicontextmenu
+warning("off");
+h = uicontextmenu();
+h1 = uimenu("Parent", h, "label", "foo1", "Callback", "disp hello");
+h2 = uimenu("Parent", h, "label", "foo2", "Callback", "disp coucou");
+// Before this bug fix, uicontextmenus could not be displayed (crash)
+disp(h)
+
+Handle of type "uicontextmenu" with properties:
+===============================================
+Parent:
+Children: ["uimenu";"uimenu"]
+// Before this bug fix, uicontextmenus were not be saved
+save(TMPDIR + filesep() + "bug_4782.tmp", h);
+clear h
+load(TMPDIR + filesep() + "bug_4782.tmp");
+deletefile(TMPDIR + filesep() + "bug_4782.tmp");
+disp(h)
+
+Handle of type "uicontextmenu" with properties:
+===============================================
+Parent:
+Children: ["uimenu";"uimenu"]
+// Check that children are saved and loaded in the same order
+if size(h.children,"*")<>2 then bugmes();quit;end
+if get(h.children(1),"label")<>"foo1" then bugmes();quit;end
+if get(h.children(2),"label")<>"foo2" then bugmes();quit;end
+clear h h1 h2
+// Same test with uimenus (problems with children save/load before this fix)
+h = uimenu("Parent", gcf(), "Label", "parentuimenu");
+h1 = uimenu("Parent", h, "label", "uimenufoo1", "Callback", "disp hello");
+h2 = uimenu("Parent", h, "label", "uimenufoo2", "Callback", "disp coucou");
+// Before this bug fix, uimenus children were not be saved
+save(TMPDIR + filesep() + "bug_4782.tmp", h);
+clear h
+load(TMPDIR + filesep() + "bug_4782.tmp");
+deletefile(TMPDIR + filesep() + "bug_4782.tmp");
+// Check that children are saved and loaded in the same order
+if size(h.children,"*")<>2 then bugmes();quit;end
+if get(h.children(1),"label")<>"uimenufoo1" then bugmes();quit;end
+if get(h.children(2),"label")<>"uimenufoo2" then bugmes();quit;end
+clear h h1 h2
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+//
+// <-- Non-regression test for bug 4782 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=4782
+//
+// <-- Short Description -->
+// Can not save/display uicontextmenu
+
+warning("off");
+h = uicontextmenu();
+h1 = uimenu("Parent", h, "label", "foo1", "Callback", "disp hello");
+h2 = uimenu("Parent", h, "label", "foo2", "Callback", "disp coucou");
+
+// Before this bug fix, uicontextmenus could not be displayed (crash)
+disp(h)
+
+// Before this bug fix, uicontextmenus were not be saved
+save(TMPDIR + filesep() + "bug_4782.tmp", h);
+clear h
+load(TMPDIR + filesep() + "bug_4782.tmp");
+deletefile(TMPDIR + filesep() + "bug_4782.tmp");
+
+disp(h)
+// Check that children are saved and loaded in the same order
+if size(h.children,"*")<>2 then pause;end
+if get(h.children(1),"label")<>"foo1" then pause;end
+if get(h.children(2),"label")<>"foo2" then pause;end
+
+clear h h1 h2
+
+// Same test with uimenus (problems with children save/load before this fix)
+h = uimenu("Parent", gcf(), "Label", "parentuimenu");
+h1 = uimenu("Parent", h, "label", "uimenufoo1", "Callback", "disp hello");
+h2 = uimenu("Parent", h, "label", "uimenufoo2", "Callback", "disp coucou");
+
+// Before this bug fix, uimenus children were not be saved
+save(TMPDIR + filesep() + "bug_4782.tmp", h);
+clear h
+load(TMPDIR + filesep() + "bug_4782.tmp");
+deletefile(TMPDIR + filesep() + "bug_4782.tmp");
+
+// Check that children are saved and loaded in the same order
+if size(h.children,"*")<>2 then pause;end
+if get(h.children(1),"label")<>"uimenufoo1" then pause;end
+if get(h.children(2),"label")<>"uimenufoo2" then pause;end
+
+clear h h1 h2
h.user_data = list("hello", "Scilab", 5);
h.tag = "My uimenu tag"; // Default is ""
// Save figure contents
-save(TMPDIR + "/uicontrol.scg", h);
+save(TMPDIR + "/uicontrol.scg", "h");
hsaved = h;
clear h;
// Load saved handle
h.tag = "My uimenu tag"; // Default is ""
// Save figure contents
-save(TMPDIR + "/uicontrol.scg", h);
+save(TMPDIR + "/uicontrol.scg", "h");
hsaved = h;
clear h;
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// This test check save and load functions used with uicontrols
+// The following functions are tested:
+// - SCI/modules/graphics/macros/%h_save.sci
+// - SCI/modules/graphics/macros/%h_load.sci
+warning("off");
+// Create an uimenu
+f = scf(0);
+h = uicontrol("parent", f, "style", "frame"); // Default style is pushbutton
+// Change value of each property to be sure it is saved and loaded correctly
+h.backgroundcolor = [0 0 0]; // Default is [0.6 0.6 0.6]
+h.enable = "off"; // Default is "on"
+h.fontangle = "italic"; // Default is "normal"
+h.fontname = "arial"; // Default is "helvetica"
+h.fontsize = 20; // Default is 10
+h.fontunits = "pixels"; // Default is "points"
+h.fontweight = "bold"; // Default is "normal"
+h.foregroundcolor = [1 1 1]; // Default is [0 0 0]
+h.horizontalalignment = "right"; // Default is "center"
+h.listboxtop = 1; // Default is []
+h.max = 10; // Default is 1
+h.min = 5; // Default is 0
+h.position = [100 100 200 200]; // Default is [20 20 80 40]
+h.relief = "sunken"; // Default is "ridge" for frames
+h.sliderstep = [1 2]; // Default is [0.01,0.1]
+h.string = "titi"; // Default is ""
+h.units = "points"; // Default is pixels
+h.value = 10; // Default is []
+h.verticalalignment = "top"; // Default is "center"
+h.visible = "off"; // Default is "on"
+h.callback = "disp(1)"; // Default is ""
+h.callback_type = 1; // Default is 0
+h.user_data = list("hello", "Scilab", 5);
+h.tag = "My uimenu tag"; // Default is ""
+// Save figure contents
+save(TMPDIR + "/uicontrol.scg", h);
+hsaved = h;
+clear h;
+// Load saved handle
+load(TMPDIR + "/uicontrol.scg");
+// Check if properties are equal
+if or(h.style<>hsaved.style) then bugmes();quit;end
+if or(h.backgroundcolor<>hsaved.backgroundcolor) then bugmes();quit;end
+if or(h.enable<>hsaved.enable) then bugmes();quit;end
+if or(h.fontangle<>hsaved.fontangle) then bugmes();quit;end
+if or(h.fontname<>hsaved.fontname) then bugmes();quit;end
+//if or(h.fontsize<>hsaved.fontsize) then bugmes();quit;end // TODO FIX ME !!
+if or(h.fontunits<>hsaved.fontunits) then bugmes();quit;end
+if or(h.fontweight<>hsaved.fontweight) then bugmes();quit;end
+if or(h.foregroundcolor<>hsaved.foregroundcolor) then bugmes();quit;end
+if or(h.horizontalalignment<>hsaved.horizontalalignment) then bugmes();quit;end
+if or(h.listboxtop<>hsaved.listboxtop) then bugmes();quit;end
+if or(h.max<>hsaved.max) then bugmes();quit;end
+if or(h.min<>hsaved.min) then bugmes();quit;end
+if abs(sum(h.position-hsaved.position)) > 4 then bugmes();quit;end // TODO FIX ME !! Can have a difference of 1 (point or pixel) when getting position
+if or(h.relief<>hsaved.relief) then bugmes();quit;end
+if or(h.sliderstep<>hsaved.sliderstep) then bugmes();quit;end
+if or(h.string<>hsaved.string) then bugmes();quit;end
+if or(h.units<>hsaved.units) then bugmes();quit;end
+if or(h.value<>hsaved.value) then bugmes();quit;end
+if or(h.verticalalignment<>hsaved.verticalalignment) then bugmes();quit;end
+if or(h.visible<>hsaved.visible) then bugmes();quit;end
+if or(h.callback<>hsaved.callback) then bugmes();quit;end
+if or(h.callback_type<>hsaved.callback_type) then bugmes();quit;end
+if or(h.user_data<>hsaved.user_data) then bugmes();quit;end
+if or(h.tag<>hsaved.tag) then bugmes();quit;end
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+// This test check save and load functions used with uicontrols
+// The following functions are tested:
+// - SCI/modules/graphics/macros/%h_save.sci
+// - SCI/modules/graphics/macros/%h_load.sci
+
+warning("off");
+
+// Create an uimenu
+f = scf(0);
+h = uicontrol("parent", f, "style", "frame"); // Default style is pushbutton
+// Change value of each property to be sure it is saved and loaded correctly
+h.backgroundcolor = [0 0 0]; // Default is [0.6 0.6 0.6]
+h.enable = "off"; // Default is "on"
+h.fontangle = "italic"; // Default is "normal"
+h.fontname = "arial"; // Default is "helvetica"
+h.fontsize = 20; // Default is 10
+h.fontunits = "pixels"; // Default is "points"
+h.fontweight = "bold"; // Default is "normal"
+h.foregroundcolor = [1 1 1]; // Default is [0 0 0]
+h.horizontalalignment = "right"; // Default is "center"
+h.listboxtop = 1; // Default is []
+h.max = 10; // Default is 1
+h.min = 5; // Default is 0
+h.position = [100 100 200 200]; // Default is [20 20 80 40]
+h.relief = "sunken"; // Default is "ridge" for frames
+h.sliderstep = [1 2]; // Default is [0.01,0.1]
+h.string = "titi"; // Default is ""
+h.units = "points"; // Default is pixels
+h.value = 10; // Default is []
+h.verticalalignment = "top"; // Default is "center"
+h.visible = "off"; // Default is "on"
+h.callback = "disp(1)"; // Default is ""
+h.callback_type = 1; // Default is 0
+h.user_data = list("hello", "Scilab", 5);
+h.tag = "My uimenu tag"; // Default is ""
+
+// Save figure contents
+save(TMPDIR + "/uicontrol.scg", h);
+
+hsaved = h;
+clear h;
+
+// Load saved handle
+load(TMPDIR + "/uicontrol.scg");
+
+// Check if properties are equal
+if or(h.style<>hsaved.style) then pause; end
+if or(h.backgroundcolor<>hsaved.backgroundcolor) then pause; end
+if or(h.enable<>hsaved.enable) then pause; end
+if or(h.fontangle<>hsaved.fontangle) then pause; end
+if or(h.fontname<>hsaved.fontname) then pause; end
+//if or(h.fontsize<>hsaved.fontsize) then pause; end // TODO FIX ME !!
+if or(h.fontunits<>hsaved.fontunits) then pause; end
+if or(h.fontweight<>hsaved.fontweight) then pause; end
+if or(h.foregroundcolor<>hsaved.foregroundcolor) then pause; end
+if or(h.horizontalalignment<>hsaved.horizontalalignment) then pause; end
+if or(h.listboxtop<>hsaved.listboxtop) then pause; end
+if or(h.max<>hsaved.max) then pause; end
+if or(h.min<>hsaved.min) then pause; end
+if abs(sum(h.position-hsaved.position)) > 4 then pause; end // TODO FIX ME !! Can have a difference of 1 (point or pixel) when getting position
+if or(h.relief<>hsaved.relief) then pause; end
+if or(h.sliderstep<>hsaved.sliderstep) then pause; end
+if or(h.string<>hsaved.string) then pause; end
+if or(h.units<>hsaved.units) then pause; end
+if or(h.value<>hsaved.value) then pause; end
+if or(h.verticalalignment<>hsaved.verticalalignment) then pause; end
+if or(h.visible<>hsaved.visible) then pause; end
+if or(h.callback<>hsaved.callback) then pause; end
+if or(h.callback_type<>hsaved.callback_type) then pause; end
+if or(h.user_data<>hsaved.user_data) then pause; end
+if or(h.tag<>hsaved.tag) then pause; end
h.callback_type = 1; // Default is 0
h.tag = "My uimenu tag"; // Default is ""
// Save figure contents
-save(TMPDIR + "/uimenu.scg", h);
+save(TMPDIR + "/uimenu.scg", "h");
hsaved = h;
clear h;
// Load saved handle
h.tag = "My uimenu tag"; // Default is ""
// Save figure contents
-save(TMPDIR + "/uimenu.scg", h);
+save(TMPDIR + "/uimenu.scg", "h");
hsaved = h;
clear h;
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// This test check save and load functions used with uimenus
+// The following functions are tested:
+// - SCI/modules/graphics/macros/%h_save.sci
+// - SCI/modules/graphics/macros/%h_load.sci
+warning("off");
+// Create an uimenu
+f = scf(0);
+h = uimenu("parent", f);
+// Change value of each property to be sure it is saved and loaded correctly
+h.enable = "off"; // Default is "on"
+h.foregroundcolor = [1 1 1]; // Default is [0.0627451,0.0627451,0.0627451]
+h.label = "My uimenu"; // Default is ""
+h.visible = "off"; // Default is "on"
+h.callback = "disp(1)"; // Default is ""
+h.callback_type = 1; // Default is 0
+h.tag = "My uimenu tag"; // Default is ""
+// Save figure contents
+save(TMPDIR + "/uimenu.scg", h);
+hsaved = h;
+clear h;
+// Load saved handle
+load(TMPDIR + "/uimenu.scg");
+// Check if properties are equal
+if h.enable<>hsaved.enable then bugmes();quit;end
+if h.foregroundcolor<>hsaved.foregroundcolor then bugmes();quit;end
+if h.label<>hsaved.label then bugmes();quit;end
+if h.visible<>hsaved.visible then bugmes();quit;end
+if h.callback<>hsaved.callback then bugmes();quit;end
+if h.callback_type<>hsaved.callback_type then bugmes();quit;end
+if h.tag<>hsaved.tag then bugmes();quit;end
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+// This test check save and load functions used with uimenus
+// The following functions are tested:
+// - SCI/modules/graphics/macros/%h_save.sci
+// - SCI/modules/graphics/macros/%h_load.sci
+
+warning("off");
+
+// Create an uimenu
+f = scf(0);
+h = uimenu("parent", f);
+// Change value of each property to be sure it is saved and loaded correctly
+h.enable = "off"; // Default is "on"
+h.foregroundcolor = [1 1 1]; // Default is [0.0627451,0.0627451,0.0627451]
+h.label = "My uimenu"; // Default is ""
+h.visible = "off"; // Default is "on"
+h.callback = "disp(1)"; // Default is ""
+h.callback_type = 1; // Default is 0
+h.tag = "My uimenu tag"; // Default is ""
+
+// Save figure contents
+save(TMPDIR + "/uimenu.scg", h);
+
+hsaved = h;
+clear h;
+
+// Load saved handle
+load(TMPDIR + "/uimenu.scg");
+
+// Check if properties are equal
+if h.enable<>hsaved.enable then pause; end
+if h.foregroundcolor<>hsaved.foregroundcolor then pause; end
+if h.label<>hsaved.label then pause; end
+if h.visible<>hsaved.visible then pause; end
+if h.callback<>hsaved.callback then pause; end
+if h.callback_type<>hsaved.callback_type then pause; end
+if h.tag<>hsaved.tag then pause; end
* Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET
* Copyright (C) 2010 - DIGITEO - Antoine ELIAS
* Copyright (C) 2010 - DIGITEO - Allan CORNET
-*
+*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
-*
+*
*/
-/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
#include <hdf5.h>
#include <string.h>
#include "h5_fileManagement.h"
#ifdef _MSC_VER
#include "strdup_windows.h"
#endif
-/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
static char *getPathFilename(char *fullfilename);
static char *getFilenameWithExtension(char *fullfilename);
-/*--------------------------------------------------------------------------*/
-int createHDF5File(char *name)
+/*--------------------------------------------------------------------------*/
+int createHDF5File(char *name)
{
hid_t file;
hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
int ierr = 0;
//H5Pset_fclose_degree(fapl, H5F_CLOSE_STRONG);
-
+
/* TO DO : remove when HDF5 will be fixed ... */
/* HDF5 does not manage no ANSI characters */
/* UGLY workaround :( */
currentpath = scigetcwd(&ierr);
//prevent error msg to change directory to ""
- if(strcmp(pathdest, "") != 0)
+ if (strcmp(pathdest, "") != 0)
{
scichdir(pathdest);
}
/*bug 5629 : to prevent replace directory by file*/
- if(isdir(filename))
+ if (isdir(filename))
{
return -2;
}
- if(FileExist(filename))
+ if (FileExist(filename))
{
deleteafile(filename);
}
scichdir(currentpath);
- if (currentpath) {FREE(currentpath); currentpath = NULL;}
- if (filename) {FREE(filename); filename = NULL;}
- if (pathdest) {FREE(pathdest); pathdest = NULL;}
+ if (currentpath)
+ {
+ FREE(currentpath);
+ currentpath = NULL;
+ }
+ if (filename)
+ {
+ FREE(filename);
+ filename = NULL;
+ }
+ if (pathdest)
+ {
+ FREE(pathdest);
+ pathdest = NULL;
+ }
return file;
}
-/*--------------------------------------------------------------------------*/
-int openHDF5File(char *name)
+/*--------------------------------------------------------------------------*/
+int openHDF5File(char *name)
{
hid_t file;
char *pathdest = getPathFilename(name);
char *currentpath = NULL;
char *filename = getFilenameWithExtension(name);
int ierr = 0;
+ /* Used to avoid stack trace to be displayed */
+ H5E_auto2_t oldfunc;;
+ void *oldclientdata = NULL;
/* TO DO : remove when HDF5 will be fixed ... */
/* HDF5 does not manage no ANSI characters */
currentpath = scigetcwd(&ierr);
//prevent error msg to change directory to ""
- if(strcmp(pathdest, "") != 0)
+ if (strcmp(pathdest, "") != 0)
{
scichdir(pathdest);
}
+ /* Save old error handler */
+ H5Eget_auto2(H5E_DEFAULT, &oldfunc, &oldclientdata);
+
+ /* Turn off error handling */
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
file = H5Fopen (filename, H5F_ACC_RDONLY, H5P_DEFAULT);
+ /* The following test will display the backtrace in case of error */
+ /* Deactivated because displayed each time we call 'load' to open a non-HDF5 file */
+ /*if (file < 0)
+ {
+ H5Eprint(stderr);
+ }*/
+ /* Restore previous error handler */
+ H5Eset_auto2(H5E_DEFAULT, oldfunc, oldclientdata);
scichdir(currentpath);
- if (currentpath) {FREE(currentpath); currentpath = NULL;}
- if (filename) {FREE(filename); filename = NULL;}
- if (pathdest) {FREE(pathdest); pathdest = NULL;}
+ if (currentpath)
+ {
+ FREE(currentpath);
+ currentpath = NULL;
+ }
+ if (filename)
+ {
+ FREE(filename);
+ filename = NULL;
+ }
+ if (pathdest)
+ {
+ FREE(pathdest);
+ pathdest = NULL;
+ }
return file;
}
-/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
void closeHDF5File(int file)
{
herr_t status = 0;
// H5Fflush(file, H5F_SCOPE_GLOBAL);
status = H5Fclose(file);
- if(status < 0)
+ if (status < 0)
{
fprintf(stderr, "%s", "failed to close file");
}
}
-/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
static char *getPathFilename(char *fullfilename)
{
char *path = NULL;
}
}
- if (drv) {FREE(drv); drv = NULL;}
- if (dir) {FREE(dir); dir = NULL;}
- if (name) {FREE(name); name = NULL;}
- if (ext) {FREE(ext); ext = NULL;}
+ if (drv)
+ {
+ FREE(drv);
+ drv = NULL;
+ }
+ if (dir)
+ {
+ FREE(dir);
+ dir = NULL;
+ }
+ if (name)
+ {
+ FREE(name);
+ name = NULL;
+ }
+ if (ext)
+ {
+ FREE(ext);
+ ext = NULL;
+ }
}
return path;
}
-/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
static char *getFilenameWithExtension(char *fullfilename)
{
char *filename = NULL;
}
}
- if (drv) {FREE(drv); drv = NULL;}
- if (dir) {FREE(dir); dir = NULL;}
- if (name) {FREE(name); name = NULL;}
- if (ext) {FREE(ext); ext = NULL;}
+ if (drv)
+ {
+ FREE(drv);
+ drv = NULL;
+ }
+ if (dir)
+ {
+ FREE(dir);
+ dir = NULL;
+ }
+ if (name)
+ {
+ FREE(name);
+ name = NULL;
+ }
+ if (ext)
+ {
+ FREE(ext);
+ ext = NULL;
+ }
}
return filename;
}
-/*--------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------------*/
deff('y=INT(x)','y=uint8(x)')
X=round(10*rand(1,30));
x=INT(X);
-save(TMPDIR+'/foo',x)
+save(TMPDIR+'/foo','x')
clear x;load(TMPDIR+'/foo');if or(x<>INT(X)) then bugmes();quit;end
-x=list(1,x,2);save(TMPDIR+'/foo',x)
+x=list(1,x,2);save(TMPDIR+'/foo','x')
clear x;load(TMPDIR+'/foo');if or(x<>list(1,INT(X),2)) then bugmes();quit;end
deff('y=INT(x)','y=int32(x)')
X=round(10*rand(1,30));
x=INT(X);
-save(TMPDIR+'/foo',x)
+save(TMPDIR+'/foo','x')
clear x;load(TMPDIR+'/foo');if or(x<>INT(X)) then bugmes();quit;end
-x=list(1,x,2);save(TMPDIR+'/foo',x)
+x=list(1,x,2);save(TMPDIR+'/foo','x')
clear x;load(TMPDIR+'/foo');if or(x<>list(1,INT(X),2)) then bugmes();quit;end
//abs
deff('y=INT(x)','y=int8(x)')
X=round(10*rand(1,30));
x=INT(X);
-save(TMPDIR+'/foo',x)
+save(TMPDIR+'/foo','x')
clear x;load(TMPDIR+'/foo');if or(x<>INT(X)) then pause,end
-x=list(1,x,2);save(TMPDIR+'/foo',x)
+x=list(1,x,2);save(TMPDIR+'/foo','x')
clear x;load(TMPDIR+'/foo');if or(x<>list(1,INT(X),2)) then pause,end
deff('y=INT(x)','y=int32(x)')
X=round(10*rand(1,30));
x=INT(X);
-save(TMPDIR+'/foo',x)
+save(TMPDIR+'/foo','x')
clear x;load(TMPDIR+'/foo');if or(x<>INT(X)) then pause,end
-x=list(1,x,2);save(TMPDIR+'/foo',x)
+x=list(1,x,2);save(TMPDIR+'/foo','x')
clear x;load(TMPDIR+'/foo');if or(x<>list(1,INT(X),2)) then pause,end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+warning("off");
+funcprot(0);
+//extractions
+v=int8([1 2 3]);
+if v(2)<>int8(2) then bugmes();quit;end
+if or(v([1 3])<>int8([1 3])) then bugmes();quit;end
+if or(v([3 3])<>int8([3 3])) then bugmes();quit;end
+if or(v(:)<>int8([1 2 3]')) then bugmes();quit;end
+if v([])<>[] then bugmes();quit;end
+v=int32([1 2 3;4 5 6]);
+if v(2)<>int8(4) then bugmes();quit;end
+if or(v([1 3])<>int8([1;2])) then bugmes();quit;end
+if or(v([3 3])<>int8([2;2])) then bugmes();quit;end
+if or(v(:)<>int8([1;4;2;5;3;6])) then bugmes();quit;end
+if v([])<>[] then bugmes();quit;end
+if v(2,1)<>int8(4) then bugmes();quit;end
+if or(v(1,[1 3])<>int8([1 3])) then bugmes();quit;end
+if or(v(1,[3 3])<>int8([3 3])) then bugmes();quit;end
+if or(v(1,:)<>int8([1 2 3])) then bugmes();quit;end
+if or(v(:,2)<>int8([2;5])) then bugmes();quit;end
+if or(v([1 1],:)<>int8([1 2 3;1 2 3])) then bugmes();quit;end
+if or(v(:,[2 1])<>int8([2 1;5 4])) then bugmes();quit;end
+if or(v(1,1:$)<>int8([1 2 3])) then bugmes();quit;end
+if or(v(1:$,2)<>int8([2;5])) then bugmes();quit;end
+if or(v([1 1],1:$)<>int8([1 2 3;1 2 3])) then bugmes();quit;end
+if or(v(1:$,[2 1])<>int8([2 1;5 4])) then bugmes();quit;end
+//insertion
+v=int8([1 2 3]);
+v(2)=int8(3);if or(v<>int8([1 3 3])) then bugmes();quit;end
+v(4)=int8(-5);if or(v<>int8([1 3 3 -5])) then bugmes();quit;end
+v([1 4])=int8([2 5]);if or(v<>int8([2 3 3 5])) then bugmes();quit;end
+v([1 1])=int8([2 5]);if or(v<>int8([5 3 3 5])) then bugmes();quit;end
+v([1 1 1 1 1 1])=int8([2 5 6 7 8 9]);if or(v<>int8([9 3 3 5])) then bugmes();quit;end
+v([4 2])=int8([8 5]);if or(v<>int8([9 5 3 8])) then bugmes();quit;end
+v=uint16([1 2 3]);
+v(2)=uint16(3);if or(v<>uint16([1 3 3])) then bugmes();quit;end
+v(4)=uint16(-5);if or(v<>uint16([1 3 3 -5])) then bugmes();quit;end
+v([1 4])=uint16([2 5]);if or(v<>uint16([2 3 3 5])) then bugmes();quit;end
+v([1 1])=uint16([2 5]);if or(v<>uint16([5 3 3 5])) then bugmes();quit;end
+v([1 1 1 1 1 1])=uint16([2 5 6 7 8 9]);if or(v<>uint16([9 3 3 5])) then bugmes();quit;end
+v([4 2])=uint16([8 5]);if or(v<>uint16([9 5 3 8])) then bugmes();quit;end
+v=uint8([1 2 3]);
+v(2,4)=uint8(10);if or(v<>uint8([1 2 3 0;0 0 0 10])) then bugmes();quit;end
+v([2 2],4)=uint8([10;20]);if or(v<>uint8([1 2 3 0;0 0 0 20])) then bugmes();quit;end
+v([2 1],4)=uint8([10;20]);if or(v<>uint8([1 2 3 20;0 0 0 10])) then bugmes();quit;end
+v([2 2 2],4)=uint8([10;20;30]);if or(v<>uint8([1 2 3 20;0 0 0 30])) then bugmes();quit;end
+v=int32([1 2 3]);
+v(2,4)=int32(10);if or(v<>int32([1 2 3 0;0 0 0 10])) then bugmes();quit;end
+v([2 2],4)=int32([10;20]);if or(v<>int32([1 2 3 0;0 0 0 20])) then bugmes();quit;end
+v([2 1],4)=int32([10;20]);if or(v<>int32([1 2 3 20;0 0 0 10])) then bugmes();quit;end
+v([2 2 2],4)=int32([10;20;30]);if or(v<>int32([1 2 3 20;0 0 0 30])) then bugmes();quit;end
+v=int16([1 2 3;0 0 10]);
+v(1,[1 1 1 1])=int16(1:4);;if or(v<>int16([4 2 3;0 0 10])) then bugmes();quit;end
+v([2 2],[1 1 1 1])=int16([1:4;2:5]);if or(v<>int16([4 2 3;5 0 10])) then bugmes();quit;end
+v(3,4)=int16(7);if or(v<>int16([4 2 3 0;5 0 10 0;0 0 0 7])) then bugmes();quit;end
+v=uint32([1 2 3;0 0 10]);
+v(1,[1 1 1 1])=uint32(1:4);;if or(v<>uint32([4 2 3;0 0 10])) then bugmes();quit;end
+v([2 2],[1 1 1 1])=uint32([1:4;2:5]);if or(v<>uint32([4 2 3;5 0 10])) then bugmes();quit;end
+v(3,4)=uint32(7);if or(v<>uint32([4 2 3 0;5 0 10 0;0 0 0 7])) then bugmes();quit;end
+v=[];
+v(5)=int8(1);if or(v<>int8([0;0;0;0;1])) then bugmes();quit;end
+v(2)=int8(4);if or(v<>int8([0;4;0;0;1])) then bugmes();quit;end
+v=uint16([1 2 3;4 5 6]);
+v(:,1)=uint16([4;1]);if or(v<>uint16([4 2 3;1 5 6])) then bugmes();quit;end
+v(:,[1 1])=uint16([4 5;1 2]);if or(v<>uint16([5 2 3;2 5 6])) then bugmes();quit;end
+v(:,[3 1])=uint16([4 5;1 2]);if or(v<>uint16([5 2 4;2 5 1])) then bugmes();quit;end
+v(:,[3 3 3 3])=uint16([4 5 6 7;1 2 3 4]);if or(v<>uint16([5 2 7;2 5 4])) then bugmes();quit;end
+v=int8([1 2 3;4 5 6]);
+v(1,:)=int8([2 3 4]);if or(v<>int8([2 3 4;4 5 6])) then bugmes();quit;end
+v([1 1],:)=int8([2 3 4;4 5 6]);if or(v<>int8([4 5 6;4 5 6])) then bugmes();quit;end
+v([2 2 2 2],:)=int8([2 3 4;4 5 6;7 8 9;10 11 12]);
+if or(v<>int8([4 5 6;10 11 12])) then bugmes();quit;end
+v=uint8([1 2 3]);
+v(2)=[];if or(v<>uint8([1 3])) then bugmes();quit;end
+v=uint8([1 2 3]);
+v([3 2])=[];if v<>uint8(1) then bugmes();quit;end
+v=int8([1 2 3]');
+v(2)=[];if or(v<>int8([1 3]')) then bugmes();quit;end
+v=int8([1 2 3]');
+v([3 2])=[];if v<>int8(1) then bugmes();quit;end
+v=int32([1 2 3;4 5 6]);
+v(1,:)=[];if or(v<>int32([4 5 6])) then bugmes();quit;end
+v=int32([1 2 3;4 5 6]);
+v(:,[3 2])=[];if or(v<>int32([1;4])) then bugmes();quit;end
+//hidden empty index in insertion
+a=int32([1 2;3 4]);a_ref=a;
+a(1,[%f %f])=[];
+if or(a<>a_ref) then bugmes();quit;end
+a([%f %f],1)=[];
+if or(a<>a_ref) then bugmes();quit;end
+a([%f %f],[%f %f])=[];
+if or(a<>a_ref) then bugmes();quit;end
+a=int8([1 2;3 4]);a_ref=a;
+a(1,[%f %f])=[];
+if or(a<>a_ref) then bugmes();quit;end
+a([%f %f],1)=[];
+if or(a<>a_ref) then bugmes();quit;end
+a([%f %f],[%f %f])=[];
+if or(a<>a_ref) then bugmes();quit;end
+//concatenations
+x1=int8(1);x2=int8(7);
+if or([x1 x2]<>int8([1 7])) then bugmes();quit;end
+if or([x1;x2]<>int8([1;7])) then bugmes();quit;end
+if or([x1 []]<>int8([1])) then bugmes();quit;end
+if or([x1;[]]<>int8([1])) then bugmes();quit;end
+if or([[] x2]<>int8([7])) then bugmes();quit;end
+if or([[];x2]<>int8([7])) then bugmes();quit;end
+[x1,x2]=([x1 x2 x1 x2],[x2 x2 x1 x1]);
+if or([x1 x2]<>int8([1 7 1 7 7 7 1 1])) then bugmes();quit;end
+if or([x1;x2]<>int8([1 7 1 7;7 7 1 1])) then bugmes();quit;end
+if or([x1 []]<>int8([1 7 1 7])) then bugmes();quit;end
+if or([x1;[]]<>int8([1 7 1 7])) then bugmes();quit;end
+if or([[] x2]<>int8([7 7 1 1])) then bugmes();quit;end
+if or([[];x2]<>int8([7 7 1 1])) then bugmes();quit;end
+n=300;x1=uint16(1:n);
+if or([x1 x1]<>uint16([1:n 1:n])) then bugmes();quit;end
+if or([x1;x1]<>uint16([1:n;1:n])) then bugmes();quit;end
+//additions soustractions
+X1=1;X2=7;x1=int8(X1);x2=int8(X2);
+if or(x1+x2<>int8(X1+X2)) then bugmes();quit;end
+if or(x1-x2<>int8(X1-X2)) then bugmes();quit;end
+X1=1:10;x1=int8(X1);
+if or(x1+x2<>int8(X1+X2)) then bugmes();quit;end
+if or(x1-x2<>int8(X1-X2)) then bugmes();quit;end
+X2=2:11;x2=int8(X2);
+if or(x1+x2<>int8(X1+X2)) then bugmes();quit;end
+if or(x1-x2<>int8(X1-X2)) then bugmes();quit;end
+if or(-x1<>int8(-(1:10))) then bugmes();quit;end
+X2=[];x2=[]
+ x2 =
+
+ []
+if or(x1+x2<>int8(X1+X2)) then bugmes();quit;end
+if or(x1-x2<>int8(X1-X2)) then bugmes();quit;end
+if or(x2+x1<>int8(X2+X1)) then bugmes();quit;end
+if or(x2-x1<>int8(X2-X1)) then bugmes();quit;end
+//multiplication
+X1=1;X2=7;x1=int8(X1);x2=int8(X2);
+if or(x1*x2<>int8(X1*X2)) then bugmes();quit;end
+if or(x1.*x2<>int8(X1.*X2)) then bugmes();quit;end
+X1=1:10;x1=int8(X1);
+if or(x1*x2<>int8(X1*X2)) then bugmes();quit;end
+if or(x2*x1<>int8(X2*X1)) then bugmes();quit;end
+if or(x1.*x2<>int8(X1.*X2)) then bugmes();quit;end
+if or(x2.*x1<>int8(X2.*X1)) then bugmes();quit;end
+X2=-(1:10);x2=int8(X2);
+if or(x1.*x2<>int8(X1.*X2)) then bugmes();quit;end
+if or(x1'*x2<>int8(X1'*X2)) then bugmes();quit;end
+if or(x1*x2'<>int8(X1*X2')) then bugmes();quit;end
+// comparaisons
+X1=1;X2=7;x1=int8(X1);x2=int8(X2);
+if or((x1>x2)<>(X1>X2)) then bugmes();quit;end
+if or((x1>=x2)<>(X1>=X2)) then bugmes();quit;end
+if or((x1<x2)<>(X1<X2)) then bugmes();quit;end
+if or((x1<=x2)<>(X1<=X2)) then bugmes();quit;end
+if or((x1<>x2)<>(X1<>X2)) then bugmes();quit;end
+X1=1:10;x1=int8(X1);
+if or((x1>x2)<>(X1>X2)) then bugmes();quit;end
+if or((x1>=x2)<>(X1>=X2)) then bugmes();quit;end
+if or((x1<x2)<>(X1<X2)) then bugmes();quit;end
+if or((x1<=x2)<>(X1<=X2)) then bugmes();quit;end
+if or((x1<>x2)<>(X1<>X2)) then bugmes();quit;end
+X2=2:11;x2=int8(X2);
+if or((x1>x2)<>(X1>X2)) then bugmes();quit;end
+if or((x1>=x2)<>(X1>=X2)) then bugmes();quit;end
+if or((x1<x2)<>(X1<X2)) then bugmes();quit;end
+if or((x1<=x2)<>(X1<=X2)) then bugmes();quit;end
+if or((x1<>x2)<>(X1<>X2)) then bugmes();quit;end
+X1=1;x1=int8(X1);
+if or((x1>x2)<>(X1>X2)) then bugmes();quit;end
+if or((x1>=x2)<>(X1>=X2)) then bugmes();quit;end
+if or((x1<x2)<>(X1<X2)) then bugmes();quit;end
+if or((x1<=x2)<>(X1<=X2)) then bugmes();quit;end
+if or((x1<>x2)<>(X1<>X2)) then bugmes();quit;end
+//division
+X1=1;X2=7;x1=int8(X1);x2=int8(X2);
+if or(x1/x2<>int8(0)) then bugmes();quit;end
+if or(x2/x1<>int8(7)) then bugmes();quit;end
+if or(x1\x2<>int8(7)) then bugmes();quit;end
+if or(x2\x1<>int8(0)) then bugmes();quit;end
+if or(x1./x2<>int8(0)) then bugmes();quit;end
+if or(x2./x1<>int8(7)) then bugmes();quit;end
+if or(x1.\x2<>int8(7)) then bugmes();quit;end
+if or(x2.\x1<>int8(0)) then bugmes();quit;end
+X1=1:10;x1=int8(X1);
+if or(x1/x2<>int8([0 0 0 0 0 0 1 1 1 1])) then bugmes();quit;end
+//if or(x2/x1<>int8([7 3 2 1 1 1 1 0 0 0])) then bugmes();quit;end
+if or(x1./x2<>int8([0 0 0 0 0 0 1 1 1 1])) then bugmes();quit;end
+if or(x2./x1<>int8([7 3 2 1 1 1 1 0 0 0])) then bugmes();quit;end
+//if or(x1\x2<>int8([0 0 0 0 0 0 1 1 1 1])) then bugmes();quit;end
+if or(x1.\x2<>int8([7 3 2 1 1 1 1 0 0 0])) then bugmes();quit;end
+if or(x2\x1<> int8([0 0 0 0 0 0 1 1 1 1])) then bugmes();quit;end
+if or(x2.\x1<>int8([0 0 0 0 0 0 1 1 1 1])) then bugmes();quit;end
+X2=-(1:10);x2=int8(X2);
+if or(x1./x2<>int8(-ones(1,10))) then bugmes();quit;end
+if or(x1.\x2<>int8(-ones(1,10))) then bugmes();quit;end
+// puissance
+X1=2;X2=3;x1=int8(X1);x2=int8(X2);
+if or(x1^x2<>int8(X1^X2)) then bugmes();quit;end
+if or(x1.^x2<>int8(X1.^X2)) then bugmes();quit;end
+X1=1:5;x1=int8(X1);
+if or(x1^x2<>int8(X1^X2)) then bugmes();quit;end
+if or(x1.^x2<>int8(X1.^X2)) then bugmes();quit;end
+X1=2;x1=int8(X1);X2=(1:3);x2=int8(X2);
+if or(x1^x2<>int8(X1^X2)) then bugmes();quit;end
+if or(x1.^x2<>int8(X1.^X2)) then bugmes();quit;end
+X1=2:4;x1=int8(X1);
+//if or(x1.^x2<>int8(X1.^X2)) then bugmes();quit;end
+//kronecker
+X1=2;X2=3;x1=int8(X1);x2=int8(X2);
+if or(x1.*.x2<>int8(X1.*.X2)) then bugmes();quit;end
+X1=1:5;x1=int8(X1);
+if or(x1.*.x2<>int8(X1.*.X2)) then bugmes();quit;end
+X1=2;x1=int8(X1);X2=(1:3);x2=int8(X2);
+if or(x1.*.x2<>int8(X1.*.X2)) then bugmes();quit;end
+X1=(1:5)';x1=int8(X1);
+if or(x1.*.x2<>int8(X1.*.X2)) then bugmes();quit;end
+//sum
+X=round(10*rand(1,30));
+deff('y=INT(x)','y=int16(x)')
+x=INT(X);
+if or(sum(x)<>INT(sum(X))) then bugmes();quit;end
+if or(sum(x')<>INT(sum(X'))) then bugmes();quit;end
+if or(cumsum(x)<>INT(cumsum(X))) then bugmes();quit;end
+if or(cumsum(x')<>INT(cumsum(X'))) then bugmes();quit;end
+deff('y=INT(x)','y=uint16(x)')
+x=INT(X);
+if or(sum(x)<>INT(sum(X))) then bugmes();quit;end
+if or(sum(x')<>INT(sum(X'))) then bugmes();quit;end
+if or(cumsum(x)<>INT(cumsum(X))) then bugmes();quit;end
+if or(cumsum(x')<>INT(cumsum(X'))) then bugmes();quit;end
+deff('y=INT(x)','y=uint8(x)')
+x=INT(X);
+if or(sum(x)<>INT(sum(X))) then bugmes();quit;end
+if or(sum(x')<>INT(sum(X'))) then bugmes();quit;end
+if or(cumsum(x)<>INT(cumsum(X))) then bugmes();quit;end
+if or(cumsum(x')<>INT(cumsum(X'))) then bugmes();quit;end
+deff('y=INT(x)','y=int8(x)')
+x=INT(X);
+if or(sum(x)<>INT(sum(X))) then bugmes();quit;end
+if or(sum(x')<>INT(sum(X'))) then bugmes();quit;end
+if or(cumsum(x)<>INT(cumsum(X))) then bugmes();quit;end
+if or(cumsum(x')<>INT(cumsum(X'))) then bugmes();quit;end
+X=round(10*rand(20,30));
+x=INT(X);
+if or(sum(x,1)<>INT(sum(X,1))) then bugmes();quit;end
+if or(sum(x',1)<>INT(sum(X',1))) then bugmes();quit;end
+if or(cumsum(x,1)<>INT(cumsum(X,1))) then bugmes();quit;end
+if or(cumsum(x',1)<>INT(cumsum(X',1))) then bugmes();quit;end
+deff('y=INT(x)','y=uint16(x)')
+x=INT(X);
+if or(sum(x,1)<>INT(sum(X,1))) then bugmes();quit;end
+if or(sum(x',1)<>INT(sum(X',1))) then bugmes();quit;end
+if or(cumsum(x,1)<>INT(cumsum(X,1))) then bugmes();quit;end
+if or(cumsum(x',1)<>INT(cumsum(X',1))) then bugmes();quit;end
+deff('y=INT(x)','y=uint8(x)')
+x=INT(X);
+if or(sum(x,1)<>INT(sum(X,1))) then bugmes();quit;end
+if or(sum(x',1)<>INT(sum(X',1))) then bugmes();quit;end
+if or(cumsum(x,1)<>INT(cumsum(X,1))) then bugmes();quit;end
+if or(cumsum(x',1)<>INT(cumsum(X',1))) then bugmes();quit;end
+deff('y=INT(x)','y=int8(x)')
+x=INT(X);
+if or(sum(x,1)<>INT(sum(X,1))) then bugmes();quit;end
+if or(sum(x',1)<>INT(sum(X',1))) then bugmes();quit;end
+if or(cumsum(x,1)<>INT(cumsum(X,1))) then bugmes();quit;end
+if or(cumsum(x',1)<>INT(cumsum(X',1))) then bugmes();quit;end
+x=INT(X);
+if or(sum(x,'c')<>INT(sum(X,'c'))) then bugmes();quit;end
+if or(sum(x','c')<>INT(sum(X','c'))) then bugmes();quit;end
+if or(cumsum(x,'c')<>INT(cumsum(X,'c'))) then bugmes();quit;end
+if or(cumsum(x','c')<>INT(cumsum(X','c'))) then bugmes();quit;end
+deff('y=INT(x)','y=uint16(x)')
+x=INT(X);
+if or(sum(x,'c')<>INT(sum(X,'c'))) then bugmes();quit;end
+if or(sum(x','c')<>INT(sum(X','c'))) then bugmes();quit;end
+if or(cumsum(x,'c')<>INT(cumsum(X,'c'))) then bugmes();quit;end
+if or(cumsum(x','c')<>INT(cumsum(X','c'))) then bugmes();quit;end
+deff('y=INT(x)','y=uint8(x)')
+x=INT(X);
+if or(sum(x,'c')<>INT(sum(X,'c'))) then bugmes();quit;end
+if or(sum(x','c')<>INT(sum(X','c'))) then bugmes();quit;end
+if or(cumsum(x,'c')<>INT(cumsum(X,'c'))) then bugmes();quit;end
+if or(cumsum(x','c')<>INT(cumsum(X','c'))) then bugmes();quit;end
+deff('y=INT(x)','y=int8(x)')
+x=INT(X);
+if or(sum(x,'c')<>INT(sum(X,'c'))) then bugmes();quit;end
+if or(sum(x','c')<>INT(sum(X','c'))) then bugmes();quit;end
+if or(cumsum(x,'c')<>INT(cumsum(X,'c'))) then bugmes();quit;end
+if or(cumsum(x','c')<>INT(cumsum(X','c'))) then bugmes();quit;end
+//diag triu tril
+deff('y=INT(x)','y=int16(x)')
+X=round(10*rand(1,30));
+x=INT(X);
+if or(diag(x)<>diag(X)) then bugmes();quit;end
+if or(diag(x,2)<>diag(X,2)) then bugmes();quit;end
+if or(diag(x,-2)<>diag(X,-2)) then bugmes();quit;end
+if or(triu(x)<>triu(X)) then bugmes();quit;end
+if or(triu(x,2)<>triu(X,2)) then bugmes();quit;end
+if or(triu(x,-2)<>triu(X,-2)) then bugmes();quit;end
+if or(tril(x)<>tril(X)) then bugmes();quit;end
+if or(tril(x,2)<>tril(X,2)) then bugmes();quit;end
+if or(tril(x,-2)<>tril(X,-2)) then bugmes();quit;end
+X=round(10*rand(2,30));
+x=INT(X);
+if or(diag(x)<>diag(X)) then bugmes();quit;end
+if or(diag(x,2)<>diag(X,2)) then bugmes();quit;end
+if or(diag(x,-2)<>diag(X,-2)) then bugmes();quit;end
+if or(triu(x)<>triu(X)) then bugmes();quit;end
+if or(triu(x,2)<>triu(X,2)) then bugmes();quit;end
+if or(triu(x,-2)<>triu(X,-2)) then bugmes();quit;end
+if or(tril(x)<>tril(X)) then bugmes();quit;end
+if or(tril(x,2)<>tril(X,2)) then bugmes();quit;end
+if or(tril(x,-2)<>tril(X,-2)) then bugmes();quit;end
+deff('y=INT(x)','y=uint8(x)')
+X=round(10*rand(1,30));
+x=INT(X);
+if or(diag(x)<>diag(X)) then bugmes();quit;end
+if or(diag(x,2)<>diag(X,2)) then bugmes();quit;end
+if or(diag(x,-2)<>diag(X,-2)) then bugmes();quit;end
+if or(triu(x)<>triu(X)) then bugmes();quit;end
+if or(triu(x,2)<>triu(X,2)) then bugmes();quit;end
+if or(triu(x,-2)<>triu(X,-2)) then bugmes();quit;end
+if or(tril(x)<>tril(X)) then bugmes();quit;end
+if or(tril(x,2)<>tril(X,2)) then bugmes();quit;end
+if or(tril(x,-2)<>tril(X,-2)) then bugmes();quit;end
+X=round(10*rand(2,30));
+x=INT(X);
+if or(diag(x)<>diag(X)) then bugmes();quit;end
+if or(diag(x,2)<>diag(X,2)) then bugmes();quit;end
+if or(diag(x,-2)<>diag(X,-2)) then bugmes();quit;end
+if or(triu(x)<>triu(X)) then bugmes();quit;end
+if or(triu(x,2)<>triu(X,2)) then bugmes();quit;end
+if or(triu(x,-2)<>triu(X,-2)) then bugmes();quit;end
+if or(tril(x)<>tril(X)) then bugmes();quit;end
+if or(tril(x,2)<>tril(X,2)) then bugmes();quit;end
+if or(tril(x,-2)<>tril(X,-2)) then bugmes();quit;end
+// save load
+deff('y=INT(x)','y=uint8(x)')
+X=round(10*rand(1,30));
+x=INT(X);
+save(TMPDIR+'/foo',x)
+clear x;load(TMPDIR+'/foo');if or(x<>INT(X)) then bugmes();quit;end
+x=list(1,x,2);save(TMPDIR+'/foo',x)
+clear x;load(TMPDIR+'/foo');if or(x<>list(1,INT(X),2)) then bugmes();quit;end
+deff('y=INT(x)','y=int32(x)')
+X=round(10*rand(1,30));
+x=INT(X);
+save(TMPDIR+'/foo',x)
+clear x;load(TMPDIR+'/foo');if or(x<>INT(X)) then bugmes();quit;end
+x=list(1,x,2);save(TMPDIR+'/foo',x)
+clear x;load(TMPDIR+'/foo');if or(x<>list(1,INT(X),2)) then bugmes();quit;end
+//abs
+deff('y=INT(x)','y=int8(x)')
+X=round(10*rand(1,30))-5;
+x=INT(X);
+if or(abs(x)<>INT(abs(X))) then bugmes();quit;end
+deff('y=INT(x)','y=int16(x)')
+X=round(10*rand(1,30))-5;
+x=INT(X);
+if or(abs(x)<>INT(abs(X))) then bugmes();quit;end
+//matrix
+deff('y=INT(x)','y=int8(x)')
+X=round(10*rand(1,30))-5;
+x=INT(X);
+if or(matrix(x,10,-1)<>INT(matrix(X,10,-1))) then bugmes();quit;end
+if or(matrix(x,10,3)<>INT(matrix(X,10,3))) then bugmes();quit;end
+if or(matrix(x,-1,3)<>INT(matrix(X,-1,3))) then bugmes();quit;end
+deff('y=INT(x)','y=uint8(x)')
+X=round(10*rand(1,30))-5;
+x=INT(X);
+if or(matrix(x,10,-1)<>INT(matrix(X,10,-1))) then bugmes();quit;end
+if or(matrix(x,10,3)<>INT(matrix(X,10,3))) then bugmes();quit;end
+if or(matrix(x,-1,3)<>INT(matrix(X,-1,3))) then bugmes();quit;end
+//max min
+deff('y=INT(x)','y=int8(x)')
+X=round(10*rand(2,30))-5;
+Y=ones(2,30);
+x=INT(X);
+y=INT(Y);
+if or(max(x)<>INT(max(X))) then bugmes();quit;end
+if or(max(x,'r')<>INT(max(X,'r'))) then bugmes();quit;end
+if or(max(x,'c')<>INT(max(X,'c'))) then bugmes();quit;end
+if or(max(x,INT(2))<>INT(max(X,2))) then bugmes();quit;end
+if or(max(x,y)<>INT(max(X,Y))) then bugmes();quit;end
+if or(min(x)<>INT(min(X))) then bugmes();quit;end
+if or(min(x,'r')<>INT(min(X,'r'))) then bugmes();quit;end
+if or(min(x,'c')<>INT(min(X,'c'))) then bugmes();quit;end
+if or(min(x,INT(2))<>INT(min(X,2))) then bugmes();quit;end
+if or(min(x,y)<>INT(min(X,Y))) then bugmes();quit;end
+a=[0 3 7];
+b=[1 2 7];
+A=[0 3 7 5;
+ 1 2 0 2
+ 8 9 3 1];
+types=['double','int32','uint32','int16','uint16','int8','uint8']
+ types =
+
+!double int32 uint32 int16 uint16 int8 uint8 !
+// checking max(a,b)
+[mx,kx]=max(a,b);
+for t1=types
+ for t2=types
+ execstr('at='+t1+'(a); bt='+t2+'(b);')
+ [mt,kt]=max(at,bt);
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('max('+t1+','+t2+')'),pause
+ end
+ end
+end
+// checking min(a,b)
+[mn,kn]=min(a,b);
+for t1=types
+ for t2=types
+ execstr('at='+t1+'(a); bt='+t2+'(b);')
+ [mt,kt]=min(at,bt);
+ if or(kt<>kn)|or(mn<>double(mt)) then
+ disp('min('+t1+','+t2+')'),pause
+ end
+ end
+end
+// checking max(A)
+[mx,kx]=max(A)
+ kx =
+
+ 3. 2.
+ mx =
+
+ 9.
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=max(At);
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('max('+t1+')'),pause
+ end
+end
+// checking min(A)
+[mx,kx]=min(A)
+ kx =
+
+ 1. 1.
+ mx =
+
+ 0.
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=min(At);
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('min('+t1+')'),pause
+ end
+end
+// checking max(A,'r')
+[mx,kx]=max(A,'r')
+ kx =
+
+ 3. 3. 1. 1.
+ mx =
+
+ 8. 9. 7. 5.
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=max(At,'r');
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('max('+t1+',''r'')'),pause
+ end
+end
+// checking min(A,'r')
+[mx,kx]=min(A,'r')
+ kx =
+
+ 1. 2. 2. 3.
+ mx =
+
+ 0. 2. 0. 1.
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=min(At,'r');
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('min('+t1+',''r'')'),pause
+ end
+end
+// checking max(A,'c')
+[mx,kx]=max(A,'c')
+ kx =
+
+ 3.
+ 2.
+ 2.
+ mx =
+
+ 7.
+ 2.
+ 9.
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=max(At,'c');
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('max('+t1+',''c'')'),pause
+ end
+end
+// checking min(A,'c')
+[mx,kx]=min(A,'c')
+ kx =
+
+ 1.
+ 3.
+ 4.
+ mx =
+
+ 0.
+ 0.
+ 1.
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=min(At,'c');
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('min('+t1+',''c'')'),pause
+ end
+end
+//int32 int8 ... iconvert
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+warning("off");
+
+funcprot(0);
+
+//extractions
+v=int8([1 2 3]);
+if v(2)<>int8(2) then pause,end
+if or(v([1 3])<>int8([1 3])) then pause,end
+if or(v([3 3])<>int8([3 3])) then pause,end
+if or(v(:)<>int8([1 2 3]')) then pause,end
+if v([])<>[] then pause,end
+v=int32([1 2 3;4 5 6]);
+if v(2)<>int8(4) then pause,end
+if or(v([1 3])<>int8([1;2])) then pause,end
+if or(v([3 3])<>int8([2;2])) then pause,end
+if or(v(:)<>int8([1;4;2;5;3;6])) then pause,end
+if v([])<>[] then pause,end
+
+if v(2,1)<>int8(4) then pause,end
+if or(v(1,[1 3])<>int8([1 3])) then pause,end
+if or(v(1,[3 3])<>int8([3 3])) then pause,end
+if or(v(1,:)<>int8([1 2 3])) then pause,end
+if or(v(:,2)<>int8([2;5])) then pause,end
+if or(v([1 1],:)<>int8([1 2 3;1 2 3])) then pause,end
+if or(v(:,[2 1])<>int8([2 1;5 4])) then pause,end
+
+
+if or(v(1,1:$)<>int8([1 2 3])) then pause,end
+if or(v(1:$,2)<>int8([2;5])) then pause,end
+if or(v([1 1],1:$)<>int8([1 2 3;1 2 3])) then pause,end
+if or(v(1:$,[2 1])<>int8([2 1;5 4])) then pause,end
+
+
+
+
+//insertion
+v=int8([1 2 3]);
+v(2)=int8(3);if or(v<>int8([1 3 3])) then pause,end
+
+v(4)=int8(-5);if or(v<>int8([1 3 3 -5])) then pause,end
+
+v([1 4])=int8([2 5]);if or(v<>int8([2 3 3 5])) then pause,end
+v([1 1])=int8([2 5]);if or(v<>int8([5 3 3 5])) then pause,end
+v([1 1 1 1 1 1])=int8([2 5 6 7 8 9]);if or(v<>int8([9 3 3 5])) then pause,end
+v([4 2])=int8([8 5]);if or(v<>int8([9 5 3 8])) then pause,end
+
+v=uint16([1 2 3]);
+v(2)=uint16(3);if or(v<>uint16([1 3 3])) then pause,end
+
+v(4)=uint16(-5);if or(v<>uint16([1 3 3 -5])) then pause,end
+
+v([1 4])=uint16([2 5]);if or(v<>uint16([2 3 3 5])) then pause,end
+v([1 1])=uint16([2 5]);if or(v<>uint16([5 3 3 5])) then pause,end
+v([1 1 1 1 1 1])=uint16([2 5 6 7 8 9]);if or(v<>uint16([9 3 3 5])) then pause,end
+v([4 2])=uint16([8 5]);if or(v<>uint16([9 5 3 8])) then pause,end
+
+
+
+v=uint8([1 2 3]);
+v(2,4)=uint8(10);if or(v<>uint8([1 2 3 0;0 0 0 10])) then pause,end
+v([2 2],4)=uint8([10;20]);if or(v<>uint8([1 2 3 0;0 0 0 20])) then pause,end
+v([2 1],4)=uint8([10;20]);if or(v<>uint8([1 2 3 20;0 0 0 10])) then pause,end
+v([2 2 2],4)=uint8([10;20;30]);if or(v<>uint8([1 2 3 20;0 0 0 30])) then pause,end
+
+v=int32([1 2 3]);
+v(2,4)=int32(10);if or(v<>int32([1 2 3 0;0 0 0 10])) then pause,end
+v([2 2],4)=int32([10;20]);if or(v<>int32([1 2 3 0;0 0 0 20])) then pause,end
+v([2 1],4)=int32([10;20]);if or(v<>int32([1 2 3 20;0 0 0 10])) then pause,end
+v([2 2 2],4)=int32([10;20;30]);if or(v<>int32([1 2 3 20;0 0 0 30])) then pause,end
+
+
+
+v=int16([1 2 3;0 0 10]);
+v(1,[1 1 1 1])=int16(1:4);;if or(v<>int16([4 2 3;0 0 10])) then pause,end
+v([2 2],[1 1 1 1])=int16([1:4;2:5]);if or(v<>int16([4 2 3;5 0 10])) then pause,end
+v(3,4)=int16(7);if or(v<>int16([4 2 3 0;5 0 10 0;0 0 0 7])) then pause,end
+
+v=uint32([1 2 3;0 0 10]);
+v(1,[1 1 1 1])=uint32(1:4);;if or(v<>uint32([4 2 3;0 0 10])) then pause,end
+v([2 2],[1 1 1 1])=uint32([1:4;2:5]);if or(v<>uint32([4 2 3;5 0 10])) then pause,end
+v(3,4)=uint32(7);if or(v<>uint32([4 2 3 0;5 0 10 0;0 0 0 7])) then pause,end
+
+
+
+v=[];
+v(5)=int8(1);if or(v<>int8([0;0;0;0;1])) then pause,end
+v(2)=int8(4);if or(v<>int8([0;4;0;0;1])) then pause,end
+
+v=uint16([1 2 3;4 5 6]);
+v(:,1)=uint16([4;1]);if or(v<>uint16([4 2 3;1 5 6])) then pause,end
+v(:,[1 1])=uint16([4 5;1 2]);if or(v<>uint16([5 2 3;2 5 6])) then pause,end
+v(:,[3 1])=uint16([4 5;1 2]);if or(v<>uint16([5 2 4;2 5 1])) then pause,end
+v(:,[3 3 3 3])=uint16([4 5 6 7;1 2 3 4]);if or(v<>uint16([5 2 7;2 5 4])) then pause,end
+
+v=int8([1 2 3;4 5 6]);
+v(1,:)=int8([2 3 4]);if or(v<>int8([2 3 4;4 5 6])) then pause,end
+v([1 1],:)=int8([2 3 4;4 5 6]);if or(v<>int8([4 5 6;4 5 6])) then pause,end
+v([2 2 2 2],:)=int8([2 3 4;4 5 6;7 8 9;10 11 12]);
+if or(v<>int8([4 5 6;10 11 12])) then pause,end
+
+v=uint8([1 2 3]);
+v(2)=[];if or(v<>uint8([1 3])) then pause,end
+v=uint8([1 2 3]);
+v([3 2])=[];if v<>uint8(1) then pause,end
+
+v=int8([1 2 3]');
+v(2)=[];if or(v<>int8([1 3]')) then pause,end
+v=int8([1 2 3]');
+v([3 2])=[];if v<>int8(1) then pause,end
+
+v=int32([1 2 3;4 5 6]);
+v(1,:)=[];if or(v<>int32([4 5 6])) then pause,end
+v=int32([1 2 3;4 5 6]);
+v(:,[3 2])=[];if or(v<>int32([1;4])) then pause,end
+
+//hidden empty index in insertion
+a=int32([1 2;3 4]);a_ref=a;
+
+a(1,[%f %f])=[];
+if or(a<>a_ref) then pause,end
+a([%f %f],1)=[];
+if or(a<>a_ref) then pause,end
+a([%f %f],[%f %f])=[];
+if or(a<>a_ref) then pause,end
+
+a=int8([1 2;3 4]);a_ref=a;
+
+a(1,[%f %f])=[];
+if or(a<>a_ref) then pause,end
+a([%f %f],1)=[];
+if or(a<>a_ref) then pause,end
+a([%f %f],[%f %f])=[];
+if or(a<>a_ref) then pause,end
+
+
+//concatenations
+
+x1=int8(1);x2=int8(7);
+if or([x1 x2]<>int8([1 7])) then pause,end
+if or([x1;x2]<>int8([1;7])) then pause,end
+if or([x1 []]<>int8([1])) then pause,end
+if or([x1;[]]<>int8([1])) then pause,end
+if or([[] x2]<>int8([7])) then pause,end
+if or([[];x2]<>int8([7])) then pause,end
+[x1,x2]=([x1 x2 x1 x2],[x2 x2 x1 x1]);
+
+if or([x1 x2]<>int8([1 7 1 7 7 7 1 1])) then pause,end
+if or([x1;x2]<>int8([1 7 1 7;7 7 1 1])) then pause,end
+if or([x1 []]<>int8([1 7 1 7])) then pause,end
+if or([x1;[]]<>int8([1 7 1 7])) then pause,end
+if or([[] x2]<>int8([7 7 1 1])) then pause,end
+if or([[];x2]<>int8([7 7 1 1])) then pause,end
+
+n=300;x1=uint16(1:n);
+if or([x1 x1]<>uint16([1:n 1:n])) then pause,end
+if or([x1;x1]<>uint16([1:n;1:n])) then pause,end
+
+//additions soustractions
+X1=1;X2=7;x1=int8(X1);x2=int8(X2);
+if or(x1+x2<>int8(X1+X2)) then pause,end
+if or(x1-x2<>int8(X1-X2)) then pause,end
+X1=1:10;x1=int8(X1);
+if or(x1+x2<>int8(X1+X2)) then pause,end
+if or(x1-x2<>int8(X1-X2)) then pause,end
+X2=2:11;x2=int8(X2);
+if or(x1+x2<>int8(X1+X2)) then pause,end
+if or(x1-x2<>int8(X1-X2)) then pause,end
+if or(-x1<>int8(-(1:10))) then pause,end
+
+X2=[];x2=[]
+if or(x1+x2<>int8(X1+X2)) then pause,end
+if or(x1-x2<>int8(X1-X2)) then pause,end
+if or(x2+x1<>int8(X2+X1)) then pause,end
+if or(x2-x1<>int8(X2-X1)) then pause,end
+//multiplication
+X1=1;X2=7;x1=int8(X1);x2=int8(X2);
+if or(x1*x2<>int8(X1*X2)) then pause,end
+if or(x1.*x2<>int8(X1.*X2)) then pause,end
+X1=1:10;x1=int8(X1);
+if or(x1*x2<>int8(X1*X2)) then pause,end
+if or(x2*x1<>int8(X2*X1)) then pause,end
+
+if or(x1.*x2<>int8(X1.*X2)) then pause,end
+if or(x2.*x1<>int8(X2.*X1)) then pause,end
+X2=-(1:10);x2=int8(X2);
+if or(x1.*x2<>int8(X1.*X2)) then pause,end
+if or(x1'*x2<>int8(X1'*X2)) then pause,end
+if or(x1*x2'<>int8(X1*X2')) then pause,end
+
+// comparaisons
+X1=1;X2=7;x1=int8(X1);x2=int8(X2);
+if or((x1>x2)<>(X1>X2)) then pause,end
+if or((x1>=x2)<>(X1>=X2)) then pause,end
+if or((x1<x2)<>(X1<X2)) then pause,end
+if or((x1<=x2)<>(X1<=X2)) then pause,end
+if or((x1<>x2)<>(X1<>X2)) then pause,end
+X1=1:10;x1=int8(X1);
+if or((x1>x2)<>(X1>X2)) then pause,end
+if or((x1>=x2)<>(X1>=X2)) then pause,end
+if or((x1<x2)<>(X1<X2)) then pause,end
+if or((x1<=x2)<>(X1<=X2)) then pause,end
+if or((x1<>x2)<>(X1<>X2)) then pause,end
+
+X2=2:11;x2=int8(X2);
+if or((x1>x2)<>(X1>X2)) then pause,end
+if or((x1>=x2)<>(X1>=X2)) then pause,end
+if or((x1<x2)<>(X1<X2)) then pause,end
+if or((x1<=x2)<>(X1<=X2)) then pause,end
+if or((x1<>x2)<>(X1<>X2)) then pause,end
+
+X1=1;x1=int8(X1);
+if or((x1>x2)<>(X1>X2)) then pause,end
+if or((x1>=x2)<>(X1>=X2)) then pause,end
+if or((x1<x2)<>(X1<X2)) then pause,end
+if or((x1<=x2)<>(X1<=X2)) then pause,end
+if or((x1<>x2)<>(X1<>X2)) then pause,end
+
+//division
+X1=1;X2=7;x1=int8(X1);x2=int8(X2);
+if or(x1/x2<>int8(0)) then pause,end
+if or(x2/x1<>int8(7)) then pause,end
+if or(x1\x2<>int8(7)) then pause,end
+if or(x2\x1<>int8(0)) then pause,end
+if or(x1./x2<>int8(0)) then pause,end
+if or(x2./x1<>int8(7)) then pause,end
+if or(x1.\x2<>int8(7)) then pause,end
+if or(x2.\x1<>int8(0)) then pause,end
+
+X1=1:10;x1=int8(X1);
+if or(x1/x2<>int8([0 0 0 0 0 0 1 1 1 1])) then pause,end
+//if or(x2/x1<>int8([7 3 2 1 1 1 1 0 0 0])) then pause,end
+if or(x1./x2<>int8([0 0 0 0 0 0 1 1 1 1])) then pause,end
+if or(x2./x1<>int8([7 3 2 1 1 1 1 0 0 0])) then pause,end
+//if or(x1\x2<>int8([0 0 0 0 0 0 1 1 1 1])) then pause,end
+if or(x1.\x2<>int8([7 3 2 1 1 1 1 0 0 0])) then pause,end
+if or(x2\x1<> int8([0 0 0 0 0 0 1 1 1 1])) then pause,end
+if or(x2.\x1<>int8([0 0 0 0 0 0 1 1 1 1])) then pause,end
+
+X2=-(1:10);x2=int8(X2);
+if or(x1./x2<>int8(-ones(1,10))) then pause,end
+if or(x1.\x2<>int8(-ones(1,10))) then pause,end
+// puissance
+
+
+X1=2;X2=3;x1=int8(X1);x2=int8(X2);
+if or(x1^x2<>int8(X1^X2)) then pause,end
+if or(x1.^x2<>int8(X1.^X2)) then pause,end
+X1=1:5;x1=int8(X1);
+if or(x1^x2<>int8(X1^X2)) then pause,end
+if or(x1.^x2<>int8(X1.^X2)) then pause,end
+X1=2;x1=int8(X1);X2=(1:3);x2=int8(X2);
+if or(x1^x2<>int8(X1^X2)) then pause,end
+if or(x1.^x2<>int8(X1.^X2)) then pause,end
+X1=2:4;x1=int8(X1);
+//if or(x1.^x2<>int8(X1.^X2)) then pause,end
+
+//kronecker
+X1=2;X2=3;x1=int8(X1);x2=int8(X2);
+if or(x1.*.x2<>int8(X1.*.X2)) then pause,end
+X1=1:5;x1=int8(X1);
+if or(x1.*.x2<>int8(X1.*.X2)) then pause,end
+X1=2;x1=int8(X1);X2=(1:3);x2=int8(X2);
+if or(x1.*.x2<>int8(X1.*.X2)) then pause,end
+X1=(1:5)';x1=int8(X1);
+if or(x1.*.x2<>int8(X1.*.X2)) then pause,end
+
+//sum
+X=round(10*rand(1,30));
+deff('y=INT(x)','y=int16(x)')
+x=INT(X);
+if or(sum(x)<>INT(sum(X))) then pause,end
+if or(sum(x')<>INT(sum(X'))) then pause,end
+if or(cumsum(x)<>INT(cumsum(X))) then pause,end
+if or(cumsum(x')<>INT(cumsum(X'))) then pause,end
+deff('y=INT(x)','y=uint16(x)')
+x=INT(X);
+if or(sum(x)<>INT(sum(X))) then pause,end
+if or(sum(x')<>INT(sum(X'))) then pause,end
+if or(cumsum(x)<>INT(cumsum(X))) then pause,end
+if or(cumsum(x')<>INT(cumsum(X'))) then pause,end
+deff('y=INT(x)','y=uint8(x)')
+x=INT(X);
+if or(sum(x)<>INT(sum(X))) then pause,end
+if or(sum(x')<>INT(sum(X'))) then pause,end
+if or(cumsum(x)<>INT(cumsum(X))) then pause,end
+if or(cumsum(x')<>INT(cumsum(X'))) then pause,end
+deff('y=INT(x)','y=int8(x)')
+x=INT(X);
+if or(sum(x)<>INT(sum(X))) then pause,end
+if or(sum(x')<>INT(sum(X'))) then pause,end
+if or(cumsum(x)<>INT(cumsum(X))) then pause,end
+if or(cumsum(x')<>INT(cumsum(X'))) then pause,end
+X=round(10*rand(20,30));
+x=INT(X);
+if or(sum(x,1)<>INT(sum(X,1))) then pause,end
+if or(sum(x',1)<>INT(sum(X',1))) then pause,end
+if or(cumsum(x,1)<>INT(cumsum(X,1))) then pause,end
+if or(cumsum(x',1)<>INT(cumsum(X',1))) then pause,end
+deff('y=INT(x)','y=uint16(x)')
+x=INT(X);
+if or(sum(x,1)<>INT(sum(X,1))) then pause,end
+if or(sum(x',1)<>INT(sum(X',1))) then pause,end
+if or(cumsum(x,1)<>INT(cumsum(X,1))) then pause,end
+if or(cumsum(x',1)<>INT(cumsum(X',1))) then pause,end
+deff('y=INT(x)','y=uint8(x)')
+x=INT(X);
+if or(sum(x,1)<>INT(sum(X,1))) then pause,end
+if or(sum(x',1)<>INT(sum(X',1))) then pause,end
+if or(cumsum(x,1)<>INT(cumsum(X,1))) then pause,end
+if or(cumsum(x',1)<>INT(cumsum(X',1))) then pause,end
+deff('y=INT(x)','y=int8(x)')
+x=INT(X);
+if or(sum(x,1)<>INT(sum(X,1))) then pause,end
+if or(sum(x',1)<>INT(sum(X',1))) then pause,end
+if or(cumsum(x,1)<>INT(cumsum(X,1))) then pause,end
+if or(cumsum(x',1)<>INT(cumsum(X',1))) then pause,end
+
+x=INT(X);
+if or(sum(x,'c')<>INT(sum(X,'c'))) then pause,end
+if or(sum(x','c')<>INT(sum(X','c'))) then pause,end
+if or(cumsum(x,'c')<>INT(cumsum(X,'c'))) then pause,end
+if or(cumsum(x','c')<>INT(cumsum(X','c'))) then pause,end
+deff('y=INT(x)','y=uint16(x)')
+x=INT(X);
+if or(sum(x,'c')<>INT(sum(X,'c'))) then pause,end
+if or(sum(x','c')<>INT(sum(X','c'))) then pause,end
+if or(cumsum(x,'c')<>INT(cumsum(X,'c'))) then pause,end
+if or(cumsum(x','c')<>INT(cumsum(X','c'))) then pause,end
+deff('y=INT(x)','y=uint8(x)')
+x=INT(X);
+if or(sum(x,'c')<>INT(sum(X,'c'))) then pause,end
+if or(sum(x','c')<>INT(sum(X','c'))) then pause,end
+if or(cumsum(x,'c')<>INT(cumsum(X,'c'))) then pause,end
+if or(cumsum(x','c')<>INT(cumsum(X','c'))) then pause,end
+deff('y=INT(x)','y=int8(x)')
+x=INT(X);
+if or(sum(x,'c')<>INT(sum(X,'c'))) then pause,end
+if or(sum(x','c')<>INT(sum(X','c'))) then pause,end
+if or(cumsum(x,'c')<>INT(cumsum(X,'c'))) then pause,end
+if or(cumsum(x','c')<>INT(cumsum(X','c'))) then pause,end
+
+//diag triu tril
+deff('y=INT(x)','y=int16(x)')
+
+X=round(10*rand(1,30));
+x=INT(X);
+
+if or(diag(x)<>diag(X)) then pause,end
+if or(diag(x,2)<>diag(X,2)) then pause,end
+if or(diag(x,-2)<>diag(X,-2)) then pause,end
+
+if or(triu(x)<>triu(X)) then pause,end
+if or(triu(x,2)<>triu(X,2)) then pause,end
+if or(triu(x,-2)<>triu(X,-2)) then pause,end
+
+if or(tril(x)<>tril(X)) then pause,end
+if or(tril(x,2)<>tril(X,2)) then pause,end
+if or(tril(x,-2)<>tril(X,-2)) then pause,end
+
+X=round(10*rand(2,30));
+x=INT(X);
+
+if or(diag(x)<>diag(X)) then pause,end
+if or(diag(x,2)<>diag(X,2)) then pause,end
+if or(diag(x,-2)<>diag(X,-2)) then pause,end
+
+if or(triu(x)<>triu(X)) then pause,end
+if or(triu(x,2)<>triu(X,2)) then pause,end
+if or(triu(x,-2)<>triu(X,-2)) then pause,end
+
+if or(tril(x)<>tril(X)) then pause,end
+if or(tril(x,2)<>tril(X,2)) then pause,end
+if or(tril(x,-2)<>tril(X,-2)) then pause,end
+
+deff('y=INT(x)','y=uint8(x)')
+X=round(10*rand(1,30));
+x=INT(X);
+
+if or(diag(x)<>diag(X)) then pause,end
+if or(diag(x,2)<>diag(X,2)) then pause,end
+if or(diag(x,-2)<>diag(X,-2)) then pause,end
+
+if or(triu(x)<>triu(X)) then pause,end
+if or(triu(x,2)<>triu(X,2)) then pause,end
+if or(triu(x,-2)<>triu(X,-2)) then pause,end
+
+if or(tril(x)<>tril(X)) then pause,end
+if or(tril(x,2)<>tril(X,2)) then pause,end
+if or(tril(x,-2)<>tril(X,-2)) then pause,end
+
+X=round(10*rand(2,30));
+x=INT(X);
+
+if or(diag(x)<>diag(X)) then pause,end
+if or(diag(x,2)<>diag(X,2)) then pause,end
+if or(diag(x,-2)<>diag(X,-2)) then pause,end
+
+if or(triu(x)<>triu(X)) then pause,end
+if or(triu(x,2)<>triu(X,2)) then pause,end
+if or(triu(x,-2)<>triu(X,-2)) then pause,end
+
+if or(tril(x)<>tril(X)) then pause,end
+if or(tril(x,2)<>tril(X,2)) then pause,end
+if or(tril(x,-2)<>tril(X,-2)) then pause,end
+
+// save load
+deff('y=INT(x)','y=uint8(x)')
+X=round(10*rand(1,30));
+x=INT(X);
+
+save(TMPDIR+'/foo',x)
+clear x;load(TMPDIR+'/foo');if or(x<>INT(X)) then pause,end
+
+x=list(1,x,2);save(TMPDIR+'/foo',x)
+clear x;load(TMPDIR+'/foo');if or(x<>list(1,INT(X),2)) then pause,end
+
+deff('y=INT(x)','y=int32(x)')
+X=round(10*rand(1,30));
+x=INT(X);
+
+save(TMPDIR+'/foo',x)
+clear x;load(TMPDIR+'/foo');if or(x<>INT(X)) then pause,end
+
+x=list(1,x,2);save(TMPDIR+'/foo',x)
+clear x;load(TMPDIR+'/foo');if or(x<>list(1,INT(X),2)) then pause,end
+
+
+//abs
+deff('y=INT(x)','y=int8(x)')
+X=round(10*rand(1,30))-5;
+x=INT(X);
+
+if or(abs(x)<>INT(abs(X))) then pause,end
+
+deff('y=INT(x)','y=int16(x)')
+X=round(10*rand(1,30))-5;
+x=INT(X);
+
+if or(abs(x)<>INT(abs(X))) then pause,end
+
+//matrix
+deff('y=INT(x)','y=int8(x)')
+X=round(10*rand(1,30))-5;
+x=INT(X);
+
+if or(matrix(x,10,-1)<>INT(matrix(X,10,-1))) then pause,end
+if or(matrix(x,10,3)<>INT(matrix(X,10,3))) then pause,end
+if or(matrix(x,-1,3)<>INT(matrix(X,-1,3))) then pause,end
+
+deff('y=INT(x)','y=uint8(x)')
+X=round(10*rand(1,30))-5;
+x=INT(X);
+
+if or(matrix(x,10,-1)<>INT(matrix(X,10,-1))) then pause,end
+if or(matrix(x,10,3)<>INT(matrix(X,10,3))) then pause,end
+if or(matrix(x,-1,3)<>INT(matrix(X,-1,3))) then pause,end
+
+//max min
+deff('y=INT(x)','y=int8(x)')
+X=round(10*rand(2,30))-5;
+Y=ones(2,30);
+x=INT(X);
+y=INT(Y);
+if or(max(x)<>INT(max(X))) then pause,end
+if or(max(x,'r')<>INT(max(X,'r'))) then pause,end
+if or(max(x,'c')<>INT(max(X,'c'))) then pause,end
+if or(max(x,INT(2))<>INT(max(X,2))) then pause,end
+if or(max(x,y)<>INT(max(X,Y))) then pause,end
+
+if or(min(x)<>INT(min(X))) then pause,end
+if or(min(x,'r')<>INT(min(X,'r'))) then pause,end
+if or(min(x,'c')<>INT(min(X,'c'))) then pause,end
+if or(min(x,INT(2))<>INT(min(X,2))) then pause,end
+if or(min(x,y)<>INT(min(X,Y))) then pause,end
+
+
+a=[0 3 7];
+b=[1 2 7];
+A=[0 3 7 5;
+ 1 2 0 2
+ 8 9 3 1];
+types=['double','int32','uint32','int16','uint16','int8','uint8']
+
+// checking max(a,b)
+[mx,kx]=max(a,b);
+for t1=types
+ for t2=types
+ execstr('at='+t1+'(a); bt='+t2+'(b);')
+ [mt,kt]=max(at,bt);
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('max('+t1+','+t2+')'),pause
+ end
+ end
+end
+
+// checking min(a,b)
+[mn,kn]=min(a,b);
+for t1=types
+ for t2=types
+ execstr('at='+t1+'(a); bt='+t2+'(b);')
+ [mt,kt]=min(at,bt);
+ if or(kt<>kn)|or(mn<>double(mt)) then
+ disp('min('+t1+','+t2+')'),pause
+ end
+ end
+end
+
+// checking max(A)
+[mx,kx]=max(A)
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=max(At);
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('max('+t1+')'),pause
+ end
+end
+
+// checking min(A)
+[mx,kx]=min(A)
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=min(At);
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('min('+t1+')'),pause
+ end
+end
+
+
+// checking max(A,'r')
+[mx,kx]=max(A,'r')
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=max(At,'r');
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('max('+t1+',''r'')'),pause
+ end
+end
+
+// checking min(A,'r')
+[mx,kx]=min(A,'r')
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=min(At,'r');
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('min('+t1+',''r'')'),pause
+ end
+end
+
+// checking max(A,'c')
+[mx,kx]=max(A,'c')
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=max(At,'c');
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('max('+t1+',''c'')'),pause
+ end
+end
+
+// checking min(A,'c')
+[mx,kx]=min(A,'c')
+for t1=types
+ execstr('At='+t1+'(A);')
+ [mt,kt]=min(At,'c');
+ if or(kt<>kx)|or(mx<>double(mt)) then
+ disp('min('+t1+',''c'')'),pause
+ end
+end
+
+
+//int32 int8 ... iconvert
current variables in a binary file. If a variable is a graphic handle, the
<literal>save</literal> function saves all the corresponding <link linkend="graphics_entities">graphics_entities</link> definition.
</para>
- <para>
- Since Scilab 5.0, all <link linkend="uimenu">uimenu</link> or <link linkend="uicontrol">uicontrol</link> handles are also saved by this
- function.
- </para>
<para>The file can be given either by its paths or by its descriptor
previously given by <literal>mopen</literal>.
</para>
defined by the descriptor <literal>fd</literal>.
</para>
<para>
- <literal>save(filename,x,y)</literal> or
- <literal>save(fd,x,y)</literal> saves only named variables
- <literal>x</literal> and <literal>y</literal>.
+ <literal>save(filename,x,y)</literal> or <literal>save(fd,x,y)</literal> (with <literal>x</literal> and <literal>y</literal> variables of your environment) saves only named variables <literal>x</literal> and <literal>y</literal>.
+ </para>
+ <para>
+ <literal>save(filename,"x","y")</literal> (with <literal>"x"</literal> and <literal>"y"</literal> names of variables of your environment) will save your data in HDF5, format that will be readable by Scilab 6 family.
</para>
<para>
Saved variables can be reloaded by the
</literal>
command.
</para>
- <para>Note that the written file is portable to other operating systems
- and architectures (little and big endian).
+ <para>Note that the written file is portable to other operating systems and architectures (little and big endian).
</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
+// Binary format readable up to Scilab 5 family
a=eye(2,2);b=ones(a);
save('val.dat',a,b);
clear a
lst=list(1,2,3)
save(fd,lst)
mclose(fd)
+
+// Binary format readable by Scilab 5.4.X and Scilab 6 family
+a=eye(2,2);b=ones(a);
+save("val.h5", "a", "b");
+clear a
+clear b
+load("val.dat", "a", "b");
]]></programlisting>
</refsection>
<refsection role="see also">
</member>
</simplelist>
</refsection>
+ <refsection>
+ <title>History</title>
+ <revhistory>
+ <revision>
+ <revnumber>5.0.0</revnumber>
+ <revremark>
+ All <link linkend="uimenu">uimenu</link> or <link linkend="uicontrol">uicontrol</link> handles are also saved by this function.
+ </revremark>
+ </revision>
+ <revision>
+ <revnumber>5.4.0</revnumber>
+ <revremark>When called with variables names (character string) as input, variables are saved in HDF5 format, format that will be readable by Scilab 6 family.</revremark>
+ </revision>
+ </revhistory>
+ </refsection>
</refentry>
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Antoine ELIAS
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+//called by save function, transform handle in tlist and save result
+function %_save(filename, varargin)
+
+ varList = list();
+ for i = 1:size(varargin)
+ temp = evstr(varargin(i));
+
+ if isList(temp) then
+ //list container
+ value = inspectList(temp);
+ //update
+ execstr(varargin(i) + " = value");
+ elseif typeof(temp) == "handle" then
+ //convert handle to tlist
+ value = extractMatrixHandle(temp);
+ //update
+ execstr(varargin(i) + " = value");
+ end
+ end
+
+ result = export_to_hdf5(filename, varargin(:));
+
+endfunction
+
+function result = isList(var)
+
+ //15 : list
+ //16 : tlist
+ //17 : mlist
+ if or(type(var) == [15, 16, 17]) then
+ result = %t;
+ else
+ result = %f;
+ end
+endfunction
+
+function result = inspectList(l)
+
+ result = list();
+ for i = 1:size(l)
+ if typeof(l(i)) == "handle" then
+ result(i) = extractMatrixHandle(l(i));
+ elseif isList(l(i)) then
+ result(i) = inspectList(l(i));
+ else
+ result(i) = l(i);
+ end
+ end
+endfunction
+
+function matrixHandle = extractMatrixHandle(h)
+
+ if typeof(h) <> "handle" then
+ matrixHandle = [];
+ return;
+ end
+
+ matrixHandle = tlist(["ScilabMatrixHandle", "dims", "values"]);
+ matrixHandle.dims = size(h);
+ matrixHandle.values = list();
+ for i = 1:size(h, "*")
+ matrixHandle.values($+1) = extractSingleHandle(h(i));
+ if or(fieldnames(matrixHandle.values($))=="user_data") then // TODO Remove after graphic branch merge
+ if isList(matrixHandle.values($).user_data) then
+ matrixHandle.values($).user_data = inspectList(matrixHandle.values($).user_data)
+ elseif typeof(matrixHandle.values($).user_data) == "handle" then
+ matrixHandle.values($).user_data = extractMatrixHandle(matrixHandle.values($).user_data)
+ end
+ end
+ end
+endfunction
+
+
+function item = extractSingleHandle(h)
+
+ select h.type
+ case "Figure"
+ item = extractFigure(h);
+ case "Axes"
+ item = extractAxes(h);
+ case "Polyline"
+ item = extractPolyline(h);
+ case "Plot3d"
+ item = extractPlot3d(h);
+ case "Fac3d"
+ item = extractFac3d(h);
+ case "Compound"
+ item = extractCompound(h);
+ case "Rectangle"
+ item = extractRectangle(h);
+ case "Arc"
+ item = extractArc(h);
+ case "Champ"
+ item = extractChamp(h);
+ case "Segs"
+ item = extractSegs(h);
+ case "Grayplot"
+ item = extractGrayplot(h);
+ case "Matplot"
+ item = extractMatplot(h);
+ case "Fec"
+ item = extractFec(h);
+ case "Legend"
+ item = extractLegend(h);
+ case "Text"
+ item = extractText(h);
+ case "Axis"
+ item = extractAxis(h);
+ case "uimenu"
+ item = extractuimenu(h);
+ case "uicontextmenu"
+ item = extractuicontextmenu(h);
+ case "uicontrol"
+ item = extractuicontrol(h);
+ else
+ error("handle of type " + h.type + " unhandled");
+ item = [];
+ end
+endfunction
+
+//
+// FIGURE
+//
+function returnedFigure = extractFigure(h)
+ returnedFigure = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "figure_position", ...
+ "figure_size", ...
+ "axes_size", ...
+ "viewport", ...
+ "info_message", ...
+ "tag", ...
+ "auto_resize", ...
+ "figure_name", ...
+ "figure_id", ...
+ "color_map", ...
+ "pixmap", ...
+ "pixel_drawing_mode", ...
+ "anti_aliasing", ...
+ "immediate_drawing", ...
+ "background", ...
+ "rotation_style", ...
+ "event_handler", ...
+ "event_handler_enable", ...
+ "children", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedFigure);
+
+ for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ returnedFigure(fields(i)) = extractMatrixHandle(h(fields(i)));
+ else
+ returnedFigure(fields(i)) = h(fields(i));
+ end
+ end
+endfunction
+
+//
+// LABEL
+//
+function returnedLabel = extractLabel(h)
+ returnedLabel = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "text", ...
+ "font_foreground", ...
+ "foreground", ...
+ "background", ...
+ "fill_mode", ...
+ "font_style", ...
+ "font_size", ...
+ "fractional_font", ...
+ "font_angle", ...
+ "auto_rotation", ...
+ "position", ...
+ "auto_position"]);
+
+ fields = fieldnames(returnedLabel);
+
+ for i = 1:size(fields, "*")
+ returnedLabel(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// TICKS
+//
+function returnedTicks = extractTicks(ticks)
+ returnedTicks = tlist([
+ "Ticks", ...
+ "locations", ...
+ "labels"]);
+
+ fields = fieldnames(returnedTicks);
+
+ for i = 1:size(fields, "*")
+ returnedTicks(fields(i)) = ticks(fields(i));
+ end
+endfunction
+
+//
+// AXES
+//
+function returnedAxes = extractAxes(h)
+ returnedAxes = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "axes_visible", ...
+ "axes_reverse", ...
+ "grid", ...
+ "grid_position", ...
+ "x_location", ...
+ "y_location", ...
+ "view", ...
+ "title", ...
+ "x_label", ...
+ "y_label", ...
+ "z_label", ...
+ "auto_ticks", ...
+ "x_ticks", ...
+ "y_ticks", ...
+ "z_ticks", ...
+ "box", ...
+ "filled", ...
+ "sub_tics", ...
+ "font_style", ...
+ "font_size", ...
+ "font_color", ...
+ "fractional_font", ...
+ "isoview", ...
+ "cube_scaling", ...
+ "rotation_angles", ...
+ "log_flags", ...
+ "tight_limits", ...
+ "data_bounds", ...
+ "zoom_box", ...
+ "margins", ...
+ "axes_bounds", ...
+ "auto_clear", ...
+ "auto_scale", ...
+ "hidden_axis_color", ...
+ "arc_drawing_method", ...
+ "hiddencolor", ...
+ "line_mode", ...
+ "line_style", ...
+ "thickness", ...
+ "mark_mode", ...
+ "mark_style", ...
+ "mark_size", ...
+ "mark_size_unit", ...
+ "mark_foreground", ...
+ "mark_background", ...
+ "foreground", ...
+ "background", ...
+ "clip_state", ...
+ "clip_box", ...
+ "children", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedAxes);
+
+ for i = 1:size(fields, "*")
+ if or(fields(i) == ["title","x_label","y_label","z_label"]) then
+ returnedAxes(fields(i)) = extractLabel(h(fields(i)));
+ elseif or(fields(i) == ["x_ticks", "y_ticks", "z_ticks"]) then
+ returnedAxes(fields(i)) = extractTicks(h(fields(i)));
+ elseif fields(i) == "children" then
+ returnedAxes(fields(i)) = extractMatrixHandle(h(fields(i)));
+ else
+ returnedAxes(fields(i)) = h(fields(i));
+ end
+ end
+endfunction
+
+//
+// POLYLINE
+//
+function returnedPolyline = extractPolyline(h)
+ returnedPolyline = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "data", ...
+ "closed", ...
+ "line_mode", ...
+ "fill_mode", ...
+ "line_style", ...
+ "thickness", ...
+ "arrow_size_factor", ...
+ "polyline_style", ...
+ "interp_color_vector", ...
+ "interp_color_mode", ...
+ "mark_mode", ...
+ "mark_style", ...
+ "mark_size", ...
+ "mark_size_unit", ...
+ "foreground", ...
+ "background", ...
+ "mark_foreground", ...
+ "mark_background", ...
+ "x_shift", ...
+ "y_shift", ...
+ "z_shift", ...
+ "bar_width", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedPolyline);
+
+ for i = 1:size(fields, "*")
+ returnedPolyline(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// PLOT3D
+//
+function returnedPlot3d = extractPlot3d(h)
+ returnedPlot3d = extractSurface(h);
+endfunction
+
+//
+// FAC3D
+//
+function returnedFac3d = extractFac3d(h)
+ returnedFac3d = extractSurface(h);
+endfunction
+
+//
+// SURFACE
+//
+function returnedSurface = extractSurface(h)
+ returnedSurface = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "surface_mode", ...
+ "foreground", ...
+ "thickness", ...
+ "mark_mode", ...
+ "mark_style", ...
+ "mark_size", ...
+ "mark_size_unit", ...
+ "mark_foreground", ...
+ "mark_background", ...
+ "color_mode", ...
+ "color_flag", ...
+ "data", ...
+ "color_flag", ...
+ "hiddencolor", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data", ...
+ "cdata_mapping"]);
+
+ fields = fieldnames(returnedSurface);
+
+ for i = 1:size(fields, "*")
+ if fields(i)=="cdata_mapping" then
+ if h.type=="Fac3d" then
+ returnedSurface(fields(i)) = h(fields(i));
+ end
+ else
+ returnedSurface(fields(i)) = h(fields(i));
+ end
+ end
+endfunction
+
+//
+// COMPOUND
+//
+function returnedCompound = extractCompound(h)
+ returnedCompound = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "children", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedCompound);
+
+ for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ returnedCompound(fields(i)) = extractMatrixHandle(h(fields(i)));
+ else
+ returnedCompound(fields(i)) = h(fields(i));
+ end
+ end
+endfunction
+
+//
+// RECTANGLE
+//
+function returnedRectangle = extractRectangle(h)
+ returnedRectangle = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "thickness", ...
+ "mark_mode", ...
+ "mark_style", ...
+ "mark_size", ...
+ "mark_size_unit", ...
+ "mark_foreground", ...
+ "mark_background", ...
+ "line_mode", ...
+ "line_style", ...
+ "fill_mode", ...
+ "foreground", ...
+ "background", ...
+ "data", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedRectangle);
+
+ for i = 1:size(fields, "*")
+ returnedRectangle(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// ARC
+//
+function returnedArc = extractArc(h)
+ returnedArc = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "thickness", ...
+ "line_style", ...
+ "line_mode", ...
+ "fill_mode", ...
+ "foreground", ...
+ "background", ...
+ "data", ...
+ "arc_drawing_method", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedArc);
+
+ for i = 1:size(fields, "*")
+ returnedArc(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// CHAMP
+//
+function returnedChamp = extractChamp(h)
+ returnedChamp = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "data", ...
+ "line_style", ...
+ "thickness", ...
+ "colored", ...
+ "arrow_size", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedChamp);
+
+ for i = 1:size(fields, "*")
+ returnedChamp(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// SEG
+//
+function returnedSeg = extractSegs(h)
+ returnedSeg = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "data", ...
+ "line_mode", ...
+ "line_style", ...
+ "thickness", ...
+ "segs_color", ...
+ "mark_mode", ...
+ "mark_style", ...
+ "mark_size", ...
+ "mark_size_unit", ...
+ "mark_foreground", ...
+ "mark_background", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedSeg);
+
+ for i = 1:size(fields, "*")
+ returnedSeg(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// GRAYPLOT
+//
+function returnedGrayplot = extractGrayplot(h)
+ returnedGrayplot = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "data", ...
+ "data_mapping", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedGrayplot);
+
+ for i = 1:size(fields, "*")
+ returnedGrayplot(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// MATPLOT
+//
+function returnedMatplot = extractMatplot(h)
+ returnedMatplot = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "data", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedMatplot);
+
+ for i = 1:size(fields, "*")
+ returnedMatplot(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// FEC
+//
+function returnedFec = extractFec(h)
+ returnedFec = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "data", ...
+ "triangles", ...
+ "z_bounds", ...
+ "color_range", ...
+ "outside_colors", ...
+ "line_mode", ...
+ "foreground", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedFec);
+
+ for i = 1:size(fields, "*")
+ returnedFec(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// LEGEND
+//
+function returnedLegend = extractLegend(h)
+ returnedLegend = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "text", ...
+ "font_style", ...
+ "font_size", ...
+ "font_color", ...
+ "fractional_font", ...
+ "links", ...
+ "legend_location", ...
+ "position", ...
+ "line_mode", ...
+ "thickness", ...
+ "foreground", ...
+ "fill_mode", ...
+ "background", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data", ..
+ "paths"]);
+
+ fields = fieldnames(returnedLegend);
+
+ for i = 1:size(fields, "*")
+ if fields(i) == "links" then
+ returnedLegend(fields(i)) = extractMatrixHandle(h(fields(i)));
+ elseif fields(i) == "paths" then
+ p = list();
+ for kl=1:size(h.links,'*');
+ p($+1) = get_entity_path(h.links(kl));
+ end
+ returnedLegend(fields(i)) = p;
+ else
+ returnedLegend(fields(i)) = h(fields(i));
+ end
+ end
+endfunction
+
+//
+// TEXT
+//
+function returnedText = extractText(h)
+ returnedText = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "text", ...
+ "data", ...
+ "text_box", ...
+ "text_box_mode", ...
+ "foreground", ...
+ "font_style", ...
+ "font_size", ...
+ "font_angle", ...
+ "box", ...
+ "line_mode", ...
+ "fill_mode", ...
+ "font_foreground", ...
+ "background", ...
+ "alignment", ...
+ "fractional_font", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedText);
+
+ for i = 1:size(fields, "*")
+ returnedText(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// AXIS
+//
+function returnedAxis = extractAxis(h)
+ returnedAxis = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "visible", ...
+ "tics_direction", ...
+ "xtics_coord", ...
+ "ytics_coord", ...
+ "tics_color", ...
+ "tics_segment", ...
+ "tics_style", ...
+ "sub_tics", ...
+ "tics_labels", ...
+ "labels_font_size", ...
+ "labels_font_color", ...
+ "fractional_font", ...
+ "clip_state", ...
+ "clip_box", ...
+ "user_data"]);
+
+ fields = fieldnames(returnedAxis);
+
+ for i = 1:size(fields, "*")
+ returnedAxis(fields(i)) = h(fields(i));
+ end
+endfunction
+
+//
+// uimenu
+//
+function returneduimenu = extractuimenu(h)
+ returneduimenu = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "enable", ...
+ "foregroundcolor", ...
+ "label", ...
+ "visible", ...
+ "callback", ...
+ "callback_type", ...
+ "tag", ...
+ "checked", ...
+ "children", ..
+ "user_data"]);
+
+ fields = fieldnames(returneduimenu);
+
+ for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ returneduimenu(fields(i)) = extractMatrixHandle(h(fields(i))($:-1:1));
+ else
+ returneduimenu(fields(i)) = h(fields(i));
+ end
+ end
+endfunction
+
+//
+// UICONTEXTMENU
+//
+function returneduicontextmenu = extractuicontextmenu(h)
+ returneduicontextmenu = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "children"]);
+
+ fields = fieldnames(returneduicontextmenu);
+
+ for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ returneduicontextmenu(fields(i)) = extractMatrixHandle(h(fields(i))($:-1:1));
+ else
+ returneduicontextmenu(fields(i)) = h(fields(i));
+ end
+ end
+endfunction
+
+//
+// uicontrol
+//
+function returneduicontrol = extractuicontrol(h)
+ returneduicontrol = tlist([
+ "ScilabSingleHandle", ...
+ "type", ...
+ "style", ...
+ "backgroundcolor", ...
+ "enable", ...
+ "fontangle", ...
+ "fontname", ...
+ "fontsize", ...
+ "fontunits", ...
+ "fontweight", ...
+ "foregroundcolor", ...
+ "horizontalalignment", ...
+ "listboxtop", ...
+ "max", ...
+ "min", ...
+ "position", ...
+ "relief", ...
+ "sliderstep", ...
+ "string", ...
+ "units", ...
+ "value", ...
+ "verticalalignment", ...
+ "visible", ...
+ "callback", ...
+ "callback_type", ...
+ "user_data", ...
+ "tag", ...
+ "children"]);
+
+ fields = fieldnames(returneduicontrol);
+
+ for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ returneduicontrol(fields(i)) = extractMatrixHandle(h(fields(i))($:-1:1));
+ else
+ returneduicontrol(fields(i)) = h(fields(i));
+ end
+ end
+endfunction
+
+// Utility function for legends, copy/paste from %h_load
+function p=get_entity_path(e)
+// given a handle e on an entity this function returns its path relative
+// to its parent axes.
+// the path is a vector of child index.
+p=[];
+parent=e.parent;
+
+while %t
+ pos=find(parent.children==e,1)
+ if pos==[] then
+ error(msprintf(_("%s : Invalid entity %s\n"),"save","Legend"))
+ end
+ p=[pos p]
+ if parent.type=='Axes' then
+ break
+ end
+ e=parent
+ parent=e.parent;
+end
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Antoine ELIAS
+// Copyright (C) 2012 - DIGITEO - Vincent COUVERT
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+
+function load(filename, varargin)
+
+// Store input arguments as global variables
+global %__varargin__ %__filename__
+%__varargin__ = varargin;
+%__filename__ = filename;
+
+// Clear environment to be sure to load variables even if they already exist
+clear
+
+// Restore input arguments from global variables
+global %__varargin__ %__filename__
+%__varargin__ = %__varargin__;
+%__filename__ = %__filename__;
+
+%__nbNamesBefore__ = size(who("get"), "*");
+
+%__isHdf5Format__ = %T;
+%__ierr__ = execstr("import_from_hdf5(pathconvert(%__filename__, %F, %T))", "errcatch");
+
+if %__ierr__<>0 then
+ %__isHdf5Format__ = %F;
+ %_load(%__filename__, %__varargin__(:));
+end
+clear %__ierr__ ans // ans is the output status of import_from_hdf5
+%__namesAfter__ = who("get");
+
+%__createdNames__ = %__namesAfter__(1:(size(%__namesAfter__, "*") - %__nbNamesBefore__ - 2)); // -2 for %__nbNamesBefore__ & %__isHdf5Format__
+
+%__createdValues__ = list();
+for %__variableIndex = 1:size(%__createdNames__, "*")
+ %__createdValues__($+1) = evstr(%__createdNames__(%__variableIndex));
+end
+
+if %__isHdf5Format__ then
+ [%__createdNames__, %__createdValues__] = %__selectVariables__(%__createdNames__, %__createdValues__, %__varargin__);
+end
+
+execstr("[" + strcat(%__createdNames__, ",") + "] = resume(%__createdValues__(:))");
+
+// Clear temporary variables input arguments from global variables
+clearglobal %__varargin__ %__filename__
+
+endfunction
+
+function [varNames, varValues] = %__selectVariables__(varNames, varValues, loadVarargin)
+
+// Get the names the user wants to load
+userNames = [];
+for kArg = 1:size(loadVarargin)
+ userNames($+1) = loadVarargin(kArg);
+end
+
+// Remove the variables the user does not want
+if ~isempty(userNames) then
+ kVar = 1;
+ while kVar <= size(varNames, "*")
+ if ~or(varNames(kVar)==userNames) then // Not wanted
+ varNames(kVar) = [];
+ varValues(kVar) = null();
+ else
+ kVar = kVar + 1;
+ end
+ end
+end
+
+// Manage handles properly
+varValues = %__convertHandles__(varValues);
+endfunction
+
+function [varValues] = %__convertHandles__(varValues)
+for i = 1:size(varValues)
+ if typeof(varValues(i)) == "ScilabMatrixHandle" then
+ //convert handle to tlist
+ varValues(i) = createMatrixHandle(varValues(i));
+ elseif isList(varValues(i)) then
+ //list container
+ varValues(i) = inspectList(varValues(i));
+ end
+end
+endfunction
+
+function result = isList(var)
+ //15 : list
+ //16 : tlist
+ //17 : mlist
+ if or(type(var) == [15, 16, 17]) then
+ result = %t;
+ else
+ result = %f;
+ end
+endfunction
+
+function varValue = inspectList(varValue)
+for i = 1:size(varValue)
+ if typeof(varValue(i)) == "ScilabMatrixHandle" then
+ varValue(i) = createMatrixHandle(varValue(i));
+ elseif isList(varValue(i)) then
+ varValue(i) = inspectList(varValue(i));
+ else
+ varValue(i) = varValue(i);
+ end
+end
+endfunction
+
+function h = createMatrixHandle(matrixHandle)
+h = [];
+if typeof(matrixHandle) <> "ScilabMatrixHandle" then
+ return;
+end
+
+for i = prod(matrixHandle.dims):-1:1
+ h($+1) = createSingleHandle(matrixHandle.values(i));
+ if or(fieldnames(matrixHandle.values(i))=="user_data") then // TODO Remove after graphic branch merge
+ if isList(matrixHandle.values(i).user_data) then
+ h($).user_data = inspectList(matrixHandle.values(i).user_data)
+ elseif typeof(matrixHandle.values(i).user_data) == "ScilabMatrixHandle" then
+ h($).user_data = createMatrixHandle(matrixHandle.values(i).user_data)
+ end
+ end
+end
+h = matrix(h, matrixHandle.dims);
+endfunction
+
+function h = createSingleHandle(item)
+ select item.type
+ case "Figure"
+ h = createFigure(item);
+ case "Axes"
+ h = createAxes(item);
+ case "Polyline"
+ h = createPolyline(item);
+ case "Plot3d"
+ h = createPlot3d(item);
+ case "Fac3d"
+ h = createFac3d(item);
+ case "Compound"
+ h = createCompound(item);
+ case "Rectangle"
+ h = createRectangle(item);
+ case "Arc"
+ h = createArc(item);
+ case "Champ"
+ h = createChamp(item);
+ case "Segs"
+ h = createSegs(item);
+ case "Grayplot"
+ h = createGrayplot(item);
+ case "Matplot"
+ h = createMatplot(item);
+ case "Fec"
+ h = createFec(item);
+ case "Legend"
+ h = createLegend(item);
+ case "Text"
+ h = createText(item);
+ case "Axis"
+ h = createAxis(item);
+ case "uimenu"
+ h = createuimenu(item);
+ case "uicontextmenu"
+ h = createuicontextmenu(item);
+ case "uicontrol"
+ h = createuicontrol(item);
+ else
+ error("handle of type " + item.type + " unhandled");
+ h = [];
+ end
+endfunction
+
+//
+// FIGURE
+//
+function h = createFigure(figureProperties)
+fields = fieldnames(figureProperties);
+fields(1) = [];
+
+h = scf(figureProperties.figure_id);
+fields(fields=="figure_id") = [];
+
+h.figure_position=figureProperties.figure_position;
+fields(fields=="figure_position") = [];
+// set auto_resize first otherwise viewport modification may not have any effect.
+h.auto_resize = figureProperties.auto_resize;
+fields(fields=="auto_resize") = [];
+h.figure_size = figureProperties.figure_size;
+fields(fields=="figure_size") = [];
+// set axes_size last because it's more important than figure_size
+h.axes_size = figureProperties.axes_size;
+fields(fields=="axes_size") = [];
+
+for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ createMatrixHandle(figureProperties(fields(i)));
+ else
+ h(fields(i)) = figureProperties(fields(i));
+ end
+end
+endfunction
+
+//
+// LABEL
+//
+function h = createLabel(labelProperties, h)
+fields = fieldnames(labelProperties);
+fields(1) = [];
+for i = 1:size(fields, "*")
+ h(fields(i)) = labelProperties(fields(i));
+end
+endfunction
+
+//
+// TICKS
+//
+function h = createTicks(ticksProperties)
+h = tlist(['ticks','locations','labels'], [], []);
+fields = fieldnames(ticksProperties);
+for i = 1:size(fields, "*")
+ h(fields(i)) = ticksProperties(fields(i));
+end
+endfunction
+
+//
+// AXES
+//
+function h = createAxes(axesProperties)
+h = gca();
+fields = fieldnames(axesProperties);
+fields(1) = [];
+for i = 1:size(fields, "*")
+ if or(fields(i) == ["title","x_label","y_label","z_label"]) then
+ createLabel(axesProperties(fields(i)), h(fields(i)));
+ elseif or(fields(i) == ["x_ticks", "y_ticks", "z_ticks"]) then
+ h(fields(i)) = createTicks(axesProperties(fields(i)));
+ elseif fields(i) == "children" then
+ createMatrixHandle(axesProperties(fields(i)));
+ elseif fields(i) == "clip_state" then
+ if axesProperties.clip_state=="on" then
+ set(h,"clip_box",axesProperties.clip_box);
+ end
+ set(h,"clip_state", axesProperties.clip_state);
+ elseif fields(i) == "clip_box" then
+ // managed with 'clip_state'
+ else
+ h(fields(i)) = axesProperties(fields(i));
+ end
+end
+
+// Legend management
+global %LEG
+if ~isempty(%LEG) then
+ // Get handles from paths
+ links=get_links_from_path(h, %LEG.paths)
+ if ~isempty(links) then
+ L = captions(links, %LEG.text)
+ L.visible = %LEG.visible
+ L.font_style = %LEG.font_style
+ L.font_size = %LEG.font_size
+ L.font_color = %LEG.font_color
+ L.fractional_font = %LEG.fractional_font
+ L.mark_mode = 'off';
+ L.legend_location = %LEG.legend_location
+ L.position = %LEG.position
+ L.line_mode = %LEG.line_mode
+ L.thickness = %LEG.thickness
+ L.foreground = %LEG.foreground
+ L.fill_mode = %LEG.fill_mode
+ L.background = %LEG.background
+ if %LEG.clip_state=="on" then
+ L.clip_box = %LEG.clip_box
+ end
+ L.clip_state = %LEG.clip_state
+ L.user_data = %LEG.user_data
+ else
+ warning(msprintf(_("%s: Legend does not fit with the current context. Skipped\n"), "load"));
+ end
+end
+clearglobal %LEG
+endfunction
+
+//
+// POLYLINE
+//
+function h = createPolyline(polylineProperties)
+fields = fieldnames(polylineProperties);
+fields(1) = [];
+
+xpoly(polylineProperties.data(:,1), polylineProperties.data(:,2))
+
+h = gce();
+
+if polylineProperties.clip_state=="on" then
+ set(h, "clip_box", polylineProperties.clip_box)
+end
+set(h, "clip_state", polylineProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+if polylineProperties.interp_color_mode=="on" & ~isempty(polylineProperties.interp_color_vector) then
+ set(h, "interp_color_vector", polylineProperties.interp_color_vector);
+ set(h, "interp_color_mode", polylineProperties.interp_color_mode);
+else
+ if ~isempty(polylineProperties.interp_color_vector) then
+ h.interp_color_vector = polylineProperties.interp_color_vector;
+ end
+ h.interp_color_mode = polylineProperties.interp_color_mode;
+end
+fields(fields=="interp_color_vector") = [];
+fields(fields=="interp_color_mode") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = polylineProperties(fields(i));
+end
+endfunction
+
+//
+// PLOT3D
+//
+function h = createPlot3d(plot3dProperties)
+h = createSurface(plot3dProperties);
+endfunction
+
+//
+// FAC3D
+//
+function h = createFac3d(fac3dProperties)
+h = createSurface(fac3dProperties);
+endfunction
+
+//
+// SURFACE
+//
+function h = createSurface(surfaceProperties)
+// plot3d modify the axes properties
+// - Save it
+// - Draw plot3d
+// - Restore it
+a=gca();
+rotation_angles = a.rotation_angles;
+axes_visible = a.axes_visible;
+box = a.box;
+margins = a.margins;
+x_label_visible = a.x_label.visible;
+y_label_visible = a.y_label.visible;
+z_label_visible = a.z_label.visible;
+x_label_text = a.x_label.text;
+y_label_text = a.y_label.text;
+z_label_text = a.z_label.text;
+axes_isoview = a.isoview;
+
+if (or(surfaceProperties.color_flag==[2 5]) & ~or(fields=="cdata_mapping")) | ..
+ ((surfaceProperties.color_flag>=2) & or(fields=="cdata_mapping")) then
+ plot3d1(surfaceProperties.data.x, surfaceProperties.data.y, list(surfaceProperties.data.z, surfaceProperties.data.color))
+else
+ plot3d(surfaceProperties.data.x,surfaceProperties.data.y,surfaceProperties.data.z)
+end
+fields(fields=="data") = [];
+
+// Restore this properties after plot3d.
+a.rotation_angles = rotation_angles;
+a.axes_visible = axes_visible;
+a.box = box;
+a.margins = margins;
+a.x_label.visible = x_label_visible;
+a.y_label.visible = y_label_visible;
+a.z_label.visible = z_label_visible;
+a.x_label.text = x_label_text;
+a.y_label.text = y_label_text;
+a.z_label.text = z_label_text;
+a.isoview = axes_isoview;
+
+h=gce();
+
+if or(fields=="cdata_mapping") then // Fac3d specific
+ if surfaceProperties.color_flag >= 2 then
+ set(h, "cdata_mapping", surfaceProperties.cdata_mapping);
+ end
+ fields(fields=="cdata_mapping") = [];
+end
+
+if surfaceProperties.clip_state == "on" then
+ set(h,"clip_box", surfaceProperties.clip_box);
+end
+set(h,"clip_state",surfaceProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = surfaceProperties(fields(i));
+end
+endfunction
+
+//
+// COMPOUND
+//
+function h = createCompound(compoundProperties)
+fields = fieldnames(compoundProperties);
+fields(1) = [];
+
+h = glue(createMatrixHandle(compoundProperties.children));
+fields(fields=="children") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = compoundProperties(fields(i));
+end
+endfunction
+
+//
+// RECTANGLE
+//
+function h = createRectangle(rectangleProperties)
+fields = fieldnames(rectangleProperties);
+fields(1) = [];
+
+xrect(0,1,1,1); // create the rectangle with dummy values
+h = gce();
+
+if rectangleProperties.clip_state == "on" then
+ set(h,"clip_box", rectangleProperties.clip_box);
+end
+set(h,"clip_state",rectangleProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = rectangleProperties(fields(i));
+end
+endfunction
+
+//
+// ARC
+//
+function h = createArc(arcProperties)
+fields = fieldnames(arcProperties);
+fields(1) = [];
+
+xarc(0,1,1,1,0,360); // create the arc with dummy values
+h = gce();
+
+if arcProperties.clip_state == "on" then
+ set(h,"clip_box", arcProperties.clip_box);
+end
+set(h,"clip_state",arcProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = arcProperties(fields(i));
+end
+endfunction
+
+//
+// CHAMP
+//
+function h = createChamp(champProperties)
+fields = fieldnames(champProperties);
+fields(1) = [];
+
+champ(champProperties.data.x, champProperties.data.y, champProperties.data.fx, champProperties.data.fy);
+fields(fields=="data") = [];
+
+h=gce();
+
+if champProperties.clip_state == "on" then
+ set(h,"clip_box", champProperties.clip_box);
+end
+set(h,"clip_state",champProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = champProperties(fields(i));
+end
+endfunction
+
+//
+// SEG
+//
+function h = createSegs(segsProperties)
+fields = fieldnames(segsProperties);
+fields(1) = [];
+
+xsegs(segsProperties.data(:,1), segsProperties.data(:,2))
+
+h=gce()
+
+if segsProperties.clip_state == "on" then
+ set(h,"clip_box", segsProperties.clip_box);
+end
+set(h,"clip_state",segsProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = segsProperties(fields(i));
+end
+endfunction
+
+//
+// GRAYPLOT
+//
+function h = createGrayplot(grayplotProperties)
+fields = fieldnames(grayplotProperties);
+fields(1) = [];
+
+grayplot(grayplotProperties.data.x, grayplotProperties.data.y, grayplotProperties.data.z);
+fields(fields=="data") = [];
+
+h = gce();
+
+if grayplotProperties.clip_state=="on" then
+ set(h, "clip_box", grayplotProperties.clip_box)
+end
+set(h, "clip_state", grayplotProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = grayplotProperties(fields(i));
+end
+endfunction
+
+//
+// MATPLOT
+//
+function h = createMatplot(matplotProperties)
+fields = fieldnames(matplotProperties);
+fields(1) = [];
+
+Matplot(matplotProperties.data);
+fields(fields=="data") = [];
+
+h = gce();
+
+if matplotProperties.clip_state=="on" then
+ set(h, "clip_box", matplotProperties.clip_box)
+end
+set(h, "clip_state", matplotProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = matplotProperties(fields(i));
+end
+endfunction
+
+//
+// FEC
+//
+function h = createFec(fecProperties)
+fields = fieldnames(fecProperties);
+fields(1) = [];
+
+fec(fecProperties.data(:,1), fecProperties.data(:,2), fecProperties.triangles, fecProperties.data(:,3));
+fields(fields=="data") = [];
+fields(fields=="triangles") = [];
+
+h = unglue(gce());
+
+if fecProperties.clip_state=="on" then
+ set(h, "clip_box", fecProperties.clip_box)
+end
+set(h, "clip_state", fecProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = fecProperties(fields(i));
+end
+endfunction
+
+//
+// LEGEND
+//
+function h = createLegend(legendProperties)
+global %LEG
+%LEG = legendProperties;
+endfunction
+
+//
+// TEXT
+//
+function h = createText(textProperties)
+fields = fieldnames(textProperties);
+fields(1) = [];
+
+if textProperties.text_box_mode == 'off' then
+ xstring(textProperties.data(1), textProperties.data(2), textProperties.text)
+else
+ xstringb(textProperties.data(1), textProperties.data(2), textProperties.text, textProperties.text_box(1), textProperties.text_box(2))
+end
+
+h = gce();
+
+if textProperties.clip_state=="on" then
+ set(h, "clip_box", textProperties.clip_box)
+end
+set(h, "clip_state", textProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = textProperties(fields(i));
+end
+endfunction
+
+//
+// AXIS
+//
+function h = createAxis(axisProperties)
+fields = fieldnames(axisProperties);
+fields(1) = [];
+
+if axisProperties.tics_direction == "bottom" then
+ axisdir='d';
+elseif tics_direction == "top" then
+ axisdir='u';
+elseif tics_direction == "left" then
+ axisdir='l';
+elseif tics_direction == "right" then
+ axisdir='r';
+elseif nx>1 then
+ axisdir='u';
+else
+ axisdir='l';
+end
+fields(fields=="tics_direction") = [];
+
+drawaxis(x=axisProperties.xtics_coord,y=axisProperties.ytics_coord,dir=axisdir);
+fields(fields=="xtics_coord") = [];
+fields(fields=="ytics_coord") = [];
+
+h=gce()
+
+if axisProperties.clip_state=="on" then
+ set(h, "clip_box", axisProperties.clip_box)
+end
+set(h, "clip_state", axisProperties.clip_state);
+fields(fields=="clip_box") = [];
+fields(fields=="clip_state") = [];
+
+for i = 1:size(fields, "*")
+ h(fields(i)) = axisProperties(fields(i));
+end
+endfunction
+
+//
+// uimenu
+//
+function h = createuimenu(uimenuProperties)
+fields = fieldnames(uimenuProperties);
+fields(1) = [];
+
+h = uimenu();
+
+for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ children = createMatrixHandle(uimenuProperties(fields(i)));
+ for k=1:size(children, "*")
+ set(children(k), "parent", h);
+ end
+ else
+ h(fields(i)) = uimenuProperties(fields(i));
+ end
+end
+endfunction
+
+//
+// UICONTEXTMENU
+//
+function h = createuicontextmenu(uicontextmenuProperties)
+fields = fieldnames(uicontextmenuProperties);
+fields(1) = [];
+
+h = uicontextmenu();
+
+for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ children = createMatrixHandle(uicontextmenuProperties(fields(i)));
+ for k=1:size(children, "*")
+ set(children(k), "parent", h);
+ end
+ else
+ h(fields(i)) = uicontextmenuProperties(fields(i));
+ end
+end
+endfunction
+
+//
+// uicontrol
+//
+function h = createuicontrol(uicontrolProperties)
+
+fields = fieldnames(uicontrolProperties);
+fields(1) = [];
+
+h = uicontrol("Style", uicontrolProperties.style);
+fields(fields=="style") = [];
+
+for i = 1:size(fields, "*")
+ if fields(i) == "children" then
+ children = createMatrixHandle(uicontrolProperties(fields(i)));
+ for k=1:size(children, "*")
+ set(children(k), "parent", h);
+ end
+ else
+ h(fields(i)) = uicontrolProperties(fields(i));
+ end
+end
+endfunction
+
+// Utility function for legends, copy/paste from %h_load
+function links=get_links_from_path(ax,paths)
+// ax is a handle on an axes entity
+// paths a list or row vector which gives the set of paths relative to
+// the axes
+links=[];
+ok=%t;
+for p=paths
+ e=ax;
+ p(1)=p(1)-1// the caption does not exists yet
+ for kp=1:size(p,'*'),
+ if or(e.type==['Axes','Compound'])&p(kp)<=size(e.children,'*') then
+ e=e.children(p(kp)),
+ else
+ ok=%f
+ break
+ end
+ end
+ if ~ok then
+ break
+ end
+ links=[links,e]
+end
+if ~ok then
+ links=[];
+end
+endfunction
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2006 - INRIA - Allan CORNET
- *
+ *
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
- * are also available at
+ * are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
*
*/
{sci_read4b, "read4b"},
{sci_write4b, "write4b"},
{sci_save, "save"},
- {sci_load, "load"}
+ {sci_load, "%_load"}
};
/*--------------------------------------------------------------------------*/
int gw_io(void)
-{
+{
/* Recursion from a function */
- if(pvApiCtx == NULL)
+ if (pvApiCtx == NULL)
{
pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
}
{
switch ( getRecursionFunctionToCall() )
{
- case RECURSION_CALL_SAVE:
+ case RECURSION_CALL_SAVE:
{
pvApiCtx->pstName = "save";
- C2F(intsave)();
+ C2F(intsave)();
return 0;
}
break;
- case RECURSION_CALL_LOAD:
+ case RECURSION_CALL_LOAD:
{
pvApiCtx->pstName = "load";
- sci_load("load",(unsigned long)strlen("load"));
+ sci_load("load", (unsigned long)strlen("load"));
return 0;
}
break;
- default:
- break;
+ default:
+ break;
}
}
else
{
Rhs = Max(0, Rhs);
- pvApiCtx->pstName = (char*)Tab[Fin-1].name;
+ pvApiCtx->pstName = (char*)Tab[Fin - 1].name;
callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
}
return 0;
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2006 - INRIA - Allan CORNET
- *
+ *
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
- * are also available at
+ * are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
*
*/
#include "gw_io.h"
+#include "stack-c.h"
+#include "api_scilab.h"
+#include "localization.h"
/*--------------------------------------------------------------------------*/
extern int C2F(intsave)(); /* fortran subroutine */
/*--------------------------------------------------------------------------*/
-int sci_save(char *fname,unsigned long fname_len)
+int sci_save(char *fname, unsigned long fname_len)
{
- C2F(intsave)();
- return 0;
+ SciErr sciErr;
+
+ int iOldSave = FALSE;
+
+ int* piAddr1 = NULL;
+ int iType1 = 0;
+ int iRows1 = 0;
+ int iCols1 = 0;
+
+ CheckRhs(1, 100000);
+ CheckLhs(0, 1);
+
+ //filename or file descriptor
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ sciErr = getVarType(pvApiCtx, piAddr1, &iType1);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ if (iType1 == sci_strings)
+ {
+ int* piAddrI = NULL;
+ int* piAddrI2 = NULL;
+ int iTypeI = 0;
+ int iRowsI = 0;
+ int iColsI = 0;
+ char* pstVarI = NULL;
+
+ int i = 0;
+ for (i = 2 ; i <= Rhs ; i++)
+ {
+ sciErr = getVarAddressFromPosition(pvApiCtx, i, &piAddrI);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ sciErr = getVarType(pvApiCtx, piAddrI, &iTypeI);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ if (iTypeI != sci_strings)
+ {
+ iOldSave = TRUE;
+ break;
+ }
+
+ sciErr = getVarDimension(pvApiCtx, piAddrI, &iRowsI, &iColsI);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ if (iRowsI != 1 || iColsI != 1)
+ {
+ iOldSave = TRUE;
+ break;
+ }
+
+ if (getAllocatedSingleString(pvApiCtx, piAddrI, &pstVarI))
+ {
+ return 1;
+ }
+
+ //try to get varaible by name
+ sciErr = getVarAddressFromName(pvApiCtx, pstVarI, &piAddrI2);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 1;
+ }
+
+ if (piAddrI2 == 0)
+ {
+ iOldSave = TRUE;
+ break;
+ }
+
+ freeAllocatedSingleString(pstVarI);
+
+ {
+ int lw = 0;
+ //call "overload" to prepare data to export_to_hdf5 function.
+ C2F(overload) (&lw, "save", (unsigned long)strlen("save"));
+ }
+
+ }
+ }
+ else
+ {
+ iOldSave = TRUE;
+ }
+
+
+ //new -> %_export_to_hdf5
+ //old
+ if (iOldSave)
+ {
+ if (getWarningMode())
+ {
+ sciprint(_("WARNING: your data will be saved in a format that Scilab 6 family will not load.\n"));
+ sciprint(_("WARNING: please use new 'save' syntax using variables names to be able to import your data in Scilab 6 and more.\n"));
+ }
+ C2F(intsave)();
+ }
+
+ return 0;
}
/*--------------------------------------------------------------------------*/
<!DOCTYPE GATEWAY SYSTEM "../../functions/xml/gateway.dtd">
<GATEWAY name="io">
-<!-- =================== -->
-<!--
+ <!-- =================== -->
+ <!--
Scilab
Interface description. In this file, we define the list of the function which
will be available into Scilab and the link to the "native" function.
===================
Don't touch if you do not know what you are doing
-->
-<!-- =================== -->
-
-<PRIMITIVE gatewayId="5" primitiveId="1" primitiveName="setenv" />
-<PRIMITIVE gatewayId="5" primitiveId="2" primitiveName="read" />
-<PRIMITIVE gatewayId="5" primitiveId="3" primitiveName="getenv" />
-<PRIMITIVE gatewayId="5" primitiveId="4" primitiveName="getio" />
-<!-- <PRIMITIVE gatewayId="5" primitiveId="5" primitiveName="" /> -->
-<!-- <PRIMITIVE gatewayId="5" primitiveId="6" primitiveName="" /> -->
-<PRIMITIVE gatewayId="5" primitiveId="7" primitiveName="write" />
-<!-- <PRIMITIVE gatewayId="5" primitiveId="8" primitiveName="" /> -->
-<PRIMITIVE gatewayId="5" primitiveId="9" primitiveName="file" />
-<PRIMITIVE gatewayId="5" primitiveId="10" primitiveName="host" />
-<PRIMITIVE gatewayId="5" primitiveId="11" primitiveName="unix" />
-<PRIMITIVE gatewayId="5" primitiveId="12" primitiveName="readb" />
-<PRIMITIVE gatewayId="5" primitiveId="13" primitiveName="writb" />
-<PRIMITIVE gatewayId="5" primitiveId="14" primitiveName="getpid" />
-<PRIMITIVE gatewayId="5" primitiveId="15" primitiveName="read4b" />
-<PRIMITIVE gatewayId="5" primitiveId="16" primitiveName="write4b" />
-<PRIMITIVE gatewayId="5" primitiveId="17" primitiveName="save" />
-<PRIMITIVE gatewayId="5" primitiveId="18" primitiveName="load" />
-
+ <!-- =================== -->
+
+ <PRIMITIVE gatewayId="5" primitiveId="1" primitiveName="setenv" />
+ <PRIMITIVE gatewayId="5" primitiveId="2" primitiveName="read" />
+ <PRIMITIVE gatewayId="5" primitiveId="3" primitiveName="getenv" />
+ <PRIMITIVE gatewayId="5" primitiveId="4" primitiveName="getio" />
+ <!-- <PRIMITIVE gatewayId="5" primitiveId="5" primitiveName="" /> -->
+ <!-- <PRIMITIVE gatewayId="5" primitiveId="6" primitiveName="" /> -->
+ <PRIMITIVE gatewayId="5" primitiveId="7" primitiveName="write" />
+ <!-- <PRIMITIVE gatewayId="5" primitiveId="8" primitiveName="" /> -->
+ <PRIMITIVE gatewayId="5" primitiveId="9" primitiveName="file" />
+ <PRIMITIVE gatewayId="5" primitiveId="10" primitiveName="host" />
+ <PRIMITIVE gatewayId="5" primitiveId="11" primitiveName="unix" />
+ <PRIMITIVE gatewayId="5" primitiveId="12" primitiveName="readb" />
+ <PRIMITIVE gatewayId="5" primitiveId="13" primitiveName="writb" />
+ <PRIMITIVE gatewayId="5" primitiveId="14" primitiveName="getpid" />
+ <PRIMITIVE gatewayId="5" primitiveId="15" primitiveName="read4b" />
+ <PRIMITIVE gatewayId="5" primitiveId="16" primitiveName="write4b" />
+ <PRIMITIVE gatewayId="5" primitiveId="17" primitiveName="save" />
+ <PRIMITIVE gatewayId="5" primitiveId="18" primitiveName="%_load" />
+
</GATEWAY>
getrhsvar_
vartype_
dynamic_setenvtcl
+overload_
\ No newline at end of file
// handle objects cannot be saved
A = sparse(rand(5,5));
[h,rk] = lufact(A);
-if execstr("save(TMPDIR+""/pointer.bin"",h)", "errcatch")<>0 then bugmes();quit;end
+if execstr("save(TMPDIR+""/pointer.bin"",""h"")", "errcatch")<>0 then bugmes();quit;end
A = sparse(rand(5,5));
[h,rk] = lufact(A);
-if execstr("save(TMPDIR+""/pointer.bin"",h)", "errcatch")<>0 then pause,end
+if execstr("save(TMPDIR+""/pointer.bin"",""h"")", "errcatch")<>0 then pause,end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 2389 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=2389
+//
+// <-- Short Description -->
+// handle objects cannot be saved
+A = sparse(rand(5,5));
+[h,rk] = lufact(A);
+warning("off");
+if execstr("save(TMPDIR+""/pointer.bin"",h)", "errcatch")<>0 then bugmes();quit;end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2008 - INRIA - Vincent COUVERT
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 2389 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=2389
+//
+// <-- Short Description -->
+// handle objects cannot be saved
+A = sparse(rand(5,5));
+[h,rk] = lufact(A);
+warning("off");
+if execstr("save(TMPDIR+""/pointer.bin"",h)", "errcatch")<>0 then bugmes();quit;end
'global filename'
'select rhs'
'case 1 then'
-'a1=a;save(filename,a1);a1=null();load(filename);'
+'a1=a;save(filename,''a1'');a1=null();load(filename);'
'if or(a1<>a) then r=%f,end'
'case 2 then'
-'a1=a;b1=b;save(filename,a1,b1);a1=null();b1=null();load(filename);'
+'a1=a;b1=b;save(filename,''a1'',''b1'');a1=null();b1=null();load(filename);'
'if or(a1<>a)|or(b1<>b) then r=%f,end'
'case 3 then'
'a1=a;b1=b;c1=c;'
-'save(filename,a1,b1,c1);'
+'save(filename,''a1'',''b1'',''c1'');'
'a1=null();b1=null();c1=null();load(filename);'
'if or(a1<>a)|or(b1<>b)|or(c1<>c) then r=%f,end'
'case 4 then'
'a1=a;b1=b;c1=c;d1=d'
-'save(filename,a1,b1,c1,d1);'
+'save(filename,''a1'',''b1'',''c1'',''d1'');'
'a1=null();b1=null();c1=null();;d1=null();load(filename);'
'if or(a1<>a)|or(b1<>b)|or(c1<>c)|or(d1<>d) then r=%f,end'
'end,if ~r then bugmes();quit;end'])
'global filename'
'select rhs'
'case 1 then'
-'a1=a;save(filename,a1);a1=null();load(filename);'
+'a1=a;save(filename,''a1'');a1=null();load(filename);'
'if or(a1<>a) then r=%f,end'
'case 2 then'
-'a1=a;b1=b;save(filename,a1,b1);a1=null();b1=null();load(filename);'
+'a1=a;b1=b;save(filename,''a1'',''b1'');a1=null();b1=null();load(filename);'
'if or(a1<>a)|or(b1<>b) then r=%f,end'
'case 3 then'
'a1=a;b1=b;c1=c;'
-'save(filename,a1,b1,c1);'
+'save(filename,''a1'',''b1'',''c1'');'
'a1=null();b1=null();c1=null();load(filename);'
'if or(a1<>a)|or(b1<>b)|or(c1<>c) then r=%f,end'
'case 4 then'
'a1=a;b1=b;c1=c;d1=d'
-'save(filename,a1,b1,c1,d1);'
+'save(filename,''a1'',''b1'',''c1'',''d1'');'
'a1=null();b1=null();c1=null();;d1=null();load(filename);'
'if or(a1<>a)|or(b1<>b)|or(c1<>c)|or(d1<>d) then r=%f,end'
'end,if ~r then pause,end'])
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+warning("off");
+funcprot(0);
+global filename;
+filename = TMPDIR+"/saveloadtst_mysave";
+deff('r=Check(a,b,c,d)',[
+'[lhs,rhs]=argn(),r=%t'
+'global filename'
+'select rhs'
+'case 1 then'
+'a1=a;save(filename,a1);a1=null();load(filename);'
+'if or(a1<>a) then r=%f,end'
+'case 2 then'
+'a1=a;b1=b;save(filename,a1,b1);a1=null();b1=null();load(filename);'
+'if or(a1<>a)|or(b1<>b) then r=%f,end'
+'case 3 then'
+'a1=a;b1=b;c1=c;'
+'save(filename,a1,b1,c1);'
+'a1=null();b1=null();c1=null();load(filename);'
+'if or(a1<>a)|or(b1<>b)|or(c1<>c) then r=%f,end'
+'case 4 then'
+'a1=a;b1=b;c1=c;d1=d'
+'save(filename,a1,b1,c1,d1);'
+'a1=null();b1=null();c1=null();;d1=null();load(filename);'
+'if or(a1<>a)|or(b1<>b)|or(c1<>c)|or(d1<>d) then r=%f,end'
+'end,if ~r then bugmes();quit;end'])
+a=[];if ~Check(a) then bugmes();quit;end
+a=1;if ~Check(a) then bugmes();quit;end
+a=[1 2 3];if ~Check(a) then bugmes();quit;end
+a=[1 2 3;4 5 6];if ~Check(a) then bugmes();quit;end
+a=1:100000;if ~Check(a) then bugmes();quit;end
+a=1+%i;if ~Check(a) then bugmes();quit;end
+a=[1 2+%i 3];if ~Check(a) then bugmes();quit;end
+a=[1 2 3;4 5+%i 6];if ~Check(a) then bugmes();quit;end
+a=1:100000;a(35)=%i;if ~Check(a) then bugmes();quit;end
+a='';if ~Check(a) then bugmes();quit;end
+a='123';if ~Check(a) then bugmes();quit;end
+a=['1','abcdefgs';'' 'ABDCEFGHIJKLMN'];if ~Check(a) then bugmes();quit;end
+a=string(1:10000);if ~Check(a) then bugmes();quit;end
+a=1+%s;if ~Check(a) then bugmes();quit;end
+a=[1 2+%s 3];if ~Check(a) then bugmes();quit;end
+a=[1 2 3;4 5 6+%s];if ~Check(a) then bugmes();quit;end
+a=1:10000;a(4)=%s;if ~Check(a) then bugmes();quit;end
+a=1+%i+%s;if ~Check(a) then bugmes();quit;end
+a=[1 2+%i 3+%s];if ~Check(a) then bugmes();quit;end
+a=[1 2+%s 3;4 5+%i 6];if ~Check(a) then bugmes();quit;end
+a=1:100;a(35)=%i;a(1)=%s;if ~Check(a) then bugmes();quit;end
+a=%t;if ~Check(a) then bugmes();quit;end
+a=rand(100,100)>0.5;if ~Check(a) then bugmes();quit;end
+a=mtlb_sparse(sparse(1));if ~Check(a) then bugmes();quit;end
+a=mtlb_sparse(sprand(100,100,0.1));if ~Check(a) then bugmes();quit;end
+a=mtlb_sparse(sparse(zeros(100,100)));if ~Check(a) then bugmes();quit;end
+a=sparse(1)==1;if ~Check(a) then bugmes();quit;end
+a=sprand(100,100,0.1)<0.5;if ~Check(a) then bugmes();quit;end
+a=sparse(zeros(100,100))==1;if ~Check(a) then bugmes();quit;end
+a=1:$;if ~Check(a) then bugmes();quit;end
+a=1:3:$;if ~Check(a) then bugmes();quit;end
+a=int8(1);if ~Check(a) then bugmes();quit;end
+a=int8(1:9);if ~Check(a) then bugmes();quit;end
+a=int8(1:10000);if ~Check(a) then bugmes();quit;end
+a=uint8(1);if ~Check(a) then bugmes();quit;end
+a=uint8(1:9);if ~Check(a) then bugmes();quit;end
+a=uint8(1:10000);if ~Check(a) then bugmes();quit;end
+a=int16(1);if ~Check(a) then bugmes();quit;end
+a=int16(1:9);if ~Check(a) then bugmes();quit;end
+a=int16(1:10000);if ~Check(a) then bugmes();quit;end
+a=uint16(1);if ~Check(a) then bugmes();quit;end
+a=uint16(1:9);if ~Check(a) then bugmes();quit;end
+a=uint16(1:10000);if ~Check(a) then bugmes();quit;end
+a=int32(1);if ~Check(a) then bugmes();quit;end
+a=int32(1:9);if ~Check(a) then bugmes();quit;end
+a=int32(1:10000);if ~Check(a) then bugmes();quit;end
+a=uint32(1);if ~Check(a) then bugmes();quit;end
+a=uint32(1:9);if ~Check(a) then bugmes();quit;end
+a=uint32(1:10000);if ~Check(a) then bugmes();quit;end
+deff('x=a(n)','x=n+1','n');if ~Check(a) then bugmes();quit;end
+deff('x=a(n)','x=n+1');if ~Check(a) then bugmes();quit;end
+deff('x=a','x=n+1','n');if ~Check(a) then bugmes();quit;end
+deff('x=a','x=n+1');if ~Check(a) then bugmes();quit;end
+deff('a(n)','x=n+1','n');if ~Check(a) then bugmes();quit;end
+deff('a(n)','x=n+1');if ~Check(a) then bugmes();quit;end
+deff('a()','x=n+1','n');if ~Check(a) then bugmes();quit;end
+deff('a()','x=n+1');if ~Check(a) then bugmes();quit;end
+a=list();if ~Check(a) then bugmes();quit;end
+a=list(1);if ~Check(a) then bugmes();quit;end
+a=list(1,rand(10,10),'asdfsf');if ~Check(a) then bugmes();quit;end
+a=list(1,rand(10,10),'asdfsf',poly(rand(10,10),'s'));if ~Check(a) then bugmes();quit;end
+a=list(1);a(4)='as';if ~Check(a) then bugmes();quit;end
+a=list(1,rand(10,10),'asdfsf',poly(rand(1,11),'s','c'));if ~Check(a) then bugmes();quit;end
+a=list(list());if ~Check(a) then bugmes();quit;end
+a=list(list(1));if ~Check(a) then bugmes();quit;end
+a=list(list(1,rand(10,10),'asdfsf'));if ~Check(a) then bugmes();quit;end
+a=list(list(1,rand(10,10),'asdfsf',poly(rand(10,10),'s')));if ~Check(a) then bugmes();quit;end
+a=list(1);a(4)='as';a=list(a);if ~Check(a) then bugmes();quit;end
+a=list(list(1,rand(10,10),'asdfsf',poly(rand(1,11),'s','c')));if ~Check(a) then bugmes();quit;end
+a=list(list(),2);if ~Check(a) then bugmes();quit;end
+a=list(list(1),rand(3,3));if ~Check(a) then bugmes();quit;end
+a=list(list(1,rand(10,10),'asdfsf'),'sdfs');if ~Check(a) then bugmes();quit;end
+a=list(list(1,rand(10,10),'asdfsf',poly(rand(10,10),'s')),$);if ~Check(a) then bugmes();quit;end
+a=list(1);a(4)='as';a=list(a,[]);if ~Check(a) then bugmes();quit;end
+a=list(list(1,rand(10,10),'asdfsf',poly(rand(1,11),'s','c')),list());if ~Check(a) then bugmes();quit;end
+a=[];b=1;c=[1 2 3];d=[1 2 3;4 5 6];
+if ~Check(a,b) then bugmes();quit;end
+if ~Check(a,b,c) then bugmes();quit;end
+if ~Check(a,b,c,d) then bugmes();quit;end
+a=1+%i;b=[1 2+%i 3];c=[1 2 3;4 5+%i 6];d=1:100000;d(35)=%i;
+if ~Check(a,b) then bugmes();quit;end
+if ~Check(a,b,c) then bugmes();quit;end
+if ~Check(a,b,c,d) then bugmes();quit;end
+a=sprand(100,100,0.1);
+b=sparse(zeros(100,100))==1;
+c=list(list(1,rand(10,10),'asdfsf',poly(rand(1,11),'s','c')),list());
+deff('d()','x=n+1','n');
+if ~Check(a,b) then bugmes();quit;end
+if ~Check(a,b,c) then bugmes();quit;end
+if ~Check(a,b,c,d) then bugmes();quit;end
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) ????-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+warning("off");
+
+funcprot(0);
+
+global filename;
+filename = TMPDIR+"/saveloadtst_mysave";
+
+deff('r=Check(a,b,c,d)',[
+'[lhs,rhs]=argn(),r=%t'
+'global filename'
+'select rhs'
+'case 1 then'
+'a1=a;save(filename,a1);a1=null();load(filename);'
+'if or(a1<>a) then r=%f,end'
+'case 2 then'
+'a1=a;b1=b;save(filename,a1,b1);a1=null();b1=null();load(filename);'
+'if or(a1<>a)|or(b1<>b) then r=%f,end'
+'case 3 then'
+'a1=a;b1=b;c1=c;'
+'save(filename,a1,b1,c1);'
+'a1=null();b1=null();c1=null();load(filename);'
+'if or(a1<>a)|or(b1<>b)|or(c1<>c) then r=%f,end'
+'case 4 then'
+'a1=a;b1=b;c1=c;d1=d'
+'save(filename,a1,b1,c1,d1);'
+'a1=null();b1=null();c1=null();;d1=null();load(filename);'
+'if or(a1<>a)|or(b1<>b)|or(c1<>c)|or(d1<>d) then r=%f,end'
+'end,if ~r then pause,end'])
+
+a=[];if ~Check(a) then pause,end
+a=1;if ~Check(a) then pause,end
+a=[1 2 3];if ~Check(a) then pause,end
+a=[1 2 3;4 5 6];if ~Check(a) then pause,end
+a=1:100000;if ~Check(a) then pause,end
+
+a=1+%i;if ~Check(a) then pause,end
+a=[1 2+%i 3];if ~Check(a) then pause,end
+a=[1 2 3;4 5+%i 6];if ~Check(a) then pause,end
+a=1:100000;a(35)=%i;if ~Check(a) then pause,end
+
+a='';if ~Check(a) then pause,end
+a='123';if ~Check(a) then pause,end
+a=['1','abcdefgs';'' 'ABDCEFGHIJKLMN'];if ~Check(a) then pause,end
+a=string(1:10000);if ~Check(a) then pause,end
+
+
+a=1+%s;if ~Check(a) then pause,end
+a=[1 2+%s 3];if ~Check(a) then pause,end
+a=[1 2 3;4 5 6+%s];if ~Check(a) then pause,end
+a=1:10000;a(4)=%s;if ~Check(a) then pause,end
+
+a=1+%i+%s;if ~Check(a) then pause,end
+a=[1 2+%i 3+%s];if ~Check(a) then pause,end
+a=[1 2+%s 3;4 5+%i 6];if ~Check(a) then pause,end
+a=1:100;a(35)=%i;a(1)=%s;if ~Check(a) then pause,end
+
+
+a=%t;if ~Check(a) then pause,end
+a=rand(100,100)>0.5;if ~Check(a) then pause,end
+
+a=mtlb_sparse(sparse(1));if ~Check(a) then pause,end
+a=mtlb_sparse(sprand(100,100,0.1));if ~Check(a) then pause,end
+a=mtlb_sparse(sparse(zeros(100,100)));if ~Check(a) then pause,end
+
+
+
+
+a=sparse(1)==1;if ~Check(a) then pause,end
+a=sprand(100,100,0.1)<0.5;if ~Check(a) then pause,end
+a=sparse(zeros(100,100))==1;if ~Check(a) then pause,end
+
+a=1:$;if ~Check(a) then pause,end
+a=1:3:$;if ~Check(a) then pause,end
+
+a=int8(1);if ~Check(a) then pause,end
+a=int8(1:9);if ~Check(a) then pause,end
+a=int8(1:10000);if ~Check(a) then pause,end
+a=uint8(1);if ~Check(a) then pause,end
+a=uint8(1:9);if ~Check(a) then pause,end
+a=uint8(1:10000);if ~Check(a) then pause,end
+
+a=int16(1);if ~Check(a) then pause,end
+a=int16(1:9);if ~Check(a) then pause,end
+a=int16(1:10000);if ~Check(a) then pause,end
+a=uint16(1);if ~Check(a) then pause,end
+a=uint16(1:9);if ~Check(a) then pause,end
+a=uint16(1:10000);if ~Check(a) then pause,end
+
+a=int32(1);if ~Check(a) then pause,end
+a=int32(1:9);if ~Check(a) then pause,end
+a=int32(1:10000);if ~Check(a) then pause,end
+a=uint32(1);if ~Check(a) then pause,end
+a=uint32(1:9);if ~Check(a) then pause,end
+a=uint32(1:10000);if ~Check(a) then pause,end
+
+
+deff('x=a(n)','x=n+1','n');if ~Check(a) then pause,end
+deff('x=a(n)','x=n+1');if ~Check(a) then pause,end
+deff('x=a','x=n+1','n');if ~Check(a) then pause,end
+deff('x=a','x=n+1');if ~Check(a) then pause,end
+deff('a(n)','x=n+1','n');if ~Check(a) then pause,end
+deff('a(n)','x=n+1');if ~Check(a) then pause,end
+deff('a()','x=n+1','n');if ~Check(a) then pause,end
+deff('a()','x=n+1');if ~Check(a) then pause,end
+
+a=list();if ~Check(a) then pause,end
+a=list(1);if ~Check(a) then pause,end
+a=list(1,rand(10,10),'asdfsf');if ~Check(a) then pause,end
+a=list(1,rand(10,10),'asdfsf',poly(rand(10,10),'s'));if ~Check(a) then pause,end
+a=list(1);a(4)='as';if ~Check(a) then pause,end
+a=list(1,rand(10,10),'asdfsf',poly(rand(1,11),'s','c'));if ~Check(a) then pause,end
+
+a=list(list());if ~Check(a) then pause,end
+a=list(list(1));if ~Check(a) then pause,end
+a=list(list(1,rand(10,10),'asdfsf'));if ~Check(a) then pause,end
+a=list(list(1,rand(10,10),'asdfsf',poly(rand(10,10),'s')));if ~Check(a) then pause,end
+a=list(1);a(4)='as';a=list(a);if ~Check(a) then pause,end
+a=list(list(1,rand(10,10),'asdfsf',poly(rand(1,11),'s','c')));if ~Check(a) then pause,end
+
+
+a=list(list(),2);if ~Check(a) then pause,end
+a=list(list(1),rand(3,3));if ~Check(a) then pause,end
+a=list(list(1,rand(10,10),'asdfsf'),'sdfs');if ~Check(a) then pause,end
+a=list(list(1,rand(10,10),'asdfsf',poly(rand(10,10),'s')),$);if ~Check(a) then pause,end
+a=list(1);a(4)='as';a=list(a,[]);if ~Check(a) then pause,end
+a=list(list(1,rand(10,10),'asdfsf',poly(rand(1,11),'s','c')),list());if ~Check(a) then pause,end
+
+
+
+a=[];b=1;c=[1 2 3];d=[1 2 3;4 5 6];
+if ~Check(a,b) then pause,end
+if ~Check(a,b,c) then pause,end
+if ~Check(a,b,c,d) then pause,end
+
+a=1+%i;b=[1 2+%i 3];c=[1 2 3;4 5+%i 6];d=1:100000;d(35)=%i;
+if ~Check(a,b) then pause,end
+if ~Check(a,b,c) then pause,end
+if ~Check(a,b,c,d) then pause,end
+
+a=sprand(100,100,0.1);
+b=sparse(zeros(100,100))==1;
+c=list(list(1,rand(10,10),'asdfsf',poly(rand(1,11),'s','c')),list());
+deff('d()','x=n+1','n');
+if ~Check(a,b) then pause,end
+if ~Check(a,b,c) then pause,end
+if ~Check(a,b,c,d) then pause,end
// and reloaded.
//
nm = neldermead_new ();
-save(fullfile(TMPDIR,"pb.dat"),nm)
+save(fullfile(TMPDIR,"pb.dat"),"nm")
clear
load(fullfile(TMPDIR,"pb.dat"))
computed = exists("nm");
//
nm = neldermead_new ();
-save(fullfile(TMPDIR,"pb.dat"),nm)
+save(fullfile(TMPDIR,"pb.dat"),"nm")
clear
load(fullfile(TMPDIR,"pb.dat"))
computed = exists("nm");
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Michael Baudin
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- JVM NOT MANDATORY -->
+//
+// <-- Non-regression test for bug 7093 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7093
+//
+// <-- Short Description -->
+// The data structure generated by neldermead_new cannot be saved
+// and reloaded.
+//
+warning("off");
+nm = neldermead_new ();
+save(fullfile(TMPDIR,"pb.dat"),nm)
+clear
+load(fullfile(TMPDIR,"pb.dat"))
+computed = exists("nm");
+assert_checkequal(computed,1);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2011 - DIGITEO - Michael Baudin
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- JVM NOT MANDATORY -->
+//
+// <-- Non-regression test for bug 7093 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=7093
+//
+// <-- Short Description -->
+// The data structure generated by neldermead_new cannot be saved
+// and reloaded.
+//
+
+warning("off");
+
+nm = neldermead_new ();
+save(fullfile(TMPDIR,"pb.dat"),nm)
+clear
+load(fullfile(TMPDIR,"pb.dat"))
+computed = exists("nm");
+assert_checkequal(computed,1);