Autoscale for cmscope graph 61/19261/4
diptighosalkar [Thu, 20 Apr 2017 14:54:30 +0000 (19:54 +0530)]
Change-Id: I1d4217aa2c5e68b77c47a8d8af84814385f70451

19 files changed:
scilab/CHANGES.md
scilab/modules/helptools/images/SCALE_CMSCOPE.png [new file with mode: 0644]
scilab/modules/helptools/images/SCALE_CMSCOPE_en_US.zcos.png [new file with mode: 0644]
scilab/modules/helptools/images/SCALE_CMSCOPE_gui.gif [new file with mode: 0644]
scilab/modules/scicos/palettes/Sinks.cosf
scilab/modules/scicos_blocks/Makefile.am
scilab/modules/scicos_blocks/Makefile.in
scilab/modules/scicos_blocks/macros/Sinks/SCALE_CMSCOPE.sci [new file with mode: 0644]
scilab/modules/scicos_blocks/src/c/scale_cmscope.c [new file with mode: 0644]
scilab/modules/xcos/Makefile.am
scilab/modules/xcos/Makefile.in
scilab/modules/xcos/etc/Xcos-style.xml
scilab/modules/xcos/etc/palettes.xml
scilab/modules/xcos/examples/sinks_pal/en_US/SCALE_CMSCOPE_en_US.zcos [new file with mode: 0644]
scilab/modules/xcos/help/en_US/palettes/Sinks_pal/AA_Sinks_pal.xml
scilab/modules/xcos/help/en_US/palettes/Sinks_pal/CMSCOPE.xml
scilab/modules/xcos/help/en_US/palettes/Sinks_pal/SCALE_CMSCOPE.xml [new file with mode: 0644]
scilab/modules/xcos/images/gui/SCALE_CMSCOPE_gui.gif [new file with mode: 0644]
scilab/modules/xcos/images/palettes/SCALE_CMSCOPE.png [new file with mode: 0644]

index 9ae6f04..5dc486f 100644 (file)
@@ -95,7 +95,7 @@ Xcos
 ----
 
 * scicos_log() support options parameters to retrieve model statistics.
-* Added a new block `SCALE_CSCOPE` which is `CSCOPE` block with additional feature of autoscaling of graph. It takes a parameter (1 for Yes/0 for No) for scaling/no-scaling.
+* Added two new blocks `SCALE_CSCOPE` & `SCALE_CMSCOPE` which are `CSCOPE` & `CMSCOPE` blocks (resp) with additional feature of autoscaling of graph. It takes a parameter (1 for Yes or 0 for No) for scaling or no-scaling.
 
 
 API modification
@@ -121,7 +121,7 @@ Bug Fixes
 ---------
 
 ### Bugs fixed in 6.1.0:
