1 /* |
1 /* |
2 Copyright (c) 2013-2014, Santeri Piippo |
2 Copyright (c) 2012-2014, Santeri Piippo |
3 All rights reserved. |
3 All rights reserved. |
4 |
4 |
5 Redistribution and use in source and binary forms, with or without |
5 Redistribution and use in source and binary forms, with or without |
6 modification, are permitted provided that the following conditions are met: |
6 modification, are permitted provided that the following conditions are met: |
7 |
7 |
29 */ |
29 */ |
30 |
30 |
31 #ifndef BOTC_COMMANDS_H |
31 #ifndef BOTC_COMMANDS_H |
32 #define BOTC_COMMANDS_H |
32 #define BOTC_COMMANDS_H |
33 |
33 |
34 #define MAX_MAXARGS 8 |
|
35 #define MAX_ARGNAMELEN 16 |
|
36 |
|
37 #include "main.h" |
34 #include "main.h" |
38 #include "str.h" |
35 #include "str.h" |
39 |
36 |
40 #define ITERATE_COMMANDS(comm) \ |
37 struct command_argument |
41 for (comm = g_CommDef; comm->next != null; comm = comm->next) |
38 { |
42 |
39 type_e type; |
43 struct CommandDef { |
40 string name; |
44 string name; |
41 int defvalue; |
45 int number; |
|
46 int numargs; |
|
47 int maxargs; |
|
48 type_e returnvalue; |
|
49 type_e argtypes[MAX_MAXARGS]; |
|
50 char argnames[MAX_MAXARGS][MAX_ARGNAMELEN]; |
|
51 int defvals[MAX_MAXARGS]; |
|
52 CommandDef* next; |
|
53 }; |
42 }; |
54 |
43 |
55 void ReadCommands (); |
44 struct command_info |
56 CommandDef* FindCommand (string a); |
45 { |
57 string GetCommandPrototype (CommandDef* comm); |
46 string name; |
|
47 int number; |
|
48 int numargs; |
|
49 int maxargs; |
|
50 type_e returnvalue; |
|
51 list<command_argument> args; |
|
52 }; |
58 |
53 |
59 extern CommandDef* g_CommDef; |
54 void init_commands (); |
|
55 command_info* find_command_by_name (string a); |
|
56 string get_command_signature (command_info* comm); |
|
57 const list<command_info*> get_commands(); |
60 |
58 |
61 #endif // BOTC_COMMANDS_H |
59 #endif // BOTC_COMMANDS_H |