Print Page | Close Window

Mapping properties

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: http://www.metacase.com/forums/forum_posts.asp?TID=885
Printed Date: 19.Apr.2024 at 09:18
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: Mapping properties
Posted By: Tinhinane
Subject: Mapping properties
Date Posted: 02.May.2018 at 20:32
Hello,

I am using MetaEdit+ to describe a small language for automation. What I want to do is to map my objects states with signal states; meaning say a Switch object with property 'state' (fixed list) [Pressed, Released], I want to map that with [1, 0]. Is there a way to add that on top of my language?



Replies:
Posted By: stevek
Date Posted: 02.May.2018 at 21:30
DSM is about raising the level of abstraction, so the default answer would be that the language should be human-readable - just Pressed/Released - and the generator should be responsible for mapping that to 1/0. 

With just two values, you can simply say "if :state='Pressed' then '1' else '0' endif". If there were more values, I often like to put the mapping as a http://www.metacase.com/support/55/manuals/mwb/Mw-6_5_5.html" rel="nofollow - translator rather than logic:
to '%stateValue
$Pressed $1
$Released $0'
endto

:state%stateValue
If some strings on the left-hand side of the translator are substrings of later strings, either re-order or switch to using more precise regular expressions like /^Pressed$/.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.05 - http://www.webwizforums.com
Copyright ©2001-2022 Web Wiz Ltd. - https://www.webwiz.net