File: do_load.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (77 lines) | stat: -rw-r--r-- 1,479 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function [ok,scs_m,cpr,edited]=do_load(fname,typ)
// Copyright INRIA
[lhs,rhs]=argn(0)
edited=%f
if rhs<2 then typ='diagram',end

if alreadyran&typ=='diagram' then 
  do_terminate(),//end current simulation
end  

current_version=scicos_ver
scicos_ver='scicos2.2' //default version, for latter version scicos_ver is stored in files

if rhs<=0 then fname=xgetfile('*.cos*'),end
if fname<>emptystr() then
  cpr=list()
  scs_m=[]
  [path,name,ext]=splitfilepath(fname)
  select ext
  case 'cosf'
    exec(fname,-1)
    ok=%t
  case 'cos' then
    load(fname),
    ok=%t
  else
    message(['Only *.cos (binary) and *.cosf (formatted) files';
      'allowed'])
    ok=%f
    scs_m=list()
    return
  end
  if scs_m==[] then scs_m=x,end //for compatibility
  scs_m(1)(2)=[scs_m(1)(2)(1),path]
  if scicos_ver<>current_version then 
    scs_m=do_version(scs_m,scicos_ver),
    cpr=list()
    edited=%t
  end
else
  ok=%f
  //scs_m=list()
  return
end

if typ=='diagram' then
  if cpr<>list() then
    for jj=1:size(cpr(2)('funtyp'),'*')
      if cpr(2)('funtyp')(jj)>999 then
	funam=cpr(2)('funs')(jj)
	if ~c_link(funam) then
	  qqq=cpr(4)(jj)
	  path=list(qqq(1))
	  for kkk=qqq(2:$)
	    path($+1)=3
	    path($+1)=8
	    path($+1)=kkk
	  end
	  path($+1)=2;path($+1)=4;path($+1)=2;
	  tt=scs_m(path)
	  if cpr(2)('funtyp')(jj)>1999 then
	    [ok]=do_ccomlink(funam,tt)
	  else
	    [ok]=do_forcomlink(funam,tt)
	  end 
	end
      end
    end
  end
end