File: exec.cat

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (78 lines) | stat: -rw-r--r-- 2,217 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
78
exec             Scilab Group             Scilab Function              exec
NAME
   exec - script file execution
  
CALLING SEQUENCE
 exec(path [,mode])
 exec(fun [,mode])
 ierr=exec(path,'errcatch' [,mode])
 ierr=exec(fun,'errcatch' [,mode])
PARAMETERS
 path  : a string, the path of the script file
       
 mode  : an integer scalar, the execution mode (see below)
       
 fun   : a scilab function
       
 ierr  : integer, 0 or error number 
       
DESCRIPTION
   exec(path [,mode]) executes sequentialy the scilab instructions contained
  in the file given by path  with an optional  execution mode mode . 
  
   The different cases for mode are :
  
      0  : the default value
      
      -1  : nothing is printed
      
      1  : echo of each command line
      
      2  : prompt --> is printed
      
      3  : echoes + prompts
      
      4  : stops before each prompt
      
      7  : stops + prompts + echoes : useful mode for demos.
      
     exec(fun [,mode]) executes function  fun as a script: no input nor
      output argument nor specific variable environment. This form is more
      efficient, because script code may be pre-compiled (see getf, comp).
      This method for script evaluation allows to store scripts as function
      in libraries. 
      
     If an error is encountered while executing , if 'errcatch' flag is
      present exec issues an error message, aborts execution of the 
      instructions and resume with ierr equal to the error number,if
      'errcatch' flag is not present, standard error handling works. 
      
REMARK
   exec files may now be used to define functions using the inline function
  definition syntax (see function). 
  
EXAMPLES
 // create a script file
 write(TMPDIR+'/myscript','a=1;b=2')
 // execute it
 exec(TMPDIR+'/myscript')
 who
 
 //create a function
 deff('y=foo(x)','a=x+1;y=a^2')
 clear a b
 //execute the function
 foo(1)
 // a is a variable created in the environment of the function foo
 //    it is destroyed when foo returns
 who 
 
 x=1 //create x to make it known by the script foo
 exec(foo)
 // a and y are created in the current environment
 who
   
  
SEE ALSO
   getf, execstr, evstr, comp, mode, chdir, getcwd