Preprocessor enhancement

0 votes
asked Nov 22, 2016 in Wanted features by Serge Wenger Work (7,840 points)
I do a lot of test with version 8049 and !define and I see some possible enhancement:
1) !endif and !else don't like spaces. It is possible to correct it in line 43
protected static final Pattern2 elsePattern = MyPattern.cmpile("^[%s]*!else[%s]*$");
protected static final Pattern2 endifPattern = MyPattern.cmpile("^[%s]*!endif[%s]*$");
2) !else, !definelong and !enddefinelong are not defined in language description line 143
3) ifndef is not described in the documentation
4) It would be nice to have a !define with the file format output type
For example in line 84:
public void setFileFormat(FileFormat fileFormat) {
this.fileFormat = fileFormat;
String s = "FILE_FORMAT_" + fileFormat.toString() +"=\"1\"";
public Option(String... arg) throws InterruptedException, IOException {
if (arg.length == 0) {

1 Answer

0 votes
answered Nov 23, 2016 by plantuml (144,190 points)
selected Nov 24, 2016 by Serge Wenger Work
Best answer

Thanks for your contribution. Points 1,2 and 3 are ok. (integrated in last beta )

About point 4, we have an issue.

We understand the point and the interest of this suggestion.

However in some cases the diagram can be parsed before knowing which format is going to be used for export (depending how you integrate PlantUML). So we have to think about this.

Thanks again

commented Nov 24, 2016 by Serge Wenger Work (7,840 points)
Thanks for points 1) to 3). I check, it is OK.

I try a workaround with the option -DFILE_FORMAT_PNG=value but it seem not working:

java.exe -jar plantuml.8051Beta3.jar -DFILE_FORMAT_PNG=1 TestDefine2.txt

Alice -> Bob: png
Alice -> Bob: svg
commented Nov 24, 2016 by plantuml (144,190 points)
Yes, this is a good workaround.

Sorry, there is a bug in 8051beta3 (underscore badly managed in !ifdef, due to new || && implementation).

You can either download 8051beta4 that fixes that issue, or use FILEFORMATPNG as variable name with beta3).
commented Nov 24, 2016 by Serge Wenger Work (7,840 points)
8051beta4  is OK. Thanks
commented Dec 2, 2016 by Serge Wenger Work (7,840 points)

It is OK with command line, but not with -gui. Sorry.
commented Dec 2, 2016 by plantuml (144,190 points)
Thanks for the report.
Should be ok with last beta
(Not highly tested)