MudOSa4DGD/
MudOSa4DGD/bin/
MudOSa4DGD/data/
MudOSa4DGD/doc/
MudOSa4DGD/doc/driver/
MudOSa4DGD/doc/efun/bitstrings/
MudOSa4DGD/doc/efun/command/
MudOSa4DGD/doc/efun/communication/
MudOSa4DGD/doc/efun/heart_beat/
MudOSa4DGD/doc/efun/interactive/
MudOSa4DGD/doc/efun/inventory/
MudOSa4DGD/doc/efun/living/
MudOSa4DGD/doc/efun/mappings/
MudOSa4DGD/doc/efun/strings/
MudOSa4DGD/doc/efun/uid/
MudOSa4DGD/doc/funs/
MudOSa4DGD/doc/language/
MudOSa4DGD/mudlib/dgd/doc/
MudOSa4DGD/mudlib/dgd/lib/include/dgd/
MudOSa4DGD/mudlib/dgd/lib/std/
MudOSa4DGD/mudlib/dgd/lib/sys/
MudOSa4DGD/mudlib/dgd/log/
MudOSa4DGD/mudlib/log/
MudOSa4DGD/mudlib/std/include/
MudOSa4DGD/mudlib/std/obj/
/*
 * call_other.c
 *
 * possibly override call_other to emulate MudOS some
 *
 * (C) Frank Schmidt, Jesus@NorseMUD
 *
 */


/* call another object failing all DRIVER_PRIV and AUTO_PRIV checks */
static varargs mixed __call_other(mixed var1, mixed var2, mixed args...) {
  return ::call_other(var1, var2, args...);
}


/* call any local function, may be static (driver objects only) */
nomask varargs mixed __call_local(string func, mixed args...) {
  if (DRIVER_PRIV()) {
    return ::call_other(this_object(), func, args...);
  }
  else
    illegal();
}



/* THIS DEFINE IS NOT RECOMMENDED DUE TO PERFORMANCE CONCERNS! */
#ifdef MUDOS_CALL_OTHER_ARRAY

/* call a function in another object, may be an array of objects */
static varargs mixed call_other(mixed var1, mixed var2, mixed args...) {
  if (!arrayp(var1)) {
    /* EXTRA BUT NEEDED DRIVER SECURITY / CPU HOGGER */
    if (!IS_DRIVER_SOURCE(previous_program())) {
      string file;
      if (objectp(var1)) file = object_name(var1);
      else file = var1;
      if (IS_DRIVER_SOURCE(file)) {
	/* illegal: non-DriverLib object calling DriverLib object */
	error("Illegal call_other()!");
	return 0;
      }
    }
    return ::call_other(var1, var2, args...);
  }
  else {
    int sz;
    if ((sz=::sizeof(var1)) > 0) {
      int i;
      mixed *rets;
      for (rets = allocate(sz); i < sz; ++i) {
	mixed ob;
	if (ob=var1[i]) {
	  /* EXTRA BUT NEEDED DRIVER SECURITY / CPU HOGGER */
	  if (!IS_DRIVER_SOURCE(previous_program())) {
	    string file;
	    if (objectp(ob)) file = object_name(ob);
	    else file = ob;
	    if (IS_DRIVER_SOURCE(file)) {
	      /* illegal: non-DriverLib object calling DriverLib object */
	      error("Illegal call_other()!");
	      return 0;
	    }
	  }
	  rets[i] = ::call_other(ob, var2, args...);
	}
      }
      /* return array of returned values */
      return rets;
    }
    else
      return ({ });
  }
}

#endif