dmuck0.15-beta/docs/muf/
dmuck0.15-beta/game/
dmuck0.15-beta/game/logs/
dmuck0.15-beta/game/muf/
dmuck0.15-beta/game/muf/text/
/* MUSH specific defines.    Gawd, I hate MUSH!!!!!!   --Howard  3-23-93 
   Copyright notice included from the PennMUSH 1.50 software at the end of 
   this file.  PLEASE GO READ IT                        */

#include "interface.h"
#include "db.h"
#include "match.h"

#define SUN_OS
#define DO_GLOBALS
#define MUSH_VERSION  "2.0.BETA"    /* What verison are we slinging?  */

/* maximum comma's arguments to function */
#ifdef HAVE_VAR_LOCAL_VAR
#define MAX_MUSH_ARG (o_max_mush_args)      
#else
#define MAX_MUSH_ARG 100
#endif

/* Maximum number of commands per time slice */
#define MAX_MUSH_QUEUE (o_max_mush_queue)     

/* max number of queued command at any time */
#define QUEUE_QUOTA (o_queue_quota)
        
/* Cost of queued commands */
#define Q_COST (o_queue_cost)

/* excessive recursion prevention */
#define MAX_NEST_LEVEL  (o_max_nest_level)

/* Don't let the parents get tooo deep */
#define MAX_PARENTS (o_max_parents)        

/* The MUSH MASTER ROOM.  Where GLOBAL MUSH objects are kept. */
/* Do NOT, I repeat do NOT make this the same as the GLOBAL_ENVIRONMENT */
#define MASTER_ROOM (o_master_room)        

#define SBUF_LEN 32           /* Temp buff */

/* exec FLAGS  */
#define EV_FMAND   0x0100	/* text before () must be a function name */
#define EV_FCHECK  0x0200	/* check text before () for function name */
#define EV_STRIP   0x0400	/* strip a level of brackets */
#define EV_EVAL    0x0800	/* evaluate results before returning */

/* Defines */
#define FN_REG		0
#define FN_NOPARSE	1
#define MAX_GLOBAL_FNS  50
#define GLOBAL_OFFSET   100
#define ANY_OWNER       99
#define ATR_HASH_SIZE 128
#define ATR_HASH_MASK 127

/* Miscellaneous MUSH flags */
#define CHECK_INVENTORY            0x10
#define CHECK_NEIGHBORS            0x20
#define CHECK_SELF                 0x40
#define CHECK_HERE                 0x80
#define CHECK_ZONE                 0x100
#define CHECK_GLOBAL               0x200

/* Macros */
#define safe_str(s,b,p)         safe_copy_str(s,b,p,BUFFER_LEN - 1)
#define safe_short_str(s,b,p)   safe_copy_str(s,b,p,SBUF_LEN - 1)
#define quiet_notify(p,m)       notify_check(p,m,0)
#define GF_Index(x)             (x - GLOBAL_OFFSET)
#define Contents(x)             (DBFETCH(x)->contents)
#define Location(x)             (DBFETCH(x)->location)
#define Global_Funcs(x)         Wizard(x)
#define Home(x)                 (DBFETCH(x)->exits)
#define Zone(x)                 ((dbref) -1)
#define HugeQueue(x)            (Wizard(x))
#define LookQueue(x)            (Wizard(x))
#define notify_noecho(p,m)      notify_check(p,m,1)
#define IfSwitch(string)        if (string_prefix((string), slashp))
#define Listen(x)               (find_property(x, "LISTEN", ACCESS_WI))
#define Mobile(x) ((Typeof(x) == TYPE_PLAYER) || (Typeof(x) == TYPE_THING))
#define Can_Locate(p,x)         (controls(p,x) || nearby(p,x) || Wizard(p) \
                                 || Findable(x))
#define Can_Examine(p,x)        (controls(p,x) || Chown_Ok(x) || Visual(x))
#define DESC_ITER_CONN(d) \
        for(d = descriptor_list;(d);d=(d)->next) \
	  if((d)->connected)

