On Sat, Nov 22, 2008 at 5:01 PM, Dumindu Pallewela <[EMAIL PROTECTED]>wrote:

> Hi All,
> While I doubt the need for removing recursion here (given the fact that
> using more than a few url components will plainly be an overkill), it seems
> to me that removing recursion from both the functions is quite straight
> forward.
>
> As it was mentioned earlier the function 
> axis2_core_utils_internal_build_rest_map_recursively()
> is tail recursion, all you need is a loop.
>
> Since axis2_core_utils_internal_infer_op_from_rest_map_recursively() is
> basically a Depth First Search (DFS) over the op_rest_map structure which
> essentially is a tree, it is just a matter of implementing the DFS
> iteratively, for which again there is a well known technique (e.g. [1]),
> which can be achieved using a stack to hold the current list of
> param/const_maps to visit.
>

Thanks for remembering that:). Only variables we need to keep in the stack
is the mapping structure and the pointer to the component of the URL. So as
you said it should be straight forward.
Thanks
Dimuthu

>
> HTH.
> Thanks,
> Dumindu.
>
> [1]
> http://faculty.simpson.edu/lydia.sinapova/www/cmsc250/LN250_Tremblay/L20-Depth.htm
>
> On Sat, Nov 22, 2008 at 1:20 AM, Thiago Rafael Becker <
> [EMAIL PROTECTED]> wrote:
>
>> Hi, all
>>
>> I was looking at the recursive functions and below are my findings.
>>
>> In the case of axis2_core_utils_internal_build_rest_map_recursively,
>> which is a tail-recursive function, seems easy to convert it to a
>> iterative function.
>>
>> In the case of
>> axis2_core_utils_internal_infer_op_from_rest_map_recursively,
>> which is not a tail-recursive function, seems harder to do. Also, it
>> spans for about 250 lines, it's complicated to find how to convert it.
>> Did you ever thought about switching from ansi c to iso99 c? You can
>> do some things to reduce the line span of functions (static inline
>> functions) that you can't do with ansi c. What do you think about it?
>>
>> Thanks :)
>>
>> On Thu, Nov 20, 2008 at 4:04 PM, Thiago Rafael Becker
>> <[EMAIL PROTECTED]> wrote:
>> > Hi,
>> >
>> > On Thu, Nov 20, 2008 at 2:51 PM, Dimuthu Gamage <[EMAIL PROTECTED]>
>> wrote:
>> <... Large clip ...>
>> --
>> Thiago Rafael Becker
>> http://www.monstros.org/trbecker
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>


-- 
Thanks,
Dimuthu Gamage

http://www.dimuthu.org
http://www.wso2.org

Reply via email to