1 | #ifndef MAD_CMD_H |
---|
2 | #define MAD_CMD_H |
---|
3 | |
---|
4 | // types |
---|
5 | |
---|
6 | struct name_list; |
---|
7 | struct command_parameter_list; |
---|
8 | |
---|
9 | struct command /* holds one command */ |
---|
10 | { |
---|
11 | char name[NAME_L]; |
---|
12 | char module[NAME_L]; /* name of module it belongs to */ |
---|
13 | char group[NAME_L]; /* command group it belongs to */ |
---|
14 | int stamp; |
---|
15 | int link_type; /* 0 none, 1 start, 2 end of group */ |
---|
16 | int mad8_type; /* 0 none, else mad-8 element code */ |
---|
17 | int beam_def; /* beam commands: 1 if defined */ |
---|
18 | struct name_list* par_names; /* names + input flag of parameters */ |
---|
19 | struct command_parameter_list* par; /* parameter pointer list */ |
---|
20 | }; |
---|
21 | |
---|
22 | struct command_list /* contains list of command pointers sorted by name */ |
---|
23 | { |
---|
24 | char name[NAME_L]; |
---|
25 | int max, /* max. pointer array size */ |
---|
26 | curr; /* current occupation */ |
---|
27 | struct name_list* list; /* index list of names */ |
---|
28 | int stamp; |
---|
29 | struct command** commands; /* command pointer list */ |
---|
30 | }; |
---|
31 | |
---|
32 | struct command_list_list /* contains list of command lists */ |
---|
33 | { |
---|
34 | char name[NAME_L]; |
---|
35 | int max, /* max. pointer array size */ |
---|
36 | curr; /* current occupation */ |
---|
37 | struct name_list* list; /* index list of names */ |
---|
38 | struct command_list** command_lists; /* command_list pointer list */ |
---|
39 | int stamp; |
---|
40 | }; |
---|
41 | |
---|
42 | // interface |
---|
43 | |
---|
44 | struct command* new_command(char* name, int nl_length, int pl_length, char* module, char* group, int link, int mad_8); |
---|
45 | struct command* delete_command(struct command*); |
---|
46 | struct command* clone_command(struct command*); |
---|
47 | struct command* find_command(char* name, struct command_list*); |
---|
48 | |
---|
49 | struct command_list* new_command_list(char* l_name, int length); |
---|
50 | struct command_list* delete_command_list(struct command_list* cl); |
---|
51 | struct command_list* find_command_list(char* name, struct command_list_list*); |
---|
52 | void grow_command_list(struct command_list*); |
---|
53 | void add_to_command_list(char* label, struct command*, struct command_list*, int flag); |
---|
54 | |
---|
55 | struct command_list_list* new_command_list_list(int length); |
---|
56 | //struct command_list_list* delete_command_list_list(struct command_list_list*); // never used... |
---|
57 | void add_to_command_list_list(char* label, struct command_list*, struct command_list_list*); |
---|
58 | |
---|
59 | void exec_command(void); |
---|
60 | int decode_command(void); |
---|
61 | void dump_command(struct command*); // for debugging |
---|
62 | void print_command(struct command*); |
---|
63 | void store_command_def(char* cmd_string); /* processes command definition */ |
---|
64 | int make_line(char* statement); |
---|
65 | int get_stmt(FILE* file, int supp_flag); |
---|
66 | void get_defined_commands(void); |
---|
67 | void remove_from_command_list(char* label, struct command_list*); |
---|
68 | |
---|
69 | #endif // MAD_CMD_H |
---|