|
From: William S F. <ws...@fu...> - 2006-04-21 23:17:34
|
Jeffrey D. Wheelhouse wrote:
> Hello,
>
> I've discovered the following issue in the current version of swig.
>
> If a function has a default argument that is a bool, or if two
> overloaded functions differ by the addition of a bool parameter, the
> resulting swig wrapper that chooses between them doesn't seem to
> recognize incoming boolean values.
>
> I.e. for a function defined:
>
> void fish(int i, bool b = false);
>
> This PHP code will work:
>
> fish(1);
> fish(1,1);
>
> But this PHP code will fail:
>
> fish(1,true);
>
> If the bool argument is not defaulted/overloaded, it seems to recognize
> things properly. In the generated _wrap_fish() function, this code
> seems to be responsible:
>
> if (argc == 2) {
> int _v;
> _v = (Z_TYPE_PP(argv[0]) == IS_LONG ||
> Z_TYPE_PP(argv[0]) == IS_DOUBLE ||
> Z_TYPE_PP(argv[0]) == IS_STRING) ? 1 : 0;
> if (_v) {
> _v = (Z_TYPE_PP(argv[1]) == IS_LONG ||
> Z_TYPE_PP(argv[1]) == IS_DOUBLE ||
> Z_TYPE_PP(argv[1]) == IS_STRING) ? 1 : 0;
> if (_v) {
> return _wrap_fish__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU);
> }
> }
> }
>
> It doesn't pass the second "if (_v)." My guess is that there ought to be
> something in the nature of a " == IS_BOOL" in there at some point.
>
> Unfortunately, I haven't the faintest idea how to go about something
> like that.
>
> Thanks for any help!
>
Please log as a bug in the bug tracker or it might get forgotten about.
William
|