Whitespace characters in element names
Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: https://www.metacase.com/forums/forum_posts.asp?TID=50
Printed Date: 27.Mar.2026 at 02:15 Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com
Topic: Whitespace characters in element names
Posted By: stefanvw
Subject: Whitespace characters in element names
Date Posted: 10.Jul.2008 at 18:17
Hej,
in my state machine using the WatchApplication DSL I have names with whitespaces and dot-characters. This causes problems for compilation of the generated c files. Is it possible to replace these characters in the generator on the fly by underscore characters? I would not like using the oid property, because it would impair the readability of the generated code.
Thanks in advance! Stefan
|
Replies:
Posted By: janne
Date Posted: 11.Jul.2008 at 09:26
Yes, translators can be used for that.
In the generator script you had to have call to the subreport '_translators', which initializes the predefined translators. Then you may use e.g. %var translator, which makes a legal variable name by mapping non-alphanumerics to underscore.
e.g. subreport '_translators' run foreach .State [Watch] { id%var newline }
In the sample above all the State [Watch] id property values are translated to have only alphanumeric values (all other characters are replaced with underscore). Subreport '_translators' is stored in the Graph, so any DSM language can access it. In the _translator script there exists predefiened translators e.g. having upper or lower case, XML, adding and removing indentations etc.
See more details from the online manual http://www.metacase.com/support/45/manuals/mwb/Mw-5_3_6.html#Heading1454 - Translating stings
|
|