pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1617:    push_int(0);    }    else    {    pop_n_elems(args-1);    Pike_sp[-1].u.integer = SUBTYPEOF(Pike_sp[-1]);    SET_SVAL_SUBTYPE(Pike_sp[-1], NUMBER_NUMBER);    }   }    - static int generate_zero_type(node *n) + static int generate_arg_for(node *n)   { -  struct compilation *c = THIS_COMPILATION; -  CHECK_COMPILER(); +     if(count_args(CDR(n)) != 1) return 0;    if(do_docode(CDR(n),DO_NOT_COPY) != 1)    Pike_fatal("Count args was wrong in generate_zero_type().\n"); -  +  return 1; + } +  + static int generate_zero_type(node *n) + { +  struct compilation *c = THIS_COMPILATION; +  if( generate_arg_for( n ) )    emit0(F_ZERO_TYPE); -  +  else +  return 0;    return 1;   }    -  + static int generate_undefinedp(node *n) + { +  struct compilation *c = THIS_COMPILATION; +  if( generate_arg_for(n) ) +  emit0(F_UNDEFINEDP); +  else +  return 0; +  return 1; + } +  + static int generate_destructedp(node *n) + { +  struct compilation *c = THIS_COMPILATION; +  if( generate_arg_for(n) ) +  emit0(F_DESTRUCTEDP); +  else +  return 0; +  return 1; + } +    /*    * Some wide-strings related functions    */      /*! @decl string(0..255) string_to_unicode(string s)    *!    *! Converts a string into an UTF16 compliant byte-stream.    *!    *! @note    *! Throws an error if characters not legal in an UTF16 stream are
pike.git/src/builtin_functions.c:9822:       ADD_EFUN2("indices",f_indices,    tOr3(tFunc(tArray,tArr(tIntPos)),    tFunc(tOr3(tMap(tSetvar(1,tMix),tMix),    tSet(tSetvar(1,tMix)),    tNStr(tSetvar(1,tInt))),    tArr(tVar(1))),    tFunc(tOr(tObj,tPrg(tObj)),tArr(tStr))),    OPT_TRY_OPTIMIZE,fix_indices_type,0);    -  ADD_EFUN("undefinedp", f_undefinedp, tFunc(tMix,tInt01), OPT_TRY_OPTIMIZE); -  ADD_EFUN("destructedp", f_destructedp, tFunc(tMix,tInt01), OPT_TRY_OPTIMIZE); +  ADD_EFUN2("undefinedp", f_undefinedp, tFunc(tMix,tInt01), OPT_TRY_OPTIMIZE, 0, generate_undefinedp); +  ADD_EFUN2("destructedp", f_destructedp, tFunc(tMix,tInt01), OPT_TRY_OPTIMIZE,0, generate_destructedp);      /* function(mixed:int) */    ADD_EFUN("intp", f_intp,tFunc(tMix,tInt01),OPT_TRY_OPTIMIZE);      /* function(mixed:int) */    ADD_EFUN("multisetp", f_multisetp,tFunc(tMix,tInt01),OPT_TRY_OPTIMIZE);      /* function(string:string)|function(int:int) */    ADD_EFUN("lower_case",f_lower_case,    tOr(tFunc(tStr,tStr), tFunc(tInt,tInt)),OPT_TRY_OPTIMIZE);