On Dec 7, 2013, at 2:27 PM, Tom Browder wrote:

> On Sat, Dec 7, 2013 at 12:12 PM, Christopher Sean Morrison
> <[email protected]> wrote:
>> 
>> On Dec 7, 2013, at 9:01 AM, Tom Browder wrote:
>> 
>>> If I find one or more with differing signatures, what  should I do?
>>> My guess is: I should rework them to fit a common signature, even
>>> though they may have one or more UNUSED(x) wrappers around func args.
>> 
>> They should definitely be using a common signature.
> 
> Attached is a list of the functions I've found grouped into sets of
> similar args-looks like just one real weirdo (camo_setup).

Interesting, helpful list but possible incorrect/incomplete.  Camo_setup is not 
a bu_structparse callback.  It's an mfuncs callback which are different 
altogether.

If I recall correctly, and looking at the implementation to confirm, the 
structparse callback parameters are expected to be the matching structparse 
entry, the matching sp_name, a pointer (assumed to be a variable address or 
array base pointer address), and the parsed value (as a string: NULL during 
import, string during export).

Some of that makes sense to me, some of that does not.  Conceptually, though, I 
don't see any reason why all except base cannot be const.  A quick check of the 
first one in your list, and it indeed writes into the base pointer.  I also 
note that in that case, the base pointer should be a void*.

My suggestion is:
1) update the bu.h signature to be (const struct bu_structparse *, const char 
*name, void *addr, const char *value)
2) update the callback functions definitions to match (marking UNUSED if needed)
3) see if any issues remain ... hopefully none

I'd like to make that void* the last argument, but this is unfortunately 
published public API and not worth going through deprecation.

Cheers!
Sean


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to