[slang-users] _NARGS is not set when calling an "overloaded" function (ie one set by __add_string)

John E. Davis davis at space.mit.edu
Mon Dec 19 23:35:29 EST 2005


Doug Burke <dburke at cfa.harvard.edu> wrote:
>following situation, so I just wanted to know whether it was 
>intentional behavior or a bug. The following is with S-Lang 2.0.5 on a

A little of both.  The function will always be called with exactly one
argument; hence there is nothing to be gained by checking the value of
_NARGS in it.  Nevertheless, it is a bug since _NARGS should be 1.
Here is the patch:

--- slstruct.c~	2005-12-16 16:21:18.000000000 -0500
+++ slstruct.c	2005-12-19 14:09:53.000000000 -0500
@@ -1259,10 +1259,10 @@
 	return SLmake_string (buf);
      }
    
-   if (-1 == _pSLang_push_struct (s))
-     return NULL;
-   
-   if (-1 == SLexecute_function (f))
+   if ((-1 == SLang_start_arg_list ())
+       || (-1 == SLang_push_struct (s))
+       || (-1 == SLang_end_arg_list ())
+       || (-1 == SLexecute_function (f)))
      return NULL;
 
    if (-1 == SLpop_string (&str))

Thanks,
--John




More information about the slang-users-l mailing list