pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:6655:    */   static void f_interleave_array(INT32 args)   {    struct array *arr = NULL;    struct array *min = NULL;    struct array *order = NULL;    int max = 0;    int nelems = 0;    int i;    -  get_all_args("interleave_array", args, "%a", &arr); +  get_all_args(NULL, args, "%a", &arr);       /* We're not interrested in any other arguments. */    pop_n_elems(args-1);       if( (arr->type_field & ~BIT_MAPPING) &&    (array_fix_type_field(arr) & ~BIT_MAPPING) )    SIMPLE_ARG_TYPE_ERROR("interleave_array", 1, "array(mapping(int:mixed))");       /* The order array */    ref_push_array(arr);
pike.git/src/builtin_functions.c:6901:    *! ordered sequence of elements in the array.    *!    *! @seealso    *! @[diff()]    */   static void f_longest_ordered_sequence(INT32 args)   {    struct array *a = NULL;    struct array *aa = NULL;    -  get_all_args("longest_ordered_sequence", args, "%a", &a); +  get_all_args(NULL, args, "%a", &a);       /* THREADS_ALLOW(); */       aa = longest_ordered_sequence(a);       /* THREADS_DISALLOW(); */       if (!aa) {    SIMPLE_OUT_OF_MEMORY_ERROR("longest_ordered_sequence",    (int)sizeof(int *)*a->size*2);
pike.git/src/builtin_functions.c:7592:    *!    *! @seealso    *! @[shuffle()]    */   PMOD_EXPORT void f_permute( INT32 args )   {    INT_TYPE q, i=0, n;    struct array *a;    struct svalue *it;    -  get_all_args("permute", args, "%a%+", &a, &n); +  get_all_args(NULL, args, "%a%+", &a, &n);       if( a->refs>1 )    {    a = copy_array( a );    push_array( a );    }    else    pop_n_elems(args-1);       q = a->size;
pike.git/src/builtin_functions.c:7641:    *! @[String.fuzzymatch()]    */   PMOD_EXPORT void f_diff(INT32 args)   {    struct array *seq;    struct array *cmptbl;    struct array *diff;    struct array *a, *b;    int uniq;    -  get_all_args("diff", args, "%a%a", &a, &b); +  get_all_args(NULL, args, "%a%a", &a, &b);       if ((a == b) || !a->size || !b->size) {    if (!a->size && !b->size) {    /* Both arrays are empty. */    ref_push_array(a);    ref_push_array(b);    f_aggregate(2);    } else {    /* The arrays are equal or one of them is empty. */    ref_push_array(a);
pike.git/src/builtin_functions.c:7713:    *! @}    *!    *! @seealso    *! @[diff()], @[diff_longest_sequence()], @[String.fuzzymatch()]    */   PMOD_EXPORT void f_diff_compare_table(INT32 args)   {    struct array *a;    struct array *b;    -  get_all_args("diff_compare_table", args, "%a%a", &a, &b); +  get_all_args(NULL, args, "%a%a", &a, &b);       push_array(diff_compare_table(a, b, NULL));   }      /*! @decl array(int) diff_longest_sequence(array a, array b)    *!    *! Gives the longest sequence of indices in @[b] that have corresponding    *! values in the same order in @[a].    *!    *! @seealso    *! @[diff()], @[diff_compare_table()], @[String.fuzzymatch()]    */   PMOD_EXPORT void f_diff_longest_sequence(INT32 args)   {    struct array *a;    struct array *b;    struct array *cmptbl;    -  get_all_args("diff_longest_sequence", args, "%a%a", &a, &b); +  get_all_args(NULL, args, "%a%a", &a, &b);       cmptbl = diff_compare_table(a, b, NULL);    push_array(cmptbl);       push_array(diff_longest_sequence(cmptbl, b->size));   }      /*! @decl array(int) diff_dyn_longest_sequence(array a, array b)    *!    *! Gives the longest sequence of indices in @[b] that have corresponding
pike.git/src/builtin_functions.c:7759:    *! @seealso    *! @[diff_longest_sequence()], @[diff()], @[diff_compare_table()],    *! @[String.fuzzymatch()]    */   PMOD_EXPORT void f_diff_dyn_longest_sequence(INT32 args)   {    struct array *a;    struct array *b;    struct array *cmptbl;    -  get_all_args("diff_dyn_longest_sequence", args, "%a%a", &a, &b); +  get_all_args(NULL, args, "%a%a", &a, &b);       cmptbl=diff_compare_table(a, b, NULL);    push_array(cmptbl);       push_array(diff_dyn_longest_sequence(cmptbl, b->size));   }      /*! @endmodule    */   
pike.git/src/builtin_functions.c:8517:    *! Elements are compared with @[`==]. They are also hashed (see    *! @[lfun::__hash] for further details if the array contains    *! objects).    */   PMOD_EXPORT void f_uniq_array(INT32 args)   {    struct array *a, *b;    struct mapping *m;    int i, j=0,size=0;    -  get_all_args("uniq", args, "%a", &a); +  get_all_args(NULL, args, "%a", &a);    if( !a->size )    {    push_empty_array();    return;    }       push_mapping(m = allocate_mapping(a->size));    b = allocate_array(a->size);       for(i =0; i< a->size; i++)
pike.git/src/builtin_functions.c:8562:    *! This means that the returned array has the first element in the    *! first given array, then the first argument in next array and so    *! on for all arrays. Then the second elements are added, etc.    *!    *! @seealso    *! @[`/()], @[`*()], @[`+()], @[`-()], @[everynth()]    */   PMOD_EXPORT void f_splice(INT32 args)   {    struct array *out; -  INT32 size=0x7fffffff; +  INT32 size=MAX_INT32;    INT32 i,j,k;       for(i=0;i<args;i++)    if (TYPEOF(Pike_sp[i-args]) != T_ARRAY)    SIMPLE_ARG_TYPE_ERROR("splice", i+1, "array");    else    if (Pike_sp[i-args].u.array->size < size)    size=Pike_sp[i-args].u.array->size;       if(!args || !size)
pike.git/src/builtin_functions.c:8611:    */   PMOD_EXPORT void f_everynth(INT32 args)   {    INT32 k,n=2;    INT32 start=0;    struct array *a;    struct array *ina;    TYPE_FIELD types;    INT32 size=0;    -  check_all_args("everynth", args, +  check_all_args(NULL, args,    BIT_ARRAY, BIT_INT | BIT_VOID, BIT_INT | BIT_VOID , 0);       switch(args)    {    default:    case 3:    start=Pike_sp[2-args].u.integer;    if(start<0)    bad_arg_error("everynth", args, 3, "int", Pike_sp+2-args,    "Argument negative.\n");
pike.git/src/builtin_functions.c:9511:   {    struct program *p;    struct pike_string *ident;    struct program *id_prog, *p2;    struct identifier *id;    INT_TYPE line;    INT_TYPE offset;    struct pike_string *file = NULL;       if( !(p = program_from_svalue(Pike_sp-args)) ) -  Pike_error("Illegal argument 1 to defined(program,string)\n"); +  SIMPLE_ARG_TYPE_ERROR("program_identifier_defined", 1, "program");       if( TYPEOF(Pike_sp[1-args]) != PIKE_T_STRING ) -  Pike_error("Illegal argument 2 to defined(program,string)\n"); +  SIMPLE_ARG_TYPE_ERROR("program_identifier_defined", 2, "string");    else    ident = Pike_sp[-args+1].u.string;       if( (offset = find_shared_string_identifier( ident, p )) == -1 )    {    INT_TYPE line;    struct pike_string *tmp = low_get_program_line(p, &line);       if (tmp)    {
pike.git/src/builtin_functions.c:9579:    *!    *! Returns an array with the programs that @[p] has inherited.    */   PMOD_EXPORT void f_inherit_list(INT32 args)   {    struct program *p;    struct svalue *arg;    struct object *par;    int parid,e,q=0;    -  get_all_args("inherit_list",args,"%*",&arg); +  get_all_args(NULL, args, "%*", &arg);    if(TYPEOF(Pike_sp[-args]) == T_OBJECT)    f_object_program(1);       p=program_from_svalue(arg);    if(!p)    SIMPLE_ARG_TYPE_ERROR("inherit_list", 1, "program");       if(TYPEOF(*arg) == T_FUNCTION)    {    par=arg->u.object;
pike.git/src/builtin_functions.c:9664:   /*! @decl string defined(function fun)    *!    *! Returns a string with filename and linenumber where @[fun]    *! was defined.    *!    *! Returns @expr{0@} (zero) when no line can be found, e.g. for    *! builtin functions and functions in destructed objects.    */   PMOD_EXPORT void f_function_defined(INT32 args)   { -  check_all_args("Function.defined",args,BIT_FUNCTION, 0); +  check_all_args(NULL, args, BIT_FUNCTION, 0);       if(SUBTYPEOF(Pike_sp[-args]) != FUNCTION_BUILTIN &&    Pike_sp[-args].u.object->prog)    {    struct program *p = Pike_sp[-args].u.object->prog;    struct program *id_prog, *p2;    int func = SUBTYPEOF(Pike_sp[-args]);    struct identifier *id;    INT_TYPE line;    struct pike_string *file = NULL;