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: Strange Buffer behavior
Topic Summary:
Created On: 17-Jun-2005 20:03
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.
 17-Jun-2005 20:03
User is offline View Users Profile Print this message


Leonard Becraft

Posts: 8
Joined: 10-Jun-2005

I have a basic loop ( for object in module do... and a nested loop checking for links ( for thisLink in obj -> "*" do { Everything works fine. But when I try to write some data to the buffer from the inner loop -- the buffer seems to get the data multiple times. I am trying to capture data from the inner loop and later write out to a file at the proper location. If I print the buffered data (debug) at the spot where its collected everything seem OK. But the output file has 2, 3 sometimes more copies of the data printed. I have been pulling my hair out for 2 days trying to figure this out. Please help.. I also tried with a string variable instead of a buffer but the results are the same..
Report this to a Moderator Report this to a Moderator
 17-Jun-2005 20:17
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I'm having trouble reading this due to the indentation and lack of declaring variables, such as out and buf. But I'm pretty sure you need a buf = "" statement before the link loop, otherwise buf just grows and grows.

Other comments:

You don't need to have the double quotes after the out << buf statement. That inserts the contents of the buffer into the string table, which wastes memory and slow things down.

Looks odd that you save the req start in the buffer but output the req close to the file, and then output the buffer.

- Louie
Report this to a Moderator Report this to a Moderator
 17-Jun-2005 20:32
User is offline View Users Profile Print this message


Leonard Becraft

Posts: 8
Joined: 10-Jun-2005

Thanks for your reply. I do have a buf = "" to reset the buffer before the start of each inner loop. ( I removed that and some other things to make the example smaller) The buffer collects a complete req start and close to output latter in the file.
Report this to a Moderator Report this to a Moderator
 17-Jun-2005 21:13
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Add your variable declarations and send the whole script.
Report this to a Moderator Report this to a Moderator
 17-Jun-2005 21:18
User is offline View Users Profile Print this message


Leonard Becraft

Posts: 8
Joined: 10-Jun-2005

Here are the variable declarations. I can't sent the whole script due to the attach code size limit of 2000 characters. Is there another way?

Edited: 17-Jun-2005 at 21:19 by Leonard Becraft
Report this to a Moderator Report this to a Moderator
 18-Jun-2005 03:17
User is offline View Users Profile Print this message


Leonard Becraft

Posts: 8
Joined: 10-Jun-2005

Souce Code Link

Here is a link to the current code. Buffer issue still happening.
Report this to a Moderator Report this to a Moderator
 20-Jun-2005 11:36
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

The following is the script from your original posting with variable declarations added.
I have replaced the ouput steam with print statements to save time.
I have added a buffer declaration inside the for object loop.
I have also removed all the comments to reduce the size so the forum would accept it.
Seems to work okay.
I think this was a scope problem caused by autodeclare.
I advise that you turn auto declare off on your client. This will ensure that all vriables are properly declared before use. This is the only way to ensure the correct scope of variables.

-------------------------
Tony Goodman
http://www.smartdxl.com

Edited: 20-Jun-2005 at 11:39 by Tony Goodman
Report this to a Moderator Report this to a Moderator
 20-Jun-2005 17:16
User is offline View Users Profile Print this message


Leonard Becraft

Posts: 8
Joined: 10-Jun-2005

Thanks your example help. Creating and deleting the Buffer within the outer loop solved the problem. Before I was creating a global Buffer and resetting to "" inside the outer loop giving me unpredictable results.
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.