Branch: Tag:

2021-05-30

2021-05-30 15:16:28 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Runtime: Adjusted return types for lots of functions to include zero.

229:    RETURN THIS->unix_time;    }    -  /*! @decl string asctime() +  /*! @decl string|zero asctime()    *! Return a string representing the time. Mostly useful for debug    *! purposes, the exact format is very locale (see    *! @[Gettext.setlocale]) and OS dependent.    */ -  PIKEFUN string asctime() +  PIKEFUN string|zero asctime()    {    FIX_THIS();    {
306:    push_undefined();    }    -  /*! @decl string zone +  /*! @decl string|zero zone    *!    *! The timezone of this structure    */ -  PIKEFUN string `zone() { +  PIKEFUN string|zero `zone() {    FIX_THIS();    if( GET_ZONE(THIS) )    push_text( GET_ZONE(THIS) );
1585:    *! (zero) will be returned.    */   PMOD_EXPORT - PIKEFUN string program_defined(program p) + PIKEFUN string|zero program_defined(program p)    errname defined;    optflags OPT_TRY_OPTIMIZE;   {
2006:    type_stack_mark();    push_int_type(MIN_INT32, MAX_INT32);    push_unlimited_array_type(T_STRING); +  push_type(PIKE_T_ZERO); +  push_type(T_OR);    push_type(T_VOID);    push_type(T_MANY);    push_int_type(MIN_INT32, MAX_INT32);
2066:       return p;   } - PIKEFUN program ProxyFactory(program p) + PIKEFUN program|zero ProxyFactory(program p)    optflags OPT_TRY_OPTIMIZE; -  rawtype tFunc(tSetvar(0, tPrg(tObj)), tVar(0)); +  rawtype tFunc(tSetvar(0, tPrg(tObj)), tOr(tVar(0), tZero));   {    struct program *res = proxy_factory(p, NULL, 0);   
2411:    *! @[function_object()]    */   PMOD_EXPORT - PIKEFUN string function_name(program|function func) + PIKEFUN string|zero function_name(program|function func)    efun;    optflags OPT_TRY_OPTIMIZE;   {
2504:    *! @[function_name()], @[function_program()]    */   PMOD_EXPORT - PIKEFUN object function_object(function|program func) + PIKEFUN object|zero function_object(function|program func)    efun;    optflags OPT_TRY_OPTIMIZE; -  type function(function:object); +  type function(function:object|zero);   {    switch(TYPEOF(*func))    {
2547:    *! @[function_name()], @[function_object()]    */   PMOD_EXPORT - PIKEFUN program function_program(program|function func) + PIKEFUN program|zero function_program(program|function func)    efun;    optflags OPT_TRY_OPTIMIZE;   {
2907:   /* Works exactly like the getenv efun defined in the master, but only    * accesses the real environment. Everyone should use the caching    * version in the master instead. */ - PIKEFUN string|mapping _getenv (void|string var) -  rawtype tOr(tFunc(tStr, tString), tFunc(tVoid, tMap (tStr, tStr))); + PIKEFUN string|mapping|zero _getenv (void|string var) +  rawtype tOr(tFunc(tStr, tOr(tString, tZero)), +  tFunc(tNone, tMap (tStr, tStr)));   {    /* FIXME: Perhaps add the amigaos4 stuff from pike_push_env here too. */   
3402:    fill_in_file_and_line(THIS, NULL);    }    -  PIKEFUN string `filename() +  PIKEFUN string|zero `filename()    {    apply_current(f_backtrace_frame_fill_in_file_and_line_fun_num, 0);    pop_stack();
3422:       /*! @decl string _sprintf(int c, mapping|void opts)    */ -  PIKEFUN string _sprintf(int c, mapping|void opts) +  PIKEFUN string|zero _sprintf(int c, mapping|void opts)    flags ID_PROTECTED;    {    pop_n_elems(args);
3765:    RETURN (t == literal_array_string);    }    -  PIKEFUN array `args() +  PIKEFUN array|zero `args()    {    struct pike_frame *fp = THIS->fp;    struct array *res;
3813:    }    }    -  PIKEFUN string `filename() +  PIKEFUN string|zero `filename()    {    apply_current(f_LiveBacktraceFrame_fill_in_file_and_line_fun_num, 0);    pop_stack();
3979:    assign_svalue(fp->locals + l, val);    }    -  PIKEFUN string get_local_name(int(0..) l) +  PIKEFUN string|zero get_local_name(int(0..) l)    {    struct pike_frame *fp = THIS->fp;    if (!fp || (l >= fp->num_locals)) {
3998:    push_undefined();    }    -  PIKEFUN type get_local_type(int(0..) l) +  PIKEFUN type|zero get_local_type(int(0..) l)    {    struct pike_frame *fp = THIS->fp;    if (!fp || (l >= fp->num_locals)) {
4451:       /*! @decl array(array(string)) _encode()    */ -  PIKEFUN array(array(string)) _encode() +  PIKEFUN array(array(string))|zero _encode()    {    if (THIS->from) {    ref_push_array(THIS->from);
4647:    RETURN end_shared_string(ret);    }    -  /*! @decl array(string) _encode() +  /*! @decl array(string)|zero _encode()    */ -  PIKEFUN array(string) _encode() +  PIKEFUN array(string)|zero _encode()    {    if (THIS->del) {    ref_push_string(THIS->del);
5133:    pop_n_elems(2);    }    -  PIKEFUN string _sprintf(int mode, mapping flags) +  PIKEFUN string|zero _sprintf(int mode, mapping flags)    {    pop_n_elems(args);    if (mode != 'O') {
5339:    return res;   }    - /*! @decl function(mixed_void) _get_setter(object o, string varname) + /*! @decl function(mixed_void)|zero _get_setter(object o, string varname)    *!    *! Get a setter for the variable named @[varname] in object @[o].    *!
5350:    *! @seealso    *! @[object_variablep()]    */ - PIKEFUN function(mixed:void) _get_setter(object o, string s) + PIKEFUN function(mixed:void)|zero _get_setter(object o, string s)   {    struct program *p;    struct inherit *inh;
5406:    add_integer_constant("is_sql_null", 1, 0);    }    -  PIKEFUN int `!() +  PIKEFUN int(0..1) `!()    flags ID_PROTECTED;    {    RETURN 1;    }    -  PIKEFUN string _sprintf(int fmt, mixed ... extras) +  PIKEFUN string|zero _sprintf(int fmt, mixed ... extras)    flags ID_PROTECTED;    {    pop_n_elems(args);
6324:    }    }    -  /*! @decl array cast(string type) +  /*! @decl array|zero cast(string type)    *!    *! Cast the lists. @expr{array@} is the only    *! supported type.    */ -  PIKEFUN array cast(string type) +  PIKEFUN array|zero cast(string type)    flags ID_PROTECTED;    {    pop_stack(); /* type as at least one more reference. */
7204:    }    }    -  PIKEFUN string _sprintf(int t) +  PIKEFUN string|zero _sprintf(int t)    flags ID_PROTECTED;    {    if (t != '0') {
7376:    }    }    -  PIKEFUN string _sprintf(int c, mapping|void opts) +  PIKEFUN string|zero _sprintf(int c, mapping|void opts)    {    struct byte_buffer buf = BUFFER_INIT();