File: do_fsave.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 (53 lines) | stat: -rw-r--r-- 912 bytes parent folder | download | duplicates (2)
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
function ok=do_fsave(scs_m)
//
// Copyright INRIA
scs_m=do_purge(scs_m)
ok=%f
fname=xgetfile('*.cosf')
if fname==emptystr() then return,end

[path,name,ext]=splitfilepath(fname)
select ext
case 'cosf' then
  ok=%t
else
  message('Only *.cosf  files allowed');
  ok=%f
  return
end

// Change the name in the structure
scs_m(1)(2)=[name,path]

//open the file
errcatch(240,'continue','nomessage')
[u,i]=file('open',fname,'unknown')
errcatch(-1)
if iserror(240)==1 then
  message('Directory write access denied')
  errclear(240)
  ok=%f
  return
end

//save 
errcatch(49,'continue','nomessage')
write(u,sci2exp(scicos_ver,'scicos_ver'),'(a)')
errcatch(-1)
if iserror(49)==1 then
  message('File write access denied')
  errclear(49)
  ok=%f
  file('close',u)
  return
end
disablemenus()
cos2cosf(u,scs_m)
file('close',u)
enablemenus()
ok=%t
if pal_mode then update_scicos_pal(path,scs_m(1)(2)(1),fname),end