/* Globals */
extern char rptr[10][BUFFER_LEN];     /* local registers */
extern dbref speaker;         /* MUSH listener stuff */

/* MUSH specific BOOLS */
#define BOOLEXP_IND 5
#define BOOLEXP_CARRY 6
#define BOOLEXP_IS 7
#define BOOLEXP_OWNER 8
#define BOOLEXP_EVAL 9 
#define AT_TOKEN '@'
#define IN_TOKEN '+'
#define IS_TOKEN '='
#define OWNER_TOKEN '$'

/* MUSH specific LOCKS */
#define BASICLOCK 0
#define USELOCK 1
#define ENTERLOCK 2

/* Externs */
extern char *parse_to(char **dstr, char delim, int eflags);
void do_medit(dbref player, dbref thing, char *q, char *argv[]);
extern void do_config(dbref player, int type);
extern void match_list(dbref first, match_data *md);
extern void do_debug_examine(dbref player, char *name);
extern void do_mush_unlock(dbref player, char *name, int locktype);
extern boolexp *get_ue_locks(dbref player, dbref thing, int type);
extern void do_use_enterlocks(dbref thing, char *lock, int lock_type, int add_rm);
extern void mush_notify_except(dbref first, dbref exception, char *msg);
extern dbref Parent(dbref thing);
extern dbref_list *listcreate(dbref ref);
extern void listfree(dbref_list *head);
extern void listadd(dbref_list *head, dbref ref);
extern char *strip_braces(char *line1);
extern char *atr_get_noparent(dbref thing, char *atr);
extern void atr_add(dbref player, char *atrname, char *buff);
extern void do_switch(dbref player, char *exp, char *argv[], dbref cause, int first);
extern void do_halt(dbref owner, char *ncom, dbref victim);
extern void do_halt1(dbref player, char *arg1, char *arg2);
extern void burst_object_command();
extern char *atr_get_noparent(dbref thing, char *atr);
extern char *atr_get_fullname(dbref thing, char *atr);
extern char *parse_arglist(dbref player, dbref cause, char *dstr, char delim,\
int eflags, char *fargs[], int nfargs);
void notify_check(dbref player, char *msg, int no_puppet);
extern void do_trigger(dbref player, char *objct, char *argv[]);
extern void do_verb(dbref player, dbref cause, char *arg1, char *argv[]);
extern void do_poor(dbref player, char *arg1);
extern void do_lemit(dbref player, char *tbuf1);
extern void do_enter(dbref player, char *what);
extern void do_pemit(dbref player, char *arg1, char *arg2, int silent);
extern void do_use(dbref player, char *what);
extern void do_wipe(dbref player, char *name);
extern void do_remit(dbref player, char *arg1, char *arg2);
extern void do_oemit(dbref player, char *arg1, char *arg2);
extern void do_emit(dbref player, char *tbuf1);
void oemit_notify_except(dbref first, dbref exc1, dbref exc2, char *msg);
void esnotify(dbref player, char *msg, dbref sender);
void emit_notify_except(dbref first, dbref exception, char *msg);
void safe_tel(dbref player, dbref dest);
void decompile_flags(dbref player, dbref thing, char *objct);
void decompile_atrs(dbref player, dbref thing, char *name, char *pattern);
void do_search(dbref player, char *arg1, char *arg3[]);
char *grep_util(dbref thing, char *pattern, char *lookfor, int len);
extern void do_mush_prop_set(__DO_PROTO);
extern void do_kick(dbref player, char *arg1);
extern void do_dolist(dbref player, char *list, char *command, dbref cause, \
int flag);
extern void did_it(dbref player, dbref thing, char *what, char *def, \
char *owhat, char *odef, char *awhat, dbref loc);
void notify_except2(dbref first, dbref exc1, dbref exc2, char *msg);
void propagate_sound(dbref thing, char *msg);
void do_mid_halt(dbref player, char *arg1, char *arg2, char *slashp);
void bind_and_queue(dbref player, dbref cause, char *action, char *arg);
int filter_found(dbref thing, char *msg, int flag);
extern int giveto(dbref who, int cost);
extern char *exec(dbref cause, char *str, dbref player, int eflags);

