1
function [ok,scs_m,%cpr,edited]=do_load(fname,typ)
5
if rhs<2 then typ='diagram',end
7
if alreadyran&typ=='diagram' then
8
do_terminate(),//end current simulation
11
current_version=scicos_ver
12
scicos_ver='scicos2.2' //default version, for latter version scicos_ver is stored in files
14
if rhs<=0 then fname=xgetfile('*.cos*'),end
15
if fname<>emptystr() then
18
[path,name,ext]=splitfilepath(fname)
22
ierr=execstr('exec(fname,-1)','errcatch')
25
ierr=execstr('load(fname)','errcatch')
28
message(['Only *.cos (binary) and *.cosf (formatted) files';
35
message(name+' cannot be loaded.')
38
if scs_m==[] then scs_m=x,end //for compatibility
39
scs_m(1)(2)=[scs_m(1)(2)(1),path]
40
if scicos_ver<>current_version then
41
scs_m=do_version(scs_m,scicos_ver),
51
if typ=='diagram' then
53
for jj=1:size(%cpr(2)('funtyp'),'*')
54
if %cpr(2)('funtyp')(jj)>999 then
55
funam=%cpr(2)('funs')(jj)
56
if ~c_link(funam) then
64
path($+1)=2;path($+1)=4;path($+1)=2;
66
if %cpr(2)('funtyp')(jj)>1999 then
67
[ok]=do_ccomlink(funam,tt)
69
[ok]=do_forcomlink(funam,tt)