[Scilab-users] ?==?utf-8?q? Scilab API sciprint to print on the same line

Antoine Monmayrant amonmayr at laas.fr
Fri Dec 13 09:22:22 CET 2019


Well, I can see the same behaviour under linux.
But while playing with your example, I discovered a nice bug:
    sleep 100
just kills scilab (Segmentation fault (core dumped)).
It works from both scinotes or the console.
Can anyone give it a try under windows so that I can make an accurate bug report?

Cheers,

Antoine
 
 
Le Vendredi, Décembre 13, 2019 09:08 CET, P M <p.muehlmann at gmail.com> a écrit: 
 
> ...even more strange than the reported bug:
> clc(1) seems to behave different when directly written into the console vs
> used from SciNotes.
> 
> from SciNotes:
> 
> clc();for i=1:10 mprintf("%d\n",i)endclc(1)
> 
> result in console:
>  1
> 2
> 3
> 4
> 5
> 6
> 7  // note that number 8,9,10 are cleared..so it's 3 lines, not only two
> 
> -->
> 
> code directly put into console...do this step by step
> --> clc();
> --> for i=1:10 mprintf("%d\n",i) end
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 
> --> clc(1)
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 
> -->  // works as expected
> 
> tested on win7, Scilab 6.0.2
> 
> best regards,
> Philipp
> 
> 
> 
> 
> Am Do., 12. Dez. 2019 um 23:20 Uhr schrieb Samuel Gougeon <sgougeon at free.fr
> >:
> 
> > Hello Chin Luh
> >
> > Le 12/12/2019 à 17:10, Chin Luh Tan a écrit :
> >
> > Hi Samuel,
> >
> > Thanks for your reply.
> >
> > Previously I was using clc(linenumtoclear) for showing this effect in
> > scilab, but i never thought of the mprintf, i was using disp that time
> >
> > for i = 1:100
> > disp("Static counter : " + string(i));
> > sleep(1); clc(1)
> > end
> >
> >
> > I could not think using disp(). According to its expected behavior, it
> > always appends an \n, while we want to stay on the line, what's the purpose
> > of \r instead of \n, and mprintf() does not append anything to what it is
> > requested to display.
> >
> >
> > it seems that the mprintf also kind of broken? as it needs 3 \n to get
> > this result?
> >
> >
> > I do not think that disp() is broken. It looks OK, while clc(1) is bugged
> > <http://bugzilla.scilab.org/show_bug.cgi?id=16143>. This is why extra \n
> > are required for this workaround using clc.
> >
> > I also tried to look into the clc C source and see whether I could use the
> > c code of clc in scilab api but no luck, but your example of mprintf which
> > need 3 \n inspired me to look into the mprintf c code and see how it works.
> >
> >
> > Now that you know the clc code, please do not hesitate to propose a patch
> > for its clc(1) bug ;-))
> > Regards
> >
> > Samuel
> >
> >
> > _______________________________________________
> > users mailing list
> > users at lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> >




More information about the users mailing list