/* Function Defs */
#define FUNCTION(x)   \
  static void (x)(buff, args, nargs, privs, doer) \
     char *buff; \
     char *args[10]; \
     int nargs; \
     dbref privs; \
     dbref doer;

#define GLOBAL_FUN(x)  \
  static void (x)(buff, args, nargs, privs, doer, fn_num) \
     char *buff; \
     char *args[10]; \
     int nargs; \
     dbref privs; \
     dbref doer; \
     int fn_num;

#define XFUNCTION(x)   \
  void (x)(buff, args, nargs, privs, doer) \
     char *buff; \
     char *args[10]; \
     int nargs; \
     dbref privs; \
     dbref doer;

/*
 *  Copyright Notice for PennMUSH 1.50
 *
 * TinyMUSH 1.x Source code
 * Based on TinyMUD code
 *
 * -*-C-*-
 * 
 * Copyright (c) 1989, 1990 by David Applegate, James Aspnes, 
 *                             Timothy Freeman, and Bennet Yee.
 * 
 * This material was developed by the above-mentioned authors. Permission to
 * copy this software, to redistribute it, and to use it for any purpose is
 * granted, subject to the following restrictions and understandings.
 * 
 * 1. Any copy made of this software must include this copyright notice 
 * in full.
 * 
 * 2. Users of this software agree to make their best efforts (a) to return to
 * the above-mentioned authors any improvements or extensions that they make,
 * so that these may be included in future releases; and (b) to inform the
 * authors of noteworthy uses of this software.
 * 
 * 3. All materials developed as a consequence of the use of this software 
 * shall duly acknowledge such use, in accordance with the usual standards of
 * acknowledging credit in academic research.
 * 
 * 4. The authors have made no warrantee or representation that the operation 
 * of this software will be error-free, and the authors are under no obligation
 * to provide any services, by way of maintenance, update, or otherwise.
 * 
 * 5. In conjunction with products arising from the use of this material, there
 * shall be no use of the names of the authors, of Carnegie-Mellon
 * University, nor of any adaptation thereof in any advertising, promotional,
 * or sales literature without prior written consent from the authors and
 * Carnegie-Mellon University in each case.
 * 
 * The original TinyMUD code has been heavily modified by Lawrence Foard. This
 * code is presently in a constant state of change and is known to contain
 * some unresolved bugs. It is given out on an as is basis. I ask only that I
 * be given credit for additional features I have created ( @destroy,@asucc
 * etc).
 * 
 * Credits (for borrowed ideas &| code): Robert Hood (virus): Modified the
 * interface.c code to support alots of users. Lachesis: Introduced the idea
 * of property lists to TinyMUCK Many others: Many features borrowed from
 * other muds.
 *
 *---
 *
 * This code is heavily based on the micromush code which in turn was based on
 * the mush code.  I have modified it quite a bit since then as detailed in
 * the file CHANGES.   -- Moonchilde (JT Traub, jt1o@andrew.cmu.edu)
 *
 *---
 *
 * This code is based on the Pern code which Moonchilde stopped supporting
 * when PernMUSH itself went to 2.0. The file CHANGES-1 now details
 * Moonchilde's extensive modifications (PernMUSH 1.02 through 1.15).
 * The file CHANGES-2 now contains my modifications (PernMUSH 1.16, and
 * PennMUSH 1.17 to 1.19). PennMUSH 1.50.p1 changes and beyond are
 * in CHANGES-3. 
 *
 * This source code may not be copied, in part or in full, without
 * acknowledgement of the authors. The same is true of the help text.
 *
 *         -- Amberyl (Lydia Leong, lwl@eniac.seas.upenn.edu)
 *
 * Additional credits:
 *
 * Moonchilde and Ambar: Answered my occasional screams for help.
 *   Ambar also did a lot of bugfixing in versions 1.14 and 1.15.
 * Delta@Twilight: Added much of the HP-UX compatibility.
 * Jim Miller: Provided pointers to a few problems in the code
     which had been overlooked for quite some time.
 * Annalyn@PernMUSH, Javelin@Belgariad, Talek@Belgariad, and lots of others:
 *   Contributed lots and lots of good ideas.
 * TinyMUSH 2.0 and the mushhacks: Answered lots of questions,
 *   contributed many ideas, and in general acted extremely helpful.
 *   A small portion of this code is taken from TinyMUSH 2.0.
 *   Such sections are clearly marked with "taken from the 2.0 code".
 *   The parser is mostly from 2.0  (the end section of eval.c), with
 *   some modifications; this author is grateful for the use of the
 *   TinyMUSH 2.0 parser code.
 * Rosse@PernMUSH: Answered lots of probably inane coding questions,
 *   and providing help in tracking down various problems.
 * Henrik, Kheldar, and other Belgariad players: Did a fair amount
 *   of testing on the new parser and were very patient in figuring
 *   out test cases that went wrong and waiting for bugs to be fixed.
 * Zakath, Garion, Varana, and Geran of the the Belgariad, Tiercel@Pern,
 *   and the rest of the Penn MUSHers: Kept me sane and dragged me away
 *   from my terminal when necessary.  :) 
 * The rest of the Belgariad wiz team: Durnik for sanity checks, and
 *   everyone else for putting up with the occasional weird code bug.
 *
 * TinyMUSH 2.0 is Copyright (c) 1991 Joseph Traub and Glenn Crocker.
 * If you use of sections of this code which contain source code from 2.0,
 * you must retain this copyright notice.
 *
 * Ported to DaemonMUCK 0.14 on March 23, 1993 by Howard.
 *
 * THIS CODE MAY NOT BE USED COMMERCIALLY.
 *
 */


