diff debug.h @ 2188:e17d99c96c89

Make blocks an explicitly supported concept in the debugger rather than a one-off for the commands command
author Michael Pavone <pavone@retrodev.com>
date Sat, 20 Aug 2022 11:40:41 -0700
parents 2d7f8195be3b
children d00fb9c6a6a2
line wrap: on
line diff
--- a/debug.h	Sun Aug 14 17:37:37 2022 -0700
+++ b/debug.h	Sat Aug 20 11:40:41 2022 -0700
@@ -56,19 +56,21 @@
 } command_arg;
 
 typedef struct debug_root debug_root;
-typedef uint8_t (*raw_cmd)(debug_root *root, char *format, char *param);
-typedef uint8_t (*cmd)(debug_root *root, char *format, int num_args, command_arg *args);
+typedef struct parsed_command parsed_command;
+typedef uint8_t (*cmd_fun)(debug_root *root, parsed_command *cmd);
 
 typedef struct {
 	const char **names;
 	const char *usage;
 	const char *desc;
-	raw_cmd    raw_impl;
-	cmd        impl;
+	cmd_fun    impl;
 	int        min_args;
 	int        max_args;
 	uint8_t    skip_eval;
 	uint8_t    visited;
+	uint8_t    has_block;
+	uint8_t    accepts_else;
+	uint8_t    raw_args;
 } command_def;
 
 typedef struct disp_def {
@@ -80,12 +82,19 @@
 } disp_def;
 
 typedef struct {
-	command_def *def;
-	char        *format;
-	char        *raw;
-	command_arg *args;
-	int         num_args;
-} parsed_command;
+	parsed_command *commands;
+	int            num_commands;
+} command_block;
+
+struct parsed_command {
+	command_def   *def;
+	char          *format;
+	char          *raw;
+	command_arg   *args;
+	int           num_args;
+	command_block block;
+	command_block else_block;
+};
 
 typedef struct bp_def {
 	struct bp_def  *next;