Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: What's 'eval_'
Topic Summary:
Created On: 27-Feb-2004 15:10
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 27-Feb-2004 15:10
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

What's "eval_'. What's 'return_'. How do I find out about stuff like that?

- Louie
Report this to a Moderator Report this to a Moderator
 11-Mar-2004 07:57
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

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
Report this to a Moderator Report this to a Moderator
 11-Mar-2004 13:23
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

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
Report this to a Moderator Report this to a Moderator
 11-Mar-2004 14:31
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I did a little testing. Run the attached.

Why would you use this?

- Louie
Report this to a Moderator Report this to a Moderator
 18-Mar-2004 12:31
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

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
Report this to a Moderator Report this to a Moderator
 18-Mar-2004 14:19
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.