File: do_save.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 (47 lines) | stat: -rw-r--r-- 997 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
function ok=do_save(scs_m)   
// saves scicos data structures scs_m and cpr on a binary file
//!
// Copyright INRIA
if pal_mode then scs_m=do_purge(scs_m),end
//file path
if size(scs_m(1)(2),'*')<2 then 
  path='./'
else
  path=scs_m(1)(2)(2)
end
//open file

fname=path+scs_m(1)(2)(1)+'.cos'
[u,err]=file('open',fname,'unknown','unformatted')
if err<>0 then
  message('Directory write access denied')
  ok=%f
  return
end
if ~super_block&~pal_mode then
  //update cpr data structure to make it coherent with last changes
  if needcompile==4 then
    cpr=list()
  else
    [cpr,state0,needcompile,ok]=do_update(cpr,state0,needcompile)
    if ~ok then return,end
    cpr(1)=state0
  end
else
  cpr=list()
end
//save
errcatch(49,'continue','nomessage')
save(u,scicos_ver,scs_m,cpr)
errcatch(-1)
if iserror(49)==1 then
  message('File write access denied')
  errclear(49)
  ok=%f
  file('close',u)
  return
end
file('close',u)
if pal_mode then update_scicos_pal(path,scs_m(1)(2)(1),fname),end
ok=%t