interpreter.h
1 /* ************************************************************************ 2 * File: interpreter.h Part of CircleMUD * 3 * Usage: header file: public procs, macro defs, subcommand defines * 4 * * 5 * All rights reserved. See license.doc for complete information. * 6 * * 7 * Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * 8 * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * 9 ************************************************************************ */ 10 11 #define ACMD(name) \ 12 void name(struct char_data *ch, char *argument, int cmd, int subcmd) 13 14 ACMD(do_move); 15 16 #define CMD_NAME (cmd_info[cmd].command) 17 #define CMD_IS(cmd_name) (!strcmp(cmd_name, cmd_info[cmd].command)) 18 #define IS_MOVE(cmdnum) (cmd_info[cmdnum].command_pointer == do_move) 19 20 void command_interpreter(struct char_data *ch, char *argument); 21 int search_block(char *arg, const char **list, int exact); 22 char lower( char c ); 23 char *one_argument(char *argument, char *first_arg); 24 char *one_word(char *argument, char *first_arg); 25 char *any_one_arg(char *argument, char *first_arg); 26 char *two_arguments(char *argument, char *first_arg, char *second_arg); 27 int fill_word(char *argument); 28 void half_chop(char *string, char *arg1, char *arg2); 29 void nanny(struct descriptor_data *d, char *arg); 30 int is_abbrev(const char *arg1, const char *arg2); 31 int is_number(const char *str); 32 int find_command(const char *command); 33 void skip_spaces(char **string); 34 char *delete_doubledollar(char *string); 35 36 /* for compatibility with 2.20: */ 37 #define argument_interpreter(a, b, c) two_arguments(a, b, c) 38 39 40 struct command_info { 41 const char *command; 42 byte minimum_position; 43 void (*command_pointer) 44 (struct char_data *ch, char *argument, int cmd, int subcmd); 45 sh_int minimum_level; 46 int subcmd; 47 }; 48 49 /* 50 * Necessary for CMD_IS macro. Borland needs the structure defined first 51 * so it has been moved down here. 52 */ 53 #ifndef __INTERPRETER_C__ 54 extern const struct command_info cmd_info[]; 55 #endif 56 57 /* 58 * Alert! Changed from 'struct alias' to 'struct alias_data' in bpl15 59 * because a Windows 95 compiler gives a warning about it having similiar 60 * named member. 61 */ 62 struct alias_data { 63 char *alias; 64 char *replacement; 65 int type; 66 struct alias_data *next; 67 }; 68 69 #define ALIAS_SIMPLE 0 70 #define ALIAS_COMPLEX 1 71 72 #define ALIAS_SEP_CHAR ';' 73 #define ALIAS_VAR_CHAR '$' 74 #define ALIAS_GLOB_CHAR '*' 75 76 /* 77 * SUBCOMMANDS 78 * You can define these however you want to, and the definitions of the 79 * subcommands are independent from function to function. 80 */ 81 82 /* directions */ 83 #define SCMD_NORTH 1 84 #define SCMD_EAST 2 85 #define SCMD_SOUTH 3 86 #define SCMD_WEST 4 87 #define SCMD_UP 5 88 #define SCMD_DOWN 6 89 90 /* do_gen_ps */ 91 #define SCMD_INFO 0 92 #define SCMD_HANDBOOK 1 93 #define SCMD_CREDITS 2 94 #define SCMD_NEWS 3 95 #define SCMD_WIZLIST 4 96 #define SCMD_POLICIES 5 97 #define SCMD_VERSION 6 98 #define SCMD_IMMLIST 7 99 #define SCMD_MOTD 8 100 #define SCMD_IMOTD 9 101 #define SCMD_CLEAR 10 102 #define SCMD_WHOAMI 11 103 104 /* do_gen_tog */ 105 #define SCMD_NOSUMMON 0 106 #define SCMD_NOHASSLE 1 107 #define SCMD_BRIEF 2 108 #define SCMD_COMPACT 3 109 #define SCMD_NOTELL 4 110 #define SCMD_NOAUCTION 5 111 #define SCMD_DEAF 6 112 #define SCMD_NOGOSSIP 7 113 #define SCMD_NOGRATZ 8 114 #define SCMD_NOWIZ 9 115 #define SCMD_QUEST 10 116 #define SCMD_ROOMFLAGS 11 117 #define SCMD_NOREPEAT 12 118 #define SCMD_HOLYLIGHT 13 119 #define SCMD_SLOWNS 14 120 #define SCMD_AUTOEXIT 15 121 #define SCMD_TRACK 16 122 123 /* do_wizutil */ 124 #define SCMD_REROLL 0 125 #define SCMD_PARDON 1 126 #define SCMD_NOTITLE 2 127 #define SCMD_SQUELCH 3 128 #define SCMD_FREEZE 4 129 #define SCMD_THAW 5 130 #define SCMD_UNAFFECT 6 131 132 /* do_spec_com */ 133 #define SCMD_WHISPER 0 134 #define SCMD_ASK 1 135 136 /* do_gen_com */ 137 #define SCMD_HOLLER 0 138 #define SCMD_SHOUT 1 139 #define SCMD_GOSSIP 2 140 #define SCMD_AUCTION 3 141 #define SCMD_GRATZ 4 142 143 /* do_shutdown */ 144 #define SCMD_SHUTDOW 0 145 #define SCMD_SHUTDOWN 1 146 147 /* do_quit */ 148 #define SCMD_QUI 0 149 #define SCMD_QUIT 1 150 151 /* do_date */ 152 #define SCMD_DATE 0 153 #define SCMD_UPTIME 1 154 155 /* do_commands */ 156 #define SCMD_COMMANDS 0 157 #define SCMD_SOCIALS 1 158 #define SCMD_WIZHELP 2 159 160 /* do_drop */ 161 #define SCMD_DROP 0 162 #define SCMD_JUNK 1 163 #define SCMD_DONATE 2 164 165 /* do_gen_write */ 166 #define SCMD_BUG 0 167 #define SCMD_TYPO 1 168 #define SCMD_IDEA 2 169 170 /* do_look */ 171 #define SCMD_LOOK 0 172 #define SCMD_READ 1 173 174 /* do_qcomm */ 175 #define SCMD_QSAY 0 176 #define SCMD_QECHO 1 177 178 /* do_pour */ 179 #define SCMD_POUR 0 180 #define SCMD_FILL 1 181 182 /* do_poof */ 183 #define SCMD_POOFIN 0 184 #define SCMD_POOFOUT 1 185 186 /* do_hit */ 187 #define SCMD_HIT 0 188 #define SCMD_MURDER 1 189 190 /* do_eat */ 191 #define SCMD_EAT 0 192 #define SCMD_TASTE 1 193 #define SCMD_DRINK 2 194 #define SCMD_SIP 3 195 196 /* do_use */ 197 #define SCMD_USE 0 198 #define SCMD_QUAFF 1 199 #define SCMD_RECITE 2 200 201 /* do_echo */ 202 #define SCMD_ECHO 0 203 #define SCMD_EMOTE 1 204 205 /* do_gen_door */ 206 #define SCMD_OPEN 0 207 #define SCMD_CLOSE 1 208 #define SCMD_UNLOCK 2 209 #define SCMD_LOCK 3 210 #define SCMD_PICK 4