PennMUSH Community
Show
Ignore:
Timestamp:
12/28/07 19:57:17 (1 year ago)
Author:
shawnw
Message:

Merge devel into trunk for p6 release

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/trunk/hdrs/command.h

    r919 r1167  
    22#define __COMMAND_H 
    33 
    4 #define NUM_BYTES 20 
    5 typedef unsigned char switch_mask[NUM_BYTES]; 
     4 
     5typedef uint8_t *switch_mask; 
     6extern int switch_bytes; 
     7#define SW_ALLOC()      mush_calloc(switch_bytes, 1, "cmd.switch.vector"); 
     8#define SW_FREE(s)      mush_free((s), "cmd.switch.vector"); 
    69#define SW_SET(m,n)     (m[(n) >> 3] |= (1 << ((n) & 0x7))) 
    710#define SW_CLR(m,n)     (m[(n) >> 3] &= ~(1 << ((n) & 0x7))) 
    811#define SW_ISSET(m,n)   (m[(n) >> 3] & (1 << ((n) & 0x7))) 
    9 #define SW_ZERO(m)      memset(m, 0, NUM_BYTES) 
     12bool SW_BY_NAME(switch_mask, const char *); 
     13#define SW_ZERO(m)      memset(m, 0, switch_bytes) 
     14#define SW_COPY(new,old) memcpy((new), (old), switch_bytes) 
    1015 
    1116/* These are type restrictors */ 
     
    129134  object_flag_type flagmask;    /**< Flags to which the command is restricted */ 
    130135  object_flag_type powers;      /**< Powers to which the command is restricted */ 
    131   switch_mask sw;       /**< Bitflags of switches this command can take */ 
     136  /** Switches for this command. */ 
     137  union { 
     138    switch_mask mask;       /**< Bitflags of switches this command can take */ 
     139    const char *names; /**< Space-seperated list of switches */ 
     140  } sw; 
    132141  /** Hooks on this command. 
    133142   */ 
     
    189198#include "switches.h" 
    190199 
    191 extern switch_mask *switchmask(const char *switches); 
    192 extern COMMAND_INFO *command_find(const char *name); 
    193 extern COMMAND_INFO *command_find_exact(const char *name); 
    194 extern COMMAND_INFO *command_add 
     200switch_mask switchmask(const char *switches); 
     201COMMAND_INFO *command_find(const char *name); 
     202COMMAND_INFO *command_find_exact(const char *name); 
     203COMMAND_INFO *command_add 
    195204  (const char *name, int type, const char *flagstr, const char *powers, 
    196205   const char *switchstr, command_func func); 
    197 extern COMMAND_INFO *make_command 
     206COMMAND_INFO *make_command 
    198207  (const char *name, int type, object_flag_type flagmask, 
    199    object_flag_type powers, switch_mask *sw, command_func func); 
    200 extern COMMAND_INFO *command_modify(const char *name, int type, 
    201                                     object_flag_type flagmask, 
    202                                     object_flag_type powers, switch_mask *sw, 
    203                                     command_func func); 
    204 extern void reserve_alias(const char *a); 
    205 extern int alias_command(const char *command, const char *alias); 
    206 extern void command_init_preconfig(void); 
    207 extern void command_init_postconfig(void); 
    208 extern void command_splitup 
     208   object_flag_type powers, const char *sw, command_func func); 
     209COMMAND_INFO *command_modify(const char *name, int type, 
     210                             object_flag_type flagmask, 
     211                             object_flag_type powers, switch_mask sw, 
     212                             command_func func); 
     213void reserve_alias(const char *a); 
     214int alias_command(const char *command, const char *alias); 
     215void command_init_preconfig(void); 
     216void command_init_postconfig(void); 
     217void command_splitup 
    209218  (dbref player, dbref cause, char *from, char *to, char **args, 
    210219   COMMAND_INFO *cmd, int side); 
    211 extern void command_argparse 
     220void command_argparse 
    212221  (dbref player, dbref cause, char **from, char *to, char **argv, 
    213222   COMMAND_INFO *cmd, int side, int forcenoparse); 
    214 extern char *command_parse 
    215   (dbref player, dbref cause, char *string, int fromport); 
    216 extern void do_list_commands(dbref player, int lc); 
    217 extern char *list_commands(void); 
    218 extern int command_check_byname(dbref player, const char *name); 
    219 extern int restrict_command(const char *name, const char *restriction); 
    220 extern void reserve_aliases(void); 
    221 extern void local_commands(void); 
    222 extern void do_command_add(dbref player, char *name, int flags); 
    223 extern void do_command_delete(dbref player, char *name); 
     223char *command_parse(dbref player, dbref cause, char *string, int fromport); 
     224void do_list_commands(dbref player, int lc); 
     225char *list_commands(void); 
     226int command_check_byname(dbref player, const char *name); 
     227int restrict_command(const char *name, const char *restriction); 
     228void reserve_aliases(void); 
     229void local_commands(void); 
     230void do_command_add(dbref player, char *name, int flags); 
     231void do_command_delete(dbref player, char *name); 
    224232 
    225233