![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: do operator Topic Summary: Created On: 13-Dec-2007 07:56 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi All!
I'm currently experimenting with my own do operator. The syntax for this is void ::do (Type&, Type, void) ex void ::do (string &s, Buffer b, void v) { print "Testing\n" s = "Testing2\n" } String s Buffer b = create for s in b do { print s } I do not, however, make it work... The s variable does not seem to be assigned. However (if you comment the "print s" line) it prints "Testing", so the function is called. I do not know what the void v actually stands for either... Has anybody succeeded in making your own do operator? /Mattias |
|
![]() |
|
![]() |
|
Never tried, but I'll put money on Reik knowing how to do it ;-)
------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
From the DOORS API manual:
C Entry* variable, and is the type of the scan variable. Table is the TXL data type representing a C Table* variable, and is the parent of the scan. BEGIN_FOR_DO(tdsDoFn,Table*,tab,Entry*,scan) tdsDo(tab,scan) { PROCESS_DO(scan); } END_FOR_DO apiInstall("void ::do(Entry&, Table, void)", tdsDoFn); What I understand from this is that the PROCESS_DO declaration allows inserting the body of the loop inside your do function. In fact, your ::do function shall call PROCESS_DO at the point where your iterator is ready for use, in order to actually execute the "print s" line. And I honestly have no idea about how to do that with dxl. My guess is that it wasn't even planed, and that do loops can only be defined through the C API. But I'd gladly be wrong about that, as I tried hard to create a "for string in buffer" loop myself ! |
|
![]() |
|
![]() |
|
Don't know, but its spelled 'string' not 'String'. I'd assign some value to the buffer, perhaps 'b = "abc".
Let me think. For a 'do' loop to work, there must be an initial condition, some change each time its called, and a mechanism for ending the loop. If so, it seems as though the Mystery call-parameter function could realistically do the initialization code, and the do loop itself figure out when its finished. Attached find my feeble attempt at this. Doesn't work. I find it VERY interesting that the '>Loop' gets printed before the 'do', suggesting we get INTO the loop before the do code is called. That can't be right. - Louie |
|
![]() |
|
![]() |
|
Hi Mattias,
unfortunately Tony lost the bet ![]() I've tried to that many times with many variants, but never succeeded. I found the same behaviour as you are describing - it works when you do not use the loop variable inside body code ![]() Additionally I tried to declare the void function explicitly and then do an explicit call to the "do" function -> that works, but is not usefull ![]() It seem, that Eric is right. "for ... do" loops can only be defined with C-Api, but unfortunately it is AFAIK not possible to add programmig features to existing DXL. The C-Api will create a new language with no possibilities to access the database direcly. Sorry for that bad news (esspeacially for Tony, who lost his money ![]() Have a nice weekend, greetings Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
do operator
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.