Skip to content
Snippets Groups Projects
Select Git revision
  • 98bfd8a66b0f59b0def6d4dc3f309e5eaab3c64a
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

Process.pmod

Blame
  • module_support.c 14.88 KiB
    /*
    || This file is part of Pike. For copyright information see COPYRIGHT.
    || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
    || for more information.
    || $Id: module_support.c,v 1.66 2005/12/04 18:57:55 nilsson Exp $
    */
    
    #include "global.h"
    #include "module_support.h"
    #include "interpret.h"
    #include "svalue.h"
    #include "stralloc.h"
    #include "pike_types.h"
    #include "pike_error.h"
    #include "mapping.h"
    #include "object.h"
    #include "operators.h"
    #include "bignum.h"
    
    #define sp Pike_sp
    
    /* Checks that args_to_check arguments are OK.
     * Returns 1 if everything worked ok, zero otherwise.
     * If something went wrong, 'exepect_result' tells you what went wrong.
     * Make sure to finish the argument list with a zero.
     */
    static int va_check_args(struct svalue *s,
    			 int args_to_check,
    			 struct expect_result *res,
    			 va_list arglist)
    {
      res->error_type = ERR_NONE;
      res->expected = 0;
      
      for (res->argno=0; res->argno < args_to_check; res->argno++)
      {
        if(!(res->expected & BIT_MANY))
        {
          res->expected = va_arg(arglist, unsigned int);
          if(!res->expected)
          {
    	res->error_type = ERR_TOO_MANY;
    	return 0;
          }
        }
    
        if (!((1UL << s[res->argno].type) & res->expected) &&
    	!(res->expected & BIT_ZERO &&
    	  s[res->argno].type == T_INT && s[res->argno].u.integer == 0))
        {
          res->got = DO_NOT_WARN((unsigned char)s[res->argno].type);
          res->error_type = ERR_BAD_ARG;
          return 0;
        }
      }
    
      if(!(res->expected & BIT_MANY))
        res->expected = va_arg(arglist, unsigned int);
    
      if(!res->expected ||
         (res->expected & BIT_VOID)) return 1;
      res->error_type = ERR_TOO_FEW;
      return 0;
    }
    
    /* Returns the number of the first bad argument,
     * -X if there were too few arguments
     * or 0 if all arguments were OK.
     */
    PMOD_EXPORT int check_args(int args, ...)