summaryrefslogtreecommitdiff
path: root/modules/scinotes/macros
diff options
context:
space:
mode:
authorShashank2017-05-29 12:40:26 +0530
committerShashank2017-05-29 12:40:26 +0530
commit0345245e860375a32c9a437c4a9d9cae807134e9 (patch)
treead51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/scinotes/macros
downloadscilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2
scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip
CMSCOPE changed
Diffstat (limited to 'modules/scinotes/macros')
-rwxr-xr-xmodules/scinotes/macros/buildmacros.bat11
-rwxr-xr-xmodules/scinotes/macros/buildmacros.sce16
-rwxr-xr-xmodules/scinotes/macros/cleanmacros.bat13
-rwxr-xr-xmodules/scinotes/macros/edit_error.binbin0 -> 3052 bytes
-rwxr-xr-xmodules/scinotes/macros/edit_error.sci35
-rwxr-xr-xmodules/scinotes/macros/editor.binbin0 -> 5792 bytes
-rwxr-xr-xmodules/scinotes/macros/editor.sci67
-rwxr-xr-xmodules/scinotes/macros/libbin0 -> 316 bytes
-rwxr-xr-xmodules/scinotes/macros/names2
9 files changed, 144 insertions, 0 deletions
diff --git a/modules/scinotes/macros/buildmacros.bat b/modules/scinotes/macros/buildmacros.bat
new file mode 100755
index 000000000..23a827489
--- /dev/null
+++ b/modules/scinotes/macros/buildmacros.bat
@@ -0,0 +1,11 @@
+
+rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+rem Copyright (C) 2009 - DIGITEO
+rem
+rem This file must be used under the terms of the CeCILL.
+rem This source file is licensed as described in the file COPYING, which
+rem you should have received as part of this distribution. The terms
+rem are also available at
+rem http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+@..\..\..\bin\scilex -nwni -ns -e exec('buildmacros.sce');quit;
diff --git a/modules/scinotes/macros/buildmacros.sce b/modules/scinotes/macros/buildmacros.sce
new file mode 100755
index 000000000..2ef3aa8d2
--- /dev/null
+++ b/modules/scinotes/macros/buildmacros.sce
@@ -0,0 +1,16 @@
+
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET <allan.cornet@inria.fr>
+//
+// 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.1-en.txt
+
+if (isdef("genlib") == %f) then
+ exec(SCI+"/modules/functions/scripts/buildmacros/loadgenlib.sce");
+end
+
+genlib("scinoteslib","SCI/modules/scinotes/macros",%f,%t);
+
diff --git a/modules/scinotes/macros/cleanmacros.bat b/modules/scinotes/macros/cleanmacros.bat
new file mode 100755
index 000000000..053cf56f2
--- /dev/null
+++ b/modules/scinotes/macros/cleanmacros.bat
@@ -0,0 +1,13 @@
+
+rem Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+rem Copyright (C) 2009 - DIGITEO
+rem
+rem This file must be used under the terms of the CeCILL.
+rem This source file is licensed as described in the file COPYING, which
+rem you should have received as part of this distribution. The terms
+rem are also available at
+rem http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+
+@del *.bin 2>NUL
+@del lib 2>NUL
+@del names 2>NUL
diff --git a/modules/scinotes/macros/edit_error.bin b/modules/scinotes/macros/edit_error.bin
new file mode 100755
index 000000000..c4ef6cc1c
--- /dev/null
+++ b/modules/scinotes/macros/edit_error.bin
Binary files differ
diff --git a/modules/scinotes/macros/edit_error.sci b/modules/scinotes/macros/edit_error.sci
new file mode 100755
index 000000000..315e0f044
--- /dev/null
+++ b/modules/scinotes/macros/edit_error.sci
@@ -0,0 +1,35 @@
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2009 - DIGITEO - Allan CORNET
+//
+// 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.1-en.txt
+//
+
+function answ = edit_error(clearerror)
+ if (argn(2) == 0) then
+ clearerror = %f;
+ end
+ [str, n, line, func] = lasterror(clearerror);
+ if (n > 0) then
+ if (func == "") then
+ answ = gettext("The last error did not occur inside a Scilab macro.");
+ else
+ p = get_function_path(func);
+ if (p <> []) then
+ editor(p, line, func);
+ answ = gettext("Opening file ") + p + gettext(" on line ") + ..
+ msprintf("%d",line) + gettext(" of the source file of the function ") + func;
+ else
+ answ = gettext("The source file of the function ") + func + ..
+ gettext(" was not found in any library path");
+ end
+ end
+ else
+ answ = gettext("There is no recorded error");
+ end
+endfunction
+
diff --git a/modules/scinotes/macros/editor.bin b/modules/scinotes/macros/editor.bin
new file mode 100755
index 000000000..0a540dab6
--- /dev/null
+++ b/modules/scinotes/macros/editor.bin
Binary files differ
diff --git a/modules/scinotes/macros/editor.sci b/modules/scinotes/macros/editor.sci
new file mode 100755
index 000000000..07da1236d
--- /dev/null
+++ b/modules/scinotes/macros/editor.sci
@@ -0,0 +1,67 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET
+//
+// 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.1-en.txt
+
+// This function is designed to call the godd "editor" according the values in
+// the preferences file.
+// This function can take any type of arguments.
+function editor(varargin)
+ if ~isfile(SCIHOME + "/XConfiguration.xml") then
+ cmd = makeCommand("scinotes", varargin);
+ execstr(cmd);
+ return;
+ end
+
+ doc = xmlRead(SCIHOME + "/XConfiguration.xml");
+ prefsNode = xmlXPath(doc, "//scinotes/body/scinotes-preferences");
+ prefsNode = prefsNode(1);
+ if prefsNode.attributes.scinotes == "true" then
+ xmlDelete(doc);
+ cmd = makeCommand("scinotes", varargin);
+ execstr(cmd);
+ elseif prefsNode.attributes("external-cmd") == "true" then
+ cmd = prefsNode.attributes.cmd;
+ xmlDelete(doc);
+ if ~isempty(varargin) then
+ cmd = cmd + " """ + string(varargin(1)) + """";
+ end
+ unix_w(cmd);
+ else
+ cmd = makeCommand(prefsNode.attributes.macro, varargin);
+ xmlDelete(doc);
+ execstr(cmd);
+ end
+endfunction
+
+// Private function
+// Params:
+// - name: the command name
+// - args: a list of arguments
+// Return:
+// - cmd: the complete command to call with execstr
+//
+function cmd = makeCommand(name, args)
+ cmd = name + "(";
+ N = size(args);
+ if N ~= 0 then
+ for i=1:(N-1)
+ arg = string(args(i));
+ if type(args(i)) == 10 then
+ arg = """" + arg + """";
+ end
+ cmd = cmd + arg + ",";
+ end
+
+ arg = string(args(N));
+ if type(args(N)) == 10 then
+ arg = """" + arg + """";
+ end
+ cmd = cmd + arg
+ end
+ cmd = cmd + ")";
+endfunction
diff --git a/modules/scinotes/macros/lib b/modules/scinotes/macros/lib
new file mode 100755
index 000000000..03e685df8
--- /dev/null
+++ b/modules/scinotes/macros/lib
Binary files differ
diff --git a/modules/scinotes/macros/names b/modules/scinotes/macros/names
new file mode 100755
index 000000000..ed44955f8
--- /dev/null
+++ b/modules/scinotes/macros/names
@@ -0,0 +1,2 @@
+edit_error
+editor