[Scilab-users] Small problem with Scilab 6.0.1 code generation

classic Classic list List threaded Threaded
12 messages Options
Vilppu Vilppu
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Small problem with Scilab 6.0.1 code generation

Hello,

I am using Windows 10 Enterprise, Scilab 6.0.1, MinGw toolbox 0.10.5 and gcc
6.2.0. All are 64 bit versions. When I try to use Xcos feature ‘code
generation’ on any super block I get this warning three times: “operation +:
Warning adding a matrix with the empty matrix will give an empty matrix
result”. Then the basic messages: generate loader file, …, compilation, …,
Link done, and finally info about Scilab variable blk (type pointer). Scilab
generates all the C codes and interfacing functions but for some reason the
super block doesn’t change to C block. If I manually add Xcos block
‘generic_block3’ and change the parameters to match the automatically
generated interfacing function the model will work.

If I use on the same computer Scilab 5.5.2, MinGw toolbox 0.9.3 and gcc
4.6.3 (all 64 bit versions), I don’t get any messages in Scilab prompt from
using code generation in Xcos. But the super block will automatically turn
into C block.

Any ideas what might be causing this? If something is unclear in my
description please don’t hesitate to ask verification.



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

Hello,

Le 14/02/2019 à 13:45, Vilppu a écrit :
> Hello,
>
> I am using Windows 10 Enterprise, Scilab 6.0.1, MinGw toolbox 0.10.5 and gcc
> 6.2.0. All are 64 bit versions. When I try to use Xcos feature ‘code
> generation’ on any super block I get this warning three times: “operation +:
> Warning adding a matrix with the empty matrix will give an empty matrix
> result”.

Whenever you get this warning, then please set
--> warning stop
and then redo what yielded the warning. You should then get a proper
error message
where exactly the first warning has taken place.
The error message is accurate and self-explicit, and shall be reported,
together with
the protocole enabling to reproduce the issue.

This is the only way to get a diagnostic and then fix the issue.

Thanks
Best regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Vilppu Vilppu
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

Hello,

Thank you for the quick reply.

Scilab6_step.zcos
<http://mailinglists.scilab.org/file/t497907/Scilab6_step.zcos>  
I have attached the Xcos model which I'm testing. It is just the step
function example with CLR and mux blocks inside a super block.

When I have the warning function set to stop and I try to generate code from
the super block, I get this pop-up window titled Scilab Message:
*** Execution stopped after a warning. ***
Set warning("on") to continue execution after a warning.

After I click ok. I get a new Scilab message:
Generated block cannot be linked with Scilab.

I have this text in Scilab console:
operation +: Warning adding a matrix with the empty matrix will give an
empty matrix result.
 blk  =

    []


When I have the warning function set to on and I try to generate code from
the super block, I get this text in Scilab console:
operation +: Warning adding a matrix with the empty matrix will give an
empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an
empty matrix result.
operation +: Warning adding a matrix with the empty matrix will give an
empty matrix result.
   Generate a loader file
   Generate a Makefile
   Running the Makefile
   Compilation of test.obj
   Compilation of test_void_io.obj
   Compilation of test_Cblocks.obj
   Building shared library (be patient)
   Generate a cleaner file
Shared archive loaded.
Link done.
 blk  =

GUI     : test_c
Graphics:
          orig = [190,110]
          sz = [100,90]
          exprs = []
          pin = 0
          pout = 0
          pein = []
          peout = []
          gr_i = []
          id = ""
          in_implicit = "E"
          out_implicit = "E"
          in_style =
"ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0"
          out_style =
"ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0"
          in_label = ""
          out_label = ""
          style = "SUPER_f"
Model   :
          test type: 4
          in = 1
          in2 = 1
          intyp = 1
          out = 2
          out2 = 1
          outtyp = 1
          evtin = []
          evtout = []
          state = 0
          dstate = [0;0;0;0]
          odstate = list(0,0,[0;0])
          rpar : SuperBlock
          ipar = [2;1;1]
          opar = list()
          blocktype = "c"
          firing = []
          dep_ut = [%t,%t]
          label = ""
          nzcross = 0
          nmode = 0
          equations = list()
          uid = ""



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Vilppu Vilppu
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

Hello,

Has anyone tried using code generation on my example model?

I installed the new Scilab 6.0.2 and with that I get even less far with code
generation. When trying code generation I get this Scilab pop-up window
message:
Undefined operation for the given operands. check or define function %c_a
for overloading.

After clicking ok:
Generated block cannot be linked with Scilab.

I also installed Microsoft Visual Studio 2013 Express and Scilab recognizes
that compiler with findmsvccompiler() command. I can run Xcos Modelica demos
with no problems. Still, I get same errors when trying code generation. So
the problem isn’t with compiler.

I even tried installing Scilab 6.0.1 and 6.0.2 on different PC with Windows
8.1. I get same errors there. I have also uninstalled and reinstalled
Scilabs on this Windows 10 computer with different install settings. Every
time before installing I have also deleted Scilab folder from
C:\Users\...\AppData\Roaming folder.

