mux/src/externs.h

Go to the documentation of this file.
00001 // externs.h -- Prototypes for externs not defined elsewhere.
00002 //
00003 // $Id: externs.h,v 1.66 2007/02/03 04:25:46 sdennis Exp $
00004 //
00005 
00006 #ifndef EXTERNS_H
00007 #define EXTERNS_H
00008 
00009 #include "db.h"
00010 #include "match.h"
00011 #include "mudconf.h"
00012 #include "svdrand.h"
00013 
00014 // From bsd.cpp.
00015 //
00016 void boot_slave(dbref executor, dbref caller, dbref enactor, int key);
00017 void close_sockets(bool emergency, char *message);
00018 void CleanUpSlaveSocket(void);
00019 void CleanUpSlaveProcess(void);
00020 #ifdef QUERY_SLAVE
00021 void CleanUpSQLSlaveSocket(void);
00022 void CleanUpSQLSlaveProcess(void);
00023 #endif // QUERY_SLAVE
00024 #ifdef WIN32
00025 extern HANDLE CompletionPort;    // IOs are queued up on this port
00026 extern CRITICAL_SECTION csDescriptorList;
00027 #endif // WIN32
00028 
00029 #ifdef QUERY_SLAVE
00030 void boot_sqlslave(dbref executor, dbref caller, dbref enactor, int key);
00031 #endif // QUERY_SLAVE
00032 
00033 extern NAMETAB sigactions_nametab[];
00034 
00035 // From conf.cpp
00036 //
00037 void cf_log_notfound(dbref, char *, const char *, char *);
00038 int  cf_modify_bits(int *, char *, void *, UINT32, dbref, char *);
00039 void DCL_CDECL cf_log_syntax(dbref player, char *cmd, const char *fmt, ...);
00040 void ValidateConfigurationDbrefs(void);
00041 int  cf_read(void);
00042 void cf_init(void);
00043 void cf_list(dbref, char *, char **);
00044 void cf_display(dbref, char *, char *, char **);
00045 void list_cf_access(dbref);
00046 int cf_set(char *, char *, dbref);
00047 CF_HAND(cf_cf_access);
00048 CF_HAND(cf_access);
00049 CF_HAND(cf_cmd_alias);
00050 CF_HAND(cf_acmd_access);
00051 CF_HAND(cf_attr_access);
00052 CF_HAND(cf_func_access);
00053 CF_HAND(cf_flag_access);
00054 CF_HAND(cf_flag_name);
00055 CF_HAND(cf_art_rule);
00056 
00057 // From local.cpp.
00058 //
00059 void local_startup(void);
00060 void local_presync_database(void);
00061 void local_presync_database_sigsegv(void);
00062 void local_dump_database(int);
00063 void local_dump_complete_signal(void);
00064 void local_shutdown(void);
00065 void local_dbck(void);
00066 void local_connect(dbref, int, int);
00067 void local_disconnect(dbref, int);
00068 void local_data_create(dbref);
00069 void local_data_clone(dbref, dbref);
00070 void local_data_free(dbref);
00071 
00072 // From mail.cpp.
00073 //
00074 void load_mail(FILE *);
00075 int  dump_mail(FILE *);
00076 struct mail *mail_fetch(dbref, int);
00077 
00078 // From netcommon.cpp.
00079 //
00080 void DCL_CDECL raw_broadcast(int, char *, ...);
00081 void list_siteinfo(dbref);
00082 void logged_out0(dbref executor, dbref caller, dbref enactor, int key);
00083 void logged_out1(dbref executor, dbref caller, dbref enactor, int key, char *arg);
00084 void init_logout_cmdtab(void);
00085 void desc_reload(dbref);
00086 void make_portlist(dbref, dbref, char *, char **);
00087 
00088 /* From cque.cpp */
00089 int  nfy_que(dbref, int, int, int);
00090 int  halt_que(dbref, dbref);
00091 void wait_que(dbref executor, dbref caller, dbref enactor, bool,
00092     CLinearTimeAbsolute&, dbref, int, char *, char *[],int, char *[]);
00093 
00094 #ifdef WIN32
00095 #include "crypt/crypt.h"
00096 #else // WIN32
00097 extern "C" char *crypt(const char *inptr, const char *inkey);
00098 #endif // WIN32
00099 extern bool break_called;
00100 
00101 /* From eval.cpp */
00102 void tcache_init(void);
00103 char *parse_to(char **, char, int);
00104 char *parse_arglist(dbref executor, dbref caller, dbref enactor, char *,
00105                     char, int, char *[], int, char*[], int, int *);
00106 int get_gender(dbref);
00107 void mux_exec(char *buff, char **bufc, dbref executor, dbref caller,
00108               dbref enactor, int eval, char **dstr, char *cargs[],
00109               int ncargs);
00110 void save_global_regs(const char *, char *[], int []);
00111 void save_and_clear_global_regs(const char *, char *[], int[]);
00112 void restore_global_regs(const char *, char *[], int []);
00113 char **PushPointers(int nNeeded);
00114 void PopPointers(char **p, int nNeeded);
00115 int *PushIntegers(int nNeeded);
00116 void PopIntegers(int *pi, int nNeeded);
00117 extern const signed char mux_RegisterSet[256];
00118 extern const char *ColorTable[256];
00119 
00120 /* From game.cpp */
00121 #define notify(p,m)                         notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN)
00122 #define notify_saypose(p,m)                 notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_SAYPOSE)
00123 #define notify_html(p,m)                    notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_HTML)
00124 #define notify_quiet(p,m)                   notify_check(p,p,m, MSG_PUP_ALWAYS|MSG_ME)
00125 #define notify_with_cause(p,c,m)            notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN)
00126 #define notify_with_cause_ooc(p,c,m)        notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_OOC)
00127 #define notify_with_cause_html(p,c,m)       notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN|MSG_HTML)
00128 #define notify_quiet_with_cause(p,c,m)      notify_check(p,c,m, MSG_PUP_ALWAYS|MSG_ME)
00129 //#define notify_puppet(p,c,m)                notify_check(p,c,m, MSG_ME_ALL|MSG_F_DOWN)
00130 //#define notify_quiet_puppet(p,c,m)          notify_check(p,c,m, MSG_ME)
00131 #define notify_all(p,c,m)                   notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS|MSG_F_UP|MSG_F_CONTENTS)
00132 #define notify_all_from_inside(p,c,m)       notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE)
00133 #define notify_all_from_inside_saypose(p,c,m) notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE|MSG_SAYPOSE)
00134 #define notify_all_from_inside_html(p,c,m)  notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS_A|MSG_F_UP|MSG_F_CONTENTS|MSG_S_INSIDE|MSG_HTML)
00135 //#define notify_all_from_outside(p,c,m)      notify_check(p,c,m, MSG_ME_ALL|MSG_NBR_EXITS|MSG_F_UP|MSG_F_CONTENTS|MSG_S_OUTSIDE)
00136 
00137 void notify_except(dbref, dbref, dbref, const char *, int key);
00138 void notify_except2(dbref, dbref, dbref, dbref, const char *);
00139 
00140 void notify_check(dbref, dbref, const char *, int);
00141 
00142 bool Hearer(dbref);
00143 void report(void);
00144 
00145 bool atr_match
00146 (
00147     dbref thing,
00148     dbref player,
00149     char  type,
00150     char  *str,
00151     char  *raw_str,
00152     bool  check_parents
00153 );
00154 
00155 bool regexp_match
00156 (
00157     char *pattern,
00158     char *str,
00159     int case_opt,
00160     char *args[],
00161     int nargs
00162 );
00163 
00164 bool list_check
00165 (
00166     dbref thing,
00167     dbref player,
00168     char  type,
00169     char  *str,
00170     char  *raw_str,
00171     bool  check_parent
00172 );
00173 bool html_escape(const char *src, char *dest, char **destp);
00174 
00175 #define DUMP_I_NORMAL    0  // OUTPUT to the outdb through a temporary file.
00176 #define DUMP_I_PANIC     1  // UNLOAD to a crashdb
00177 #define DUMP_I_RESTART   2  // OUTPUT to the inputdb
00178 #define DUMP_I_FLAT      3  // UNLOAD to a .FLAT file
00179 #define DUMP_I_SIGNAL    4  // UNLOAD to a .FLAT file from signal.
00180 #define NUM_DUMP_TYPES   5
00181 void dump_database_internal(int);
00182 void fork_and_dump(int key);
00183 
00184 /* From help.cpp */
00185 void helpindex_clean(int);
00186 void helpindex_load(dbref);
00187 void helpindex_init(void);
00188 void help_helper(dbref executor, int iHelpfile, char *topic_arg, char *buff, char **bufc);
00189 
00190 /* From htab.cpp */
00191 int  cf_ntab_access(int *, char *, void *, UINT32, dbref, char *);
00192 
00193 /* From log.cpp */
00194 #ifdef WIN32
00195 #define ENDLINE "\r\n"
00196 #else // WIN32
00197 #define ENDLINE "\n"
00198 #endif // WIN32
00199 bool start_log(const char *primary, const char *secondary);
00200 void end_log(void);
00201 void log_perror(const char *, const char *,const char *,
00202             const char *);
00203 void log_text(const char *);
00204 void log_number(int);
00205 void DCL_CDECL log_printf(const char *fmt, ...);
00206 void log_name(dbref);
00207 void log_name_and_loc(dbref);
00208 void log_type_and_name(dbref);
00209 
00210 /* From look.cpp */
00211 void look_in(dbref,dbref, int);
00212 void show_vrml_url(dbref, dbref);
00213 size_t decode_attr_flags(int aflags, char *buff);
00214 
00215 /* From move.cpp */
00216 void move_object(dbref, dbref);
00217 void move_via_generic(dbref, dbref, dbref, int);
00218 bool move_via_teleport(dbref, dbref, dbref, int);
00219 void move_exit(dbref, dbref, bool, const char *, int);
00220 void do_enter_internal(dbref, dbref, bool);
00221 
00222 /* From object.cpp */
00223 dbref start_home(void);
00224 dbref default_home(void);
00225 bool  can_set_home(dbref, dbref, dbref);
00226 dbref new_home(dbref);
00227 dbref clone_home(dbref, dbref);
00228 void  divest_object(dbref);
00229 dbref create_obj(dbref, int, const char *, int);
00230 void  destroy_obj(dbref);
00231 void  empty_obj(dbref);
00232 
00233 /* From player.cpp */
00234 dbref create_player(char *name, char *pass, dbref executor, bool isrobot, const char **pmsg);
00235 void AddToPublicChannel(dbref player);
00236 bool add_player_name(dbref, const char *);
00237 bool delete_player_name(dbref, const char *);
00238 dbref lookup_player(dbref, char *, bool);
00239 void load_player_names(void);
00240 void badname_add(char *);
00241 void badname_remove(char *);
00242 bool badname_check(char *);
00243 void badname_list(dbref, const char *);
00244 void ChangePassword(dbref player, const char *szPassword);
00245 const char *mux_crypt(const char *szPassword, const char *szSalt, int *piType);
00246 int  QueueMax(dbref);
00247 int  a_Queue(dbref, int);
00248 void pcache_reload(dbref);
00249 void pcache_init(void);
00250 
00251 /* From predicates.cpp */
00252 char * DCL_CDECL tprintf(const char *, ...);
00253 void DCL_CDECL safe_tprintf_str(char *, char **, const char *, ...);
00254 dbref insert_first(dbref, dbref);
00255 dbref remove_first(dbref, dbref);
00256 dbref reverse_list(dbref);
00257 bool member(dbref, dbref);
00258 bool could_doit(dbref, dbref, int);
00259 bool can_see(dbref, dbref, bool);
00260 void add_quota(dbref, int);
00261 bool canpayfees(dbref, dbref, int, int);
00262 void giveto(dbref,int);
00263 bool payfor(dbref,int);
00264 char *MakeCanonicalObjectName(const char *pName, int *pnName, bool *pbValid);
00265 char *MakeCanonicalExitName(const char *pName, int *pnName, bool *pbValid);
00266 bool ValidatePlayerName(const char *pName);
00267 bool ok_password(const char *szPassword, const char **pmsg);
00268 void handle_ears(dbref, bool, bool);
00269 dbref match_possessed(dbref, dbref, char *, dbref, bool);
00270 void parse_range(char **, dbref *, dbref *);
00271 bool parse_thing_slash(dbref, char *, char **, dbref *);
00272 bool get_obj_and_lock(dbref, char *, dbref *, ATTR **, char *, char **);
00273 dbref where_is(dbref);
00274 dbref where_room(dbref);
00275 bool locatable(dbref, dbref, dbref);
00276 bool nearby(dbref, dbref);
00277 bool exit_visible(dbref, dbref, int);
00278 bool exit_displayable(dbref, dbref, int);
00279 void did_it(dbref, dbref, int, const char *, int, const char *, int, char *[], int);
00280 bool bCanReadAttr(dbref executor, dbref target, ATTR *tattr, bool bParentCheck);
00281 bool bCanSetAttr(dbref executor, dbref target, ATTR *tattr);
00282 bool bCanLockAttr(dbref executor, dbref target, ATTR *tattr);
00283 
00284 /* From set.cpp */
00285 bool parse_attrib(dbref, char *, dbref *, ATTR **);
00286 bool parse_attrib_wild(dbref, char *, dbref *, bool, bool, bool);
00287 void edit_string(char *, char **, char *, char *);
00288 dbref match_controlled_handler(dbref player, const char *name, bool bQuiet);
00289 #define match_controlled(player,name)       match_controlled_handler(player, name, false)
00290 #define match_controlled_quiet(player,name) match_controlled_handler(player, name, true)
00291 void set_modified(dbref thing);
00292 
00293 /* From boolexp.cpp */
00294 bool eval_boolexp(dbref, dbref, dbref, BOOLEXP *);
00295 BOOLEXP *parse_boolexp(dbref, const char *, bool);
00296 bool eval_boolexp_atr(dbref, dbref, dbref, char *);
00297 
00298 /* From functions.cpp */
00299 bool xlate(char *);
00300 
00301 #define IEEE_MAKE_NAN  1
00302 #define IEEE_MAKE_IND  2
00303 #define IEEE_MAKE_PINF 3
00304 #define IEEE_MAKE_NINF 4
00305 
00306 double MakeSpecialFloat(int iWhich);
00307 
00308 /* From unparse.cpp */
00309 char *unparse_boolexp(dbref, BOOLEXP *);
00310 char *unparse_boolexp_quiet(dbref, BOOLEXP *);
00311 char *unparse_boolexp_decompile(dbref, BOOLEXP *);
00312 char *unparse_boolexp_function(dbref, BOOLEXP *);
00313 
00314 /* From walkdb.cpp */
00315 int chown_all(dbref from_player, dbref to_player, dbref acting_player, int key);
00316 void olist_push(void);
00317 void olist_pop(void);
00318 void olist_add(dbref);
00319 dbref olist_first(void);
00320 dbref olist_next(void);
00321 
00322 /* From wild.cpp */
00323 bool wild(char *, char *, char *[], int);
00324 bool wild_match(char *, const char *);
00325 bool quick_wild(const char *, const char *);
00326 
00327 /* From command.cpp */
00328 bool check_access(dbref player, int mask);
00329 void set_prefix_cmds(void);
00330 char *process_command(dbref executor, dbref caller, dbref enactor, bool,
00331     char *, char *[], int);
00332 
00333 #define Protect(f) (cmdp->perms & f)
00334 
00335 #define Invalid_Objtype(x) \
00336 ((Protect(CA_LOCATION) && !Has_location(x)) || \
00337  (Protect(CA_CONTENTS) && !Has_contents(x)) || \
00338  (Protect(CA_PLAYER) && !isPlayer(x)))
00339 
00340 /* from db.cpp */
00341 bool Commer(dbref);
00342 void s_Pass(dbref, const char *);
00343 void s_Name(dbref, const char *);
00344 void s_Moniker(dbref thing, const char *s);
00345 const char *Name(dbref thing);
00346 const char *PureName(dbref thing);
00347 const char *Moniker(dbref thing);
00348 int  fwdlist_load(FWDLIST *, dbref, char *);
00349 void fwdlist_set(dbref, FWDLIST *);
00350 void fwdlist_clr(dbref);
00351 int  fwdlist_rewrite(FWDLIST *, char *);
00352 FWDLIST *fwdlist_get(dbref);
00353 void atr_push(void);
00354 void atr_pop(void);
00355 int  atr_head(dbref, char **);
00356 int  atr_next(char **);
00357 int  init_dbfile(char *game_dir_file, char *game_pag_file, int nCachePages);
00358 void atr_cpy(dbref dest, dbref source, bool bInternal);
00359 void atr_chown(dbref);
00360 void atr_clr(dbref, int);
00361 void atr_add_raw_LEN(dbref, int, const char *, int);
00362 void atr_add_raw(dbref, int, const char *);
00363 void atr_add(dbref, int, char *, dbref, int);
00364 void atr_set_flags(dbref, int, int);
00365 const char *atr_get_raw_LEN(dbref, int, size_t *);
00366 const char *atr_get_raw(dbref, int);
00367 char *atr_get_LEN(dbref, int, dbref *, int *, size_t *);
00368 char *atr_get_real(dbref, int, dbref *, int *, const char *, const int);
00369 #define atr_get(t,a,o,f) atr_get_real(t,a,o,f, __FILE__, __LINE__)
00370 char *atr_pget_LEN(dbref, int, dbref *, int *, size_t *);
00371 char *atr_pget_real(dbref, int, dbref *, int *, const char *, const int);
00372 #define atr_pget(t,a,o,f) atr_pget_real(t,a,o,f, __FILE__, __LINE__)
00373 char *atr_get_str_LEN(char *s, dbref, int, dbref *, int *, size_t *);
00374 char *atr_get_str(char *, dbref, int, dbref *, int *);
00375 char *atr_pget_str_LEN(char *, dbref, int, dbref *, int *, size_t *);
00376 char *atr_pget_str(char *, dbref, int, dbref *, int *);
00377 bool atr_get_info(dbref, int, dbref *, int *);
00378 bool atr_pget_info(dbref, int, dbref *, int *);
00379 void atr_free(dbref);
00380 bool check_zone_handler(dbref player, dbref thing, bool bPlayerCheck);
00381 #define check_zone(player, thing) check_zone_handler(player, thing, false)
00382 void ReleaseAllResources(dbref obj);
00383 bool fwdlist_ck(dbref player, dbref thing, int anum, char *atext);
00384 
00385 extern int anum_alc_top;
00386 
00387 /* Command handler keys */
00388 
00389 #define ATTRIB_ACCESS   1   /* Change access to attribute */
00390 #define ATTRIB_RENAME   2   /* Rename attribute */
00391 #define ATTRIB_DELETE   4   /* Delete attribute */
00392 #define ATTRIB_INFO     8   /* Info (number, flags) about attribute */
00393 #define BOOT_QUIET      1   /* Inhibit boot message to victim */
00394 #define BOOT_PORT       2   /* Boot by port number */
00395 #define CEMIT_NOHEADER  1   /* Channel emit without header */
00396 #define CHOWN_ONE       1   /* item = new_owner */
00397 #define CHOWN_ALL       2   /* old_owner = new_owner */
00398 //#define CHOWN_NOSTRIP   4   /* Don't strip (most) flags from object */
00399 #define CHOWN_NOZONE    8   /* Strip zones from objects */
00400 #define CLIST_FULL      1   /* Full listing of channels */
00401 #define CLIST_HEADERS   2   /* Lists channel headers, like "[Public]" */
00402 #define CLONE_LOCATION  0   /* Create cloned object in my location */
00403 #define CLONE_INHERIT   1   /* Keep INHERIT bit if set */
00404 #define CLONE_PRESERVE  2   /* Preserve the owner of the object */
00405 #define CLONE_INVENTORY 4   /* Create cloned object in my inventory */
00406 #define CLONE_SET_COST  8   /* ARG2 is cost of cloned object */
00407 #define CLONE_SET_LOC   16  /* ARG2 is location of cloned object */
00408 #define CLONE_SET_NAME  32  /* ARG2 is alternate name of cloned object */
00409 #define CLONE_FROM_PARENT 64 /* Set parent on obj instd of cloning attrs */
00410 #define CBOOT_QUIET     1   // Cboot without a message
00411 #define COMTITLE_ON     1   // Turn Comtitles on.
00412 #define COMTITLE_OFF    2   // Turn Comtitles off.
00413 #define CRE_INVENTORY   0   /* Create object in my inventory */
00414 #define CRE_LOCATION    1   /* Create object in my location */
00415 #define CRE_SET_LOC     2   /* ARG2 is location of new object */
00416 #define CSET_PUBLIC     0   /* Sets a channel public */
00417 #define CSET_PRIVATE    1   /* Sets a channel private (default) */
00418 #define CSET_LOUD       2   /* Channel shows connects and disconnects */
00419 #define CSET_QUIET      3   /* Channel doesn't show connects/disconnects */
00420 #define CSET_LIST       4   /* Lists channels */
00421 #define CSET_OBJECT     5   /* Sets the channel object for the channel */
00422 #define CSET_SPOOF      6   /* Sets the channel spoofable */
00423 #define CSET_NOSPOOF    7   /* Sets the channel non-spoofable */
00424 #define CSET_HEADER     8   /* Sets the channel header, like "[Public]" */
00425 #define CSET_LOG        9   // Set maximum number of messages to log.
00426 #define DBCK_DEFAULT    1   /* Get default tests too */
00427 #define DBCK_FULL       2   /* Do all tests */
00428 #define DECOMP_DBREF    1   /* decompile by dbref */
00429 //#define DECOMP_PRETTY   2   /* pretty-format output */
00430 #define DEST_ONE        1   /* object */
00431 #define DEST_OVERRIDE   4   /* override Safe() */
00432 #define DEST_INSTANT    8   /* instantly destroy */
00433 #define DIG_TELEPORT    1   /* teleport to room after @digging */
00434 #define DOLIST_SPACE    0   /* expect spaces as delimiter */
00435 #define DOLIST_DELIMIT  1   /* expect custom delimiter */
00436 #define DOLIST_NOTIFY   2   /* Send an @notify after the @dolist is completed */
00437 #define DOING_MESSAGE   0   /* Set my DOING message */
00438 #define DOING_HEADER    1   /* Set the DOING header */
00439 #define DOING_POLL      2   /* List DOING header */
00440 #define DOING_UNIQUE    3   // Set DOING message for current port only
00441 #define DOING_MASK     15   // Lower four bits form non-SW_MULTIPLE part.
00442 #define DOING_QUIET    16   // Set DOING messages without 'Set.' message.
00443 #define DROP_QUIET      1   /* Don't do odrop/adrop if control */
00444 #define DUMP_STRUCT     1   /* Dump flat structure file */
00445 #define DUMP_TEXT       2   /* Dump to external attribute database. */
00446 #define DUMP_FLATFILE   4   /* Dump .FLAT file */
00447 #define EXAM_DEFAULT    0   /* Default */
00448 #define EXAM_BRIEF      1   /* Nonowner sees just owner */
00449 #define EXAM_LONG       2   /* Nonowner sees public attrs too */
00450 #define EXAM_DEBUG      4   /* Display more info for finding db problems */
00451 #define EXAM_PARENT     8   /* Get attr from parent when exam obj/attr */
00452 //#define EXAM_PRETTY     16  /* Pretty-format output */
00453 //#define EXAM_PAIRS      32  /* Print paren matches in color */
00454 #define FIXDB_OWNER     1   /* Fix OWNER field */
00455 #define FIXDB_LOC       2   /* Fix LOCATION field */
00456 #define FIXDB_CON       4   /* Fix CONTENTS field */
00457 #define FIXDB_EXITS     8   /* Fix EXITS field */
00458 #define FIXDB_NEXT      16  /* Fix NEXT field */
00459 #define FIXDB_PENNIES   32  /* Fix PENNIES field */
00460 #define FIXDB_ZONE      64  /* Fix ZONE field */
00461 #define FIXDB_LINK      128 /* Fix LINK field */
00462 #define FIXDB_PARENT    256 /* Fix PARENT field */
00463 #define FIXDB_NAME      2048 /* Set NAME attribute */
00464 #define FLAG_REMOVE     1   // Remove a flag alias
00465 #define GET_QUIET       1   /* Don't do osucc/asucc if control */
00466 #define GIVE_QUIET      64  /* Inhibit give messages */
00467 #define GLOB_ENABLE     1   /* key to enable */
00468 #define GLOB_DISABLE    2   /* key to disable */
00469 //#define GLOB_LIST       3   /* key to list */
00470 #define HALT_ALL        1   /* halt everything */
00471 
00472 #define HOOK_BEFORE     1   /* BEFORE hook */
00473 #define HOOK_AFTER      2   /* AFTER hook */
00474 #define HOOK_PERMIT     4   /* PERMIT hook */
00475 #define HOOK_IGNORE     8   /* IGNORE hook */
00476 #define HOOK_IGSWITCH   16  /* BFAIL hook */
00477 #define HOOK_AFAIL      32  /* AFAIL hook */
00478 #define HOOK_CLEAR      64  /* CLEAR hook */
00479 #define HOOK_LIST       128 /* LIST hooks */
00480 #define ICMD_DISABLE    0
00481 #define ICMD_IGNORE     1
00482 #define ICMD_ON         2
00483 #define ICMD_OFF        4
00484 #define ICMD_CLEAR      8
00485 #define ICMD_CHECK      16
00486 #define ICMD_DROOM      32
00487 #define ICMD_IROOM      64
00488 #define ICMD_CROOM      128
00489 #define ICMD_LROOM      256
00490 #define ICMD_LALLROOM   512
00491 #define KILL_KILL       1   /* gives victim insurance */
00492 #define KILL_SLAY       2   /* no insurance */
00493 #define LOOK_LOOK       1   /* list desc (and succ/fail if room) */
00494 #define LOOK_OUTSIDE    8   /* look for object in container of player */
00495 #define MAIL_STATS      1   /* Mail stats */
00496 #define MAIL_DSTATS     2   /* More mail stats */
00497 #define MAIL_FSTATS     3   /* Even more mail stats */
00498 #define MAIL_DEBUG      4   /* Various debugging options */
00499 #define MAIL_NUKE       5   /* Nuke the post office */
00500 #define MAIL_FOLDER     6   /* Do folder stuff */
00501 #define MAIL_LIST       7   /* List @mail by time */
00502 #define MAIL_READ       8   /* Read @mail message */
00503 #define MAIL_CLEAR      9   /* Clear @mail message */
00504 #define MAIL_UNCLEAR    10  /* Unclear @mail message */
00505 #define MAIL_PURGE      11  /* Purge cleared @mail messages */
00506 #define MAIL_FILE       12  /* File @mail in folders */
00507 #define MAIL_TAG        13  /* Tag @mail messages */
00508 #define MAIL_UNTAG      14  /* Untag @mail messages */
00509 #define MAIL_FORWARD    15  /* Forward @mail messages */
00510 #define MAIL_SEND       16  /* Send @mail messages in progress */
00511 #define MAIL_EDIT       17  /* Edit @mail messages in progress */
00512 #define MAIL_URGENT     18  /* Sends a @mail message as URGENT */
00513 #define MAIL_ALIAS      19  /* Creates an @mail alias */
00514 #define MAIL_ALIST      20  /* Lists @mail aliases */
00515 #define MAIL_PROOF      21  /* Proofs @mail messages in progress */
00516 #define MAIL_ABORT      22  /* Aborts @mail messages in progress */
00517 #define MAIL_QUICK      23  /* Sends a quick @mail message */
00518 #define MAIL_REVIEW     24  /* Reviews @mail sent to a player */
00519 #define MAIL_RETRACT    25  /* Retracts @mail sent to a player */
00520 #define MAIL_CC         26  /* Carbon copy */
00521 #define MAIL_SAFE       27  /* Defines a piece of mail as safe. */
00522 #define MAIL_REPLY      28  /* Replies to a message. */
00523 #define MAIL_REPLYALL   29  /* Replies to all recipients of msg */
00524 #define MAIL_BCC        30  // Blind Carbon Copy. Don't show the recipient list to these.
00525 #define MAIL_QUOTE      0x100   /* Quote back original in the reply? */
00526 
00527 #define MALIAS_DESC     1   /* Describes a mail alias */
00528 #define MALIAS_CHOWN    2   /* Changes a mail alias's owner */
00529 #define MALIAS_ADD      3   /* Adds a player to an alias */
00530 #define MALIAS_REMOVE   4   /* Removes a player from an alias */
00531 #define MALIAS_DELETE   5   /* Deletes a mail alias */
00532 #define MALIAS_RENAME   6   /* Renames a mail alias */
00533 #define MALIAS_LIST     8   /* Lists mail aliases */
00534 #define MALIAS_STATUS   9   /* Status of mail aliases */
00535 #define MARK_SET        0   /* Set mark bits */
00536 #define MARK_CLEAR      1   /* Clear mark bits */
00537 #define MOTD_ALL        0   /* login message for all */
00538 #define MOTD_WIZ        1   /* login message for wizards */
00539 #define MOTD_DOWN       2   /* login message when logins disabled */
00540 #define MOTD_FULL       4   /* login message when too many players on */
00541 #define MOTD_LIST       8   /* Display current login messages */
00542 #define MOTD_BRIEF      16  /* Suppress motd file display for wizards */
00543 #define MOVE_QUIET      1   /* Dont do osucc/ofail/asucc/afail if ctrl */
00544 #define NFY_NFY         0   /* Notify first waiting command */
00545 #define NFY_NFYALL      1   /* Notify all waiting commands */
00546 #define NFY_DRAIN       2   /* Delete waiting commands */
00547 #define NFY_QUIET       3   /* Suppress "Notified." message */
00548 #define OPEN_LOCATION   0   /* Open exit in my location */
00549 #define OPEN_INVENTORY  1   /* Open exit in me */
00550 #define PCRE_PLAYER     1   /* create new player */
00551 #define PCRE_ROBOT      2   /* create robot player */
00552 #define PEMIT_PEMIT     1   /* emit to named player */
00553 #define PEMIT_OEMIT     2   /* emit to all in current room except named */
00554 #define PEMIT_WHISPER   3   /* whisper to player in current room */
00555 #define PEMIT_FSAY      4   /* force controlled obj to say */
00556 #define PEMIT_FEMIT     5   /* force controlled obj to emit */
00557 #define PEMIT_FPOSE     6   /* force controlled obj to pose */
00558 #define PEMIT_FPOSE_NS  7   /* force controlled obj to pose w/o space */
00559 #define PEMIT_CONTENTS  8   /* Send to contents (additive) */
00560 #define PEMIT_HERE      16  /* Send to location (@femit, additive) */
00561 #define PEMIT_ROOM      32  /* Send to containing rm (@femit, additive) */
00562 #define PEMIT_LIST      64  /* Send to a list */
00563 #define PEMIT_HTML      128 /* HTML escape, and no newline */
00564 #define PS_BRIEF        0   /* Short PS report */
00565 #define PS_LONG         1   /* Long PS report */
00566 #define PS_SUMM         2   /* Queue counts only */
00567 #define PS_ALL          4   /* List entire queue */
00568 #define QUERY_SQL       1   /* SQL query */
00569 #define QUEUE_KICK      1   /* Process commands from queue */
00570 #define QUEUE_WARP      2   /* Advance or set back wait queue clock */
00571 #define QUOTA_SET       1   /* Set a quota */
00572 #define QUOTA_FIX       2   /* Repair a quota */
00573 #define QUOTA_TOT       4   /* Operate on total quota */
00574 #define QUOTA_REM       8   /* Operate on remaining quota */
00575 #define QUOTA_ALL       16  /* Operate on all players */
00576 //#define QUOTA_ROOM      32  /* Room quota set */
00577 //#define QUOTA_EXIT      64  /* Exit quota set */
00578 //#define QUOTA_THING     128 /* Thing quota set */
00579 //#define QUOTA_PLAYER    256 /* Player quota set */
00580 #define SAY_SAY         1   /* say in current room */
00581 #define SAY_NOSPACE     1   /* OR with xx_EMIT to get nospace form */
00582 #define SAY_POSE        2   /* pose in current room */
00583 #define SAY_POSE_NOSPC  3   /* pose w/o space in current room */
00584 #define SAY_PREFIX      4   /* first char indicates formatting */
00585 #define SAY_EMIT        5   /* emit in current room */
00586 #define SAY_NOEVAL      8   // Don't eval message
00587 #define SHOUT_SHOUT     1   /* shout to all logged-in players */
00588 #define SHOUT_WALLPOSE  2   /* Pose to all logged-in players */
00589 #define SHOUT_WALLEMIT  3   /* Emit to all logged-in players */
00590 #define SHOUT_WIZSHOUT  4   /* shout to all logged-in wizards */
00591 #define SHOUT_WIZPOSE   5   /* Pose to all logged-in wizards */
00592 #define SHOUT_WIZEMIT   6   /* Emit to all logged-in wizards */
00593 #define SHOUT_ADMINSHOUT 7  /* Emit to all wizards or royalty */
00594 //#define SAY_GRIPE       16  /* Complain to management */
00595 //#define SAY_NOTE        17  /* Comment to log for wizards */
00596 #define SAY_NOTAG       32  /* Don't put Broadcast: in front (additive) */
00597 #define SAY_HERE        64  /* Output to current location */
00598 #define SAY_ROOM        128 /* Output to containing room */
00599 #define SAY_HTML        256 /* Don't output a newline */
00600 #define SET_QUIET       1   /* Don't display 'Set.' message. */
00601 #define SHOUT_DEFAULT   0   /* Default @wall message */
00602 #define SHOUT_WIZARD    1   /* @wizwall */
00603 #define SHOUT_ADMIN     2   /* @wall/admin */
00604 #define SHUTDN_NORMAL   0   /* Normal shutdown */
00605 #define SHUTDN_PANIC    1   /* Write a panic dump file */
00606 #define SHUTDN_EXIT     2   /* Exit from shutdown code */
00607 #define SHUTDN_COREDUMP 4   /* Produce a coredump */
00608 #define SRCH_SEARCH     1   /* Do a normal search */
00609 #define SRCH_MARK       2   /* Set mark bit for matches */
00610 #define SRCH_UNMARK     3   /* Clear mark bit for matches */
00611 #define STAT_PLAYER     0   /* Display stats for one player or tot objs */
00612 #define STAT_ALL        1   /* Display global stats */
00613 #define STAT_ME         2   /* Display stats for me */
00614 #define SWITCH_DEFAULT  0   /* Use the configured default for switch */
00615 #define SWITCH_ANY      1   /* Execute all cases that match */
00616 #define SWITCH_ONE      2   /* Execute only first case that matches */
00617 #define SWEEP_ME        1   /* Check my inventory */
00618 #define SWEEP_HERE      2   /* Check my location */
00619 #define SWEEP_COMMANDS  4   /* Check for $-commands */
00620 #define SWEEP_LISTEN    8   /* Check for @listen-ers */
00621 #define SWEEP_PLAYER    16  /* Check for players and puppets */
00622 #define SWEEP_CONNECT   32  /* Search for connected players/puppets */
00623 #define SWEEP_EXITS     64  /* Search the exits for audible flags */
00624 #define SWEEP_SCAN      128 /* Scan for pattern matching */
00625 #define SWEEP_VERBOSE   256 /* Display what pattern matches */
00626 #define TELEPORT_DEFAULT 1  /* Emit all messages */
00627 #define TELEPORT_QUIET  2   /* Teleport in quietly */
00628 #define TELEPORT_LIST   4   /* Teleport a list of items */
00629 #define TIMECHK_RESET   1   /* Reset all counters to zero */
00630 #define TIMECHK_SCREEN  2   /* Write info to screen */
00631 #define TIMECHK_LOG     4   /* Write info to log */
00632 #define TOAD_NO_CHOWN   1   /* Don't change ownership */
00633 #define TRIG_QUIET      1   /* Don't display 'Triggered.' message. */
00634 #define TWARP_QUEUE     1   /* Warp the wait and sem queues */
00635 #define TWARP_DUMP      2   /* Warp the dump interval */
00636 #define TWARP_CLEAN     4   /* Warp the cleaning interval */
00637 #define TWARP_IDLE      8   /* Warp the idle check interval */
00638 /* empty       16 */
00639 #define TWARP_EVENTS    32  /* Warp the events checking interval */
00640 #define WAIT_UNTIL      1   // Absolute UTC seconds instead of delta.
00641 
00642 /* Hush codes for movement messages */
00643 
00644 #define HUSH_ENTER      1   /* xENTER/xEFAIL */
00645 #define HUSH_LEAVE      2   /* xLEAVE/xLFAIL */
00646 #define HUSH_EXIT       4   /* xSUCC/xDROP/xFAIL from exits */
00647 
00648 /* Evaluation directives */
00649 
00650 #define EV_FIGNORE      0x00000000  /* Don't look for func if () found */
00651 #define EV_FMAND        0x00000100  /* Text before () must be func name */
00652 #define EV_FCHECK       0x00000200  /* Check text before () for function */
00653 #define EV_STRIP_CURLY  0x00000400  /* Strip one level of brackets */
00654 #define EV_EVAL         0x00000800  /* Evaluate results before returning */
00655 #define EV_STRIP_TS     0x00001000  /* Strip trailing spaces */
00656 #define EV_STRIP_LS     0x00002000  /* Strip leading spaces */
00657 #define EV_STRIP_ESC    0x00004000  /* Strip one level of \ characters */
00658 #define EV_STRIP_AROUND 0x00008000  /* Strip {} only at ends of string */
00659 #define EV_TOP          0x00010000  /* This is a toplevel call to eval() */
00660 #define EV_NOTRACE      0x00020000  /* Don't trace this call to eval */
00661 #define EV_NO_COMPRESS  0x00040000  /* Don't compress spaces. */
00662 #define EV_NO_LOCATION  0x00080000  /* Supresses %l */
00663 #define EV_NOFCHECK     0x00100000  /* Do not evaluate functions! */
00664 
00665 /* Message forwarding directives */
00666 
00667 #define MSG_PUP_ALWAYS  0x00000001UL    /* Always forward msg to puppet owner */
00668 #define MSG_INV         0x00000002UL    /* Forward msg to contents */
00669 #define MSG_INV_L       0x00000004UL    /* ... only if msg passes my @listen */
00670 #define MSG_INV_EXITS   0x00000008UL    /* Forward through my audible exits */
00671 #define MSG_NBR         0x00000010UL    /* Forward msg to neighbors */
00672 #define MSG_NBR_A       0x00000020UL    /* ... only if I am audible */
00673 #define MSG_NBR_EXITS   0x00000040UL    /* Also forward to neighbor exits */
00674 #define MSG_NBR_EXITS_A 0x00000080UL    /* ... only if I am audible */
00675 #define MSG_LOC         0x00000100UL    /* Send to my location */
00676 #define MSG_LOC_A       0x00000200UL    /* ... only if I am audible */
00677 #define MSG_FWDLIST     0x00000400UL    /* Forward to my fwdlist members if aud */
00678 #define MSG_ME          0x00000800UL    /* Send to me */
00679 #define MSG_S_INSIDE    0x00001000UL    /* Originator is inside target */
00680 #define MSG_S_OUTSIDE   0x00002000UL    /* Originator is outside target */
00681 #define MSG_HTML        0x00004000UL    /* Don't send \r\n */
00682 #define MSG_OOC         0x00008000UL    /* Overide visibility rules because it's OOC */
00683 #define MSG_SAYPOSE     0x00010000UL    /* Indicates that the message is speech. */
00684 
00685 #define MSG_ME_ALL      (MSG_ME|MSG_INV_EXITS|MSG_FWDLIST)
00686 #define MSG_F_CONTENTS  (MSG_INV)
00687 #define MSG_F_UP        (MSG_NBR_A|MSG_LOC_A)
00688 #define MSG_F_DOWN      (MSG_INV_L)
00689 
00690 /* Look primitive directives */
00691 
00692 #define LK_IDESC        0x0001
00693 #define LK_OBEYTERSE    0x0002
00694 #define LK_SHOWATTR     0x0004
00695 #define LK_SHOWEXIT     0x0008
00696 #define LK_SHOWVRML     0x0010
00697 
00698 /* Quota types */
00699 //#define QTYPE_ALL       0
00700 //#define QTYPE_ROOM      1
00701 //#define QTYPE_EXIT      2
00702 //#define QTYPE_THING     3
00703 //#define QTYPE_PLAYER    4
00704 
00705 /* Exit visibility precalculation codes */
00706 
00707 #define VE_LOC_XAM      0x01    /* Location is examinable */
00708 #define VE_LOC_DARK     0x02    /* Location is dark */
00709 #define VE_LOC_LIGHT    0x04    /* Location is light */
00710 //#define VE_BASE_XAM     0x08    /* Base location (pre-parent) is examinable */
00711 #define VE_BASE_DARK    0x10    /* Base location (pre-parent) is dark */
00712 //#define VE_BASE_LIGHT   0x20    /* Base location (pre-parent) is light */
00713 
00714 /* Signal handling directives */
00715 
00716 #define SA_EXIT         1   /* Exit, and dump core */
00717 #define SA_DFLT         2   /* Try to restart on a fatal error */
00718 
00719 #define STARTLOG(key,p,s) \
00720     if ((((key) & mudconf.log_options) != 0) && start_log(p, s)) {
00721 #define ENDLOG \
00722     end_log(); }
00723 #define LOG_SIMPLE(key,p,s,m) \
00724     STARTLOG(key,p,s) \
00725         log_text(m); \
00726     ENDLOG
00727 
00728 extern const char *NOMATCH_MESSAGE;
00729 extern const char *AMBIGUOUS_MESSAGE;
00730 extern const char *NOPERM_MESSAGE;
00731 extern const char *FUNC_FAIL_MESSAGE;
00732 extern const char *FUNC_NOMATCH_MESSAGE;
00733 extern const char *OUT_OF_RANGE;
00734 extern const char *FUNC_NOT_FOUND;
00735 extern const char *FUNC_AMBIGUOUS;
00736 extern const char *FUNC_NOPERM_MESSAGE;
00737 
00738 #define safe_nothing(b,p)   safe_copy_buf(FUNC_FAIL_MESSAGE,3,(b),(p))
00739 #define safe_noperm(b,p)    safe_copy_buf(FUNC_NOPERM_MESSAGE,21,(b),(p))
00740 #define safe_nomatch(b,p)   safe_copy_buf(FUNC_NOMATCH_MESSAGE,12,(b),(p))
00741 #define safe_range(b,p)     safe_copy_buf(OUT_OF_RANGE,16,(b),(p))
00742 #define safe_ambiguous(b,p) safe_copy_buf(FUNC_AMBIGUOUS,13,(b),(p))
00743 #define safe_notfound(b,p)  safe_copy_buf(FUNC_NOT_FOUND,13,(b),(p))
00744 
00745 int  ReplaceFile(char *old_name, char *new_name);
00746 void RemoveFile(char *name);
00747 void destroy_player(dbref agent, dbref victim);
00748 void do_pemit_list
00749 (
00750     dbref player,
00751     int key,
00752     bool bDoContents,
00753     int pemit_flags,
00754     char *list,
00755     int chPoseType,
00756     char *message
00757 );
00758 void do_pemit_single
00759 (
00760     dbref player,
00761     int key,
00762     bool bDoContents,
00763     int pemit_flags,
00764     char *recipient,
00765     int chPoseType,
00766     char *message
00767 );
00768 void do_say(dbref executor, dbref caller, dbref enactor, int key,
00769                    char *message);
00770 
00771 int  boot_off(dbref player, const char *message);
00772 void do_mail_clear(dbref player, char *msglist);
00773 void do_mail_purge(dbref player);
00774 void malias_cleanup(dbref player);
00775 void count_mail(dbref player, int folder, int *rcount, int *ucount, int *ccount);
00776 void check_mail_expiration(void);
00777 void check_mail(dbref player, int folder, bool silent);
00778 const char *mail_fetch_message(dbref player, int num);
00779 int  mail_fetch_from(dbref player, int num);
00780 void raw_notify_html(dbref player, const char *msg);
00781 void do_lock(dbref executor, dbref caller, dbref enactor, int key,
00782                     int nargs, char *name, char *keytext);
00783 void check_events(void);
00784 void list_system_resources(dbref player);
00785 
00786 #if defined(WOD_REALMS) || defined(REALITY_LVLS)
00787 
00788 #define ACTION_IS_STATIONARY    0
00789 #define ACTION_IS_MOVING        1
00790 #define ACTION_IS_TALKING       2
00791 #define NUMBER_OF_ACTIONS       3  // A count, n, of the number of possible actions 0...n-1
00792 
00793 #define REALM_DO_NORMALLY_SEEN        1
00794 #define REALM_DO_HIDDEN_FROM_YOU      2
00795 #define REALM_DO_SHOW_OBFDESC         3
00796 #define REALM_DO_SHOW_WRAITHDESC      4
00797 #define REALM_DO_SHOW_UMBRADESC       5
00798 #define REALM_DO_SHOW_MATRIXDESC      6
00799 #define REALM_DO_SHOW_FAEDESC         7
00800 #define REALM_DO_MASK                 7
00801 #define REALM_DISABLE_ADESC           0x00000008L
00802 int DoThingToThingVisibility(dbref looker, dbref lookee, int action_state);
00803 #endif // WOD_REALMS
00804 
00805 typedef struct
00806 {
00807     int    port;
00808     SOCKET socket;
00809 } PortInfo;
00810 
00811 #define MAX_LISTEN_PORTS 10
00812 extern PortInfo aMainGamePorts[MAX_LISTEN_PORTS];
00813 extern int      nMainGamePorts;
00814 
00815 #ifdef WIN32
00816 extern DWORD platform;
00817 #else // WIN32
00818 extern int maxd;
00819 #endif // WIN32
00820 
00821 extern unsigned int ndescriptors;
00822 
00823 extern long DebugTotalFiles;
00824 extern long DebugTotalSockets;
00825 
00826 #ifdef WIN32
00827 extern int game_pid;
00828 extern long DebugTotalThreads;
00829 extern long DebugTotalSemaphores;
00830 extern HANDLE hGameProcess;
00831 typedef BOOL __stdcall FCANCELIO(HANDLE hFile);
00832 typedef BOOL __stdcall FGETPROCESSTIMES(HANDLE hProcess,
00833     LPFILETIME pftCreate, LPFILETIME pftExit, LPFILETIME pftKernel,
00834     LPFILETIME pftUser);
00835 extern FCANCELIO *fpCancelIo;
00836 extern FGETPROCESSTIMES *fpGetProcessTimes;
00837 #else // WIN32
00838 extern pid_t game_pid;
00839 #endif // WIN32
00840 
00841 // From timer.cpp
00842 //
00843 void init_timer(void);
00844 #ifdef WIN32
00845 void Task_FreeDescriptor(void *arg_voidptr, int arg_Integer);
00846 void Task_DeferredClose(void *arg_voidptr, int arg_Integer);
00847 #endif
00848 void dispatch_DatabaseDump(void *pUnused, int iUnused);
00849 void dispatch_FreeListReconstruction(void *pUnused, int iUnused);
00850 void dispatch_IdleCheck(void *pUnused, int iUnused);
00851 void dispatch_CheckEvents(void *pUnused, int iUnused);
00852 #ifndef MEMORY_BASED
00853 void dispatch_CacheTick(void *pUnused, int iUnused);
00854 #endif
00855 
00856 
00857 // Using a heap as the data structure for representing this priority
00858 // has some attributes which we depend on:
00859 //
00860 // 1. Most importantly, actions scheduled for the same time (i.e.,
00861 //    immediately) keep the order that they were inserted into the
00862 //    heap.
00863 //
00864 // If you ever re-implement this object using another data structure,
00865 // please remember to maintain the properties properties.
00866 //
00867 typedef void FTASK(void *, int);
00868 
00869 typedef struct
00870 {
00871     CLinearTimeAbsolute ltaWhen;
00872 
00873     int        iPriority;
00874     int        m_Ticket;        // This is the order in which the task was scheduled.
00875     FTASK      *fpTask;
00876     void       *arg_voidptr;
00877     int        arg_Integer;
00878     int        m_iVisitedMark;
00879 } TASK_RECORD, *PTASK_RECORD;
00880 
00881 #define PRIORITY_SYSTEM  100
00882 #define PRIORITY_PLAYER  200
00883 #define PRIORITY_OBJECT  300
00884 #define PRIORITY_SUSPEND 400
00885 
00886 // CF_DEQUEUE driven minimum priority levels.
00887 //
00888 #define PRIORITY_CF_DEQUEUE_ENABLED  PRIORITY_OBJECT
00889 #define PRIORITY_CF_DEQUEUE_DISABLED (PRIORITY_PLAYER-1)
00890 
00891 typedef int SCHCMP(PTASK_RECORD, PTASK_RECORD);
00892 typedef int SCHLOOK(PTASK_RECORD);
00893 
00894 class CTaskHeap
00895 {
00896 private:
00897     int m_nAllocated;
00898     int m_nCurrent;
00899     PTASK_RECORD *m_pHeap;
00900 
00901     int m_iVisitedMark;
00902 
00903     bool Grow(void);
00904     void SiftDown(int, SCHCMP *);
00905     void SiftUp(int, SCHCMP *);
00906     PTASK_RECORD Remove(int, SCHCMP *);
00907     void Update(int iNode, SCHCMP *pfCompare);
00908     void Sort(SCHCMP *pfCompare);
00909     void Remake(SCHCMP *pfCompare);
00910 
00911 public:
00912     CTaskHeap();
00913     ~CTaskHeap();
00914 
00915     bool Insert(PTASK_RECORD, SCHCMP *);
00916     PTASK_RECORD PeekAtTopmost(void);
00917     PTASK_RECORD RemoveTopmost(SCHCMP *);
00918     void CancelTask(FTASK *fpTask, void *arg_voidptr, int arg_Integer);
00919 
00920 #define IU_DONE        0
00921 #define IU_NEXT_TASK   1
00922 #define IU_REMOVE_TASK 2
00923 #define IU_UPDATE_TASK 3
00924     int TraverseUnordered(SCHLOOK *pfLook, SCHCMP *pfCompare);
00925     int TraverseOrdered(SCHLOOK *pfLook, SCHCMP *pfCompare);
00926 };
00927 
00928 class CScheduler
00929 {
00930 private:
00931     CTaskHeap m_WhenHeap;
00932     CTaskHeap m_PriorityHeap;
00933     int       m_Ticket;
00934     int       m_minPriority;
00935 
00936 public:
00937     void TraverseUnordered(SCHLOOK *pfLook);
00938     void TraverseOrdered(SCHLOOK *pfLook);
00939     CScheduler(void) { m_Ticket = 0; m_minPriority = PRIORITY_CF_DEQUEUE_ENABLED; }
00940     void DeferTask(const CLinearTimeAbsolute& ltWhen, int iPriority, FTASK *fpTask, void *arg_voidptr, int arg_Integer);
00941     void DeferImmediateTask(int iPriority, FTASK *fpTask, void *arg_voidptr, int arg_Integer);
00942     bool WhenNext(CLinearTimeAbsolute *);
00943     int  RunTasks(int iCount);
00944     int  RunAllTasks(void);
00945     int  RunTasks(const CLinearTimeAbsolute& tNow);
00946     void ReadyTasks(const CLinearTimeAbsolute& tNow);
00947     void CancelTask(FTASK *fpTask, void *arg_voidptr, int arg_Integer);
00948 
00949     void SetMinPriority(int arg_minPriority);
00950     int  GetMinPriority(void) { return m_minPriority; }
00951 };
00952 
00953 extern CScheduler scheduler;
00954 
00955 int fetch_cmds(dbref target);
00956 void fetch_ConnectionInfoFields(dbref target, long anFields[4]);
00957 long fetch_ConnectionInfoField(dbref target, int iField);
00958 void put_ConnectionInfoFields
00959 (
00960     dbref target,
00961     long anFields[4],
00962     CLinearTimeAbsolute &ltaLogout
00963 );
00964 
00965 // Added by D.Piper (del@doofer.org) 2000-APR
00966 //
00967 // In order:
00968 //
00969 //     Total online time
00970 //     Longest connection duration
00971 //     Duration of last connection
00972 //     Total number of connections.
00973 //     time (time_t) of last logout.
00974 //
00975 #define CIF_TOTALTIME      0
00976 #define CIF_LONGESTCONNECT 1
00977 #define CIF_LASTCONNECT    2
00978 #define CIF_NUMCONNECTS    3
00979 #define fetch_totaltime(t)      (fetch_ConnectionInfoField((t), CIF_TOTALTIME))
00980 #define fetch_longestconnect(t) (fetch_ConnectionInfoField((t), CIF_LONGESTCONNECT))
00981 #define fetch_lastconnect(t)    (fetch_ConnectionInfoField((t), CIF_LASTCONNECT))
00982 #define fetch_numconnections(t) (fetch_ConnectionInfoField((t), CIF_NUMCONNECTS))
00983 CLinearTimeAbsolute fetch_logouttime(dbref target);
00984 
00985 // From strtod.cpp
00986 //
00987 void FLOAT_Initialize(void);
00988 void mux_FPInit();
00989 void mux_FPSet();
00990 void mux_FPRestore();
00991 double ulp(double);
00992 double mux_strtod(const char *s00, char **se);
00993 char *mux_dtoa(double d, int mode, int ndigits, int *decpt, int *sign,
00994              char **rve);
00995 
00996 // From wiz.cpp
00997 //
00998 extern NAMETAB enable_names[];
00999 
01000 // From version.cpp
01001 //
01002 void build_version(void);
01003 void init_version(void);
01004 
01005 // From player_c.cpp
01006 //
01007 void pcache_sync(void);
01008 void pcache_trim(void);
01009 
01010 // From attrcache.cpp
01011 //
01012 void cache_redirect(void);
01013 void cache_pass2(void);
01014 extern CLinearTimeAbsolute cs_ltime;
01015 
01016 // From speech.cpp
01017 //
01018 char *modSpeech(dbref player, char *message, bool bWhich, char *command);
01019 
01020 // From funceval.cpp
01021 //
01022 void stack_clr(dbref obj);
01023 bool parse_and_get_attrib(dbref, char *[], char **, dbref *, char *, char **);
01024 
01025 #endif // EXTERNS_H

Generated on Mon May 28 04:40:09 2007 for MUX by  doxygen 1.4.7