Add two new commands: 87/9787/15
Sylvestre Ledru [Sun, 25 Nov 2012 09:22:36 +0000 (10:22 +0100)]
* scinotes
./bin/scinotes modules/core/macros/whos.sci
If the file does not exist, propose to create it.

Support also the -indent argument to indent automatically a Scilab file.
For example: ./bin/scinotes -indent modules/core/macros/whos.sci

* xcos
./bin/xcos modules/xcos/examples/integral.xcos will open the integral Xcos
schema
If the file does not exist, propose to create it.

./bin/xcos -simulate modules/xcos/examples/integral.xcos
Will start the simulation on integral.xcos

Change-Id: I2e0203e23a168bc938ecc4291340dfd610366721

20 files changed:
SEP/INDEX
SEP/SEP_087_new_binaries_xcos_scinotes.odt [new file with mode: 0644]
scilab/CHANGES_5.4.X
scilab/bin/scilab
scilab/bin/scinotes [new symlink]
scilab/bin/xcos [new symlink]
scilab/desktop/Makefile.am
scilab/desktop/Makefile.in
scilab/desktop/images/icons/16x16/apps/scinotes.png [new file with mode: 0644]
scilab/desktop/images/icons/16x16/apps/xcos.png [new file with mode: 0644]
scilab/desktop/images/icons/256x256/apps/scinotes.png [new file with mode: 0644]
scilab/desktop/images/icons/256x256/apps/xcos.png [new file with mode: 0644]
scilab/desktop/images/icons/32x32/apps/scinotes.png [new file with mode: 0644]
scilab/desktop/images/icons/32x32/apps/xcos.png [new file with mode: 0644]
scilab/desktop/images/icons/Makefile.am
scilab/desktop/images/icons/Makefile.in
scilab/desktop/scilab.desktop
scilab/desktop/scinotes.desktop [new file with mode: 0644]
scilab/desktop/xcos.desktop [new file with mode: 0644]
scilab/modules/core/help/en_US/scilab.xml

index ee69de4..9264972 100644 (file)
--- a/SEP/INDEX
+++ b/SEP/INDEX
@@ -82,4 +82,5 @@ SEP #082: eigs function
 SEP #083: example_run function
 SEP #084: fft improvements
 SEP #085: cond improvements
-SEP #086: Improvement of the regexp function
\ No newline at end of file
+SEP #086: Improvement of the regexp function
+SEP #087: New binaries: xcos scinotes
\ No newline at end of file
diff --git a/SEP/SEP_087_new_binaries_xcos_scinotes.odt b/SEP/SEP_087_new_binaries_xcos_scinotes.odt
new file mode 100644 (file)
index 0000000..c7460db
Binary files /dev/null and b/SEP/SEP_087_new_binaries_xcos_scinotes.odt differ
index 63f16b6..5e4a2b8 100644 (file)
@@ -17,6 +17,18 @@ Improvements
 * test_run no longer take in account skipped tests in the summary.
   See bug #12117
 
+* Add two new commands:
+ - scinotes
+   scinotes modules/core/macros/whos.sci
+   Support also the -indent argument to indent automatically a Scilab file.
+   For example: ./bin/scinotes -indent modules/core/macros/whos.sci
+   If the file does not exist, propose to create it.
+
+ - xcos
+   xcos modules/xcos/examples/integral.xcos will open the integral Xcos
+   schema
+   If the file does not exist, propose to create it.
+
 
 Removed functions
 ==================
