function splitfilepath in MBLOCK

40 views
Skip to first unread message

lutz.d....@googlemail.com

unread,
Jun 2, 2017, 10:54:58 AM6/2/17
to tumbi
Dear developers,

I found a problem and ask if someone could provide a fix.

Description:

The function splitfilepath() provides the following result of a given path,
which is o.k. so far:

NSP Output:
=================================================================
nsp->[dirF,nameF,extF]=splitfilepath('C:\Users\lgo\Programming\ScicoslabWork\System\DAE\dae.mo')
dirF = s (1x1)

C:\Users\lgo\Programming\ScicoslabWork\System\DAE\
nameF = s (1x1)

dae
extF = s (1x1)

mo
=================================================================

In modelica generic blocks (MBLOCK.sci) the validity of the function name is checked with the follwing Statements (line 281):

==================================================================

if (extF<>'' & extF<>'.mo')|(dirF<>'./' & extF<>'.mo') then
message("Filename extention should be ''.mo'' !")
return;
end

==================================================================

This leads to an error, since extF = 'mo' and not '.mo'.

Is it possible to provide a fix?

I use nsp for teaching, function call is an essential feature.


Thank you very much in advance.

Best regards,

Lutz Göhler.









jpc

unread,
Jun 2, 2017, 11:03:30 AM6/2/17
to tumbi
Dear Lutz,

I have made the correction. Thanks for pointing out the bug.
It will be included in next release which should come before summer.
Anyway, you can edit the file, make the correction and then
when you will restart nsp and load scicos it should be ok.
you should see something like:
 Processing file: /usr/local/src/nsp2-trunk-gtk3/toolboxes/scicos-4.4/macros/blocks/Misc/MBLOCK.sc
indicating that the file is being resaved to binary format.
Best Regards
jpc

lutz.d....@googlemail.com

unread,
Jun 3, 2017, 9:44:24 AM6/3/17
to tumbi
Thank you very much. Finest regards,

Lutz Göhler.

lutz.d....@googlemail.com

unread,
Jun 29, 2017, 11:38:33 AM6/29/17
to tumbi
Dear developers,

I posted a problem with processing the output of splitfilepath()in MBLOCK.sci recently. The function output concerning the file extension is 'mo', but the next if statement checks for '.mo'. This happened in line 282 of MBLOCK.sci and you provided a fix. Thank you.

I checked the old version of the file MBLOCK.sci and there are similar problems in line 370 and 374.

Did you checked these lines too? If not, could you please do so? Are there other files concerned? I would be very glad if you could help me.

Although you provided a fix already I finally decided to wait for the next (binary) release.

Jean-Philippe Chancelier

unread,
Jun 29, 2017, 12:03:43 PM6/29/17
to tu...@googlegroups.com

lutz> I posted a problem with processing the output of splitfilepath()in
lutz> MBLOCK.sci recently. The function output concerning the file extension
lutz> is 'mo', but the next if statement checks for '.mo'. This happened in
lutz> line 282 of MBLOCK.sci and you provided a fix. Thank you.
lutz> I checked the old version of the file MBLOCK.sci and there are similar
lutz> problems in line 370 and 374.
lutz> Did you checked these lines too? If not, could you please do so? Are
lutz> there other files concerned? I would be very glad if you could help
lutz> me.

Dear Lutz,
Yes I already changed the extension to 'mo' everywhere in MBLOCK.sci and
checked for other occurences in other files. It was the only file concerned.

lutz> Although you provided a fix already I finally decided to wait for the
lutz> next (binary) release.

OK, I hope it will be soon.
Best Regards
jpc

lutz.d....@googlemail.com

unread,
Jun 29, 2017, 12:14:32 PM6/29/17
to tumbi


Dear Jean-Philippe,

thank you very much. I will wait patiently. No hurry.


Finest regrads,

Lutz.

Reply all
Reply to author
Forward
0 new messages