Rev 2093 | Rev 3707 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2093 | Rev 2106 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | 43 | ||
| 44 | typedef enum { |
44 | typedef enum { |
| 45 | ARG_TYPE_INVALID = 0, |
45 | ARG_TYPE_INVALID = 0, |
| 46 | ARG_TYPE_INT, |
46 | ARG_TYPE_INT, |
| 47 | ARG_TYPE_STRING, |
47 | ARG_TYPE_STRING, |
| 48 | ARG_TYPE_VAR /**< Variable type - either symbol or string */ |
48 | /** Variable type - either symbol or string. */ |
| - | 49 | ARG_TYPE_VAR |
|
| 49 | } cmd_arg_type_t; |
50 | } cmd_arg_type_t; |
| 50 | 51 | ||
| 51 | /** Structure representing one argument of kconsole command line. */ |
52 | /** Structure representing one argument of kconsole command line. */ |
| 52 | typedef struct { |
53 | typedef struct { |
| 53 | cmd_arg_type_t type; /**< Type descriptor. */ |
54 | /** Type descriptor. */ |
| - | 55 | cmd_arg_type_t type; |
|
| 54 | void *buffer; /**< Buffer where to store data. */ |
56 | /** Buffer where to store data. */ |
| - | 57 | void *buffer; |
|
| 55 | size_t len; /**< Size of the buffer. */ |
58 | /** Size of the buffer. */ |
| - | 59 | size_t len; |
|
| 56 | unative_t intval; /**< Integer value */ |
60 | /** Integer value. */ |
| - | 61 | unative_t intval; |
|
| 57 | cmd_arg_type_t vartype; /**< Resulting type of variable arg */ |
62 | /** Resulting type of variable arg */ |
| - | 63 | cmd_arg_type_t vartype; |
|
| 58 | } cmd_arg_t; |
64 | } cmd_arg_t; |
| 59 | 65 | ||
| 60 | /** Structure representing one kconsole command. */ |
66 | /** Structure representing one kconsole command. */ |
| 61 | typedef struct { |
67 | typedef struct { |
| 62 | link_t link; /**< Command list link. */ |
68 | /** Command list link. */ |
| - | 69 | link_t link; |
|
| 63 | SPINLOCK_DECLARE(lock); /**< This lock protects everything below. */ |
70 | /** This lock protects everything below. */ |
| - | 71 | SPINLOCK_DECLARE(lock); |
|
| 64 | const char *name; /**< Command name. */ |
72 | /** Command name. */ |
| - | 73 | const char *name; |
|
| 65 | const char *description; /**< Textual description. */ |
74 | /** Textual description. */ |
| - | 75 | const char *description; |
|
| 66 | int (* func)(cmd_arg_t *); /**< Function implementing the command. */ |
76 | /** Function implementing the command. */ |
| - | 77 | int (* func)(cmd_arg_t *); |
|
| 67 | count_t argc; /**< Number of arguments. */ |
78 | /** Number of arguments. */ |
| - | 79 | count_t argc; |
|
| 68 | cmd_arg_t *argv; /**< Argument vector. */ |
80 | /** Argument vector. */ |
| - | 81 | cmd_arg_t *argv; |
|
| 69 | void (* help)(void); /**< Function for printing detailed help. */ |
82 | /** Function for printing detailed help. */ |
| - | 83 | void (* help)(void); |
|
| 70 | } cmd_info_t; |
84 | } cmd_info_t; |
| 71 | 85 | ||
| 72 | SPINLOCK_EXTERN(cmd_lock); |
86 | SPINLOCK_EXTERN(cmd_lock); |
| 73 | extern link_t cmd_head; |
87 | extern link_t cmd_head; |
| 74 | 88 | ||