index f30714c..50ad061 100755 (executable)
@@ -135,6 +135,18 @@ detect_type_of_scilab(){
         DISABLE_JAVA_DETECTION=1
     fi
 
+    if (echo "$progname"|grep "scinotes$" 2>&1 > /dev/null;) then
+        SCILAB_MODE="scinotes"
+        SCILABBIN="scilab-bin"
+        extraarg=1
+    fi
+
+    if (echo "$progname"|grep "xcos$" 2>&1 > /dev/null;) then
+        SCILAB_MODE="xcos"
+        SCILABBIN="scilab-bin"
+        extraarg=1
+    fi
+
     if test $SCIVERBOSE -ne 0; then
         echo "SCILABBIN : $SCILABBIN"
         echo "DISABLE_JAVA_DETECTION : $DISABLE_JAVA_DETECTION"
@@ -805,13 +817,111 @@ fi
 # Check if SELINUX is enable. If it is the case, disable it for Scilab
 check_and_disable_selinux
 
+do_scinotes()
+{
+    INDENT=""
+    if test $# -gt 0; then
+    # scinotes is called. We process the arguments
+    ARGS="["
+
+    for SCIARG in "$@"; do
+        if test "$SCIARG" = "-indent"; then
+            INDENT="'actions=indent,trailing,quote'"
+        else
+            ARGS="$ARGS '$SCIARG', "
+        fi
+    done
+    ARGS="$ARGS]"
+    fi
+
+    if test -n "$INDENT"; then
+    # Call scinotes with the arguments
+        if test $SCIVERBOSE -ne 0; then
+            echo "Will start scinotes with: $SCILABBIN -nb -nw -e scinotes($ARGS, $INDENT);exit()"
+        fi
+        "$SCILABBIN" -nb -nw -e "scinotes($ARGS, $INDENT);exit()"
+    else
+        if test $SCIVERBOSE -ne 0; then
+            echo "Will start scinotes with: $SCILABBIN -e scinotes($ARGS)"
+        fi
+
+    # Call scinotes with no argument
+        "$SCILABBIN" -e "scinotes($ARGS)"
+    fi
+}
+
+do_xcos()
+{
+    SIMULATE=0
+    if test $# -gt 0; then
+    # xcos is called. We process the arguments
+        ARGS="["
+        for SCIARG in "$@"; do
+            if test "$SCIARG" = "-simulate"; then
+                if test $# -ne 2; then
+                    echo "Wrong syntax: When -simulate is used, only one file must be provided."
+                    exit 43
+                fi
+                SIMULATE=1
+            else
+                ARGS="$ARGS '$SCIARG', "
+            fi
+        done
+        ARGS="$ARGS ]"
+    fi
+
+    if test $SIMULATE -eq 1; then
+        if test $SCIVERBOSE -ne 0; then
+            echo "Will start Xcos with: $SCILABBIN -e 'importXcosDiagram($ARGS);xcos_simulate(scs_m, 4)'"
+        fi
+
+    # Call xcos with the arguments to simulate
+        "$SCILABBIN" -e "importXcosDiagram($ARGS);xcos_simulate(scs_m, 4)"
+    else
+        if test $SCIVERBOSE -ne 0; then
+            echo "Will start Xcos with: $SCILABBIN -e xcos($ARGS)"
+        fi
+
+    # Call xcos with the arguments
+        "$SCILABBIN" -e "xcos($ARGS)"
+    fi
+
+}
+
 do_scilex()
 {
-    "$SCILABBIN" "$@"
+    if test "$SCILAB_MODE" = "xcos"; then
+        do_xcos "$@"
+    else
+        if test "$SCILAB_MODE" = "scinotes"; then
+            do_scinotes "$@"
+        else
+            "$SCILABBIN" "$@"
+        fi
+    fi
 }
 
 do_help()
 {
+    if test "$SCILAB_MODE" = "xcos"; then
+        echo "Start Xcos, the hybrid simulator"
+        echo "Usage:"
+        echo "xcos [ file1.xcos, [ file2.xcos ]]"
+        echo     " "
+        echo     "  Possible arguments are:"
+        echo     "  -simulate : Start the simulation. Only one file will be accepted."
+        exit
+    fi
+    if test "$SCILAB_MODE" = "scinotes"; then
+        echo "Start Scinotes, the Scilab text editor"
+        echo "Usage:"
+        echo     "scinotes [ file1.sci, [ file2.sce ]]"
+        echo     " "
+        echo     "  Possible arguments are:"
+        echo     "  -indent : format (indent, trailing spaces, quote mismatch) the files"
+        exit
+    fi
+
     echo "Usage:"
     echo     "scilab <arguments>"
     echo     "scilab-cli <arguments>"
@@ -826,7 +936,7 @@ do_help()
     echo     "                    -e and -f arguments are mutually exclusive."
     echo     "  -l Lang         : set the current language. Lang can be equal to fr or en."
     echo     "  -mem N          : set the initial stacksize, for use with -ns argument."
-    echo     "  -nb             : do not display Scilab loading message at starting time."
+    echo     "  -nb             : do not display Scilab loading on start."
     echo     "  -ns             : do not execute scilab.start startup file. This argument will disable many features in Scilab (Only use if you know what you are doing)."
     echo     "  -nouserstartup  : do not execute the user startup files SCIHOME/.scilab or SCIHOME/scilab.ini."
     echo     "  -noatomsautoload: do not load ATOMS installed module."
diff --git a/scilab/bin/scinotes b/scilab/bin/scinotes
new file mode 120000 (symlink)
index 0000000..2c8a84f
--- /dev/null
@@ -0,0 +1 @@
+scilab
\ No newline at end of file
diff --git a/scilab/bin/xcos b/scilab/bin/xcos
new file mode 120000 (symlink)
index 0000000..2c8a84f
--- /dev/null
@@ -0,0 +1 @@
+scilab
\ No newline at end of file
index 666bbe1..0bb38f6 100644 (file)
@@ -16,7 +16,10 @@ SUBDIRS = images/icons/
 desktopdir = $(datadir)/applications
 desktop_DATA = scilab-adv-cli.desktop \
 scilab-cli.desktop \
-scilab.desktop
+scilab.desktop \
+xcos.desktop \
+scinotes.desktop
+
 
 # Mimetype file
 # Note that here, it is datadir and NOT pkgdatadir
index 5962fe9..edf7d2c 100644 (file)
@@ -424,7 +424,9 @@ SUBDIRS = images/icons/
 desktopdir = $(datadir)/applications
 desktop_DATA = scilab-adv-cli.desktop \
 scilab-cli.desktop \
-scilab.desktop
+scilab.desktop \
+xcos.desktop \
+scinotes.desktop
 
 
 # Mimetype file
diff --git a/scilab/desktop/images/icons/16x16/apps/scinotes.png b/scilab/desktop/images/icons/16x16/apps/scinotes.png
new file mode 100644 (file)
index 0000000..188e1c1
Binary files /dev/null and b/scilab/desktop/images/icons/16x16/apps/scinotes.png differ
diff --git a/scilab/desktop/images/icons/16x16/apps/xcos.png b/scilab/desktop/images/icons/16x16/apps/xcos.png
new file mode 100644 (file)
index 0000000..c772e32
Binary files /dev/null and b/scilab/desktop/images/icons/16x16/apps/xcos.png differ
diff --git a/scilab/desktop/images/icons/256x256/apps/scinotes.png b/scilab/desktop/images/icons/256x256/apps/scinotes.png
new file mode 100644 (file)
index 0000000..236a626
Binary files /dev/null and b/scilab/desktop/images/icons/256x256/apps/scinotes.png differ
diff --git a/scilab/desktop/images/icons/256x256/apps/xcos.png b/scilab/desktop/images/icons/256x256/apps/xcos.png
new file mode 100644 (file)
index 0000000..1718599
Binary files /dev/null and b/scilab/desktop/images/icons/256x256/apps/xcos.png differ
diff --git a/scilab/desktop/images/icons/32x32/apps/scinotes.png b/scilab/desktop/images/icons/32x32/apps/scinotes.png
new file mode 100644 (file)
index 0000000..c6b6285
Binary files /dev/null and b/scilab/desktop/images/icons/32x32/apps/scinotes.png differ
diff --git a/scilab/desktop/images/icons/32x32/apps/xcos.png b/scilab/desktop/images/icons/32x32/apps/xcos.png
new file mode 100644 (file)
index 0000000..b62959e
Binary files /dev/null and b/scilab/desktop/images/icons/32x32/apps/xcos.png differ
index df664b7..2b62c35 100644 (file)
@@ -11,6 +11,8 @@
 
 iconsdir = $(datadir)/icons/hicolor
 nobase_icons_DATA = 16x16/apps/scilab.png \
+16x16/apps/scinotes.png \
+16x16/apps/xcos.png \
 16x16/mimetypes/application-x-scilab-bin.png \
 16x16/mimetypes/application-x-scilab-cosf.png \
 16x16/mimetypes/application-x-scilab-cos.png \
@@ -38,6 +40,8 @@ nobase_icons_DATA = 16x16/apps/scilab.png \
 24x24/mimetypes/application-x-scilab-zcos.png \
 256x256/apps/puffin.png \
 256x256/apps/scilab.png \
+256x256/apps/scinotes.png \
+256x256/apps/xcos.png \
 256x256/mimetypes/application-x-scilab-bin.png \
 256x256/mimetypes/application-x-scilab-cosf.png \
 256x256/mimetypes/application-x-scilab-cos.png \
@@ -51,6 +55,8 @@ nobase_icons_DATA = 16x16/apps/scilab.png \
 256x256/mimetypes/application-x-scilab-xcos.png \
 256x256/mimetypes/application-x-scilab-zcos.png \
 32x32/apps/scilab.png \
+32x32/apps/scinotes.png \
+32x32/apps/xcos.png \
 32x32/mimetypes/application-x-scilab-bin.png \
 32x32/mimetypes/application-x-scilab-cosf.png \
 32x32/mimetypes/application-x-scilab-cos.png \
index 655e77a..2445e5a 100644 (file)
@@ -379,6 +379,8 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 iconsdir = $(datadir)/icons/hicolor
 nobase_icons_DATA = 16x16/apps/scilab.png \
+16x16/apps/scinotes.png \
+16x16/apps/xcos.png \
 16x16/mimetypes/application-x-scilab-bin.png \
 16x16/mimetypes/application-x-scilab-cosf.png \
 16x16/mimetypes/application-x-scilab-cos.png \
@@ -406,6 +408,8 @@ nobase_icons_DATA = 16x16/apps/scilab.png \
 24x24/mimetypes/application-x-scilab-zcos.png \
 256x256/apps/puffin.png \
 256x256/apps/scilab.png \
+256x256/apps/scinotes.png \
+256x256/apps/xcos.png \
 256x256/mimetypes/application-x-scilab-bin.png \
 256x256/mimetypes/application-x-scilab-cosf.png \
 256x256/mimetypes/application-x-scilab-cos.png \
@@ -419,6 +423,8 @@ nobase_icons_DATA = 16x16/apps/scilab.png \
 256x256/mimetypes/application-x-scilab-xcos.png \
 256x256/mimetypes/application-x-scilab-zcos.png \
 32x32/apps/scilab.png \
+32x32/apps/scinotes.png \
+32x32/apps/xcos.png \
 32x32/mimetypes/application-x-scilab-bin.png \
 32x32/mimetypes/application-x-scilab-cosf.png \
 32x32/mimetypes/application-x-scilab-cos.png \
index 468c6a7..4e02b2e 100644 (file)
@@ -9,7 +9,6 @@ GenericName[de]=Wissenschaftssoftware
 Icon=scilab
 MimeType=application/x-scilab-sci;application/x-scilab-sce;application/x-scilab-tst;application/x-scilab-dem;application/x-scilab-sod;application/x-scilab-xcos;application/x-scilab-zcos;application/x-scilab-bin;application/x-scilab-cosf;application/x-scilab-cos;
 Name=Scilab
-Name[de]=Scilab
 StartupNotify=false
 Terminal=false
 Type=Application
diff --git a/scilab/desktop/scinotes.desktop b/scilab/desktop/scinotes.desktop
new file mode 100644 (file)
index 0000000..212d9f1
--- /dev/null
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Comment=Scilab text editor
+Comment[fr]=Editeur de texte Scilab
+Exec=scinotes
+GenericName=Scientific Software Package
+GenericName[fr]=Logiciel de calcul numérique
+GenericName[de]=Wissenschaftssoftware
+Icon=scinotes
+MimeType=application/x-scilab-sci;application/x-scilab-sce;application/x-scilab-tst;application/x-scilab-dem;
+Name=Scinotes
+StartupNotify=false
+Terminal=false
+Type=Application
+Categories=Education;Science;Math;Development;Physics;
diff --git a/scilab/desktop/xcos.desktop b/scilab/desktop/xcos.desktop
new file mode 100644 (file)
index 0000000..a781688
--- /dev/null
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Comment=Hybrid simulator
+Exec=xcos
+GenericName=Scientific Software Package
+GenericName[fr]=Logiciel de calcul numérique
+GenericName[de]=Wissenschaftssoftware
+Icon=xcos
+MimeType=application/x-scilab-xcos;application/x-scilab-zcos;application/x-scilab-cosf;application/x-scilab-cos;
+Name=Xcos
+StartupNotify=false
+Terminal=false
+Type=Application
+Categories=Education;Science;Math;Development;Physics;
index 0582cf2..ef93717 100644 (file)
@@ -401,6 +401,10 @@ echo $? ]]></programlisting>
                 <revnumber>5.4.0</revnumber>
                 <revremark>-noatomsautoload added.</revremark>
             </revision>
+            <revision>
+                <revnumber>5.4.1</revnumber>
+                <revremark>scinotes and xcos individual scripts introduced. See SEP #87.</revremark>
+            </revision>
         </revhistory>
     </refsection>
 </refentry>