To recap, Scilab 6.0.1 warns about adding empty matrix but compiles and
links the generated code without problems. The problem is that the super
block doesn’t turn into C block. Scilab 6.0.2 warns about undefined
operation where %c_a refers to adding. Scilab 5.5.2 works without problems.



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

Hello Vilppu,

Le 21/02/2019 à 11:14, Vilppu a écrit :
Hello,

Has anyone tried using code generation on my example model? 

I installed the new Scilab 6.0.2 and with that I get even less far with code
generation. When trying code generation I get this Scilab pop-up window
message:
Undefined operation for the given operands. check or define function %c_a
for overloading.

The reason why this error now occurs is known. But the point is that we need
to know where exactly this occurs in the code. So, in the message, wasn't there
any indication about the location of the error, the function, and the line number,
the stack of nested calls?
Was "Undefined operation for the given operands. check or define function %c_a for overloading. "
the whole message?
As for the "operation +" warning or error after "warning stop", not having more detail
about where exactly the error occurs is rather blocking to debug the code.

For my part, i have no compiler on my computer ; so i can't reproduce the issue.

We can't be surprised that the next steps fail. Issues must be fixed step by step,
in the order they appear.

Regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Eric Dubois Eric Dubois
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

Hello everybody 

I have noticed the same nehaviour with old code that containded +string(something) the '+' having no left hand side bit of string. 

I think that this an example of a more general approach by recent Scilab team: make coding more restrictive for the -laudable- goal of making it more rigourous, This comes however at the price of less flexibility (I have for example in mind the impossibility with the 6.0 family to have string on several lines ending with '...' to signal that the string contrinues on next line) and ascending compatibility for old code (with the risk of losing old users). As we say in French 'le mieux est l'ennemi du bien" (better is the enemy of what is good).

Regards

Éric

Garanti sans virus. www.avast.com

Le jeu. 21 févr. 2019 à 22:56, Samuel Gougeon <[hidden email]> a écrit :
Hello Vilppu,

Le 21/02/2019 à 11:14, Vilppu a écrit :
Hello,

Has anyone tried using code generation on my example model? 

I installed the new Scilab 6.0.2 and with that I get even less far with code
generation. When trying code generation I get this Scilab pop-up window
message:
Undefined operation for the given operands. check or define function %c_a
for overloading.

The reason why this error now occurs is known. But the point is that we need
to know where exactly this occurs in the code. So, in the message, wasn't there
any indication about the location of the error, the function, and the line number,
the stack of nested calls?
Was "Undefined operation for the given operands. check or define function %c_a for overloading. "
the whole message?
As for the "operation +" warning or error after "warning stop", not having more detail
about where exactly the error occurs is rather blocking to debug the code.

For my part, i have no compiler on my computer ; so i can't reproduce the issue.

We can't be surprised that the next steps fail. Issues must be fixed step by step,
in the order they appear.

Regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] unary +"string" removed <= Re: Small problem with Scilab 6.0.1 code generation

Hello Eric,

Le 24/02/2019 à 13:08, Éric Dubois a écrit :
Hello everybody 

I have noticed the same nehaviour with old code that containded +string(something) the '+' having no left hand side bit of string. 

I think that this an example of a more general approach by recent Scilab team: make coding more restrictive for the -laudable- goal of making it more rigourous, This comes however at the price of less flexibility (I have for example in mind the impossibility with the 6.0 family to have string on several lines ending with '...' to signal that the string contrinues on next line) and ascending compatibility for old code (with the risk of losing old users). As we say in French 'le mieux est l'ennemi du bien" (better is the enemy of what is good).

Both aspects are independent.

The implicit support of the unary "plus" +object has been removed for non-numerical inputs, then routing to the %c_a() overload or inputs like
--> +"abc"
because this support, that on strings did nothing, caused actual issues : please see the bug 18850, observing that
['x' +'x'] and ['x'+ 'x'] yield ['x' 'x'] , while ['x'+'x'] and ['x' + 'x'] yield ['xx'].
To be silent with such a space sensitivity was not a good think and generated bugs.

The bug has been discussed and fixed mainly by contributors, not by the Scilab team.
But we are too few. Please join us.
After fixing the bug, the ATOMS GUI was KO. We discovered that this was due to :
    + "<div>" ..
    + authorHTML
    + "</div>";
From the early ages of the ATOMS GUI, missing dots after authorHTML were not detected, leaving  + "<div>" just as an orphelin, and the built string was silently incomplete and stayed opened. To what consequences?

Then we scanned the whole native Scilab code against this feature. Only one another occurrence was found and fixed.

Now, removing suppport to the unary +string does not prevent re-implementing multiline string continuation. Both considerations are independent.

There are actual recent cases that more rigor, purism, is really with no added value and counter-productive. But not for this case.

Anyway, when some decisions have to taken to fix and improve things, mostly daily, critical constructive, balanced and argued inputs from users as us are always welcome. We miss them.

Best regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

In reply to this post by Vilppu
Hello Vilppu,

Le 21/02/2019 à 11:14, Vilppu a écrit :

