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/
/*
 * driver.h
 *
 * Include file for DriverLib objects (/dgd/ objects very close to the driver)
 *
 * (C) Frank Schmidt, Jesus@NorseMUD
 *
 */

#ifndef _DRIVER_H
#define _DRIVER_H

#include <dgd_dirs.h>
#include <objects.h>


/* default rlimits calls from driver objects (values defined in config.h) */
#define RLIMITS_ON()         rlimits(DEFAULT_CALL_STACK ; DEFAULT_TICK_LIMIT) {
#define RLIMITS_OFF()        }

/* Declaring this scope will avoid running out of rlimits at critical code */
#define NO_RLIMITS_ON()      rlimits(-1 ; -1) {
#define NO_RLIMITS_OFF()     }


/*
 * Check for AUTO and DriverLib call_other privileges. This is a HIGHLY
 * efficient security scheme, but it requires that arbitrary (variable object
 * or function) call_other in any DriverLib object to be made with a 
 * __call_other(ob, func, args...)
 */
/* call from the AUTO program? */
#define AUTO_PRIV()          (previous_program() == AUTO && \
                              previous_function() != "__call_other")

/* check wether <f> is a DriverLib filename? */
#ifndef DEFAULT_DGD_DIR
# define IS_DRIVER_SOURCE(f)  (strcocmp(_DGD_DIR, (f)))
#else /* optimize for /dgd/ directory (default) */
# define IS_DRIVER_SOURCE(f)  (strlen(f) >= 5 && (f)[0..4] == "/dgd/")
#endif

/* call from a DriverLib program? */
#define DRIVER_PRIV()        (IS_DRIVER_SOURCE(previous_program()) && \
                              previous_function() != "__call_other")


#endif