File: TCL_CreateSlave.sci

package info (click to toggle)
scilab 5.3.3-10
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 330,656 kB
file content (47 lines) | stat: -rw-r--r-- 1,534 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
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA - Vincent COUVERT
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt


function status = TCL_CreateSlave(slaveName, isSafe)
// slaveName: name of the slave to create
// isSafe: %T to create a safe slave, %F otherwise (default)

// Input arguments tests
[lhs, rhs] = argn();
if rhs<>1 & rhs<>2 then
  error(msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected.\n"), "TCL_CreateSlave", 1, 2));
end

if lhs<>1 then
  error(msprintf(gettext("%s: Wrong number of output argument(s): %d expected.\n"), "TCL_CreateSlave", 1));
end

if typeof(slaveName)<>"string" then
  error(msprintf(gettext("%s: Wrong type for input argument #%d: A String expected.\n"), "TCL_CreateSlave", 1));
end

if rhs==1 then
  isSafe = %F; // Create an unsafe slave by default
end

if typeof(isSafe)<>"boolean" then
  error(msprintf(gettext("%s: Wrong type for input argument #%d: A Boolean expected.\n"), "TCL_CreateSlave", 2));
end

if TCL_ExistInterp(slaveName) then
  error(msprintf(gettext("%s: Slave interpreter already exists.\n"),"TCL_CreateSlave"));
end

if isSafe then
  status = TCL_EvalStr("interp create -safe "+slaveName);
else
  status = TCL_EvalStr("interp create "+slaveName);
end

endfunction