/* MUSH 2.0 Copyright */
/*
 * TinyMUSH 2.0 Source code
 * Copyright (c) 1991 Joseph Traub and Glenn Crocker
 *
 * Based on TinyMUD code
 * Copyright (c) 1989, 1990 by David Applegate, James Aspnes, Timothy Freeman,
 *                             and Bennet Yee.
 *
 * This material was developed by the above-mentioned authors.  Permission to
 * copy this software, to redistribute it, and to use it for any purpose is
 * granted, subject to the following restrictions and understandings.
 *
 * 1. Any copy made of this software must include this copyright notice in
 *    full.
 *
 * 2. Users of this software agree to make their best efforts
 *    (a) to return to the above-mentioned authors any improvements or
 *        extensions that they make, so that these may be included in future
 *        releases; and
 *    (b) to inform the authors of noteworthy uses of this software.
 *
 * 3. All materials developed as a consequence of the use of this software
 *    shall duly acknowledge such use, in accordance with the usual standards
 *    of acknowledging credit in academic research.
 *
 * 4. The authors have made no warrantee or representation that the operation
 *    of this software will be error-free, and the authors are under no
 *    obligation to provide any services, by way of maintenance, update, or
 *    otherwise.
 *
 * 5. In conjunction with products arising from the use of this material,
 *    there shall be no use of the names of the authors, of Carnegie-Mellon
 *    University, nor of any adaptation thereof in any advertising,
 *    promotional, or sales literature without prior written consent from
 *    the authors and both Carnegie-Mellon University Case Wester Reserve
 *    University in each case.
 *
 * Credits:
 *    Lawrence Foard:
 *      Wrote the original TinyMUSH 1.0 code from which this later derived.
 *    Jin (and MicroMUSH):
 *      Made many, many changes to the code that improved it immensely.
 *    Robert Hood (virus):
 *      Modified the interface.c code to support alots of users.
 *    Lachesis:
 *      Introduced the idea of property lists to TinyMUCK
 *    Many others:
 *      Many features borrowed from other muds.
 */