-* [#8784](http://bugzilla.scilab.org/show_bug.cgi?id=8784): automatic self-adjusting scopes.
+* [#8784](http://bugzilla.scilab.org/show_bug.cgi?id=8784): Automatic self-adjusting blocks `SCALE_CSCOPE` & `SCALE_CMSCOPE` in Xcos.
 * [#14604](http://bugzilla.scilab.org/show_bug.cgi?id=14604): `emptystr()` is 40x slower with 6.0.0 wrt 5.5.2
 * [#14605](http://bugzilla.scilab.org/show_bug.cgi?id=14605): fixed - `bench_run` was too strict about the specification of tests names.
 * [#14812](http://bugzilla.scilab.org/show_bug.cgi?id=14812): Minor typos in messages.
diff --git a/scilab/modules/helptools/images/SCALE_CMSCOPE.png b/scilab/modules/helptools/images/SCALE_CMSCOPE.png
new file mode 100644 (file)
index 0000000..e165b3f
Binary files /dev/null and b/scilab/modules/helptools/images/SCALE_CMSCOPE.png differ
diff --git a/scilab/modules/helptools/images/SCALE_CMSCOPE_en_US.zcos.png b/scilab/modules/helptools/images/SCALE_CMSCOPE_en_US.zcos.png
new file mode 100644 (file)
index 0000000..abf99ff
Binary files /dev/null and b/scilab/modules/helptools/images/SCALE_CMSCOPE_en_US.zcos.png differ
diff --git a/scilab/modules/helptools/images/SCALE_CMSCOPE_gui.gif b/scilab/modules/helptools/images/SCALE_CMSCOPE_gui.gif
new file mode 100644 (file)
index 0000000..cdec230
Binary files /dev/null and b/scilab/modules/helptools/images/SCALE_CMSCOPE_gui.gif differ
index c2a56a7..6b6f4cb 100644 (file)
@@ -91,6 +91,20 @@ scs_m.objs(1)=scicos_block(..
                        mlist(["Block","graphics","model","gui","doc"],..
                        mlist(..
                        ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein","peout","gr_i",..
+                       "id","in_implicit","out_implicit"],[90,0],[40,40],%t,0,..
+                       ["1 1";"1 3 5 7 9 11 13 15";"-1";"[]";"[]";"-1 -5";"1 5";"30 30";"20";"0";"";"1"],..
+                       [0;0],[],0,[],..
+                       list("xstringb(orig(1),orig(2),''MScope'',sz(1),sz(2),''fill'')",8),"",["E";"E"],..
+                       []),..
+                       mlist(..
+                       ["model","sim","in","in2","intyp","out","out2","outtyp","evtin","evtout","state",..
+                       "dstate","odstate","rpar","ipar","opar","blocktype","firing","dep_ut","label",..
+                       "nzcross","nmode","equations"],list("scale_cmscope",4),[1;1],[1;1],[1;1],[],[],1,1,[],..
+                       [],[],list(),[1;30;30;-1;1;-5;5],[-1;2;20;-1;-1;-1;-1;1;1;1;3],list(),"c",[],..
+                       [%t,%f],"",0,0,list()),"SCALE_CMSCOPE",list()),..
+                       mlist(["Block","graphics","model","gui","doc"],..
+                       mlist(..
+                       ["graphics","orig","sz","flip","theta","exprs","pin","pout","pein","peout","gr_i",..
                        "id","in_implicit","out_implicit"],[160,0],[40,40],%t,0,..
                        ["1";"4";"1";"-1";"[]";"[600;400]";"-15";"15";"-15";"15";"2"],[0;0],[],0,[],..
                        list(..
index 8f5fa86..86c2256 100644 (file)
@@ -48,6 +48,7 @@ SCICOS_BLOCKS_C_SOURCES = \
     src/c/cmat3d.c \
     src/c/cmatview.c \
     src/c/cmscope.c \
+    src/c/scale_cmscope.c \
     src/c/constraint_c.c \
     src/c/convert.c \
     src/c/cos_blk.c \
index 89cf9ff..9ad1c24 100644 (file)
@@ -221,6 +221,7 @@ am__objects_1 = src/c/libsciscicos_blocks_algo_la-absblk.lo \
        src/c/libsciscicos_blocks_algo_la-cmat3d.lo \
        src/c/libsciscicos_blocks_algo_la-cmatview.lo \
        src/c/libsciscicos_blocks_algo_la-cmscope.lo \
+       src/c/libsciscicos_blocks_algo_la-scale_cmscope.lo \
        src/c/libsciscicos_blocks_algo_la-constraint_c.lo \
        src/c/libsciscicos_blocks_algo_la-convert.lo \
        src/c/libsciscicos_blocks_algo_la-cos_blk.lo \
@@ -544,7 +545,7 @@ libsciscicos_blocks_algo_la_OBJECTS =  \
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
-am__v_lt_1 = 
+am__v_lt_1 =
 libsciscicos_blocks_algo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
        $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
        $(AM_CXXFLAGS) $(CXXFLAGS) \
@@ -583,11 +584,11 @@ am__v_P_1 = :
 AM_V_GEN = $(am__v_GEN_@AM_V@)
 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
 am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
+am__v_GEN_1 =
 AM_V_at = $(am__v_at_@AM_V@)
 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
 am__v_at_0 = @
-am__v_at_1 = 
+am__v_at_1 =
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/modules/core/includes
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
@@ -601,7 +602,7 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 AM_V_CC = $(am__v_CC_@AM_V@)
 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
 am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
+am__v_CC_1 =
 CCLD = $(CC)
 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -609,7 +610,7 @@ LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
+am__v_CCLD_1 =
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
 LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
@@ -619,7 +620,7 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
 AM_V_CXX = $(am__v_CXX_@AM_V@)
 am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
 am__v_CXX_0 = @echo "  CXX     " $@;
-am__v_CXX_1 = 
+am__v_CXX_1 =
 CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -627,14 +628,14 @@ CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
 AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
 am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
 am__v_CXXLD_0 = @echo "  CXXLD   " $@;
-am__v_CXXLD_1 = 
+am__v_CXXLD_1 =
 F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
 LTF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS)
 AM_V_F77 = $(am__v_F77_@AM_V@)
 am__v_F77_ = $(am__v_F77_@AM_DEFAULT_V@)
 am__v_F77_0 = @echo "  F77     " $@;
-am__v_F77_1 = 
+am__v_F77_1 =
 F77LD = $(F77)
 F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \
@@ -642,7 +643,7 @@ F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \
 AM_V_F77LD = $(am__v_F77LD_@AM_V@)
 am__v_F77LD_ = $(am__v_F77LD_@AM_DEFAULT_V@)
 am__v_F77LD_0 = @echo "  F77LD   " $@;
-am__v_F77LD_1 = 
+am__v_F77LD_1 =
 SOURCES = $(libsciscicos_blocks_algo_la_SOURCES) \
        $(libsciscicos_blocks_cli_la_SOURCES) \
        $(libsciscicos_blocks_la_SOURCES)
@@ -1011,6 +1012,7 @@ SCICOS_BLOCKS_C_SOURCES = \
     src/c/cmat3d.c \
     src/c/cmatview.c \
     src/c/cmscope.c \
+    src/c/scale_cmscope.c \
     src/c/constraint_c.c \
     src/c/convert.c \
     src/c/cos_blk.c \
@@ -1506,7 +1508,7 @@ TARGETS_ALL = $(am__append_8)
 ################ MACROS ######################
 # Rule to build a macro
 # NOT USED  AT THE MOMENT
-SUFFIXES = .sci 
+SUFFIXES = .sci
 
 ########### INSTALL DOCUMENTATION ###################
 
@@ -1548,7 +1550,7 @@ EXAMPLES_DIR = examples
 JARDIR = jar/
 # JAR files mask
 JARMASK = *.jar
-# Chapter file 
+# Chapter file
 HELP_CHAPTERDIR = help/
 HELP_CHAPTERFILE = addchapter.sce
 HELP_CHAPTERLANG = en_US fr_FR pt_BR
@@ -1697,6 +1699,8 @@ src/c/libsciscicos_blocks_algo_la-cmatview.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libsciscicos_blocks_algo_la-cmscope.lo: src/c/$(am__dirstamp) \
        src/c/$(DEPDIR)/$(am__dirstamp)
+src/c/libsciscicos_blocks_algo_la-scale_cmscope.lo: src/c/$(am__dirstamp) \
+       src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libsciscicos_blocks_algo_la-constraint_c.lo:  \
        src/c/$(am__dirstamp) src/c/$(DEPDIR)/$(am__dirstamp)
 src/c/libsciscicos_blocks_algo_la-convert.lo: src/c/$(am__dirstamp) \
@@ -2398,12 +2402,12 @@ src/c/libsciscicos_blocks_algo_la-scicos_indexfinder.lo:  \
 src/cpp/libsciscicos_blocks_algo_la-scoUtils.lo:  \
        src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 
-libsciscicos_blocks-algo.la: $(libsciscicos_blocks_algo_la_OBJECTS) $(libsciscicos_blocks_algo_la_DEPENDENCIES) $(EXTRA_libsciscicos_blocks_algo_la_DEPENDENCIES) 
+libsciscicos_blocks-algo.la: $(libsciscicos_blocks_algo_la_OBJECTS) $(libsciscicos_blocks_algo_la_DEPENDENCIES) $(EXTRA_libsciscicos_blocks_algo_la_DEPENDENCIES)
        $(AM_V_CXXLD)$(libsciscicos_blocks_algo_la_LINK)  $(libsciscicos_blocks_algo_la_OBJECTS) $(libsciscicos_blocks_algo_la_LIBADD) $(LIBS)
 src/cpp/libsciscicos_blocks_cli_la-HelpersCLI.lo:  \
        src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 
-libsciscicos_blocks-cli.la: $(libsciscicos_blocks_cli_la_OBJECTS) $(libsciscicos_blocks_cli_la_DEPENDENCIES) $(EXTRA_libsciscicos_blocks_cli_la_DEPENDENCIES) 
+libsciscicos_blocks-cli.la: $(libsciscicos_blocks_cli_la_OBJECTS) $(libsciscicos_blocks_cli_la_DEPENDENCIES) $(EXTRA_libsciscicos_blocks_cli_la_DEPENDENCIES)
        $(AM_V_CXXLD)$(libsciscicos_blocks_cli_la_LINK) -rpath $(pkglibdir) $(libsciscicos_blocks_cli_la_OBJECTS) $(libsciscicos_blocks_cli_la_LIBADD) $(LIBS)
 src/cpp/libsciscicos_blocks_la-HelpersJNI.lo: src/cpp/$(am__dirstamp) \
        src/cpp/$(DEPDIR)/$(am__dirstamp)
@@ -2416,7 +2420,7 @@ src/jni/$(DEPDIR)/$(am__dirstamp):
 src/jni/libsciscicos_blocks_la-AfficheBlock.lo:  \
        src/jni/$(am__dirstamp) src/jni/$(DEPDIR)/$(am__dirstamp)
 
-libsciscicos_blocks.la: $(libsciscicos_blocks_la_OBJECTS) $(libsciscicos_blocks_la_DEPENDENCIES) $(EXTRA_libsciscicos_blocks_la_DEPENDENCIES) 
+libsciscicos_blocks.la: $(libsciscicos_blocks_la_OBJECTS) $(libsciscicos_blocks_la_DEPENDENCIES) $(EXTRA_libsciscicos_blocks_la_DEPENDENCIES)
        $(AM_V_CXXLD)$(libsciscicos_blocks_la_LINK) $(am_libsciscicos_blocks_la_rpath) $(libsciscicos_blocks_la_OBJECTS) $(libsciscicos_blocks_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -2462,6 +2466,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-cmat3d.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-cmatview.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-cmscope.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-scale_cmscope.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-constraint_c.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-convert.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-cos_blk.Plo@am__quote@
@@ -2981,6 +2986,13 @@ src/c/libsciscicos_blocks_algo_la-cmscope.lo: src/c/cmscope.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_blocks_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libsciscicos_blocks_algo_la-cmscope.lo `test -f 'src/c/cmscope.c' || echo '$(srcdir)/'`src/c/cmscope.c
 
+src/c/libsciscicos_blocks_algo_la-scale_cmscope.lo: src/c/scale_cmscope.c
+@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_blocks_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libsciscicos_blocks_algo_la-scale_cmscope.lo -MD -MP -MF src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-scale_cmscope.Tpo -c -o src/c/libsciscicos_blocks_algo_la-scale_cmscope.lo `test -f 'src/c/scale_cmscope.c' || echo '$(srcdir)/'`src/c/scale_cmscope.c
+@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-scale_cmscope.Tpo src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-scale_cmscope.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/scale_cmscope.c' object='src/c/libsciscicos_blocks_algo_la-scale_cmscope.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_blocks_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libsciscicos_blocks_algo_la-scale_cmscope.lo `test -f 'src/c/scale_cmscope.c' || echo '$(srcdir)/'`src/c/scale_cmscope.c
+
 src/c/libsciscicos_blocks_algo_la-constraint_c.lo: src/c/constraint_c.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciscicos_blocks_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libsciscicos_blocks_algo_la-constraint_c.lo -MD -MP -MF src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-constraint_c.Tpo -c -o src/c/libsciscicos_blocks_algo_la-constraint_c.lo `test -f 'src/c/constraint_c.c' || echo '$(srcdir)/'`src/c/constraint_c.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-constraint_c.Tpo src/c/$(DEPDIR)/libsciscicos_blocks_algo_la-constraint_c.Plo
@@ -5405,7 +5417,7 @@ check-code:
 @NEED_JAVA_TRUE@               $(ANT) clean; \
 @NEED_JAVA_TRUE@       fi;
 
-# If the user request for the SWIG generation of the wrappers Java => C/C++ 
+# If the user request for the SWIG generation of the wrappers Java => C/C++
 # We call the target swig-build on the variable SWIG_WRAPPERS
 
 @SWIG_TRUE@swig: $(SWIG_WRAPPERS)
@@ -5427,7 +5439,7 @@ check-code:
 @SWIG_TRUE@            done; \
 @SWIG_TRUE@    fi
 
-# If the user request for the SWIG generation of the wrappers Java => C/C++ 
+# If the user request for the SWIG generation of the wrappers Java => C/C++
 # We call the target swig-build on the variable SWIG_WRAPPERS
 
 @GIWS_TRUE@giws: $(GIWS_WRAPPERS)
@@ -5448,7 +5460,7 @@ check-code:
 @GIWS_TRUE@giws-exception:
 @GIWS_TRUE@    @GIWS_OUTPUTDIR=src/jni/;\
 @GIWS_TRUE@    echo "GIWS: Generation of exception class ..."; \
-@GIWS_TRUE@    $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR 
+@GIWS_TRUE@    $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR
 
 macros:
        -@( if test ! -x $(top_builddir)/scilab-bin; then \
diff --git a/scilab/modules/scicos_blocks/macros/Sinks/SCALE_CMSCOPE.sci b/scilab/modules/scicos_blocks/macros/Sinks/SCALE_CMSCOPE.sci
new file mode 100644 (file)
index 0000000..39f531d
--- /dev/null
@@ -0,0 +1,190 @@
+//  Scicos
+//
+//  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
+//  Copyright (C) 2016-2017 - FOSSEE IIT Bombay - Dipti Ghosalkar
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// See the file ../license.txt
+//
+
+function [x,y,typ]=SCALE_CMSCOPE(job,arg1,arg2)
+    x=[];
+    y=[];
+    typ=[];
+    select job
+    case "set" then
+        x=arg1;
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
+
+
+        model=arg1.model;
+        //dstate=model.in
+        //pause
+        while %t do
+            [ok,in,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,autoscale,exprs]=scicos_getvalue(..
+            "Set Scope parameters",..
+            ["Input ports sizes";
+            "Drawing colors (>0) or mark (<0)";
+            "Output window number (-1 for automatic)";
+            "Output window position";
+            "Output window sizes";
+            "Ymin vector";
+            "Ymax vector";
+            "Refresh period";
+            "Buffer size";
+            "Accept herited events 0/1"
+            "Name of Scope (label&Id)"
+            "Auto Scale 0/1"],..
+            list("vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,..
+            "vec","size(%1,''*'')","vec","size(%1,''*'')","vec","size(%1,''*'')",..
+            "vec",1,"vec",1,"str",1,"vec",1),exprs)
+            if ~ok then
+                break,
+            end //user cancel modification
+            mess=[]
+            if size(in,"*")<=0 then
+                mess=[mess;"Block must have at least one input port";" "]
+                ok=%f
+            end
+            if min(in)<=0 then
+                mess=[mess;"Port sizes must be positive";" "]
+                ok=%f
+            end
+            if size(clrs,"*")<sum(in) then
+                mess=[mess;"Not enough colors defined (at least "+string(sum(in))+")";" "]
+                ok=%f
+            end
+            if size(wpos,"*")<>0 &size(wpos,"*")<>2 then
+                mess=[mess;"Window position must be [] or a 2 vector";" "]
+                ok=%f
+            end
+            if size(wdim,"*")<>0 &size(wdim,"*")<>2 then
+                mess=[mess;"Window dim must be [] or a 2 vector";" "]
+                ok=%f
+            end
+            if autoscale <> 0 & autoscale <> 1 then
+                mess=[mess;"Auto scaling must be 0:No or 1:Yes";" "]
+                ok=%f
+            end
+            if win<-1 then
+                mess=[mess;"Window number can''t be  < -1";" "]
+                ok=%f
+            end
+            if size(per,"*")<>size(ymin,"*") then
+                mess=[mess;"Size of Refresh Period must equal size of Ymin/Ymax vector";" "]
+                ok=%f
+            end
+            for i=1:1:size(per,"*")
+                if (per(i)<=0) then
+                    mess=[mess;"Refresh Period must be positive";" "]
+                    ok=%f
+                end
+            end
+            if N<2 then
+                mess=[mess;"Buffer size must be at least 2";" "]
+                ok=%f
+            end
+            if or(ymin>=ymax) then
+                mess=[mess;"Ymax must be greater than Ymin";" "]
+                ok=%f
+            end
+            if ~or(heritance==[0 1]) then
+                mess=[mess;"Accept herited events must be 0 or 1";" "]
+                ok=%f
+            end
+            if ~ok then
+                message(["Some specified values are inconsistent:";
+                " ";mess])
+            end
+            if ok then
+                in = in(:);
+                a = size(in,1);
+                in2 = ones(a,1);
+                [model,graphics,ok]=set_io(model,graphics,list([in in2],ones(a,1)),list(),ones(1-heritance,1),[]);
+            end
+            if ok then
+                if wpos==[] then
+                    wpos=[-1;-1];
+                end
+                if wdim==[] then
+                    wdim=[-1;-1];
+                end
+                if ok then
+                    period=per(:)';
+                    yy=[ymin(:)';ymax(:)']
+                    rpar=[autoscale;period(:);yy(:)]
+                    clrs=clrs(1:sum(in))
+                    ipar=[win;size(in,"*");N;wpos(:);wdim(:);in(:);clrs(:);heritance]
+                    //if prod(size(dstate))<>(sum(in)+1)*N+1 then
+                    //dstate=-eye((sum(in)+1)*N+1,1),
+                    //end
+                    model.evtin=ones(1-heritance,1)
+                    model.dstate=[]
+                    //model.dstate=dstate;
+                    model.rpar=rpar;
+                    model.ipar=ipar
+                    model.label=nom;
+                    graphics.id=nom;
+                    graphics.exprs=exprs;
+                    x.graphics=graphics;
+                    x.model=model
+                    //pause;
+                    break
+                end
+            end
+        end
+    case "define" then
+        win=-1;
+        in=[1;1]
+        wdim=[-1;-1]
+        wpos=[-1;-1]
+        clrs=[1;3;5;7;9;11;13;15];
+        N=20;
+        autoscale=1;
+
+        ymin=[-1;-5];
+        ymax=[1;5];
+        per=[30;30];
+        yy=[ymin(:)';ymax(:)']
+        period=per(:)'
+        model=scicos_model()
+        model.sim=list("scale_cmscope",4)
+        model.in=in
+        model.in2=[1;1]
+        model.intyp=[1;1]
+        model.evtin=1
+        model.rpar=[autoscale;period(:);yy(:)]
+        model.ipar=[win;size(in,"*");N;wpos(:);wdim(:);in(:);clrs(1:sum(in))]
+        model.blocktype="c"
+        model.dep_ut=[%t %f]
+
+        exprs=[strcat(string(in)," ");
+        strcat(string(clrs)," ");
+        string(win);
+        sci2exp([]);
+        sci2exp([]);
+        strcat(string(ymin)," ");
+        strcat(string(ymax)," ");
+        strcat(string(per)," ");
+        string(N);
+        string(0);
+        emptystr()
+        string(autoscale)];
+        gr_i=[]
+        x=standard_define([2 2],model,exprs,gr_i)
+    end
+endfunction
diff --git a/scilab/modules/scicos_blocks/src/c/scale_cmscope.c b/scilab/modules/scicos_blocks/src/c/scale_cmscope.c
new file mode 100644 (file)
index 0000000..95d67e9
--- /dev/null
@@ -0,0 +1,1153 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2011-2012 - Scilab Enterprises - Clement DAVID
+ *  Copyright (C) 2016-2017 - FOSSEE IIT Bombay - Dipti Ghosalkar
+ *  Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ */
+
+ #include <string.h>
+
+#include "dynlib_scicos_blocks.h"
+#include "scoUtils.h"
+
+#include "sci_malloc.h"
+#include "elementary_functions.h"
+
+#include "getGraphicObjectProperty.h"
+#include "setGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+#include "createGraphicObject.h"
+#include "deleteGraphicObject.h"
+
+#include "CurrentFigure.h"
+#include "CurrentObject.h"
+
+#include "scicos_block4.h"
+#include "scicos.h"
+
+#include "localization.h"
+#include "os_string.h"
+
+#include "FigureList.h"
+#include "BuildObjects.h"
+#include "AxesModel.h"
+
+// #include <stdio.h>
+
+// #define LOG(...) printf(__VA_ARGS__)
+#define LOG(...)
+// #define PUSH_LOG(...) printf(__VA_ARGS__)
+#define PUSH_LOG(...)
+
+
+#define HISTORY_POINTS_THRESHOLD 4096
+
+/*****************************************************************************
+ * Internal container structure
+ ****************************************************************************/
+
+/**
+ * Container structure
+ */
+typedef struct
+{
+    struct
+    {
+        int *numberOfPoints;
+        double ***bufferCoordinates;
+        int *maxNumberOfPoints;
+        double ***historyCoordinates;
+    } internal;
+
+    struct
+    {
+        int *periodCounter;
+
+        BOOL *disableBufferUpdate;
+        int *historyUpdateCounter;
+
+        int cachedFigureUID;
+        int* cachedAxeUID;
+        int** cachedBufferPolylinesUIDs;
+        int** cachedHistoryPolylinesUIDs;
+    } scope;
+} sco_data;
+
+/**
+ * Get (and allocate on demand) the internal data used on this scope
+ * \param block the block
+ * \return the scope data
+ */
+static sco_data *getScoData(scicos_block * block);
+
+/**
+ * Release any internal data
+ *
+ * \param block the block
+ */
+static void freeScoData(scicos_block * block);
+
+/**
+ * Realloc the history buffer data
+ *
+ * \param block the block
+ * \param input the selected input
+ * \param numberOfPoints realloc to store this number of points
+ */
+static sco_data *reallocHistoryBuffer(scicos_block * block, int input, int numberOfPoints);
+
+/**
+ * Set values into the coordinates buffer.
+ *
+ * \param block the block
+ * \param input the selected input
+ * \param coordinates the buffer
+ * \param numberOfPoints the number of points to set (actual)
+ * \param bufferPoints the buffer size (max)
+ * \param t the time to set
+ * \param value the value to set
+ */
+static void setBuffersCoordinates(scicos_block * block, int input, double* coordinates, const int numberOfPoints,
+                                  const int bufferPoints, const double t, const double value);
+
+/**
+ * Append the data to the current data
+ *
+ * \param block the block
+ * \param input the input (0-indexed)
+ * \param t the current time
+ * \param data the data to append
+ */
+static void appendData(scicos_block * block, int input, double t, double *data);
+
+/**
+ * Push the block data to the polyline
+ *
+ * \param block the block
+ * \param input the selected input
+ * \param row the selected row
+ * \param iPolylineUID the polyline uid
+ *
+ */
+static BOOL pushData(scicos_block * block, int input, int row);
+
+/*****************************************************************************
+ * Graphics utils
+ ****************************************************************************/
+
+/**
+ * Get (and allocate on demand) the figure associated with the block
+ * \param block the block
+ * \return a valid figure UID or NULL on error
+ */
+static int getFigure(scicos_block * block);
+
+/**
+ * Get (and allocate on demand) the axe associated with the input
+ *
+ * \param iFigureUID the parent figure UID
+ * \param block the block
+ * \param input the current input index (0-indexed)
+ * \return a valid axe UID or NULL on error
+ */
+static int getAxe(int iFigureUID, scicos_block * block, int input);
+
+/**
+ * Get (and allocate on demand) the polyline associated with the row
+ *
+ * \param iAxeUID the parent axe UID
+ * \param block the block
+ * \param input the current input index (0-indexed)
+ * \param row the current row index (0-indexed)
+ * \param history get the history polyline
+ * \return a valid polyline UID or NULL on error
+ */
+static int getPolyline(int iAxeUID, scicos_block * block, int input, int row, BOOL history);
+
+/**
+ * Delete all the buffer polylines.
+ *
+ * \param block the block
+ */
+static void deleteBufferPolylines(scicos_block * block);
+
+/**
+ * Set the polylines history size and push the history buffer
+ *
+ * \param block the block
+ * \param input the input port index
+ * \param maxNumberOfPoints the size of the buffer
+ */
+static BOOL pushHistory(scicos_block * block, int input, int maxNumberOfPoints);
+
+/**
+ * Set the polylines bounds
+ *
+ * \param block the block
+ * \param iAxeUID the axe id
+ * \param input the input number
+ * \param periodCounter number of past periods since startup
+ */
+static BOOL setPolylinesBounds(scicos_block * block, int iAxeUID, int input, int periodCounter);
+
+/*****************************************************************************
+ * Simulation function
+ ****************************************************************************/
+
+/** \fn void scale_cmscope(scicos_block * block,int flag)
+    \brief the computational function
+    \param block A pointer to a scicos_block
+    \param flag An int which indicates the state of the block (init, update, ending)
+*/
+SCICOS_BLOCKS_IMPEXP void scale_cmscope(scicos_block * block, scicos_flag flag)
+{
+    int iFigureUID;
+
+    double t;
+    double *u;
+    sco_data *sco;
+
+    int i, j;
+    BOOL result;
+
+    switch (flag)
+    {
+
+    case Initialization:
+        sco = getScoData(block);
+        if (sco == NULL)
+        {
+            set_block_error(-5);
+            break;
+        }
+        iFigureUID = getFigure(block);
+        if (iFigureUID == 0)
+        {
+            // allocation error
+            set_block_error(-5);
+            break;
+        }
+        break;
+
+    case StateUpdate:
+        iFigureUID = getFigure(block);
+        if (iFigureUID == 0)
+        {
+            // allocation error
+            set_block_error(-5);
+            break;
+        }
+
+        t = get_scicos_time();
+        for (i = 0; i < block->nin; i++)
+        {
+            u = (double *)block->inptr[i];
+
+            appendData(block, i, t, u);
+            for (j = 0; j < block->insz[i]; j++)
+            {
+                result = pushData(block, i, j);
+                if (result == FALSE)
+                {
+                    Coserror("%s: unable to push some data.", "scale_cmscope");
+                    break;
+                }
+            }
+        }
+        break;
+
+    case Ending:
+        sco = getScoData(block);
+        for (i = 0; i < block->nin; i++)
+        {
+            sco = reallocHistoryBuffer(block, i, sco->internal.maxNumberOfPoints[i] + sco->internal.numberOfPoints[i]);
+            sco->scope.disableBufferUpdate[i] = FALSE;
+            sco->scope.historyUpdateCounter[i] = 0;
+            pushHistory(block, i, sco->internal.maxNumberOfPoints[i]);
+        }
+        deleteBufferPolylines(block);
+        freeScoData(block);
+        break;
+
+    default:
+        break;
+    }
+}
+
+/*-------------------------------------------------------------------------*/
+
+/*****************************************************************************
+ *
+ * Container management
+ *
+ ****************************************************************************/
+
+static sco_data *getScoData(scicos_block * block)
+{
+    sco_data *sco = (sco_data *) * (block->work);
+    int i, j;
+
+    if (sco == NULL)
+    {
+        /*
+         * Data allocation
+         */
+
+        sco = (sco_data *) MALLOC(sizeof(sco_data));
+        if (sco == NULL)
+        {
+            goto error_handler_sco;
+        }
+
+        sco->internal.numberOfPoints = (int *) MALLOC(block->nin * sizeof(int));
+        if (sco->internal.numberOfPoints == NULL)
+        {
+            goto error_handler_numberOfPoints;
+        }
+        sco->internal.maxNumberOfPoints = (int *) MALLOC(block->nin * sizeof(int));
+        if (sco->internal.maxNumberOfPoints == NULL)
+        {
+            goto error_handler_maxNumberOfPoints;
+        }
+
+        for (i = 0; i < block->nin; i++)
+        {
+            // 0 points out of a block->ipar[2] points buffer
+            sco->internal.numberOfPoints[i] = 0;
+            // 0 points out of a 0 points history
+            sco->internal.maxNumberOfPoints[i] = 0;
+        }
+
+        sco->internal.bufferCoordinates = (double ***)CALLOC(block->nin, sizeof(double **));
+        if (sco->internal.bufferCoordinates == NULL)
+        {
+            goto error_handler_bufferCoordinates;
+        }
+
+        for (i = 0; i < block->nin; i++)
+        {
+            sco->internal.bufferCoordinates[i] = (double **)CALLOC(block->insz[i], sizeof(double *));
+            if (sco->internal.bufferCoordinates[i] == NULL)
+            {
+                goto error_handler_bufferCoordinates_i;
+            }
+        }
+        for (i = 0; i < block->nin; i++)
+        {
+            for (j = 0; j < block->insz[i]; j++)
+            {
+                sco->internal.bufferCoordinates[i][j] = (double *)CALLOC(3 * block->ipar[2], sizeof(double));
+
+                if (sco->internal.bufferCoordinates[i][j] == NULL)
+                {
+                    goto error_handler_bufferCoordinates_ij;
+                }
+            }
+        }
+
+        sco->internal.historyCoordinates = (double ***)CALLOC(block->nin, sizeof(double **));
+        if (sco->internal.historyCoordinates == NULL)
+        {
+            goto error_handler_historyCoordinates;
+        }
+
+        for (i = 0; i < block->nin; i++)
+        {
+            sco->internal.historyCoordinates[i] = (double **)CALLOC(block->insz[i], sizeof(double *));
+            if (sco->internal.historyCoordinates[i] == NULL)
+            {
+                goto error_handler_historyCoordinates_i;
+            }
+        }
+
+        sco->scope.periodCounter = (int *) CALLOC(block->nin, sizeof(int));
+        if (sco->scope.periodCounter == NULL)
+        {
+            goto error_handler_periodCounter;
+        }
+
+        sco->scope.disableBufferUpdate = (BOOL *) CALLOC(block->nin, sizeof(BOOL));
+        if (sco->scope.disableBufferUpdate == NULL)
+        {
+            goto error_handler_disableBufferUpdate;
+        }
+        sco->scope.historyUpdateCounter = (int *) CALLOC(block->nin, sizeof(int));
+        if (sco->scope.historyUpdateCounter == NULL)
+        {
+            goto error_handler_historyUpdateCounter;
+        }
+
+        sco->scope.cachedFigureUID = 0;
+        sco->scope.cachedAxeUID = (int*)CALLOC(block->nin, sizeof(int));
+
+        sco->scope.cachedBufferPolylinesUIDs = (int**)CALLOC(block->nin, sizeof(int*));
+        sco->scope.cachedHistoryPolylinesUIDs = (int**)CALLOC(block->nin, sizeof(int*));
+        for (i = 0; i < block->nin; i++)
+        {
+            sco->scope.cachedBufferPolylinesUIDs[i] = (int*)CALLOC(block->insz[i], sizeof(int));
+            sco->scope.cachedHistoryPolylinesUIDs[i] = (int*)CALLOC(block->insz[i], sizeof(int));
+        }
+
+        *(block->work) = sco;
+    }
+
+    return sco;
+
+    /*
+     * Error management (out of normal flow)
+     */
+
+error_handler_historyUpdateCounter:
+    FREE(sco->scope.disableBufferUpdate);
+error_handler_disableBufferUpdate:
+    FREE(sco->scope.periodCounter);
+error_handler_periodCounter:
+    i = block->nin;
+error_handler_historyCoordinates_i:
+    for (j = 0; j < i; j++)
+    {
+        FREE(sco->internal.historyCoordinates[j]);
+    }
+    FREE(sco->internal.historyCoordinates);
+error_handler_historyCoordinates:
+error_handler_bufferCoordinates_ij:
+    for (i = 0; i < block->nin - 1; i++)
+    {
+        for (j = 0; j < block->insz[i] - 1; j++)
+        {
+            double* ptr = sco->internal.bufferCoordinates[i][j];
+            if (ptr != NULL)
+            {
+                FREE(ptr);
+            }
+        }
+    }
+    i = block->nin - 1;
+error_handler_bufferCoordinates_i:
+    for (j = 0; j < i; j++)
+    {
+        FREE(sco->internal.bufferCoordinates[j]);
+    }
+    FREE(sco->internal.bufferCoordinates);
+error_handler_bufferCoordinates:
+    FREE(sco->internal.maxNumberOfPoints);
+error_handler_maxNumberOfPoints:
+    FREE(sco->internal.numberOfPoints);
+error_handler_numberOfPoints:
+    FREE(sco);
+error_handler_sco:
+    // allocation error
+    set_block_error(-5);
+    return NULL;
+}
+
+static void freeScoData(scicos_block * block)
+{
+    sco_data *sco = (sco_data *) * (block->work);
+    int i, j;
+
+    if (sco != NULL)
+    {
+        for (i = 0; i < block->nin; i++)
+        {
+            for (j = 0; j < block->insz[i]; j++)
+            {
+                if (sco->internal.historyCoordinates[i][j] != NULL)
+                {
+                    FREE(sco->internal.historyCoordinates[i][j]);
+                }
+                FREE(sco->internal.bufferCoordinates[i][j]);
+            }
+            FREE(sco->internal.historyCoordinates[i]);
+            FREE(sco->internal.bufferCoordinates[i]);
+        }
+        FREE(sco->internal.historyCoordinates);
+        FREE(sco->internal.bufferCoordinates);
+
+        FREE(sco->scope.periodCounter);
+
+        FREE(sco->scope.disableBufferUpdate);
+        FREE(sco->scope.historyUpdateCounter);
+
+        for (i = 0; i < block->nin; i++)
+        {
+            FREE(sco->scope.cachedHistoryPolylinesUIDs[i]);
+            FREE(sco->scope.cachedBufferPolylinesUIDs[i]);
+        }
+
+        FREE(sco->scope.cachedHistoryPolylinesUIDs);
+        FREE(sco->scope.cachedBufferPolylinesUIDs);
+        FREE(sco->scope.cachedAxeUID);
+        FREE(sco);
+        *(block->work) = NULL;
+    }
+}
+
+static sco_data *reallocHistoryBuffer(scicos_block * block, int input, int numberOfPoints)
+{
+    sco_data *sco = (sco_data *) * (block->work);
+    int i;
+
+    double *ptr;
+    int allocatedNumberOfPoints;
+
+    int previousNumberOfPoints = sco->internal.maxNumberOfPoints[input];
+    int numberOfCopiedPoints = numberOfPoints - sco->internal.maxNumberOfPoints[input];
+
+    double *buffer;
+    int bufferNumberOfPoints = block->ipar[2];
+    int bufferNewPointInc;
+
+    if (previousNumberOfPoints == 0)
+    {
+        allocatedNumberOfPoints = numberOfPoints;
+        bufferNewPointInc = 0;
+    }
+    else
+    {
+        allocatedNumberOfPoints = numberOfPoints - 1;
+        bufferNewPointInc = 1;
+    }
+
+    if (sco->scope.historyUpdateCounter[input] <= 0)
+    {
+        if (numberOfPoints > HISTORY_POINTS_THRESHOLD)
+        {
+            sco->scope.disableBufferUpdate[input] = TRUE;
+            sco->scope.historyUpdateCounter[input] = numberOfPoints / HISTORY_POINTS_THRESHOLD;
+        }
+        else
+        {
+            sco->scope.disableBufferUpdate[input] = FALSE;
+            sco->scope.historyUpdateCounter[input] = 0;
+        }
+    }
+
+    for (i = 0; i < block->insz[input]; i++)
+    {
+        ptr = (double *)MALLOC(3 * allocatedNumberOfPoints * sizeof(double));
+        if (ptr == NULL)
+        {
+            goto error_handler;
+        }
+
+        // memcpy existing X-axis values from the history
+        memcpy(ptr, sco->internal.historyCoordinates[input][i], previousNumberOfPoints * sizeof(double));
+        // memcpy existing Y-axis values from the history
+        memcpy(ptr + allocatedNumberOfPoints, sco->internal.historyCoordinates[input][i] + previousNumberOfPoints, previousNumberOfPoints * sizeof(double));
+        // clear the last points, the Z-axis values
+        memset(ptr + 2 * allocatedNumberOfPoints, 0, allocatedNumberOfPoints * sizeof(double));
+
+        // then set the last points to the last values for X-axis and Y-axis values from the buffer points
+        buffer = sco->internal.bufferCoordinates[input][i];
+        memcpy(ptr + previousNumberOfPoints, buffer + bufferNewPointInc, (numberOfCopiedPoints - bufferNewPointInc) * sizeof(double));
+        memcpy(ptr + allocatedNumberOfPoints + previousNumberOfPoints, buffer + bufferNumberOfPoints + bufferNewPointInc, (numberOfCopiedPoints - bufferNewPointInc) * sizeof(double));
+
+        FREE(sco->internal.historyCoordinates[input][i]);
+        sco->internal.historyCoordinates[input][i] = ptr;
+    }
+
+    sco->internal.maxNumberOfPoints[input] = allocatedNumberOfPoints;
+    return sco;
+
+error_handler:
+    freeScoData(block);
+    // allocation error
+    set_block_error(-5);
+    return NULL;
+}
+
+static void setBuffersCoordinates(scicos_block * block, int input, double* coordinates, const int numberOfPoints,
+                                  const int bufferPoints, const double t, const double value)
+{
+    int setLen;
+    sco_data *sco = (sco_data *) * (block->work);
+
+    if (sco->scope.disableBufferUpdate[input] == TRUE)
+    {
+        coordinates[numberOfPoints] = t;
+        coordinates[bufferPoints + numberOfPoints] = value;
+        return;
+    }
+
+    // X-axis values first
+    for (setLen = numberOfPoints; setLen < bufferPoints; setLen++)
+    {
+        coordinates[setLen] = t;
+    }
+    // then Y-axis values
+    for (setLen = numberOfPoints; setLen < bufferPoints; setLen++)
+    {
+        coordinates[bufferPoints + setLen] = value;
+    }
+    // then Z-axis values (always clear'ed)
+}
+
+static void appendData(scicos_block * block, int input, double t, double *data)
+{
+    int i;
+
+    sco_data *sco = (sco_data *) * (block->work);
+
+    if (sco != NULL)
+    {
+
+        /*
+         * Handle the case where the t is greater than the data_bounds
+         */
+        if (t > ((sco->scope.periodCounter[input] + 1) * block->rpar[1 + input]))
+        {
+            sco->scope.periodCounter[input]++;
+
+            // set the buffer coordinates to the last point
+            for (i = 0; i < block->insz[input]; i++)
+            {
+                sco->internal.bufferCoordinates[input][i][0] = sco->internal.bufferCoordinates[input][i][sco->internal.numberOfPoints[input] - 1];
+                sco->internal.bufferCoordinates[input][i][block->ipar[2]] = sco->internal.bufferCoordinates[input][i][block->ipar[2] + sco->internal.numberOfPoints[input] - 1];
+            }
+            sco->internal.numberOfPoints[input] = 1;
+
+            // clear the history coordinates
+            sco->internal.maxNumberOfPoints[input] = 0;
+            for (i = 0; i < block->insz[input]; i++)
+            {
+                if (sco->internal.historyCoordinates[input][i] != NULL)
+                {
+                    FREE(sco->internal.historyCoordinates[input][i]);
+                    sco->internal.historyCoordinates[input][i] = NULL;
+                }
+            }
+
+            // configure scope setting
+            if (setPolylinesBounds(block, getAxe(getFigure(block), block, input), input, sco->scope.periodCounter[input]) == FALSE)
+            {
+                set_block_error(-5);
+                freeScoData(block);
+                sco = NULL;
+            }
+        }
+
+        /*
+         * Handle the case where the scope has more points than maxNumberOfPoints
+         */
+        if (sco->internal.numberOfPoints[input] >= block->ipar[2])
+        {
+            int maxNumberOfPoints = sco->internal.maxNumberOfPoints[input];
+
+            // on a full scope, re-alloc history coordinates
+            maxNumberOfPoints = maxNumberOfPoints + block->ipar[2];
+            sco = reallocHistoryBuffer(block, input, maxNumberOfPoints);
+
+            // set the buffer coordinates to the last point
+            for (i = 0; i < block->insz[input]; i++)
+            {
+                sco->internal.bufferCoordinates[input][i][0] = sco->internal.bufferCoordinates[input][i][block->ipar[2] - 1];
+                sco->internal.bufferCoordinates[input][i][block->ipar[2]] = sco->internal.bufferCoordinates[input][i][2 * block->ipar[2] - 1];
+            }
+            sco->internal.numberOfPoints[input] = 1;
+
+            // reconfigure related graphic objects
+            if (pushHistory(block, input, sco->internal.maxNumberOfPoints[input]) == FALSE)
+            {
+                set_block_error(-5);
+                freeScoData(block);
+                sco = NULL;
+            }
+        }
+
+        /*
+         * Update data
+        */
+
+        for (i = 0; i < block->insz[input]; i++)
+        {
+            const double value = data[i];
+            setBuffersCoordinates(block, input, sco->internal.bufferCoordinates[input][i], sco->internal.numberOfPoints[input], block->ipar[2], t, value);
+
+
+            if(block->rpar[0]==1) {
+                double max_curr_val,prev_max_curr_val,min_curr_val,prev_min_curr_val;
+                //Get the current maximum value of the axes
+                max_curr_val = block->rpar[block->nrpar - 2 * (block->nin) + 2 * input+1];
+                prev_max_curr_val = max_curr_val;
+
+
+                //Get the current minimum value of the axes
+                min_curr_val = block->rpar[block->nrpar - 2 * (block->nin) + 2 * input];
+                prev_min_curr_val = min_curr_val;
+
+                /* If the value to be plotted exceeds the current range, then we update the range
+                 * We could update the range from current value to the new value i.e. (value + R)
+                 *where R varies from 0 to approx 150. So we have used (value + 100.0) to give the graph good feature.
+                 *
+                 * However, the auto-scaling feature implemented is general
+                */
+
+                //If the value to be plotted is greater than or equal to the current max, then update the current max
+                if(value >= max_curr_val)
+                {
+                    max_curr_val = value + 10.0;
+                    block->rpar[block->nrpar - 2 * (block->nin) + 2 * input+1] = max_curr_val;
+                }
+
+                //If the value to be plotted is smaller than or equal to the current min, then update the current min
+                if(value <= min_curr_val)
+                {
+                    min_curr_val = value - 10.0;
+                    block->rpar[block->nrpar - 2 * (block->nin) + 2 * input] = min_curr_val;
+                }
+
+                //If value has changed, call the setPolylinesBounds function to update the ranges
+                if((max_curr_val != prev_max_curr_val) || (min_curr_val != prev_min_curr_val))
+                {
+                    if (setPolylinesBounds(block, getAxe(getFigure(block), block, input), input, sco->scope.periodCounter[input]) == FALSE)
+                    {
+                        set_block_error(-5);
+                        freeScoData(block);
+                        sco = NULL;
+                    }
+                }
+            }
+        }
+
+        sco->internal.numberOfPoints[input]++;
+    }
+}
+
+static BOOL pushData(scicos_block * block, int input, int row)
+{
+    int iFigureUID;
+    int iAxeUID;
+    int iPolylineUID;
+
+    double *data;
+    sco_data *sco;
+
+    iFigureUID = getFigure(block);
+    iAxeUID = getAxe(iFigureUID, block, input);
+    iPolylineUID = getPolyline(iAxeUID, block, input, row, FALSE);
+
+    sco = getScoData(block);
+    if (sco == NULL)
+    {
+        return FALSE;
+    }
+
+    // do not push any data if disabled
+    if (sco->scope.disableBufferUpdate[input] == TRUE)
+    {
+        return TRUE;
+    }
+
+    // select the right input and row
+    data = sco->internal.bufferCoordinates[input][row];
+
+    PUSH_LOG("%s: %d\n", "pushData", block->ipar[2]);
+    return setGraphicObjectProperty(iPolylineUID, __GO_DATA_MODEL_COORDINATES__, data, jni_double_vector, block->ipar[2]);
+}
+
+/*****************************************************************************
+ *
+ * Graphic utils
+ *
+ ****************************************************************************/
+
+/**
+ * Set properties on the figure.
+ *
+ * \param iFigureUID the figure uid
+ * \param block the current block
+ */
+static void setFigureSettings(int iFigureUID, scicos_block * block)
+{
+    int win_pos[2];
+    int win_dim[2];
+    char* label;
+
+    int *ipar = block->ipar;
+
+    win_pos[0] = ipar[3];
+    win_pos[1] = ipar[4];
+    win_dim[0] = ipar[5];
+    win_dim[1] = ipar[6];
+
+    if (win_pos[0] > 0 && win_pos[1] > 0)
+    {
+        setGraphicObjectProperty(iFigureUID, __GO_POSITION__, &win_pos, jni_int_vector, 2);
+    }
+
+    if (win_dim[0] > 0 && win_dim[1] > 0)
+    {
+        setGraphicObjectProperty(iFigureUID, __GO_SIZE__, &win_dim, jni_int_vector, 2);
+    }
+
+    label = GetLabelPtrs(block);
+    if (label != NULL)
+    {
+        if (strlen(label) > 0)
+        {
+            setGraphicObjectProperty(iFigureUID, __GO_NAME__, label, jni_string, 1);
+        }
+    }
+}
+
+/**
+ * Set properties on the axes.
+ *
+ * \param iAxeUID the axe uid
+ * \param block the current block
+ * \param index axe index (0-indexed)
+ */
+static void setAxesSettings(int iAxeUID, scicos_block * block, int index)
+{
+    double axesBounds[4];
+    double margins[4];
+
+    double nin = (double) block->nin;
+
+    axesBounds[0] = 0;              // x
+    axesBounds[1] = index / nin;    // y
+    axesBounds[2] = 1.0;            // w
+    axesBounds[3] = 1 / nin;        // h
+    setGraphicObjectProperty(iAxeUID, __GO_AXES_BOUNDS__, axesBounds, jni_double_vector, 4);
+
+    margins[0] = 0.125;
+    margins[1] = 0.125;
+    margins[2] = 0.125;
+    margins[3] = 0.125;
+    setGraphicObjectProperty(iAxeUID, __GO_MARGINS__, margins, jni_double_vector, 4);
+
+};
+
+/*****************************************************************************
+ *
+ * Graphic
+ *
+ ****************************************************************************/
+
+static int getFigure(scicos_block * block)
+{
+    signed int figNum;
+    int iFigureUID = 0;
+    int iAxe = 0;
+    int i__1 = 1;
+    sco_data *sco = (sco_data *) * (block->work);
+
+    int i;
+
+    // assert the sco is not NULL
+    if (sco == NULL)
+    {
+        return 0;
+    }
+
+    // fast path for an existing object
+    if (sco->scope.cachedFigureUID)
+    {
+        return sco->scope.cachedFigureUID;
+    }
+
+    figNum = block->ipar[0];
+
+    // with a negative id, use the block number indexed from a constant.
+    if (figNum < 0)
+    {
+        figNum = 20000 + get_block_number();
+    }
+
+    iFigureUID = getFigureFromIndex(figNum);
+    // create on demand
+    if (iFigureUID == 0)
+    {
+        iFigureUID = createNewFigureWithAxes();
+        setGraphicObjectProperty(iFigureUID, __GO_ID__, &figNum, jni_int, 1);
+
+        // the stored uid is a reference to the figure map, not to the current figure
+        iFigureUID = getFigureFromIndex(figNum);
+        sco->scope.cachedFigureUID = iFigureUID;
+
+        // set configured parameters
+        setFigureSettings(iFigureUID, block);
+
+        // allocate the axes through the getter
+        for (i = 0; i < GetNin(block); i++)
+        {
+            iAxe = getAxe(iFigureUID, block, i);
+
+            /*
+             * Setup according to block settings
+             */
+            setLabel(iAxe, __GO_X_AXIS_LABEL__, "t");
+            setLabel(iAxe, __GO_Y_AXIS_LABEL__, "y");
+
+            setGraphicObjectProperty(iAxe, __GO_X_AXIS_VISIBLE__, &i__1, jni_bool, 1);
+            setGraphicObjectProperty(iAxe, __GO_Y_AXIS_VISIBLE__, &i__1, jni_bool, 1);
+
+            setPolylinesBounds(block, iAxe, i, 0);
+        }
+    }
+    else
+    {
+        // set configured parameters
+        setFigureSettings(iFigureUID, block);
+    }
+
+    if (sco->scope.cachedFigureUID == 0)
+    {
+        sco->scope.cachedFigureUID = iFigureUID;
+    }
+    return iFigureUID;
+}
+
+static int getAxe(int iFigureUID, scicos_block * block, int input)
+{
+    int iAxe;
+    int i;
+    sco_data *sco = (sco_data *) * (block->work);
+
+    // assert the sco is not NULL
+    if (sco == NULL || sco->scope.cachedAxeUID == NULL)
+    {
+        return 0;
+    }
+
+    // fast path for an existing object
+    if (sco->scope.cachedAxeUID[input])
+    {
+        return sco->scope.cachedAxeUID[input];
+    }
+
+    iAxe = findChildWithKindAt(iFigureUID, __GO_AXES__, input);
+
+    /*
+     * Allocate if necessary
+     */
+    if (iAxe == 0)
+    {
+        cloneAxesModel(iFigureUID);
+        iAxe = findChildWithKindAt(iFigureUID, __GO_AXES__, input);
+
+        // seems that the graphic is unable to clone the default axe model
+        if (iAxe == 0)
+        {
+            return 0;
+        }
+    }
+
+    /*
+     * Setup on first access
+     */
+    // allocate the polylines through the getter
+    for (i = 0; i < block->insz[input]; i++)
+    {
+        getPolyline(iAxe, block, input, i, TRUE);
+    }
+    for (i = 0; i < block->insz[input]; i++)
+    {
+        getPolyline(iAxe, block, input, i, FALSE);
+    }
+
+    setAxesSettings(iAxe, block, input);
+
+    /*
+     * then cache with local storage
+     */
+    sco->scope.cachedAxeUID[input] = iAxe;
+    return sco->scope.cachedAxeUID[input];
+}
+
+static int getPolyline(int iAxeUID, scicos_block * block, int input, int row, BOOL history)
+{
+    int iPolyline;
+    BOOL b__true = TRUE;
+
+    int color;
+
+    int** piPolylinesUIDs;
+    int polylineIndex;
+
+    sco_data *sco = (sco_data *) * (block->work);
+
+    // assert the sco is not NULL
+    if (sco == NULL)
+    {
+        return 0;
+    }
+
+    if (!history)
+    {
+        piPolylinesUIDs = sco->scope.cachedBufferPolylinesUIDs;
+        polylineIndex = block->insz[input] + row;
+    }
+    else
+    {
+        piPolylinesUIDs = sco->scope.cachedHistoryPolylinesUIDs;
+        polylineIndex = row;
+    }
+
+    // assert that the structure is in a good shape
+    if (piPolylinesUIDs == NULL || piPolylinesUIDs[input] == NULL)
+    {
+        return 0;
+    }
+
+    // fast path for an existing object
+    if (piPolylinesUIDs[input][row] != 0)
+    {
+        return piPolylinesUIDs[input][row];
+    }
+
+    iPolyline = findChildWithKindAt(iAxeUID, __GO_POLYLINE__, polylineIndex);
+
+    /*
+     * Allocate if necessary
+     */
+    if (iPolyline == 0)
+    {
+        iPolyline = createGraphicObject(__GO_POLYLINE__);
+
+        if (iPolyline != 0)
+        {
+            createDataObject(iPolyline, __GO_POLYLINE__);
+            setGraphicObjectRelationship(iAxeUID, iPolyline);
+        }
+        else
+        {
+            return 0;
+        }
+    }
+
+    /*
+     * Setup on first access
+     */
+
+    /*
+     * Default setup of the nGons property
+     */
+    {
+        int nGons = 1;
+        setGraphicObjectProperty(iPolyline, __GO_DATA_MODEL_NUM_GONS__, &nGons, jni_int, 1);
+    }
+
+    // ipar=[win;size(in,'*');N;wpos(:);wdim(:);in(:);clrs(:);heritance]
+    //        1     1         1   2       2      nin   nin       1
+    color = block->ipar[7 + block->nin + input + row];
+    if (color > 0)
+    {
+        LOG("%s: %s at %d at %d to %d\n", "scale_cmscope", "set lines mode", input, row, color);
+
+        setGraphicObjectProperty(iPolyline, __GO_LINE_MODE__, &b__true, jni_bool, 1);
+        setGraphicObjectProperty(iPolyline, __GO_LINE_COLOR__, &color, jni_int, 1);
+    }
+    else
+    {
+        int iMarkSize = 4;
+        color = -color;
+
+        LOG("%s: %s at %d at %d to %d\n", "scale_cmscope", "set mark mode", input, row, -color);
+
+        setGraphicObjectProperty(iPolyline, __GO_MARK_MODE__, &b__true, jni_bool, 1);
+        setGraphicObjectProperty(iPolyline, __GO_MARK_STYLE__, &color, jni_int, 1);
+        setGraphicObjectProperty(iPolyline, __GO_MARK_SIZE__, &iMarkSize, jni_int, 1);
+    }
+
+    {
+        int iClipState = 1; //on
+        setGraphicObjectProperty(iPolyline, __GO_CLIP_STATE__, &iClipState, jni_int, 1);
+    }
+
+    /*
+     * then cache with local storage
+     */
+    piPolylinesUIDs[input][row] = iPolyline;
+    return piPolylinesUIDs[input][row];
+}
+
+static void deleteBufferPolylines(scicos_block * block)
+{
+    int i, j;
+
+    int iPolylineUID;
+
+    sco_data *sco;
+
+    sco = getScoData(block);
+    for (i = 0; i < block->nin; i++)
+    {
+        for (j = 0; j < block->insz[i]; j++)
+        {
+            iPolylineUID = sco->scope.cachedBufferPolylinesUIDs[i][j];
+            deleteGraphicObject(iPolylineUID);
+        }
+    }
+}
+
+static BOOL pushHistory(scicos_block * block, int input, int maxNumberOfPoints)
+{
+    int i;
+
+    int iFigureUID;
+    int iAxeUID;
+    int iPolylineUID;
+
+    double *data;
+    sco_data *sco;
+
+    BOOL result = TRUE;
+
+    sco = getScoData(block);
+    iFigureUID = getFigure(block);
+    iAxeUID = getAxe(iFigureUID, block, input);
+
+    // push the data only if the counter == 0, decrement the counter if positive
+    if (sco->scope.historyUpdateCounter[input] > 0)
+    {
+        sco->scope.historyUpdateCounter[input]--;
+    }
+    if (sco->scope.historyUpdateCounter[input] > 0)
+    {
+        return result;
+    }
+
+    for (i = 0; i < block->insz[input]; i++)
+    {
+        iPolylineUID = getPolyline(iAxeUID, block, input, i, TRUE);
+
+        data = sco->internal.historyCoordinates[input][i];
+
+        PUSH_LOG("%s: %d\n", "pushHistory", maxNumberOfPoints);
+        result = setGraphicObjectProperty(iPolylineUID, __GO_DATA_MODEL_COORDINATES__, data, jni_double_vector, maxNumberOfPoints);
+        if (result == FALSE)
+        {
+            return result;
+        }
+    }
+
+    return result;
+}
+
+static BOOL setPolylinesBounds(scicos_block * block, int iAxeUID, int input, int periodCounter)
+{
+    double dataBounds[6];
+    int nin = block->nin;
+    double period = block->rpar[block->nrpar - 3 * nin + input];
+
+    dataBounds[0] = periodCounter * period; // xMin
+    dataBounds[1] = (periodCounter + 1) * period;   // xMax
+    dataBounds[2] = block->rpar[block->nrpar - 2 * nin + 2 * input];    // yMin
+    dataBounds[3] = block->rpar[block->nrpar - 2 * nin + 2 * input + 1];    // yMax
+    dataBounds[4] = -1.0;       // zMin
+    dataBounds[5] = 1.0;        // zMax
+
+    LOG("%s: %s at %d to %f\n", "scale_cmscope", "setPolylinesBounds", input, dataBounds[1]);
+
+    return setGraphicObjectProperty(iAxeUID, __GO_DATA_BOUNDS__, dataBounds, jni_double_vector, 6);
+}
index 78a0d4f..566a543 100644 (file)
@@ -60,7 +60,7 @@ GIWS_WRAPPERS = \
 SWIG_WRAPPERS = \
     src/jni/JavaController.i \
     src/jni/JavaXMIResource.i
-    
+
 # FORCE directors due to a bug into swig
 SWIG_OPTIONS=-c++ -directors
 BUILT_SOURCES=
@@ -281,6 +281,7 @@ images/palettes/CLSS.png \
 images/palettes/CMAT3D.png \
 images/palettes/CMATVIEW.png \
 images/palettes/CMSCOPE.png \
+images/palettes/SCALE_CMSCOPE.png \
 images/palettes/ConstantVoltage.png \
 images/palettes/CONST_f.png \
 images/palettes/CONST_m.png \
index b4eec27..9e3c0e0 100644 (file)
@@ -203,7 +203,7 @@ libscixcos_algo_la_OBJECTS = $(am_libscixcos_algo_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
-am__v_lt_1 = 
+am__v_lt_1 =
 @GUI_TRUE@@XCOS_TRUE@am_libscixcos_algo_la_rpath =
 libscixcos_disable_la_LIBADD =
 am__objects_2 = src/noxcos/libscixcos_disable_la-noxcos.lo
@@ -242,11 +242,11 @@ am__v_P_1 = :
 AM_V_GEN = $(am__v_GEN_@AM_V@)
 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
 am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
+am__v_GEN_1 =
 AM_V_at = $(am__v_at_@AM_V@)
 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
 am__v_at_0 = @
-am__v_at_1 = 
+am__v_at_1 =
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/modules/core/includes
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
@@ -260,7 +260,7 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 AM_V_CC = $(am__v_CC_@AM_V@)
 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
 am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
+am__v_CC_1 =
 CCLD = $(CC)
 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -268,7 +268,7 @@ LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
+am__v_CCLD_1 =
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
 LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
@@ -278,7 +278,7 @@ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
 AM_V_CXX = $(am__v_CXX_@AM_V@)
 am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
 am__v_CXX_0 = @echo "  CXX     " $@;
-am__v_CXX_1 = 
+am__v_CXX_1 =
 CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -286,7 +286,7 @@ CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
 AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
 am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
 am__v_CXXLD_0 = @echo "  CXXLD   " $@;
-am__v_CXXLD_1 = 
+am__v_CXXLD_1 =
 SOURCES = $(libscixcos_algo_la_SOURCES) \
        $(libscixcos_disable_la_SOURCES) $(libscixcos_la_SOURCES)
 DIST_SOURCES = $(libscixcos_algo_la_SOURCES) \
@@ -665,7 +665,7 @@ SWIG_WRAPPERS = \
 # FORCE directors due to a bug into swig
 SWIG_OPTIONS = -c++ -directors
 BUILT_SOURCES = $(am__append_1) $(am__append_2)
-GATEWAY_C_SOURCES = 
+GATEWAY_C_SOURCES =
 GATEWAY_CXX_SOURCES = \
        sci_gateway/cpp/sci_Xcos.cpp \
        sci_gateway/cpp/sci_warnBlockByUID.cpp \
@@ -862,6 +862,7 @@ images/palettes/CLSS.png \
 images/palettes/CMAT3D.png \
 images/palettes/CMATVIEW.png \
 images/palettes/CMSCOPE.png \
+images/palettes/SCALE_CMSCOPE.png \
 images/palettes/ConstantVoltage.png \
 images/palettes/CONST_f.png \
 images/palettes/CONST_m.png \
@@ -1083,7 +1084,7 @@ TARGETS_ALL = $(am__append_4)
 ################ MACROS ######################
 # Rule to build a macro
 # NOT USED  AT THE MOMENT
-SUFFIXES = .sci 
+SUFFIXES = .sci
 
 ########### INSTALL DOCUMENTATION ###################
 
@@ -1125,7 +1126,7 @@ EXAMPLES_DIR = examples
 JARDIR = jar/
 # JAR files mask
 JARMASK = *.jar
-# Chapter file 
+# Chapter file
 HELP_CHAPTERDIR = help/
 HELP_CHAPTERFILE = addchapter.sce
 HELP_CHAPTERLANG = en_US fr_FR pt_BR
@@ -1239,7 +1240,7 @@ src/cpp/libscixcos_algo_la-loadStatus.lo: src/cpp/$(am__dirstamp) \
 src/jni/libscixcos_algo_la-JavaXMIResource_wrap.lo:  \
        src/jni/$(am__dirstamp) src/jni/$(DEPDIR)/$(am__dirstamp)
 
-libscixcos-algo.la: $(libscixcos_algo_la_OBJECTS) $(libscixcos_algo_la_DEPENDENCIES) $(EXTRA_libscixcos_algo_la_DEPENDENCIES) 
+libscixcos-algo.la: $(libscixcos_algo_la_OBJECTS) $(libscixcos_algo_la_DEPENDENCIES) $(EXTRA_libscixcos_algo_la_DEPENDENCIES)
        $(AM_V_CXXLD)$(CXXLINK) $(am_libscixcos_algo_la_rpath) $(libscixcos_algo_la_OBJECTS) $(libscixcos_algo_la_LIBADD) $(LIBS)
 src/noxcos/$(am__dirstamp):
        @$(MKDIR_P) src/noxcos
@@ -1251,7 +1252,7 @@ src/noxcos/libscixcos_disable_la-noxcos.lo:  \
        src/noxcos/$(am__dirstamp) \
        src/noxcos/$(DEPDIR)/$(am__dirstamp)
 
-libscixcos-disable.la: $(libscixcos_disable_la_OBJECTS) $(libscixcos_disable_la_DEPENDENCIES) $(EXTRA_libscixcos_disable_la_DEPENDENCIES) 
+libscixcos-disable.la: $(libscixcos_disable_la_OBJECTS) $(libscixcos_disable_la_DEPENDENCIES) $(EXTRA_libscixcos_disable_la_DEPENDENCIES)
        $(AM_V_CCLD)$(LINK) -rpath $(pkglibdir) $(libscixcos_disable_la_OBJECTS) $(libscixcos_disable_la_LIBADD) $(LIBS)
 sci_gateway/cpp/$(am__dirstamp):
        @$(MKDIR_P) sci_gateway/cpp
@@ -1314,7 +1315,7 @@ sci_gateway/cpp/libscixcos_la-sci_xcosSimulationStarted.lo:  \
        sci_gateway/cpp/$(am__dirstamp) \
        sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
 
-libscixcos.la: $(libscixcos_la_OBJECTS) $(libscixcos_la_DEPENDENCIES) $(EXTRA_libscixcos_la_DEPENDENCIES) 
+libscixcos.la: $(libscixcos_la_OBJECTS) $(libscixcos_la_DEPENDENCIES) $(EXTRA_libscixcos_la_DEPENDENCIES)
        $(AM_V_CXXLD)$(CXXLINK) $(am_libscixcos_la_rpath) $(libscixcos_la_OBJECTS) $(libscixcos_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -1983,7 +1984,7 @@ check-code:
 @NEED_JAVA_TRUE@               $(ANT) clean; \
 @NEED_JAVA_TRUE@       fi;
 
-# If the user request for the SWIG generation of the wrappers Java => C/C++ 
+# If the user request for the SWIG generation of the wrappers Java => C/C++
 # We call the target swig-build on the variable SWIG_WRAPPERS
 
 @SWIG_TRUE@swig: $(SWIG_WRAPPERS)
@@ -2005,7 +2006,7 @@ check-code:
 @SWIG_TRUE@            done; \
 @SWIG_TRUE@    fi
 
-# If the user request for the SWIG generation of the wrappers Java => C/C++ 
+# If the user request for the SWIG generation of the wrappers Java => C/C++
 # We call the target swig-build on the variable SWIG_WRAPPERS
 
 @GIWS_TRUE@giws: $(GIWS_WRAPPERS)
@@ -2026,7 +2027,7 @@ check-code:
 @GIWS_TRUE@giws-exception:
 @GIWS_TRUE@    @GIWS_OUTPUTDIR=src/jni/;\
 @GIWS_TRUE@    echo "GIWS: Generation of exception class ..."; \
-@GIWS_TRUE@    $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR 
+@GIWS_TRUE@    $(GIWS_BIN) --generate-exception-class --output-dir $$GIWS_OUTPUTDIR
 
 macros:
        -@( if test ! -x $(top_builddir)/scilab-bin; then \
index 103d2ad..991079a 100644 (file)
     <add as="CMSCOPE" extend="Icon">
         <add as="image" value="$SCILAB/modules/xcos/images/blocks/ASCOPE.svg"/>
     </add>
+    <add as="SCALE_CMSCOPE" extend="Icon">
+        <add as="image" value="$SCILAB/modules/xcos/images/blocks/SCALE_ASCOPE.svg"/>
+    </add>
     <add as="AFFICH_m" extend="Affiche"/>
     <add as="TRASH_f" extend="blockWithLabel">
         <add as="displayedLabel" value="Trash"/>
index 26d34ba..742e886 100644 (file)
@@ -11,6 +11,9 @@
             <block name="CMSCOPE">
                 <icon variable="SCI" path="/modules/xcos/images/palettes/CMSCOPE.png"/>
             </block>
+            <block name="SCALE_CMSCOPE">
+                <icon variable="SCI" path="/modules/xcos/images/palettes/SCALE_CMSCOPE.png"/>
+            </block>
             <block name="CONST_m">
                 <icon variable="SCI" path="/modules/xcos/images/palettes/CONST_m.png"/>
             </block>
             <block name="CMSCOPE">
                 <icon variable="SCI" path="/modules/xcos/images/palettes/CMSCOPE.png"/>
             </block>
+            <block name="SCALE_CMSCOPE">
+                <icon variable="SCI" path="/modules/xcos/images/palettes/SCALE_CMSCOPE.png"/>
+            </block>
             <block name="CSCOPE">
                 <icon variable="SCI" path="/modules/xcos/images/palettes/CSCOPE.png"/>
             </block>
diff --git a/scilab/modules/xcos/examples/sinks_pal/en_US/SCALE_CMSCOPE_en_US.zcos b/scilab/modules/xcos/examples/sinks_pal/en_US/SCALE_CMSCOPE_en_US.zcos
new file mode 100644 (file)
index 0000000..0ea213c
Binary files /dev/null and b/scilab/modules/xcos/examples/sinks_pal/en_US/SCALE_CMSCOPE_en_US.zcos differ
index cfb9508..ca14792 100644 (file)
             </inlinemediaobject>
             <inlinemediaobject>
                 <imageobject>
+                    <imagedata linkend="SCALE_CMSCOPE" fileref="../../../../../../modules/xcos/images/palettes/SCALE_CMSCOPE.png" width="100" depth="100" scalefit="0" align="center" valign="middle"/>
+                </imageobject>
+            </inlinemediaobject>
+            <inlinemediaobject>
+                <imageobject>
                     <imagedata linkend="CSCOPE" fileref="../../../../../../modules/xcos/images/palettes/CSCOPE.png" width="100" depth="100" scalefit="0" align="center" valign="middle"/>
                 </imageobject>
             </inlinemediaobject>
             </listitem>
             <listitem>
                 <para>
+                    <link linkend="SCALE_CMSCOPE">SCALE_CMSCOPE - Multi display scope with Autoscale Graph Feature</link>
+                </para>
+            </listitem>
+            <listitem>
+                <para>
                     <link linkend="CSCOPE">CSCOPE - Single Display Scope</link>
                 </para>
             </listitem>
index 4f41020..4183070 100644 (file)
@@ -4,6 +4,7 @@
  *
  * Copyright (C) INRIA - METALAU Project <scicos@inria.fr> (HTML version)
  * Copyright (C) DIGITEO - Scilab Consortium (XML Docbook version)
+ * Copyright (C) 2016-2017 - FOSSEE IIT Bombay - Dipti Ghosalkar
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
             </inlinemediaobject>
         </link>
     </refsection>
+    <refsection id="Seealso_CMSCOPE">
+        <title>See also</title>
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <link linkend="SCALE_CMSCOPE">SCALE_CMSCOPE - Multi display scope with autoscale feature of graph</link>
+                </para>
+            </listitem>
+        </itemizedlist>
+    </refsection>
 </refentry>
diff --git a/scilab/modules/xcos/help/en_US/palettes/Sinks_pal/SCALE_CMSCOPE.xml b/scilab/modules/xcos/help/en_US/palettes/Sinks_pal/SCALE_CMSCOPE.xml
new file mode 100644 (file)
index 0000000..b7ba858
--- /dev/null
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scicos
+ *
+ * Copyright (C) INRIA - METALAU Project <scicos@inria.fr> (HTML version)
+ * Copyright (C) DIGITEO - Scilab Consortium (XML Docbook version)
+ * Copyright (C) 2016-2017 - FOSSEE IIT Bombay - Dipti Ghosalkar
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * See the file ./license.txt
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="SCALE_CMSCOPE">
+    <refnamediv>
+        <refname>SCALE_CMSCOPE</refname>
+        <refpurpose>Multi display scope with autoscale feature of graph</refpurpose>
+    </refnamediv>
+    <refsection>
+        <title>Block Screenshot</title>
+        <para>
+            <inlinemediaobject>
+                <imageobject>
+                    <imagedata fileref="../../../../images/palettes/SCALE_CMSCOPE.png" align="center" valign="middle"/>
+                </imageobject>
+            </inlinemediaobject>
+        </para>
+    </refsection>
+    <refsection id="Contents_SCALE_CMSCOPE">
+        <title>Contents</title>
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <link linkend="SCALE_CMSCOPE">Multi display scope</link>
+                </para>
+            </listitem>
+            <listitem>
+                <itemizedlist>
+                    <listitem>
+                        <para>
+                            <xref linkend="Palette_SCALE_CMSCOPE">Palette</xref>
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <xref linkend="Description_SCALE_CMSCOPE">Description</xref>
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <xref linkend="Dialogbox_SCALE_CMSCOPE">Dialog box</xref>
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <xref linkend="Defaultproperties_SCALE_CMSCOPE">Default properties</xref>
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <xref linkend="Interfacingfunction_SCALE_CMSCOPE">Interfacing function</xref>
+                        </para>
+                    </listitem>
+                    <listitem>
+                        <para>
+                            <xref linkend="Computationalfunction_SCALE_CMSCOPE">Computational function</xref>
+                        </para>
+                    </listitem>
+                </itemizedlist>
+            </listitem>
+        </itemizedlist>
+    </refsection>
+    <refsection id="Palette_SCALE_CMSCOPE">
+        <title>Palette</title>
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <link linkend="Sinks_pal">Sinks palette</link>
+                </para>
+            </listitem>
+        </itemizedlist>
+    </refsection>
+    <refsection id="Description_SCALE_CMSCOPE">
+        <title>Description</title>
+        <para>
+            When you start a simulation, Xcos open Scope windows.  The Scope
+            block displays its input with respect to simulation time. The Scope
+            block can have multiple axes (one per port); all axes have a common
+            time range with independent y-axes. The Scope allows you to adjust the
+            amount of time and the range of input values displayed.
+
+        </para>
+    </refsection>
+    <refsection id="Dialogbox_SCALE_CMSCOPE">
+        <title>Dialog box</title>
+        <para>
+            <inlinemediaobject>
+                <imageobject>
+                    <imagedata fileref="../../../../images/gui/SCALE_CMSCOPE_gui.gif" align="center" valign="middle"/>
+                </imageobject>
+            </inlinemediaobject>
+        </para>
+        <para>
+
+        </para>
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Input ports sizes</emphasis>
+                </para>
+                <para> It allows multiple input ports.</para>
+                <para> Properties : Type 'vec' of size -1 </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Drawing colors </emphasis>
+                </para>
+                <para>
+                    a vector of integers. The i-th element is the color number (≥ 0) or marker type (&lt; 0) used to draw the evolution of the i-th input port signal. See<emphasis role="bold">plot2d</emphasis> for color (dash type) definitions.
+                </para>
+                <para> Properties : Type 'vec' of size -1 </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Output window number</emphasis>
+                </para>
+                <para>
+                    The number of graphic window used for the display. It is often good to use high values to avoid conflict with palettes and Super Block windows. If default value is used<emphasis role="bold">(1)</emphasis> , Xcos define the output window number.
+                </para>
+                <para> Properties : Type 'vec' of size 1 </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Output window position</emphasis>
+                </para>
+                <para> a 2 vector specifying the coordinates of the upper left corner of the graphic window. Answer [] for default window position.</para>
+                <para> Properties : Type 'vec' of size -1 </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Output window sizes</emphasis>
+                </para>
+                <para> a 2 vector specifying the coordinates of the upper left corner of the graphic window. Answer [] for default window position.</para>
+                <para> Properties : Type 'vec' of size size -1 </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Ymin vector</emphasis>
+                </para>
+                <para> Minimum values of the input; used to set up the Y-axis of the plot in the graphics window.</para>
+                <para> Properties : Type 'vec' of size size(%1,'*') </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Ymax vector</emphasis>
+                </para>
+                <para> Maximum values of the input; used to set up the Y-axis of the plot in the graphics window.</para>
+                <para> Properties : Type 'vec' of size size(%1,'*') </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Refresh period</emphasis>
+                </para>
+                <para> Maximum value on the X-axis (time). The plot is redrawn when time reaches a multiple of this value.</para>
+                <para> Properties : Type 'vec' of size size(%1,'*') </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Buffer size</emphasis>
+                </para>
+                <para>
+                    To improve efficiency it is possible to buffer the input data. The drawing is only done after each<emphasis role="bold">Buffer size</emphasis> call to the block.
+                </para>
+                <para> Properties : Type 'vec' of size 1 </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Accept herited events 0/1</emphasis>
+                </para>
+                <para>
+                    if 0<emphasis role="bold">CSCOPE_f</emphasis> draws a new point only when an event occurs on its event input port. if 1<emphasis role="bold">CSCOPE_f</emphasis> draws a new point when an event occurs on its event input port and when it's regular input changes due to an event on an other upstream block (herited events).
+                </para>
+                <para> Properties : Type 'vec' of size 1 </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Name of Scope </emphasis>
+                </para>
+                <para> Name/label of the block.</para>
+                <para> Properties : Type 'str' of size 1</para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">Auto scale 0/1</emphasis>
+                </para>
+                <para>
+                    if 0 autoscaling of graph wont be activated  If 1 autoscaling of graph at runtime will be activated and visible.
+                </para>
+                <para> Properties : Type 'vec' of size 1</para>
+            </listitem>
+        </itemizedlist>
+    </refsection>
+    <refsection id="Defaultproperties_SCALE_CMSCOPE">
+        <title>Default properties</title>
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <emphasis role="bold">always active:</emphasis> no
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">direct-feedthrough:</emphasis> yes
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">zero-crossing:</emphasis> no
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">mode:</emphasis> no
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">regular inputs:</emphasis>
+                </para>
+                <para>
+                    <emphasis role="bold">- port 1 : size [1,1] / type 1</emphasis>
+                </para>
+                <para>
+                    <emphasis role="bold">- port 2 : size [1,1] / type 1</emphasis>
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">number/sizes of activation inputs:</emphasis> 1
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">number/sizes of activation outputs:</emphasis> 0
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">continuous-time state:</emphasis> no
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">discrete-time state:</emphasis> no
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">object discrete-time state:</emphasis> no
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    <emphasis role="bold">name of computational function:</emphasis>
+                    <emphasis role="italic">scale_cmscope</emphasis>
+                </para>
+            </listitem>
+        </itemizedlist>
+    </refsection>
+    <refsection id="Interfacingfunction_SCALE_CMSCOPE">
+        <title>Interfacing function</title>
+        <itemizedlist>
+            <listitem>
+                <para> SCI/modules/scicos_blocks/macros/Sinks/SCALE_CMSCOPE.sci</para>
+            </listitem>
+        </itemizedlist>
+    </refsection>
+    <refsection id="Computationalfunction_SCALE_CMSCOPE">
+        <title>Computational function</title>
+        <itemizedlist>
+            <listitem>
+                <para> SCI/modules/scicos_blocks/src/c/scale_cmscope.c (Type 4)</para>
+            </listitem>
+        </itemizedlist>
+    </refsection>
+    <refsection id="Example_SCALE_CMSCOPE">
+        <title>Multi display scope example with autoscale graph</title>
+        <link type="scilab" linkend="scilab.xcos/xcos/examples/sinks_pal/en_US/SCALE_CMSCOPE_en_US.zcos">
+            <inlinemediaobject>
+                <imageobject>
+                    <imagedata align="center" fileref="../../../../examples/sinks_pal/en_US/SCALE_CMSCOPE_en_US.zcos" valign="middle"/>
+                </imageobject>
+            </inlinemediaobject>
+        </link>
+    </refsection>
+    <refsection id="Seealso_SCALE_CMSCOPE">
+        <title>See also</title>
+        <itemizedlist>
+            <listitem>
+                <para>
+                    <link linkend="CMSCOPE">CMSCOPE - Multi display scope</link>
+                </para>
+            </listitem>
+        </itemizedlist>
+    </refsection>
+</refentry>
diff --git a/scilab/modules/xcos/images/gui/SCALE_CMSCOPE_gui.gif b/scilab/modules/xcos/images/gui/SCALE_CMSCOPE_gui.gif
new file mode 100644 (file)
index 0000000..cdec230
Binary files /dev/null and b/scilab/modules/xcos/images/gui/SCALE_CMSCOPE_gui.gif differ
diff --git a/scilab/modules/xcos/images/palettes/SCALE_CMSCOPE.png b/scilab/modules/xcos/images/palettes/SCALE_CMSCOPE.png
new file mode 100644 (file)
index 0000000..e165b3f
Binary files /dev/null and b/scilab/modules/xcos/images/palettes/SCALE_CMSCOPE.png differ