close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 20 years ago

Closed 20 years ago

Last modified 18 years ago

#230 closed defect (fixed)

ReplaceTable goes into and endless loop.

Reported by: asalafranca Owned by: danirus
Priority: high Milestone:
Component: Text Version: head
Severity: major Keywords:
Cc:

Description

Replace table can´t perform this:

Text tipoviaya=ReplaceTable("AV",[["AV","AVDA"?,

CALLE","CALL?,
PSO","PASO?,
PL","PLZA?,
CTRA","CARR?,

RB","Rambla?]]);

It goes into and endless loop.
When it preforms a replacement it should start searching for the next occurrence
AFTER the replaced text.

Change History (6)

comment:1 Changed 20 years ago by danirus

Hello Alfonso,

I've been looking that function, but after all, I don't see any relation between
its description and the given parameters.
Can you (or anybody) explain me, what do you expect from it?
-The implementation code is also rare.

Thanks

comment:2 Changed 20 years ago by asalafranca

Text ReplaceTable(Text txt, Set tabla)
'txt' is the text we want to be mofied.
'tabla' is a table with two columns where the first one contains the pieces of text
we want to be replaced, and the second the pieces of text we want to replace with.
The example below should return:

Text tipoviaya = "AVDA"

So it is suppoused to be a 'multiple replace'. It is not clear the whether it performs
first all replacements corresponding to row 1 and then 2...

or it permorfs all at the same time (test if the begining of the text 'txt' matches

one of the pieces of text of the first column and if it does perform the
replacement... )
it doesn`t work when there is a text in the first column that it is a part of its
corresponding text in the second column (AV","AVDA? and PL", "PLZA? in
my example) becuase it goes into a endless loop.

Text tipoviaya=ReplaceTable("AV",[["AV","AVDA"?,

CALLE","CALL?,
PSO","PASO?,
PL","PLZA?,
CTRA","CARR?,

RB","Rambla?]]);

comment:3 Changed 20 years ago by danirus

Status: newassigned

comment:4 Changed 20 years ago by danirus

Thanks Alfonso,
I have to contrast what is the expected behavior of that function with other people.
I can apply some changes to avoid the infinite loop but I could cut its
functionality more than could be acceptable.
I just sent a message to Tol-Desarrollo@… to deliberate
about this.

comment:5 Changed 20 years ago by danirus

Resolution: fixed
Status: assignedclosed

Function ReplaceTable has now a new optional parameter "Real loops=0" to take
control over how many loops must be done.
Tol programmers must take care about the elements of each SetOfText inside the
Set argument. Otherwise you must use the third parameter.

The solution with a bigger and useful description is already on CVS.

comment:6 Changed 18 years ago by Víctor de Buen Remiro

bug_file_loc: http://www.tol-project.org
Note: See TracTickets for help on using tickets.