![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: What's 'eval_' Topic Summary: Created On: 27-Feb-2004 15:10 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
What's "eval_'. What's 'return_'. How do I find out about stuff like that?
- Louie |
|
![]() |
|
![]() |
|
Hi Louie,
I have some experience with the eval_ function, because I implemented my own filter function ... I have found these comments in some original DXL code : // Notes: eval_ runs the code in a separate dxl context so any // declarations in dxl files in the specified path // will not persist. // Note: evalTop_ does not evaluate the code immediately, but waits // until the current dxl context has ended, so this function // should be placed at the end of a dxl call block The problem is, that normally you can't comunicate with the "new thread" of the evaluated string, because the return value of eval_ is only an error message, if there are syntax errors in evaluated code. First I have used IPC to get a return value, but I think it's overkill for getting back a boolean value ;-)) Now I found a very better method to communicate : I use address pointers with the addr_ function, here is an example : Buffer b = create string evalCode, errM evalCode = ("Buffer b = addr_ " (int addr_ b) "\nbool result = " dxlFilter "\n"b = result?\"true\":\"false\"") errM = eval_ evalCode if (!null errM) { print "evalCode:\n" evalCode "\n" print "\t" errM "\n" halt } if ((stringOf b) == "true") { // Something } Instead of a Buffer, you can use Skip lists and Arrays, but not basic data types. I don't know really, if the code is evaluated at the same time with your calling code ?! But in my application didn't need to wait for finnishing, so I think the evaluated code must finnish before the calling code goes on. I hope this will help you to use eval_function. What "return_" is, I don't know. Where do you have the information, that it exists (I didn't found it in Telelogics sources ;-)) ) Greetings Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
|
![]() |
|
My reading of the code in the original thread (3rd post in Baseline is broken in 7.0 DXL...) that triggered this is that 'return_' permits the return of a value from an 'eval_' string.
In the code snippet (which I've tweaked for indentation comapred to the original in the other post), note the opening double quote after eval_ on line 6, which isn't closed until line 12. So the code that is being evaluated contains the string "return_ RmodFullName", where RmodFullName is a string declared within the evaluated string. The 'return_' will assign the value determined within the eval_ context to the identically named string RmodFullName in the calling context. But I'm deducing this from the snippet which we are assured worked in v5.x -- I don't have access to any more documentation than the rest of you... ------------------------- Paul dot Tiplady at TRW dot com TRW Automotive |
|
![]() |
|
![]() |
|
I did a little testing. Run the attached.
Why would you use this? - Louie |
|
![]() |
|
![]() |
|
Hi Roger,
I don't use if (dxlFilter) { // Something } because dxlFilter is a string, wich is constructed at runtime. I didn't want to build a parser for logical expressions (AND, OR, NOT, parenthesis) Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
|
![]() |
|
Hi Roger,
dxlFilter could be for example string dxlFilter = "(((matches ("U4", "")) || (matches ("U3", ""))) && (matches ("U2", ""))) || (1 == 5)" the values in this string came from filter definition and the bold one from every object to be filtered. I think it is easier to let the dxl interpreter parse this string, than doing it my own ![]() In my filter definition dialog box (which looks nearly like the original one) I create a string where the bold values above are place holders -> like this : "(((matches ("U4", $string[1])) || (matches ("U3", $string[5]))) && (matches ("U2", $string[10]))) || (1 == $number[3])" When applying the filter the place holders are replaced by attribute values of some objects and I have to decide if the hold boolean equation returns true or false Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
What's 'eval_'
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.