mux/src/command.h

Go to the documentation of this file.
00001 // command.h -- declarations used by the command processor.
00002 //
00003 // $Id: command.h,v 1.17 2006/01/07 23:46:32 sdennis Exp $
00004 //
00005 
00006 #ifndef __COMMAND_H
00007 #define __COMMAND_H
00008 
00009 #define CMD_NO_ARG(name)              extern void name(dbref executor, dbref caller, dbref enactor, int)
00010 #define CMD_ONE_ARG(name)             extern void name(dbref executor, dbref caller, dbref enactor, int, char *)
00011 #define CMD_ONE_ARG_CMDARG(name)      extern void name(dbref executor, dbref caller, dbref enactor, int, char *, char *[], int)
00012 #define CMD_TWO_ARG(name)             extern void name(dbref executor, dbref caller, dbref enactor, int, int, char *, char *)
00013 #define CMD_TWO_ARG_CMDARG(name)      extern void name(dbref executor, dbref caller, dbref enactor, int, char *, char *, char*[], int)
00014 #define CMD_TWO_ARG_ARGV(name)        extern void name(dbref executor, dbref caller, dbref enactor, int, char *, char *[], int)
00015 #define CMD_TWO_ARG_ARGV_CMDARG(name) extern void name(dbref executor, dbref caller, dbref enactor, int, char *, char *[], int, char*[], int)
00016 
00017 /* Command function handlers */
00018 /* from comsys.c */
00019 
00020 CMD_TWO_ARG(do_cemit);          /* channel emit */
00021 CMD_TWO_ARG(do_chboot);         /* channel boot */
00022 CMD_TWO_ARG(do_editchannel);    /* edit a channel */
00023 CMD_ONE_ARG(do_checkchannel);   /* check a channel */
00024 CMD_ONE_ARG(do_createchannel);  /* create a channel */
00025 CMD_ONE_ARG(do_destroychannel); /* destroy a channel */
00026 CMD_TWO_ARG(do_edituser);       /* edit a channel user */
00027 CMD_ONE_ARG(do_chanlist);        /* gives a channel listing */
00028 CMD_TWO_ARG(do_chopen);         /* opens a channel */
00029 CMD_ONE_ARG(do_channelwho);     /* who's on a channel */
00030 CMD_TWO_ARG(do_addcom);         /* adds a comalias */
00031 CMD_ONE_ARG(do_allcom);         /* on, off, who, all aliases */
00032 CMD_ONE_ARG(do_comlist);         /* channel who by alias */
00033 CMD_TWO_ARG(do_comtitle);       /* sets a title on a channel */
00034 //CMD_NO_ARG(do_clearcom);      /* clears all comaliases */
00035 CMD_ONE_ARG(do_delcom);         /* deletes a comalias */
00036 
00037 /* from mail.c */
00038 
00039 CMD_TWO_ARG(do_mail);           /* mail command */
00040 CMD_TWO_ARG(do_malias);         /* mail alias command */
00041 CMD_ONE_ARG(do_prepend);
00042 CMD_ONE_ARG(do_postpend);
00043 
00044 CMD_ONE_ARG_CMDARG(do_apply_marked);    /* Apply command to marked objects */
00045 CMD_TWO_ARG(do_admin);          /* Change config parameters */
00046 CMD_TWO_ARG(do_alias);          /* Change the alias of something */
00047 CMD_TWO_ARG(do_attribute);      /* Manage user-named attributes */
00048 CMD_ONE_ARG(do_boot);           /* Force-disconnect a player */
00049 CMD_TWO_ARG(do_chown);          /* Change object or attribute owner */
00050 CMD_TWO_ARG(do_chownall);       /* Give away all of someone's objs */
00051 CMD_TWO_ARG(do_chzone);         /* Change an object's zone. */
00052 CMD_TWO_ARG(do_clone);          /* Create a copy of an object */
00053 CMD_NO_ARG(do_comment);         /* Ignore argument and do nothing */
00054 CMD_TWO_ARG_ARGV(do_cpattr);    /* Copy attributes */
00055 CMD_TWO_ARG(do_create);         /* Create a new object */
00056 CMD_ONE_ARG(do_cut);            /* Truncate contents or exits list */
00057 CMD_NO_ARG(do_dbck);            /* Consistency check */
00058 CMD_TWO_ARG(do_decomp);         /* Reproduce commands to recreate obj */
00059 CMD_ONE_ARG(do_destroy);        /* Destroy an object */
00060 CMD_TWO_ARG_ARGV(do_dig);       /* Dig a new room */
00061 CMD_ONE_ARG(do_doing);          /* Set doing string in WHO report */
00062 CMD_TWO_ARG_CMDARG(do_dolist);  /* Iterate command on list members */
00063 CMD_ONE_ARG(do_drop);           /* Drop an object */
00064 CMD_NO_ARG(do_dump);            /* Dump the database */
00065 CMD_TWO_ARG_ARGV(do_edit);      /* Edit one or more attributes */
00066 CMD_ONE_ARG(do_enter);          /* Enter an object */
00067 CMD_ONE_ARG(do_entrances);      /* List exits and links to loc */
00068 CMD_ONE_ARG(do_examine);        /* Examine an object */
00069 CMD_ONE_ARG(do_find);           /* Search for name in database */
00070 CMD_TWO_ARG(do_fixdb);          /* Database repair functions */
00071 CMD_TWO_ARG_CMDARG(do_force);   /* Force someone to do something */
00072 CMD_ONE_ARG_CMDARG(do_force_prefixed);  /* #<num> <cmd> variant of FORCE */
00073 CMD_TWO_ARG(do_forwardlist);    // Set a forwardlist on something
00074 CMD_TWO_ARG(do_function);       /* Make user-def global function */
00075 CMD_ONE_ARG(do_get);            /* Get an object */
00076 CMD_TWO_ARG(do_give);           /* Give something away */
00077 CMD_ONE_ARG(do_global);         /* Enable/disable global flags */
00078 CMD_ONE_ARG(do_halt);           /* Remove commands from the queue */
00079 CMD_ONE_ARG(do_help);           /* Print info from help files */
00080 CMD_TWO_ARG_ARGV_CMDARG(do_if); // Execute cmd based on truth of expression
00081 CMD_NO_ARG(do_inventory);       /* Print what I am carrying */
00082 CMD_TWO_ARG(do_prog);           /* Interactive input */
00083 CMD_ONE_ARG(do_quitprog);       /* Quits @prog */
00084 CMD_TWO_ARG(do_kill);           /* Kill something */
00085 CMD_ONE_ARG(do_last);           /* Get recent login info */
00086 CMD_NO_ARG(do_leave);           /* Leave the current object */
00087 CMD_TWO_ARG(do_link);           /* Set home, dropto, or dest */
00088 CMD_ONE_ARG(do_list);           /* List contents of internal tables */
00089 CMD_ONE_ARG(do_list_file);      /* List contents of message files */
00090 CMD_TWO_ARG(do_lock);           /* Set a lock on an object */
00091 CMD_TWO_ARG(do_log);            /* Extra logging routine */
00092 CMD_ONE_ARG(do_look);           /* Look here or at something */
00093 CMD_NO_ARG(do_markall);         /* Mark or unmark all objects */
00094 CMD_ONE_ARG(do_motd);           /* Set/list MOTD messages */
00095 CMD_ONE_ARG(do_move);           /* Move about using exits */
00096 CMD_TWO_ARG_ARGV(do_mvattr);    /* Move attributes on object */
00097 CMD_TWO_ARG(do_name);           /* Change the name of something */
00098 CMD_TWO_ARG(do_newpassword);    /* Change passwords */
00099 CMD_TWO_ARG(do_notify);         /* Notify or drain semaphore */
00100 CMD_TWO_ARG_ARGV(do_open);      /* Open an exit */
00101 CMD_TWO_ARG(do_page);           /* Send message to faraway player */
00102 CMD_TWO_ARG(do_parent);         /* Set parent field */
00103 CMD_TWO_ARG(do_password);       /* Change my password */
00104 CMD_TWO_ARG(do_pcreate);        /* Create new characters */
00105 CMD_TWO_ARG(do_pemit);          /* Messages to specific player */
00106 CMD_ONE_ARG(do_poor);           /* Reduce wealth of all players */
00107 CMD_TWO_ARG(do_power);          /* Sets powers */
00108 CMD_ONE_ARG(do_ps);             /* List contents of queue */
00109 CMD_ONE_ARG(do_queue);          /* Force queue processing */
00110 CMD_TWO_ARG(do_quota);          /* Set or display quotas */
00111 CMD_NO_ARG(do_readcache);       /* Reread text file cache */
00112 CMD_NO_ARG(do_restart);         /* Restart the game. */
00113 CMD_NO_ARG(do_backup);          /* Backup the database and restart */
00114 CMD_ONE_ARG(do_say);            /* Messages to all */
00115 CMD_NO_ARG(do_score);           /* Display my wealth */
00116 CMD_ONE_ARG(do_search);         /* Search for objs matching criteria */
00117 CMD_TWO_ARG(do_set);            /* Set flags or attributes */
00118 CMD_TWO_ARG(do_setattr);        /* Set object attribute */
00119 CMD_TWO_ARG(do_setvattr);       /* Set variable attribute */
00120 CMD_ONE_ARG(do_shout);          /* Messages to all */
00121 CMD_ONE_ARG(do_shutdown);       /* Stop the game */
00122 CMD_ONE_ARG(do_stats);          /* Display object type breakdown */
00123 CMD_ONE_ARG(do_sweep);          /* Check for listeners */
00124 CMD_TWO_ARG_ARGV_CMDARG(do_switch); /* Execute cmd based on match */
00125 CMD_TWO_ARG(do_teleport);       /* Teleport elsewhere */
00126 CMD_ONE_ARG(do_think);          /* Think command */
00127 CMD_NO_ARG(do_timecheck);       /* Check time used by objects */
00128 CMD_ONE_ARG(do_timewarp);       /* Warp various timers */
00129 CMD_TWO_ARG(do_toad);           /* Turn a tinyjerk into a tinytoad */
00130 CMD_TWO_ARG_ARGV(do_trigger);   /* Trigger an attribute */
00131 CMD_ONE_ARG(do_unlock);         /* Remove a lock from an object */
00132 CMD_ONE_ARG(do_unlink);         /* Unlink exit or remove dropto */
00133 CMD_ONE_ARG(do_use);            /* Use object */
00134 CMD_NO_ARG(do_version);         /* List MUX version number */
00135 CMD_NO_ARG(do_report);          /* Do player/game statistics report */
00136 CMD_TWO_ARG_ARGV(do_verb);      /* Execute a user-created verb */
00137 CMD_TWO_ARG_CMDARG(do_wait);    /* Perform command after a wait */
00138 #ifdef QUERY_SLAVE
00139 CMD_TWO_ARG_CMDARG(do_query);   /* Generic external queries (e.g., SQL) */
00140 #endif // QUERY_SLAVE
00141 CMD_ONE_ARG(do_wipe);           /* Mass-remove attrs from obj */
00142 CMD_NO_ARG(do_dbclean);         /* Remove stale vattr entries */
00143 CMD_TWO_ARG(do_addcommand);     /* Add or replace a global command */
00144 CMD_TWO_ARG(do_delcommand);     /* Delete an added global command */
00145 CMD_ONE_ARG(do_listcommands);   /* List added global commands */
00146 CMD_ONE_ARG(do_break);          /* Stop evaluating an action list */
00147 #ifdef REALITY_LVLS
00148 CMD_TWO_ARG(do_rxlevel);        /* set Rx Levels */
00149 CMD_TWO_ARG(do_txlevel);        /* set Tx Levels */
00150 #endif
00151 CMD_TWO_ARG_ARGV(do_icmd);      // Disable commands on a player or room
00152 CMD_ONE_ARG(do_hook);           // Set additional operations for a command
00153 CMD_TWO_ARG(do_flag);           // Rename a flag or remove flag aliases
00154 CMD_ONE_ARG(do_train);          // Display code to room, then execute
00155 CMD_TWO_ARG(do_moniker);        // Set accented, colorized name of object
00156 
00157 typedef struct
00158 {
00159     char    *cmdname;
00160     NAMETAB *switches;
00161     int     perms;
00162     int     extra;
00163     int     callseq;
00164     int     hookmask;
00165     void    (*handler)(dbref executor, dbref caller, dbref enactor, int);
00166 } CMDENT_NO_ARG;
00167 
00168 typedef struct
00169 {
00170     char    *cmdname;
00171     NAMETAB *switches;
00172     int     perms;
00173     int     extra;
00174     int     callseq;
00175     int     hookmask;
00176     void    (*handler)(dbref executor, dbref caller, dbref enactor, int, char *);
00177 } CMDENT_ONE_ARG;
00178 
00179 typedef struct
00180 {
00181     char    *cmdname;
00182     NAMETAB *switches;
00183     int     perms;
00184     int     extra;
00185     int     callseq;
00186     int     hookmask;
00187     void    (*handler)(dbref executor, dbref caller, dbref enactor, int, char *, char *[], int);
00188 } CMDENT_ONE_ARG_CMDARG;
00189 
00190 typedef struct
00191 {
00192     char    *cmdname;
00193     NAMETAB *switches;
00194     int     perms;
00195     int     extra;
00196     int     callseq;
00197     int     hookmask;
00198     void    (*handler)(dbref executor, dbref caller, dbref enactor, int, int, char *, char *);
00199 } CMDENT_TWO_ARG;
00200 
00201 typedef struct
00202 {
00203     char    *cmdname;
00204     NAMETAB *switches;
00205     int     perms;
00206     int     extra;
00207     int     callseq;
00208     int     hookmask;
00209     void    (*handler)(dbref executor, dbref caller, dbref enactor, int, char *, char *, char*[], int);
00210 } CMDENT_TWO_ARG_CMDARG;
00211 
00212 typedef struct
00213 {
00214     char    *cmdname;
00215     NAMETAB *switches;
00216     int     perms;
00217     int     extra;
00218     int     callseq;
00219     int     hookmask;
00220     void    (*handler)(dbref executor, dbref caller, dbref enactor, int, char *, char *[], int);
00221 } CMDENT_TWO_ARG_ARGV;
00222 
00223 typedef struct
00224 {
00225     char    *cmdname;
00226     NAMETAB *switches;
00227     int     perms;
00228     int     extra;
00229     int     callseq;
00230     int     hookmask;
00231     void    (*handler)(dbref executor, dbref caller, dbref enactor, int,
00232                        char *, char *[], int, char*[], int);
00233 } CMDENT_TWO_ARG_ARGV_CMDARG;
00234 
00235 typedef struct addedentry ADDENT;
00236 struct addedentry
00237 {
00238     dbref   thing;
00239     int     atr;
00240     char    *name;
00241     struct addedentry *next;
00242 };
00243 
00244 typedef struct
00245 {
00246     char    *cmdname;
00247     NAMETAB *switches;
00248     int     perms;
00249     int     extra;
00250     int     callseq;
00251     int     hookmask;
00252     union
00253     {
00254         void (*handler)(void);
00255         ADDENT *addent;
00256     };
00257 } CMDENT;
00258 
00259 void commands_no_arg_add(CMDENT_NO_ARG cmdent[]);
00260 void commands_one_arg_add(CMDENT_ONE_ARG cmdent[]);
00261 void commands_one_arg_cmdarg_add(CMDENT_ONE_ARG_CMDARG cmdent[]);
00262 void commands_two_arg_add(CMDENT_TWO_ARG cmdent[]);
00263 void commands_two_arg_cmdarg_add(CMDENT_TWO_ARG_CMDARG cmdent[]);
00264 void commands_two_arg_argv_add(CMDENT_TWO_ARG_ARGV cmdent[]);
00265 void commands_two_arg_argv_cmdarg_add(CMDENT_TWO_ARG_ARGV_CMDARG cmdent[]);
00266 void init_cmdtab(void);
00267 
00268 extern NAMETAB access_nametab[];
00269 extern NAMETAB attraccess_nametab[];
00270 extern NAMETAB indiv_attraccess_nametab[];
00271 extern NAMETAB lock_sw[];
00272 extern NAMETAB logoptions_nametab[];
00273 extern NAMETAB logdata_nametab[];
00274 extern NAMETAB list_names[];
00275 
00276 /* Command handler call conventions */
00277 
00278 #define CS_NO_ARGS    0x0000    /* No arguments */
00279 #define CS_ONE_ARG    0x0001    /* One argument */
00280 #define CS_TWO_ARG    0x0002    /* Two arguments */
00281 #define CS_NARG_MASK  0x0003    /* Argument count mask */
00282 #define CS_ARGV       0x0004    /* ARG2 is in ARGV form */
00283 #define CS_INTERP     0x0010    /* Interpret ARG2 if 2 args, ARG1 if 1 */
00284 #define CS_NOINTERP   0x0020    /* Never interp ARG2 if 2 or ARG1 if 1 */
00285 #define CS_CAUSE      0x0040    /* Pass cause to old command handler */
00286 #define CS_UNPARSE    0x0080    /* Pass unparsed cmd to old-style handler */
00287 #define CS_CMDARG     0x0100    /* Pass in given command args */
00288 #define CS_STRIP      0x0200    /* Strip braces even when not interpreting */
00289 #define CS_STRIP_AROUND 0x0400  /* Strip braces around entire string only */
00290 #define CS_ADDED      0x0800    /* Command has been added by @addcommand */
00291 #define CS_LEADIN     0x1000    /* Command is a single-letter lead-in */
00292 #define CS_NOSQUISH   0x4000    // Do not space-compress.
00293 
00294 /* Command permission flags */
00295 
00296 #define CA_PUBLIC     0x00000000  /* No access restrictions */
00297 #define CA_GOD        0x00000001  /* GOD only... */
00298 #define CA_WIZARD     0x00000002  /* Wizards only */
00299 #define CA_BUILDER    0x00000004  /* Builders only */
00300 #define CA_IMMORTAL   0x00000008  /* Immortals only */
00301 #define CA_STAFF      0x00000010  /* Must have STAFF flag */
00302 #define CA_HEAD       0x00000020  /* Must have HEAD flag */
00303 //#define CA_SQL_OK     0x00000040  /* Must have SQL_OK power */
00304 #define CA_ADMIN      0x00000080  /* Wizard or royal */
00305 #define CA_ROBOT      0x00000100  /* Robots only */
00306 #define CA_ANNOUNCE   0x00000200  /* Announce Power */
00307 #define CA_UNINS      0x00000400  /* Uninspected players ONLY */
00308 #define CA_MUSTBE_MASK  (CA_GOD|CA_WIZARD|CA_BUILDER|CA_IMMORTAL|CA_STAFF|CA_HEAD|CA_ADMIN|CA_ROBOT|CA_ANNOUNCE|CA_UNINS)
00309 
00310 #define CA_NO_HAVEN   0x00001000  /* Not by HAVEN players */
00311 #define CA_NO_ROBOT   0x00002000  /* Not by ROBOT players */
00312 #define CA_NO_SLAVE   0x00004000  /* Not by SLAVE players */
00313 #define CA_NO_SUSPECT 0x00008000  /* Not by SUSPECT players */
00314 #define CA_NO_GUEST   0x00010000  /* Not by GUEST players */
00315 #define CA_NO_UNINS   0x00020000  /* Not by UNINSPECTED players */
00316 #define CA_CANTBE_MASK (CA_NO_HAVEN|CA_NO_ROBOT|CA_NO_SLAVE|CA_NO_SUSPECT|CA_NO_GUEST|CA_NO_UNINS)
00317 
00318 #define CA_MARKER0    0x00002000
00319 #define CA_MARKER1    0x00004000
00320 #define CA_MARKER2    0x00008000
00321 #define CA_MARKER3    0x00010000
00322 #define CA_MARKER4    0x00020000
00323 #define CA_MARKER5    0x00040000
00324 #define CA_MARKER6    0x00080000
00325 #define CA_MARKER7    0x00100000
00326 #define CA_MARKER8    0x00200000
00327 #define CA_MARKER9    0x00400000
00328 
00329 #define CA_GBL_BUILD  0x00800000  /* Requires the global BUILDING flag */
00330 #define CA_GBL_INTERP 0x01000000  /* Requires the global INTERP flag */
00331 #define CA_DISABLED   0x02000000  /* Command completely disabled */
00332 #define CA_STATIC     0x04000000  /* Cannot be changed at runtime */
00333 #define CA_NO_DECOMP  0x08000000  /* Don't include in @decompile */
00334 
00335 #define CA_LOCATION   0x10000000  /* Invoker must have location */
00336 #define CA_CONTENTS   0x20000000  /* Invoker must have contents */
00337 #define CA_PLAYER     0x40000000  /* Invoker must be a player */
00338 #define CF_DARK       0x80000000  /* Command doesn't show up in list */
00339 
00340 #define SW_MULTIPLE   0x80000000  /* This sw may be spec'd w/others */
00341 #define SW_GOT_UNIQUE 0x40000000  /* Already have a unique option */
00342 #define SW_NOEVAL     0x20000000  /* Don't parse args before calling */
00343                                   /* handler (typically via a switch */
00344                                   /* alias) */
00345 #endif // !__COMMAND_H

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