[Mapserver-dev] cpl utility functions

Yewondwossen Assefa assefa at dmsolutions.ca
Thu Jul 22 10:04:59 EDT 2004


Frank Warmerdam wrote:

> Daniel Morissette wrote:
> 
>> Yewondwossen Assefa wrote:
>>
>>>
>>>   I need to use some utility function that are available in gdal 
>>> cpl_xxx library. (In this specific case it is functions like 
>>> CPLGetBasename). At the same time, It seems a bit odd to add a 
>>> dependency to GDAL/OGR just to have access to a couple of functions. 
>>> (in this case It is the swf module and It should normally not need 
>>> gdal to work).
>>>
>>>   What is the general guidline for such a case ? Do we need to add 
>>> the dependency ? Do I copy the functions inside mapserver utility 
>>> files ?
>>>
>>
>> In the past we've always tried to avoid using CPL in MapServer source 
>> (except in code that relies on GDAL/OGR already). What I've done when 
>> I ran into those cases was either find another way to do the same 
>> thing, or implement an equivalent function (or rename and copy the CPL 
>> function) in mapstring.c or where it fits best.
>>
>> I'm not sure it's a good idea to create a dependency on CPL, but OTOH 
>> it provides several very useful utility functions that we often end up 
>> having to replicate... let's see what others think.
> 
> 
> Assefa / Daniel,
> 
> My take is similar to Daniel's.  I think that for small utility functions
> from CPL, you should just replicate them into mapserver.  I would
> like to suggest though that:
>  o We make a map_cpl.c file with morphed code.
>  o We exactly change CPL to "ms" but otherwise leave the function the
>    same externally so it will be easy to use and recognise for folks who
>    know CPL a bit. So CPLGetBasename() would become msGetBasename().
>  o When you copy over the implementation you will of course need to
>    modify the code internally to use mapserver services for memory
>    allocation and various macros.  Most are pretty simple.
> 

  If there is no objection, I will add the functions I need into a new 
file map_cpl.c.

> I was going to suggest that you dump them into maputil.c, but decided 
> not to.
> Boy is that file a hodge-podge of stuff.  Why are there lots of functions
> in there not starting with ms, like getMeasureUsingPoint()?
>

I am going to rename also the function getMeasureUsingPoint. It was done 
few years back and I did not consider at that time the masperverver 
naming convention.

Thanks.

-- 
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------





More information about the mapserver-dev mailing list