Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

@pauseuml for splitting uml code

+1 vote
I desperately need this!
 a @pauseuml operator to split uml generation across my code.

example:

/*

@startuml

some uml code

@pauseuml

*/

 

SOME C CODE

/*

@startuml

another uml code that will be merged to the former code

@enduml

*/

 

is this possible with the actual plantuml version?
asked Jan 21, 2014 in Wanted features by anonymous

3 Answers

0 votes

Hello,

What you can do, is do use the /' '/ comments used in PlantUML :

@startuml
/' this is
ignored by
PlantUML '/
actor foo
@enduml


So you have to mix /' '/ PlantUML comments and /* */ C comments:

#include <stdio.h>

/* starting UML
@startuml
actor bob
/' pauseuml */

void main() {

/*
continue uml '/
actor alice
@enduml
*/
}



This should work. But the idea of adding @pauseuml and @continueuml is a good one.
This will be more readable. We will considere this and post a news here if/when this will be implemented.

Regards

answered Jan 21, 2014 by plantuml (113,980 points)
thanks, funnily i figured that out myself :)
this solution assumes thet there is no
'/
in my code anywhere (it actually is not, but i have to be careful)
0 votes

In version 7991, you can now use @pause / @continue :

#include <stdio.h>

/* starting UML
@startuml
actor bob
@pause
*/

void main() {
}

/*
@continue
actor alice
@enduml
*/

Enjoy!

answered Jan 22, 2014 by plantuml (113,980 points)
WONDERFUL!
i can work perfectly with that.
keep in mind that it yould be that @continue could be used in other tools.
not in doxygen that i use beside plantuml, but in this tool e.g.
http://www.zieg.com/pub/pseudocode/index.html
(I'm not using it , but @continueuml would be more unique)

the second feature i thought that could solve this situation is to give @startuml a handle
 this could solve multiple uml diagrams in one source code
example

void main (void)
{
//some main program
/* @startuml main_uml_diagram
* ' a part of the uml diagram of the main function
* @enduml
*/
if (button == pressed)
{
//enter selection menu
/* @startuml menu_uml_diagram
* ' a part of the uml diagram of the selection menu
* @enduml
*/
}
/* @startuml main_uml_diagram
* ' another part of the uml diagram of the main function
* @enduml
*/
}

edit: just wanted to add that plantuml is THE ideal tool for me now. will donate as soon as my paypal account is filled up.
We try to avoid "uml" in @pauseuml, because this is also working for non-UML diagram (@startditaa for example).

To have something more unique, what about : @pauseinput & @unpauseinput ?
Or just @pause & @unpause ?

Let's define the syntax now : once this will be officially released, we won't be able to change it without breaking ascending compatibility.
@pause & @unpause is good because the only critical command is the unpause command
"unpause" is in my opinion quite unique.

anyway, here are some additional suggestions:
@pausediagram
@pauseplantuml
now, I'm out of ideas.

greetings.
So in last beta, we finally use @pause & @unpause.
This is likely to be the official syntax.
ok i tried with
@pause and @continue
and the problem is that the code identation (tabs) breaks it.
the code formatter will ident the comment blocks automatically but
@pause and
@ continue
have to be in the same row.
This is odd : all betas are sharing the same branch, so the last one should have @pause/@unpause.
Anyway, we have uploaded the last version, and double-check that this version is using @pause/@unpause.
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

About code formatting, any heading spaces/tabulations characters should be ignored, so having @pause/@unpause in the column should not be mandatory.
If you still have some issues, could you send us by mail an example of non working file.

Thanks
0 votes

The @pause/@unpause is GREAT! May we have some syntactic sugar?

Could it be possible to have a one-line statement, for example @append ... as a shortcut for @unpause ... @pause on the same line?

This would come in handy for such inline documentation of a FSM :

/// My FSM looks like this:
/// @startuml{myfsm.png}
/// title My FSM

/// @pause

enum {
   // @append state AA
   STATE_AA,
   // @append state BB
   STATE_BB,
};

struct fsm my_fsm = {
    // @append [*] --> AA: Event 1
    { STATE_ENRTY, EVENT_1, STATE_AA },

    // @append AA --> BB: Event 3
    { STATE_AA, EVENT_3, STATE_BB },

    // and so on with a bunch of transitions...
};
/// @unpause
/// @enduml

 

Best Regards

answered Feb 24, 2014 by rmric (2,520 points)
We love the idea! Thanks.
The has been implemented in the following beta:
https://dl.dropboxusercontent.com/u/13064071/ca/plantuml.jar
Very few tests have been done, so feedback is welcome!

Best regards,
The beta is working fine, Thanks!

On a related note (but not peculiar to @pause/@unpause), it looks like it is not possible to declare a new state, and its content on the same line, i.e.:

  @append state AA : My AA state

Dropping the 'state' keyword makes it to work. However, without the 'state' keyword, there's no way to have an alias ('as'). There are also some other corner cases, like an aliased description demands double quotes. Maybe a new bug should be open for that matter?

Best Regards
One-line declaration in state diagram
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...