!function vs. !procedure

0 votes
asked Dec 7, 2020 in Question / help by schmidtjano (220 points)

Hello!

I am having a problem with the below UML sequence diagram.

In Eclipse, the diagram is generated if the code on lines 38 to 102, inclusive, is designated a !function.

When processed by PlantUML (locally or via online server), it results in the error "This function does not have any !return directive. Declare it as a procedure?" Please see here.

When I switch it to a !procedure, it works as seen here

Then, when I try that !procedure version in Eclipse, I receive an "Unknown variable $sbrName" error for line 45. However, I do define $sbrName on line 107 right before invoking $sbrStart() on line 116.

I neither understand why the same code is being handled differently by Eclipse and PlantUML, nor which syntax is correct. Any thoughts would be much appreciated. 

Many thanks in advance!

Jan

3 Answers

+1 vote
answered Dec 8, 2020 by Martin
selected Feb 2 by schmidtjano
 
Best answer

Maybe you can use the old !definelong

I had to remove the $ from the define name, and remove the default parameter values.

!definelong sbrStart($a, $b, $c, $d)

...

!enddefinelong

...

sbrStart($sbrName, $sbrCode, $sbrEdiName, $sbrEdiVer)

...

And I got this (I've not checked it 100% matches your working one,but at a glance it looks similar):

commented Dec 8, 2020 by schmidtjano (220 points)
That is great! Thank you so much, Martin.
0 votes
answered Dec 8, 2020 by plantuml (244,920 points)

It looks like your PlantUML in Eclipse is older.

Can you check its version :

@startuml
version
@enduml

And tell us the result.

commented Dec 8, 2020 by schmidtjano (220 points)

Good morning and many thanks for your reply!

The version in Eclipse is 1.2019.11 (Sun Sep 22 05:02:15 CDT 2019) (EPL source distribution) Loaded from bundleresource://1436.fwk1150293741/. This was the version that came with PlantUML for Eclipse when I installed it recently. Running "Check for Updates" in Eclipse has no effect on the PlantUML version. 

I also tried placing the latest PlantUML JAR file directly in the Eclipse directory C:\Users\mailb\eclipse\modeling-latest-released\eclipse\configuration\org.eclipse.osgi\1436\0.cp\lib with the latest version, also to no avail.

How does one go about installing a newer PlantUML version in Eclipse? I apologise for this newbie question, but I have only been using PlantUML and Eclipse for 1½ months.

Many thanks in advance! 

Best regards,

Jan

+1 vote
answered Dec 8, 2020 by The-Lu (16,520 points)

Hello J.,

It seems that your PlantUML plugin in Eclipse is too old and does not accept the new function definition (with mandatory !return value) or new procedure (replacement of old void function).

For information, the new preprocessing is coming from V1.2020.7:

19 Apr, 2020: Introducing procedure in preprocessor (V1.2020.7). You may have to replace some !function declaration to !procedure declaration in your diagrams if you use some advanced features of the preprocessor. We are really sorry about that. This is an easy change that is important to keep the preprocessor consistent.

(See on https://plantuml.com/en/news)

  • Could you check your version?

If that can help,
Regards,
Th.

commented Dec 8, 2020 by schmidtjano (220 points)

Good morning, The-Lu. 

Many thanks for your reply!

The version in Eclipse is 1.2019.11 (Sun Sep 22 05:02:15 CDT 2019) (EPL source distribution) Loaded from bundleresource://1436.fwk1150293741/. This was the version that came with PlantUML for Eclipse when I installed it recently. Running "Check for Updates" in Eclipse has no effect on the PlantUML version. 

I also tried placing the latest PlantUML JAR file directly in the Eclipse directory C:\Users\mailb\eclipse\modeling-latest-released\eclipse\configuration\org.eclipse.osgi\1436\0.cp\lib with the latest version, also to no avail.

How does one go about installing a newer PlantUML version in Eclipse? I apologise for this newbie question, but I have only been using PlantUML and Eclipse for 1½ months.

Many thanks in advance! 

Best regards,

Jan

...