File: kparser.h

package info (click to toggle)
koala 0.3.2a-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,036 kB
  • ctags: 581
  • sloc: ansic: 29,450; makefile: 1,664; xml: 11
file content (69 lines) | stat: -rw-r--r-- 1,790 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*  @(#) kparser.h 1.9 @(#)  */
/***************************************************************\
*	Copyright (c) 1999-2000 First Step Internet Services, Inc.
*		All Rights Reserved
*
*	Module: Parser
\***************************************************************/

#ifndef _KOALAMUD_PARSER_H
#define _KOALAMUD_PARSER_H "@(#) nitehawk@winghove.1ststep.net|include/kparser.h|20001105044148|05136 @(#)"

#include "koalatypes.h"
#include "module.h"

/* Command structures */
/* Arguments */
typedef struct TAG_ARGUMENT {
	enum {
		ARG_INT,
		ARG_CHAR,
		ARG_DOUBLE,
		ARG_WORD,	/* These three are different */
		ARG_STRING,	/* types of the same */
		ARG_LINE,	/* actual type. */
		ARG_NODEID,
	} argtype;
	union {
		int argint;
	} argdata;
	int strlen;
} argument;

/* Command Pointers */
typedef koalaerror (*commandptr)(pdescriptor player, argument *arglist[]);

/* Keys */
typedef struct TAG_KEY {
	struct TAG_KEY *parent, *child, *next;
	char *keyname;
	int keyid;
} key;

/* Command Entry */
typedef struct TAG_COMMANDENTRY {
	struct TAG_COMMANDENTRY *next;
	char *command;
	commandptr	handler;
	enum {	/* This is partially for sorting in 'commands' */
		CMD_GENERIC,	/* and partially for default handler and/or hooks */
		CMD_SOCIAL,
		CMD_COMM,
		CMD_MODULE,
	} commandtype;
	unsigned numargs;	/* Used to set the bounds of the argument list */
	argument *arglist;
	key *unlock;	/* Null key means anyone can use the command */
	dynmod_t *owner;
} commandentry;
typedef commandentry *pcommandentry;

extern pcommandentry ctablehead;

koalaerror commandparser(pdescriptor desc);
pcommandentry clsearch(char *word, bool matchabbrev);
pcommandentry clsearchnorm(char *word);
pcommandentry clsearchabbrev(char *word);
koalaerror registercommand(pcommandentry cmd, dynmod_t *owner);

#endif