> Hello,
>
> Has anyone tried using code generation on my example model?
>
> I installed the new Scilab 6.0.2 and with that I get even less far with code
> generation. When trying code generation I get this Scilab pop-up window
> message:
> Undefined operation for the given operands. check or define function %c_a
> for overloading.
>
> After clicking ok:
> Generated block cannot be linked with Scilab.

I finally got the same. No need to have a compiler, since these issues
occur before compiling.
The fact that the error message in the message box does not provide any
information
about where the error occurs is very unhandy.
I will have a look to that.

Regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Vilppu Vilppu
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

Hello Samuel,


Samuel GOUGEON wrote
> Was "Undefined operation for the given operands. check or define function
> %c_a for overloading. "
> the whole message?

Yes, that was the whole message.


Samuel GOUGEON wrote
> I finally got the same. No need to have a compiler, since these issues
> occur before compiling.
> The fact that the error message in the message box does not provide any
> information
> about where the error occurs is very unhandy.
> I will have a look to that.

I was about to say that you don't even need a compiler to test this error. I
have tried this code generation without having MinGw toolbox loaded and I
get the same error messages referring to adding. After that I get warning
about having no compiler. Thank you for taking a look.

I'm not an expert but maybe the problem lies within Xcos GUI not recognizing
the super block properly. I have also tried with different super blocks and
the error is always the same.



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

In reply to this post by Vilppu
Le 21/02/2019 à 11:14, Vilppu a écrit :
Hello,

Has anyone tried using code generation on my example model? 

I installed the new Scilab 6.0.2 and with that I get even less far with code
generation. When trying code generation I get this Scilab pop-up window
message:
Undefined operation for the given operands. check or define function %c_a
for overloading.

To once and for all fix this issue in your Scilab 6.0.2 sessions, provided that you have
write permissions on the Scilab installation directory, please do the following:

edit do_compile_superblock42
// CTRL+F: search the [++"] pattern (without []) and replace ++" => +"
// Save the file
predef clear
Dir = SCI+"/modules/scicos/macros/scicos_scicos";
genlib("scicos_scicoslib", Dir)

That's all. Restart Scilab.
In Scilab 6.0.2, "operation +" issues  do not occur, at least no before compiling. I get:
   Generate a loader file
   Generate a Makefile
   Running the Makefile

!sorry compiling problem               !
!A Fortran or C compiler is required.  !
 blk  =
    []

This %c_a() issue is being fixed in the next Scilab release.
On your side, do you still get "operation +" warnings with 6.0.2?

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Vilppu Vilppu
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

Hello Samuel,


Samuel GOUGEON wrote

> To once and for all fix this issue in your Scilab 6.0.2 sessions,
> /provided that you have//
> //write permissions on the Scilab installation directory/, please do the
> following:
>
> edit do_compile_superblock42
> // CTRL+F: search the [++"] pattern (without []) and replace ++" => +"
> // Save the file
> predef clear
> Dir = SCI+"/modules/scicos/macros/scicos_scicos";
> genlib("scicos_scicoslib", Dir)

I did as you told with Scilab 6.0.2. I’m using Microsoft Visual Studio 2013
Express as a compiler. Now when I try code generation I don’t get any error
message. From Scilab console:
   Generate a loader file
   Generate a Makefile
   Running the Makefile
   Compilation of Test.c
   Compilation of Test_void_io.c
   Compilation of Test_Cblocks.c
   Building shared library (be patient)
   Generate a cleaner file
Shared archive loaded.
Link done.
 blk  =

GUI     : Test_c
Graphics:
          orig = [190,110]
          sz = [100,90]
          exprs = []
          pin = 6
          pout = 7
          pein = []
          peout = []
          gr_i = []
          id = ""
          in_implicit = "E"
          out_implicit = "E"
          in_style =
"ExplicitInputPort;align=left;verticalAlign=middle;spacing=10.0;rotation=0"
          out_style =
"ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0"
          in_label = ""
          out_label = ""
          style = "SUPER_f"
Model   :
          Test type: 4
          in = 1
          in2 = 1
          intyp = 1
          out = 2
          out2 = 1
          outtyp = 1
          evtin = []
          evtout = []
          state = 0
          dstate = [0;0;0;0]
          odstate = list(0,0,[0;0])
          rpar : SuperBlock
          ipar = [2;1;1]
          opar = list()
          blocktype = "c"
          firing = []
          dep_ut = [%t,%t]
          label = ""
          nzcross = 0
          nmode = 0
          equations = list()
          uid = ""

But still the super block doesn’t turn into C block. I also tried with MinGw
toolbox and gcc compiler. Same thing happened.

I also tried this fix with Scilab 6.0.1. Nothing changed there. I still get
the “operation +: Warning adding a matrix with the empty matrix will give an
empty matrix result.” warning three times.



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Small problem with Scilab 6.0.1 code generation

Le 26/02/2019 à 14:23, Vilppu a écrit :
.../...
I also tried this fix with Scilab 6.0.1. Nothing changed there. I still get
the “operation +: Warning adding a matrix with the empty matrix will give an
empty matrix result.” warning three times.

These "operation +" bugs have been detected after the 6.0.1 release. So they still appear in 6.0.1.
No Scilab version is maintained after its release. Newly detected bugs are fixed in next versions, never in the already released ones.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users