pike.git / src / interpret.h

version» Context lines:

pike.git/src/interpret.h:560:         enum apply_type   {    APPLY_STACK, /* The function is the first argument */    APPLY_SVALUE, /* arg1 points to an svalue containing the function */    APPLY_SVALUE_STRICT, /* Like APPLY_SVALUE, but does not return values for void functions */    APPLY_LOW /* arg1 is the object pointer,(int)arg2 the function */   };    - #define APPLY_MASTER(FUN,ARGS) \ - do{ \ -  const char* _fun_ = (FUN); \ -  int _args_ = (ARGS); \ -  static int id_, master_cnt=0; \ -  struct object *master_ob=master(); \ -  if(master_cnt != master_ob->prog->id) \ -  { \ -  id_=find_identifier(_fun_,master_ob->prog); \ -  master_cnt = master_ob->prog->id; \ -  } \ -  if (id_ >= 0) { \ -  apply_low(master_ob, id_, _args_); \ -  } else { \ -  Pike_error("Cannot call undefined function \"%s\" in master.\n", _fun_); \ -  } \ - }while(0) + PMOD_EXPORT void apply_master(const char* fun, INT32 args, int mode); + #define APPLY_MASTER(FUN,ARGS) apply_master(FUN,ARGS,1) + #define SAFE_APPLY_MASTER(FUN,ARGS) apply_master(FUN,ARGS,2) + #define SAFE_MAYBE_APPLY_MASTER(FUN,ARGS) apply_master(FUN,ARGS,3);    - #define SAFE_APPLY_MASTER(FUN,ARGS) \ - do{ \ -  const char* _fun_ = (FUN); \ -  int _args_ = (ARGS); \ -  static int id_, master_cnt=0; \ -  struct object *master_ob=master(); \ -  if(master_cnt != master_ob->prog->id) \ -  { \ -  id_=find_identifier(_fun_,master_ob->prog); \ -  master_cnt = master_ob->prog->id; \ -  } \ -  safe_apply_low2(master_ob, id_, _args_, _fun_); \ - }while(0) -  - #define SAFE_MAYBE_APPLY_MASTER(FUN,ARGS) \ - do{ \ -  const char* _fun_ = (FUN); \ -  int _args_ = (ARGS); \ -  static int id_, master_cnt=0; \ -  struct object *master_ob=master(); \ -  if(master_cnt != master_ob->prog->id) \ -  { \ -  id_=find_identifier(_fun_,master_ob->prog); \ -  master_cnt = master_ob->prog->id; \ -  } \ -  if (id_ >= 0) { \ -  safe_apply_low2(master_ob, id_, _args_, _fun_); \ -  } else { \ -  pop_n_elems(_args_); \ -  push_undefined(); \ -  } \ - }while(0) -  +    #define SAFE_APPLY_HANDLER(FUN, HANDLER, COMPAT, ARGS) do { \    static int h_fun_=-1, h_id_=0; \    static int c_fun_=-1, c_fun_id_=0; \    struct object *h_=(HANDLER), *c_=(COMPAT); \    if (h_ && h_->prog) { \    if (h_->prog->id != h_id_) { \    h_fun_ = find_identifier(fun, h_->prog); \    h_id_ = h_->prog->id; \    } \    if (h_fun_ != -1) { \